本文整理汇总了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);
});