How to use the @jupyterlab/observables.ModelDB 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 / modeldb.spec.ts View on Github external
it('should return false for a value that does not exist', () => {
        const db = new ModelDB();
        expect(db.has('value')).to.equal(false);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should create an ObservableMap`', () => {
        const db = new ModelDB();
        const map = db.createMap('map');
        expect(map instanceof ObservableJSON).to.equal(true);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should set a value at a path', () => {
        const db = new ModelDB();
        const value = db.createValue('value');
        db.setValue('value', 'set');
        expect(value.get()).to.equal('set');
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should be stackable', () => {
        const db = new ModelDB();
        const view = db.view('one');
        const viewView = view.view('two');

        expect(view.basePath).to.equal('one');
        expect(viewView.basePath).to.equal('two');

        viewView.createString('str');
        expect(viewView.get('str')).to.equal(view.get('two.str'));
        expect(viewView.get('str')).to.equal(db.get('one.two.str'));
      });
    });
github jupyterlab / jupyterlab / tests / test-notebook / src / model.spec.ts View on Github external
it('should create a new content factory with a new IModelDB', () => {
          const modelDB = new ModelDB();
          const factory = new NotebookModel.ContentFactory({ modelDB });
          expect(factory.modelDB).to.equal(modelDB);
          const newModelDB = new ModelDB();
          const newFactory = factory.clone(newModelDB);
          expect(newFactory.modelDB).to.equal(newModelDB);
          expect(newFactory.codeCellContentFactory).to.equal(
            factory.codeCellContentFactory
          );
        });
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should accept a baseDB', () => {
        const base = new ModelDB();
        const db = new ModelDB({ baseDB: base });
        expect(db instanceof ModelDB).to.equal(true);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should be able to retrieve that map using `get`', () => {
        const db = new ModelDB();
        const map = db.createMap('map');
        expect(db.get('map')).to.equal(map);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should return false for an in-memory database', () => {
        const db = new ModelDB();
        expect(db.isCollaborative).to.equal(false);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / modeldb.spec.ts View on Github external
it('should set the baseDB path on the view', () => {
        const db = new ModelDB();
        const view = db.view('base');
        expect(view.basePath).to.equal('base');
      });
github jupyterlab / jupyterlab / packages / codeeditor / src / editor.ts View on Github external
constructor(options?: Model.IOptions) {
      options = options || {};

      if (options.modelDB) {
        this.modelDB = options.modelDB;
      } else {
        this.modelDB = new ModelDB();
      }

      let value = this.modelDB.createString('value');
      value.text = value.text || options.value || '';

      let mimeType = this.modelDB.createValue('mimeType');
      mimeType.set(options.mimeType || 'text/plain');
      mimeType.changed.connect(this._onMimeTypeChanged, this);

      this.modelDB.createMap('selections');
    }