How to use the @jupyterlab/coreutils.ObservableUndoableVector function in @jupyterlab/coreutils

To help you get started, we’ve selected a few @jupyterlab/coreutils 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 / test / src / coreutils / undoablevector.spec.ts View on Github external
it('should redo a pushBack', () => {
        let vector = new ObservableUndoableVector(serializer);
        vector.pushBack(serializer.fromJSON(value));
        vector.undo();
        vector.redo();
        expect(vector.length).to.be(1);
      });
github jupyterlab / jupyterlab / test / src / coreutils / undoablevector.spec.ts View on Github external
it('should clear the undo stack', () => {
        let vector = new ObservableUndoableVector(serializer);
        vector.pushBack(serializer.fromJSON(value));
        vector.clearUndo();
        expect(vector.canUndo).to.be(false);
      });
github jupyterlab / jupyterlab / test / src / coreutils / undoablevector.spec.ts View on Github external
it('should dispose of the resources used by the vector', () => {
        let vector = new ObservableUndoableVector(serializer);
        vector.dispose();
        expect(vector.isDisposed).to.be(true);
        vector.dispose();
        expect(vector.isDisposed).to.be(true);
      });
github jupyterlab / jupyterlab / test / src / coreutils / undoablevector.spec.ts View on Github external
it('should not be undoable if isUndoAble is set to false', () => {
        let vector = new ObservableUndoableVector(serializer);
        vector.beginCompoundOperation(false);
        vector.pushBack(serializer.fromJSON(value));
        vector.pushBack(serializer.fromJSON(value));
        vector.endCompoundOperation();
        expect(vector.canUndo).to.be(false);
      });
github jupyterlab / jupyterlab / test / src / coreutils / undoablevector.spec.ts View on Github external
it('should return true if there is a change that can be undone', () => {
        let vector = new ObservableUndoableVector(serializer);
        vector.pushBack(serializer.fromJSON(value));
        expect(vector.canUndo).to.be(true);
      });
github jupyterlab / jupyterlab / test / src / coreutils / undoablevector.spec.ts View on Github external
it('should undo a pushBack', () => {
        let vector = new ObservableUndoableVector(serializer);
        vector.pushBack(serializer.fromJSON(value));
        vector.undo();
        expect(vector.length).to.be(0);
      });
github jupyterlab / jupyterlab / test / src / coreutils / undoablevector.spec.ts View on Github external
it('should redo a remove', () => {
         let vector = new ObservableUndoableVector(serializer);
         vector.pushAll([serializer.fromJSON(value),
                         serializer.fromJSON(value)]);
         vector.removeAt(0);
         vector.undo();
         vector.redo();
         expect(vector.length).to.be(1);
      });
github jupyterlab / jupyterlab / test / src / coreutils / undoablevector.spec.ts View on Github external
it('should return true if there is an undo that can be redone', () => {
        let vector = new ObservableUndoableVector(serializer);
        vector.pushBack(new Test(value));
        vector.undo();
        expect(vector.canRedo).to.be(true);
      });
github jupyterlab / jupyterlab / test / src / coreutils / undoablevector.spec.ts View on Github external
it('should redo a pushAll', () => {
        let vector = new ObservableUndoableVector(serializer);
        vector.pushAll([serializer.fromJSON(value),
                        serializer.fromJSON(value)]);
        vector.undo();
        vector.redo();
        expect(vector.length).to.be(2);
      });
github jupyterlab / jupyterlab / test / src / coreutils / undoablevector.spec.ts View on Github external
it('should undo a removeRange', () => {
        let vector = new ObservableUndoableVector(serializer);
        vector.pushAll([serializer.fromJSON(value),
                        serializer.fromJSON(value),
                        serializer.fromJSON(value),
                        serializer.fromJSON(value),
                        serializer.fromJSON(value),
                        serializer.fromJSON(value)]);
        vector.removeRange(1, 3);
        vector.undo();
        expect(vector.length).to.be(6);
      });