How to use the @lumino/algorithm.toArray function in @lumino/algorithm

To help you get started, we’ve selected a few @lumino/algorithm 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 / tests / test-services / src / session / session.spec.ts View on Github external
it('should yield a list of valid session models', async () => {
      const response = await Session.listRunning();
      const running = toArray(response);
      expect(running.length).to.greaterThan(0);
    });
github jupyterlab / jupyterlab / tests / test-filebrowser / src / openfiledialog.spec.ts View on Github external
it('should list all directories whatever the filter', async () => {
        let filteredModel = new FilterFileBrowserModel({
          iconRegistry,
          manager,
          filter: (model: Contents.IModel) => false
        });
        await filteredModel.cd();
        let model = new FileBrowserModel({ iconRegistry, manager });
        await model.cd();

        const filteredItems = toArray(filteredModel.items());
        const items = toArray(model.items());
        const folders = items.filter(item => item.type === 'directory');
        expect(filteredItems.length).equal(folders.length);
      });
github jupyterlab / jupyterlab / tests / test-filebrowser / src / openfiledialog.spec.ts View on Github external
it('should list all elements if no filter is defined', async () => {
        let filteredModel = new FilterFileBrowserModel({
          iconRegistry,
          manager
        });
        await filteredModel.cd();
        let model = new FileBrowserModel({ iconRegistry, manager });
        await model.cd();

        const filteredItems = toArray(filteredModel.items());
        const items = toArray(model.items());
        expect(filteredItems.length).equal(items.length);
      });
github jupyterlab / jupyterlab / tests / test-services / src / terminal / manager.spec.ts View on Github external
it('should update the running session models', async () => {
        let model: TerminalSession.IModel;
        const before = toArray(manager.running()).length;
        session = await TerminalSession.startNew();
        model = session.model;
        await manager.refreshRunning();
        const running = toArray(manager.running());
        expect(running.length).to.equal(before + 1);
        let found = false;
        running.map(m => {
          if (m.name === model.name) {
            found = true;
          }
        });
        expect(found).to.equal(true);
      });
    });
github jupyterlab / jupyterlab / tests / test-services / src / kernel / manager.spec.ts View on Github external
it('should update the running kernels', async () => {
        await manager.refreshRunning();
        expect(toArray(manager.running()).length).to.be.greaterThan(0);
      });
    });
github jupyterlab / jupyterlab / tests / test-notebook / src / widgetfactory.spec.ts View on Github external
it('should populate the customized toolbar items', () => {
        const toolbarFactory = () => [
          { name: 'foo', widget: new ToolbarButton() },
          { name: 'bar', widget: new ToolbarButton() }
        ];
        const factory = createFactory(toolbarFactory);
        const panel = factory.createNew(context);
        const panel2 = factory.createNew(context);
        expect(toArray(panel.toolbar.names())).to.deep.equal(['foo', 'bar']);
        expect(toArray(panel2.toolbar.names())).to.deep.equal(['foo', 'bar']);
        expect(toArray(panel.toolbar.children()).length).to.equal(2);
        expect(toArray(panel2.toolbar.children()).length).to.equal(2);
      });
github jupyterlab / jupyterlab / tests / test-services / src / kernel / manager.spec.ts View on Github external
manager.runningChanged.connect((sender, args) => {
          expect(sender).to.equal(manager);
          expect(toArray(args).length).to.be.greaterThan(0);
          called = true;
        });
        await Kernel.startNew();
github jupyterlab / jupyterlab / packages / observables / src / observablelist.ts View on Github external
insertAll(index: number, values: IterableOrArrayLike): void {
    let newIndex = index;
    each(values, value => {
      ArrayExt.insert(this._array, index++, value);
    });
    this._changed.emit({
      type: 'add',
      oldIndex: -1,
      newIndex,
      oldValues: [],
      newValues: toArray(values)
    });
  }
github jupyterlab / jupyterlab / packages / completer / src / model.ts View on Github external
setOptions(
    newValue: IterableOrArrayLike,
    typeMap?: Completer.TypeMap
  ) {
    const values = toArray(newValue || []);
    const types = typeMap || {};

    if (
      JSONExt.deepEqual(values, this._options) &&
      JSONExt.deepEqual(types, this._typeMap)
    ) {
      return;
    }
    if (values.length) {
      this._options = values;
      this._typeMap = types;
      this._orderedTypes = Private.findOrderedTypes(types);
    } else {
      this._options = [];
      this._typeMap = {};
      this._orderedTypes = [];
github jtpio / ipylab / src / widgets / sessions.ts View on Github external
private _sendSessions(): void {
    this.set('sessions', toArray(this._sessions.running()));
    this.save_changes();
  }