How to use the @jupyterlab/observables/src.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 yuvipanda / simplest-notebook / tests / test-observables / src / undoablelist.spec.ts View on Github external
it('should redo a removeRange', () => {
        const list = new ObservableUndoableList(serializer);
        list.pushAll([
          serializer.fromJSON(value),
          serializer.fromJSON(value),
          serializer.fromJSON(value),
          serializer.fromJSON(value),
          serializer.fromJSON(value),
          serializer.fromJSON(value)
        ]);
        list.removeRange(1, 3);
        list.undo();
        list.redo();
        expect(list.length).to.equal(4);
      });
github yuvipanda / simplest-notebook / 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 yuvipanda / simplest-notebook / 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 yuvipanda / simplest-notebook / tests / test-observables / src / undoablelist.spec.ts View on Github external
it('should redo a remove', () => {
        const list = new ObservableUndoableList(serializer);
        list.pushAll([serializer.fromJSON(value), serializer.fromJSON(value)]);
        list.remove(0);
        list.undo();
        list.redo();
        expect(list.length).to.equal(1);
      });
github yuvipanda / simplest-notebook / 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 yuvipanda / simplest-notebook / tests / test-observables / src / undoablelist.spec.ts View on Github external
it('should create a new ObservableUndoableList', () => {
        const list = new ObservableUndoableList(serializer);
        expect(list).to.be.an.instanceof(ObservableUndoableList);
      });
    });
github yuvipanda / simplest-notebook / 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 yuvipanda / simplest-notebook / tests / test-observables / src / undoablelist.spec.ts View on Github external
it('should return true if there is an undo that can be redone', () => {
        const list = new ObservableUndoableList(serializer);
        list.push(new Test(value));
        list.undo();
        expect(list.canRedo).to.equal(true);
      });
    });
github yuvipanda / simplest-notebook / 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 yuvipanda / simplest-notebook / 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);
      });