本文整理汇总了TypeScript中@jupyterlab/testutils.signalToPromise函数的典型用法代码示例。如果您正苦于以下问题:TypeScript signalToPromise函数的具体用法?TypeScript signalToPromise怎么用?TypeScript signalToPromise使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了signalToPromise函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should add a new code cell when cells are cleared', async () => {
const model = new NotebookModel();
let promise = signalToPromise(model.cells.changed);
model.cells.clear();
await promise;
expect(model.cells.length).to.equal(0);
await signalToPromise(model.cells.changed);
expect(model.cells.length).to.equal(1);
expect(model.cells.get(0)).to.be.an.instanceof(CodeCellModel);
});
开发者ID:AlbertHilb,项目名称:jupyterlab,代码行数:10,代码来源:model.spec.ts
示例2: it
it('should stop routing if returned by a routed command', async () => {
const wanted = ['a', 'b'];
const recorded: string[] = [];
commands.addCommand('a', {
execute: () => {
recorded.push('a');
}
});
commands.addCommand('b', {
execute: () => {
recorded.push('b');
}
});
commands.addCommand('c', { execute: () => router.stop });
commands.addCommand('d', {
execute: () => {
recorded.push('d');
}
});
router.register({ command: 'a', pattern: /.*/, rank: 10 });
router.register({ command: 'b', pattern: /.*/, rank: 20 });
router.register({ command: 'c', pattern: /.*/, rank: 30 });
router.register({ command: 'd', pattern: /.*/, rank: 40 });
let promise = signalToPromise(router.routed);
await router.route();
await promise;
expect(recorded).to.deep.equal(wanted);
});
开发者ID:AlbertHilb,项目名称:jupyterlab,代码行数:31,代码来源:router.spec.ts
示例3: it
it('should trigger a save', () => {
let promise = signalToPromise(context.fileChanged);
context.model.fromString('bar');
expect(handler.isActive).to.equal(false);
handler.saveInterval = 1;
handler.start();
return promise;
});
开发者ID:afshin,项目名称:jupyterlab,代码行数:8,代码来源:savehandler.spec.ts
示例4: it
it('should save when clicked', async () => {
const button = ToolbarItems.createSaveButton(panel);
Widget.attach(button, document.body);
let promise = signalToPromise(context.fileChanged);
await framePromise();
(button.node.firstChild as HTMLElement).click();
await promise;
button.dispose();
});
开发者ID:willingc,项目名称:jupyterlab,代码行数:9,代码来源:default-toolbar.spec.ts
注:本文中的@jupyterlab/testutils.signalToPromise函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论