How to use the @jupyterlab/testutils.NBTestUtils.clipboard 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-notebook / src / actions.spec.ts View on Github external
it('should copy the selected cells to a NBTestUtils.clipboard', () => {
        const next = widget.widgets[1];
        widget.select(next);
        NotebookActions.copy(widget);
        expect(NBTestUtils.clipboard.hasData(JUPYTER_CELL_MIME)).to.equal(true);
        const data = NBTestUtils.clipboard.getData(JUPYTER_CELL_MIME);
        expect(data.length).to.equal(2);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-notebook / src / default-toolbar.spec.ts View on Github external
it('should cut when clicked', async () => {
        const button = ToolbarItems.createCutButton(panel);
        const count = panel.content.widgets.length;
        Widget.attach(button, document.body);
        await framePromise();
        simulate(button.node.firstChild as HTMLElement, 'mousedown');
        expect(panel.content.widgets.length).to.equal(count - 1);
        expect(NBTestUtils.clipboard.hasData(JUPYTER_CELL_MIME)).to.equal(true);
        button.dispose();
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-notebook / src / actions.spec.ts View on Github external
it('should be a no-op if there is no model', () => {
        widget.model = null;
        NotebookActions.cut(widget);
        expect(NBTestUtils.clipboard.hasData(JUPYTER_CELL_MIME)).to.equal(
          false
        );
      });
github jupyterlab / jupyterlab / tests / test-notebook / src / actions.spec.ts View on Github external
it('should delete metadata.deletable', () => {
        const next = widget.widgets[1];
        widget.select(next);
        next.model.metadata.set('deletable', false);
        NotebookActions.copy(widget);
        const data = NBTestUtils.clipboard.getData(
          JUPYTER_CELL_MIME
        ) as JSONArray;
        data.map(cell => {
          expect(((cell as JSONObject).metadata as JSONObject).deletable).to.be
            .undefined;
        });
      });
    });
github jupyterlab / jupyterlab / tests / test-notebook / src / default-toolbar.spec.ts View on Github external
it('should copy when clicked', async () => {
          const button = ToolbarItems.createCopyButton(panel);
          const count = panel.content.widgets.length;
          Widget.attach(button, document.body);
          await framePromise();
          simulate(button.node.firstChild as HTMLElement, 'mousedown');
          expect(panel.content.widgets.length).to.equal(count);
          expect(NBTestUtils.clipboard.hasData(JUPYTER_CELL_MIME)).to.equal(
            true
          );
          button.dispose();
        });
github jupyterlab / jupyterlab-data-explorer / tests / test-notebook / src / actions.spec.ts View on Github external
it('should delete metadata.deletable', () => {
        const next = widget.widgets[1];
        widget.select(next);
        next.model.metadata.set('deletable', false);
        NotebookActions.copy(widget);
        const data = NBTestUtils.clipboard.getData(
          JUPYTER_CELL_MIME
        ) as JSONArray;
        data.map(cell => {
          expect(((cell as JSONObject).metadata as JSONObject).deletable).to.be
            .undefined;
        });
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-notebook / src / default-toolbar.spec.ts View on Github external
it('should copy when clicked', async () => {
        const button = ToolbarItems.createCopyButton(panel);
        const count = panel.content.widgets.length;
        Widget.attach(button, document.body);
        await framePromise();
        simulate(button.node.firstChild as HTMLElement, 'mousedown');
        expect(panel.content.widgets.length).to.equal(count);
        expect(NBTestUtils.clipboard.hasData(JUPYTER_CELL_MIME)).to.equal(true);
        button.dispose();
      });
github jupyterlab / jupyterlab / tests / test-notebook / src / default-toolbar.spec.ts View on Github external
it('should cut when clicked', async () => {
          const button = ToolbarItems.createCutButton(panel);
          const count = panel.content.widgets.length;
          Widget.attach(button, document.body);
          await framePromise();
          simulate(button.node.firstChild as HTMLElement, 'mousedown');
          expect(panel.content.widgets.length).to.equal(count - 1);
          expect(NBTestUtils.clipboard.hasData(JUPYTER_CELL_MIME)).to.equal(
            true
          );
          button.dispose();
        });
github jupyterlab / jupyterlab / tests / test-notebook / src / actions.spec.ts View on Github external
afterEach(() => {
      widget.dispose();
      NBTestUtils.clipboard.clear();
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-notebook / src / actions.spec.ts View on Github external
afterEach(() => {
      widget.dispose();
      NBTestUtils.clipboard.clear();
    });