How to use the @jupyterlab/cells.CellModel function in @jupyterlab/cells

To help you get started, we’ve selected a few @jupyterlab/cells 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-cells / src / widget.spec.ts View on Github external
it('should save the collapse state to the model', () => {
        const model = new CellModel({});
        const widget = new Cell({ model, contentFactory }).initializeState();
        expect(widget.inputHidden).toEqual(false);

        widget.inputHidden = true;
        widget.saveCollapseState();
        expect(model.metadata.get('jupyter')).toEqual({
          source_hidden: true
        });

        widget.inputHidden = false;
        widget.saveCollapseState();
        // Default values are not saved explicitly
        expect(model.metadata.get('jupyter')).toEqual(undefined);
      });
    });
github jupyterlab / jupyterlab / test / src / cells / model.spec.ts View on Github external
it('should be true after model is disposed', () => {
        let model = new CellModel({});
        model.dispose();
        expect(model.isDisposed).to.be(true);
      });
github jupyterlab / jupyterlab / test / src / cells / widget.spec.ts View on Github external
it('should be the model used by the widget', () => {
        let model = new CellModel({});
        let widget = new BaseCellWidget({ model, contentFactory });
        expect(widget.model).to.be(model);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-cells / src / model.spec.ts View on Github external
it('should be false by default', () => {
        const model = new CellModel({});
        expect(model.isDisposed).to.equal(false);
      });
github jupyterlab / jupyterlab / tests / test-cells / src / model.spec.ts View on Github external
it('should default to an empty string', () => {
        const model = new CellModel({});
        expect(model.value.text).to.be.empty;
      });
github jupyterlab / jupyterlab / tests / test-cells / src / model.spec.ts View on Github external
it('should signal when model content has changed', () => {
        const model = new CellModel({});
        let called = false;
        model.contentChanged.connect(() => {
          called = true;
        });
        expect(called).to.equal(false);
        model.value.text = 'foo';
        expect(called).to.equal(true);
      });
    });
github jupyterlab / jupyterlab / tests / test-cells / src / model.spec.ts View on Github external
it('should accept a base cell argument', () => {
        const cell: nbformat.IRawCell = {
          cell_type: 'raw',
          source: 'foo',
          metadata: { trusted: false }
        };
        const model = new CellModel({ cell });
        expect(model).to.be.an.instanceof(CellModel);
        expect(model.value.text).to.equal(cell.source);
      });
github jupyterlab / jupyterlab / test / src / cells / model.spec.ts View on Github external
it('should default to an empty string', () => {
        let model = new CellModel({});
        expect(model.value.text).to.be.empty();
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-cells / src / model.spec.ts View on Github external
it('should be settable', () => {
        const model = new CellModel({});
        expect(model.value.text).to.be.empty;
        model.value.text = 'foo';
        expect(model.value.text).to.equal('foo');
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-cells / src / widget.spec.ts View on Github external
constructor() {
    super({
      model: new CellModel({}),
      contentFactory: NBTestUtils.createBaseCellFactory()
    });
  }