當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript testutils.sleep函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。