本文整理匯總了TypeScript中@jupyterlab/filebrowser.FileBrowserModel類的典型用法代碼示例。如果您正苦於以下問題:TypeScript FileBrowserModel類的具體用法?TypeScript FileBrowserModel怎麽用?TypeScript FileBrowserModel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FileBrowserModel類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: beforeEach
beforeEach(() => {
state.clear();
model = new FileBrowserModel({ manager, state });
return model.newUntitled({ type: 'file' }).then(contents => {
name = contents.name;
return model.cd();
});
});
示例2: it
it('should restore based on ID', (done) => {
const id = 'foo';
const model2 = new FileBrowserModel({ manager, state });
model.restore(id)
.then(() => model.cd('src'))
.then(() => { expect(model.path).to.be('src'); })
.then(() => { expect(model2.path).to.be(''); })
.then(() => model2.restore(id))
.then(() => { expect(model2.path).to.be('src'); })
.then(() => {
model2.dispose();
done();
}).catch(done);
});
示例3: it
it('should delete a file ', (done) => {
let len = toArray(model.items()).length;
model.deleteFile(name).then(() => {
return model.cd();
}).then(() => {
expect(toArray(model.items()).length).to.be(len - 1);
done();
}).catch(done);
});
示例4: it
it(`should upload a large file of size ${size}`, async () => {
const fname = uuid() + '.txt';
const content = 'a'.repeat(size);
const file = new File([content], fname);
await model.upload(file);
const contentsModel = await model.manager.services.contents.get(fname);
expect(contentsModel.content).to.be(content);
});