本文整理匯總了TypeScript中phosphor/lib/algorithm/iteration.toArray函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript toArray函數的具體用法?TypeScript toArray怎麽用?TypeScript toArray使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了toArray函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should get a list of user metadata keys', () => {
let model = new CellModel({});
let cursor = model.getMetadata('foo');
expect(toArray(model.listMetadata())).to.be.empty();
cursor.setValue(1);
expect(toArray(model.listMetadata())).to.eql(['foo']);
});
示例2: it
it('should return model options', () => {
let model = new CompleterModel();
let options = ['foo'];
model.setOptions(options);
expect(toArray(model.options())).to.not.equal(options);
expect(toArray(model.options())).to.eql(options);
});
示例3: it
it('should clone the rendermime instance with shallow copies of data', () => {
let r = defaultRenderMime();
let c = r.clone();
expect(toArray(c.mimetypes())).to.eql(toArray(r.mimetypes()));
let t = new TextRenderer();
c.addRenderer('text/foo', t);
expect(r).to.not.be(c);
});
示例4: it
it('should list the metadata namespace keys for the notebook', () => {
let model = new NotebookModel();
let keys = ['kernelspec', 'language_info', 'orig_nbformat'];
expect(toArray(model.listMetadata())).to.eql(keys);
let cursor = model.getMetadata('foo');
expect(toArray(model.listMetadata())).to.eql(keys);
cursor.setValue(1);
keys.push('foo');
expect(toArray(model.listMetadata())).to.eql(keys);
});
示例5: it
it('should handle just a multi-part extension', () => {
registry.addModelFactory(new TextModelFactory());
let factory = new WidgetFactory({
name: 'table',
fileExtensions: ['.table.json'],
});
registry.addWidgetFactory(factory);
let factories = registry.preferredWidgetFactories('.table.json');
expect(toArray(factories)).to.eql([factory]);
factories = registry.preferredWidgetFactories('.json');
expect(toArray(factories)).to.eql([]);
});
示例6: it
it('should get the registered file creators', () => {
expect(toArray(registry.creators()).length).to.be(0);
let creators = [
{ name: 'Python Notebook', fileType: 'notebook' },
{ name: 'R Notebook', fileType: 'notebook' },
{ name: 'CSharp Notebook', fileType: 'notebook' }
];
registry.addCreator(creators[0]);
registry.addCreator(creators[1]);
registry.addCreator(creators[2]);
expect(toArray(registry.creators()).length).to.be(3);
expect(registry.creators().next().name).to.be('CSharp Notebook');
});