How to use the @jupyterlab/docregistry/src.DocumentRegistry function in @jupyterlab/docregistry

To help you get started, we’ve selected a few @jupyterlab/docregistry 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 yuvipanda / simplest-notebook / tests / test-docregistry / src / registry.spec.ts View on Github external
it('should add a file type to the document registry', () => {
        registry = new DocumentRegistry({ initialFileTypes: [] });
        const fileType = { name: 'notebook', extensions: ['.ipynb'] };
        registry.addFileType(fileType);
        expect(registry.fileTypes().next().name).to.equal(fileType.name);
      });
github yuvipanda / simplest-notebook / tests / test-docregistry / src / registry.spec.ts View on Github external
it('should get the registered file types', () => {
        registry = new DocumentRegistry({ initialFileTypes: [] });
        expect(toArray(registry.fileTypes()).length).to.equal(0);
        const fileTypes = [
          { name: 'notebook', extensions: ['.ipynb'] },
          { name: 'python', extensions: ['.py'] },
          { name: 'table', extensions: ['.table.json'] }
        ];
        registry.addFileType(fileTypes[0]);
        registry.addFileType(fileTypes[1]);
        registry.addFileType(fileTypes[2]);
        const values = registry.fileTypes();
        expect(values.next().name).to.equal(fileTypes[0].name);
        expect(values.next().name).to.equal(fileTypes[1].name);
        expect(values.next().name).to.equal(fileTypes[2].name);
      });
    });
github yuvipanda / simplest-notebook / tests / test-docregistry / src / registry.spec.ts View on Github external
it('should be a no-op if a file type of the same name is registered', () => {
        registry = new DocumentRegistry({ initialFileTypes: [] });
        const fileType = { name: 'notebook', extensions: ['.ipynb'] };
        registry.addFileType(fileType);
        const disposable = registry.addFileType(fileType);
        disposable.dispose();
        expect(registry.fileTypes().next().name).to.equal(fileType.name);
      });
    });
github yuvipanda / simplest-notebook / tests / test-docregistry / src / registry.spec.ts View on Github external
beforeEach(() => {
      registry = new DocumentRegistry();
      registry.addFileType({
        name: 'foobar',
        extensions: ['.foo.bar']
      });
      registry.addFileType({
        name: 'baz',
        extensions: ['.baz']
      });
    });