How to use the @jupyterlab/observables.ObservableString 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 / observablestring.spec.ts View on Github external
it('should set the item at a specific index', () => {
        const value = new ObservableString('old');
        value.text = 'new';
        expect(value.text).to.deep.equal('new');
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / observablestring.spec.ts View on Github external
it('should remove a substring from the string', () => {
        const value = new ObservableString('one two two three');
        value.remove(4, 8);
        expect(value.text).to.deep.equal('one two three');
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / observablestring.spec.ts View on Github external
it('should test whether the string is disposed', () => {
        const value = new ObservableString();
        expect(value.isDisposed).to.equal(false);
        value.dispose();
        expect(value.isDisposed).to.equal(true);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / observablestring.spec.ts View on Github external
it('should empty the string', () => {
        const value = new ObservableString('full');
        value.clear();
        expect(value.text.length).to.equal(0);
        expect(value.text).to.equal('');
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / observablestring.spec.ts View on Github external
it('should have value changed args', () => {
        let called = false;
        const value = new ObservableString();
        value.changed.connect((sender, args) => {
          expect(sender).to.equal(value);
          expect(args.type).to.equal('set');
          expect(args.start).to.equal(0);
          expect(args.end).to.equal(3);
          expect(args.value).to.equal('new');
          called = true;
        });
        value.text = 'new';
        expect(called).to.equal(true);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / observablestring.spec.ts View on Github external
it('should return `String`', () => {
        const value = new ObservableString();
        expect(value.type).to.equal('String');
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / observablestring.spec.ts View on Github external
it('should be emitted when the string changes', () => {
        let called = false;
        const value = new ObservableString();
        value.changed.connect(() => {
          called = true;
        });
        value.text = 'change';
        expect(called).to.equal(true);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / observablestring.spec.ts View on Github external
it('should initialize the string value', () => {
        const value = new ObservableString('hello');
        expect(value.text).to.deep.equal('hello');
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / observablestring.spec.ts View on Github external
it('should trigger a changed signal', () => {
        let called = false;
        const value = new ObservableString('full');
        value.changed.connect((sender, args) => {
          expect(sender).to.equal(value);
          expect(args.type).to.equal('set');
          expect(args.start).to.equal(0);
          expect(args.end).to.equal(0);
          expect(args.value).to.equal('');
          called = true;
        });
        value.clear();
        expect(called).to.equal(true);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-observables / src / observablestring.spec.ts View on Github external
it('should accept no arguments', () => {
        const value = new ObservableString();
        expect(value instanceof ObservableString).to.equal(true);
      });