本文整理汇总了TypeScript中@jupyterlab/testutils.sleep函数的典型用法代码示例。如果您正苦于以下问题:TypeScript sleep函数的具体用法?TypeScript sleep怎么用?TypeScript sleep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sleep函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should paste when clicked', async () => {
const button = ToolbarItems.createPasteButton(panel);
const count = panel.content.widgets.length;
Widget.attach(button, document.body);
await framePromise();
NotebookActions.copy(panel.content);
(button.node.firstChild as HTMLElement).click();
await sleep();
expect(panel.content.widgets.length).to.equal(count + 1);
button.dispose();
});
开发者ID:willingc,项目名称:jupyterlab,代码行数:11,代码来源:default-toolbar.spec.ts
示例2: it
it('should emit a tick identical to the poll state', async () => {
poll = new Poll<void, void>({
factory: () => Promise.resolve(),
frequency: { interval: 100, backoff: false },
name: '@jupyterlab/test-coreutils:Poll#ticked-3'
});
poll.ticked.connect((_, tick) => {
expect(tick).to.equal(poll.state);
});
await sleep(250);
});
开发者ID:afshin,项目名称:jupyterlab,代码行数:11,代码来源:poll.spec.ts
示例3: it
it('should resolve after the reveal and context ready promises', async () => {
const x = Object.create(null);
const reveal = sleep(300, x);
const contextReady = Promise.all([context.ready, x]);
const widget = new DocumentWidget({ context, content, reveal });
expect(widget.isRevealed).to.equal(false);
// Our promise should resolve before the widget reveal promise.
expect(await Promise.race([widget.revealed, reveal])).to.equal(x);
// The context ready promise should also resolve first.
context.initialize(true);
expect(
await Promise.race([widget.revealed, contextReady])
).to.deep.equal([undefined, x]);
// The widget.revealed promise should finally resolve.
expect(await widget.revealed).to.be.undefined;
});
开发者ID:willingc,项目名称:jupyterlab,代码行数:17,代码来源:default.spec.ts
注:本文中的@jupyterlab/testutils.sleep函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论