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


TypeScript testutils.waitForDialog函數代碼示例

本文整理匯總了TypeScript中@jupyterlab/testutils.waitForDialog函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript waitForDialog函數的具體用法?TypeScript waitForDialog怎麽用?TypeScript waitForDialog使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了waitForDialog函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: async

 const func = async () => {
   await waitForDialog();
   const dialog = document.body.getElementsByClassName('jp-Dialog')[0];
   const input = dialog.getElementsByTagName('input')[0];
   input.value = newPath;
   await acceptDialog(); // Accept rename dialog
   await dismissDialog(); // Reject conflict dialog
 };
開發者ID:AlbertHilb,項目名稱:jupyterlab,代碼行數:8,代碼來源:context.spec.ts

示例2: async

 const func = async () => {
   await waitForDialog();
   const dialog = document.body.getElementsByClassName('jp-Dialog')[0];
   const input = dialog.getElementsByTagName('input')[0];
   input.value = newPath;
   await acceptDialog();
   await acceptDialog();
 };
開發者ID:SylvainCorlay,項目名稱:jupyterlab,代碼行數:8,代碼來源:context.spec.ts

示例3: it

      it('should revert to the file on disk', async () => {
        const delegate = new PromiseDelegate();
        const revert = () => {
          const dialog = document.body.getElementsByClassName('jp-Dialog')[0];
          const buttons = dialog.getElementsByTagName('button');

          for (let i = 0; i < buttons.length; i++) {
            if (buttons[i].textContent === 'REVERT') {
              buttons[i].click();
              return;
            }
          }
        };

        // Lower the duration multiplier.
        (handler as any)._multiplier = 1;

        await context.initialize(true);
        context.model.fromString('foo');
        context.fileChanged.connect(() => {
          expect(context.model.toString()).to.equal('bar');
          delegate.resolve(undefined);
        });

        // The server has a one second resolution for saves.
        setTimeout(async () => {
          await manager.contents.save(context.path, {
            type: factory.contentType,
            format: factory.fileFormat,
            content: 'bar'
          });
          handler.saveInterval = 1;
          handler.start();
          context.model.fromString('baz');
        }, 1500);

        // Extend the timeout to wait for the dialog because of the setTimeout.
        await waitForDialog(document.body, 3000);
        revert();
        await delegate.promise;
      });
開發者ID:afshin,項目名稱:jupyterlab,代碼行數:41,代碼來源:savehandler.spec.ts


注:本文中的@jupyterlab/testutils.waitForDialog函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。