How to use the @jupyterlab/testutils.waitForDialog function in @jupyterlab/testutils

To help you get started, we’ve selected a few @jupyterlab/testutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab / tests / test-docmanager / src / savehandler.spec.ts View on Github external
});

        // 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;
      });
    });
github jupyterlab / jupyterlab / tests / test-apputils / src / inputdialog.spec.ts View on Github external
it('should be editable', async () => {
        const node = document.createElement('div');

        document.body.appendChild(node);

        const prompt = InputDialog.getNumber({
          label: 'text',
          title: 'Pick a number',
          host: node
        });

        await waitForDialog(node);
        const body = node.getElementsByClassName('jp-Input-Dialog').item(0)!;
        const input = body.getElementsByTagName('input').item(0)!;
        input.value = '25';

        await acceptDialog();

        const result = await prompt;

        expect(result.button.accept).toBe(true);
        expect(result.value).toBe(25);
        document.body.removeChild(node);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-apputils / src / dialog.spec.tsx View on Github external
it.skip('should attach the dialog to the host', async () => {
        const host = document.createElement('div');
        const dialog = new TestDialog({ host });

        document.body.appendChild(host);
        void dialog.launch();
        await waitForDialog(host);
        expect(host.contains(dialog.node)).toBe(true);
        dialog.dispose();
        document.body.removeChild(host);
      });
github jupyterlab / jupyterlab / tests / test-apputils / src / dialog.spec.tsx View on Github external
it.skip('should attach the dialog to the host', async () => {
        const host = document.createElement('div');
        const dialog = new TestDialog({ host });

        document.body.appendChild(host);
        void dialog.launch();
        await waitForDialog(host);
        expect(host.contains(dialog.node)).toBe(true);
        dialog.dispose();
        document.body.removeChild(host);
      });