How to use the @jupyterlab/observables.ObservableUndoableList function in @jupyterlab/observables

To help you get started, we’ve selected a few @jupyterlab/observables 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-data-explorer / tests / test-observables / src / undoablelist.spec.ts View on Github external
it('should undo a push', () => {
        const list = new ObservableUndoableList(serializer);
        list.push(serializer.fromJSON(value));
        list.undo();
        expect(list.length).to.equal(0);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / undoablelist.spec.ts View on Github external
it('should not be undoable if isUndoAble is set to false', () => {
        const list = new ObservableUndoableList(serializer);
        list.beginCompoundOperation(false);
        list.push(serializer.fromJSON(value));
        list.push(serializer.fromJSON(value));
        list.endCompoundOperation();
        expect(list.canUndo).to.equal(false);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / undoablelist.spec.ts View on Github external
it('should dispose of the resources used by the list', () => {
        const list = new ObservableUndoableList(serializer);
        list.dispose();
        expect(list.isDisposed).to.equal(true);
        list.dispose();
        expect(list.isDisposed).to.equal(true);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / undoablelist.spec.ts View on Github external
it('should redo a push', () => {
        const list = new ObservableUndoableList(serializer);
        list.push(serializer.fromJSON(value));
        list.undo();
        list.redo();
        expect(list.length).to.equal(1);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / undoablelist.spec.ts View on Github external
it('should return false if there is no history', () => {
        const list = new ObservableUndoableList(serializer);
        expect(list.canUndo).to.equal(false);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / undoablelist.spec.ts View on Github external
it('should begin a compound operation', () => {
        const list = new ObservableUndoableList(serializer);
        list.beginCompoundOperation();
        list.push(serializer.fromJSON(value));
        list.push(serializer.fromJSON(value));
        list.endCompoundOperation();
        expect(list.canUndo).to.equal(true);
        list.undo();
        expect(list.canUndo).to.equal(false);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / undoablelist.spec.ts View on Github external
it('should undo a move', () => {
        const items = [
          serializer.fromJSON(value),
          serializer.fromJSON(value),
          serializer.fromJSON(value)
        ];
        const list = new ObservableUndoableList(serializer);
        list.pushAll(items);
        list.move(1, 2);
        list.undo();
        expect((list.get(1) as any)['count']).to.equal(
          (items[1] as any)['count']
        );
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / undoablelist.spec.ts View on Github external
it('should clear the undo stack', () => {
        const list = new ObservableUndoableList(serializer);
        list.push(serializer.fromJSON(value));
        list.clearUndo();
        expect(list.canUndo).to.equal(false);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / undoablelist.spec.ts View on Github external
it('should undo a remove', () => {
        const list = new ObservableUndoableList(serializer);
        list.pushAll([serializer.fromJSON(value), serializer.fromJSON(value)]);
        list.remove(0);
        list.undo();
        expect(list.length).to.equal(2);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / undoablelist.spec.ts View on Github external
it('should redo a pushAll', () => {
        const list = new ObservableUndoableList(serializer);
        list.pushAll([serializer.fromJSON(value), serializer.fromJSON(value)]);
        list.undo();
        list.redo();
        expect(list.length).to.equal(2);
      });