Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('JSONEditor', () => {
let editor: LogEditor;
let editorServices = new CodeMirrorEditorFactory();
const editorFactory = editorServices.newInlineEditor.bind(editorServices);
beforeEach(() => {
editor = new LogEditor({ editorFactory });
});
afterEach(() => {
editor.dispose();
});
describe('#constructor', () => {
it('should create a new metadata editor', () => {
let newEditor = new JSONEditor({ editorFactory });
expect(newEditor).to.be.an.instanceof(JSONEditor);
});
});
describe('NotebookTools.NotebookMetadataEditorTool', () => {
const editorServices = new CodeMirrorEditorFactory();
const editorFactory = editorServices.newInlineEditor.bind(editorServices);
it('should create a new metadata editor tool', () => {
const tool = new NotebookTools.NotebookMetadataEditorTool({
editorFactory
});
expect(tool).to.be.an.instanceof(
NotebookTools.NotebookMetadataEditorTool
);
});
it('should handle a change to the active notebook', () => {
panel0.model.metadata.set('panel0', 1);
panel1.model.metadata.set('panel1', 1);
const tool = new NotebookTools.NotebookMetadataEditorTool({
editorFactory
it('should create a new editor with given options', () => {
const factory = new CodeMirrorEditorFactory(options);
const editor = factory.newDocumentEditor({
host,
model
}) as CodeMirrorEditor;
expect(editor).to.be.an.instanceof(CodeMirrorEditor);
for (let key in Object.keys(options)) {
const option = key as keyof CodeMirrorEditor.IConfig;
expect(editor.getOption(option)).to.equal(options[option]);
}
editor.dispose();
});
});
it('should create a new editor', () => {
const factory = new CodeMirrorEditorFactory();
const editor = factory.newInlineEditor({ host, model });
expect(editor).to.be.an.instanceof(CodeMirrorEditor);
editor.dispose();
});
describe('Debugger', () => {
const service = new DebuggerService();
const registry = new CommandRegistry();
const factoryService = new CodeMirrorEditorFactory();
const mimeTypeService = new CodeMirrorMimeTypeService();
let sidebar: TestSidebar;
beforeEach(() => {
sidebar = new TestSidebar({
service,
callstackCommands: {
registry,
continue: '',
terminate: '',
next: '',
stepIn: '',
stepOut: ''
},
editorServices: {
describe('fileeditorcodewrapper', () => {
const factoryService = new CodeMirrorEditorFactory();
const modelFactory = new TextModelFactory();
const mimeTypeService = new CodeMirrorMimeTypeService();
let context: Context;
let manager: ServiceManager.IManager;
beforeAll(() => {
manager = new ServiceManager({ standby: 'never' });
return manager.ready;
});
describe('FileEditorCodeWrapper', () => {
let widget: FileEditorCodeWrapper;
beforeEach(() => {
const path = UUID.uuid4() + '.py';
context = new Context({ manager, factory: modelFactory, path });
describe('fileeditorcodewrapper', () => {
const factoryService = new CodeMirrorEditorFactory();
const modelFactory = new TextModelFactory();
const mimeTypeService = new CodeMirrorMimeTypeService();
let context: Context;
let manager: ServiceManager.IManager;
beforeAll(() => {
manager = new ServiceManager({ standby: 'never' });
return manager.ready;
});
describe('FileEditorCodeWrapper', () => {
let widget: FileEditorCodeWrapper;
beforeEach(() => {
const path = UUID.uuid4() + '.py';
context = new Context({ manager, factory: modelFactory, path });
activeWidget = widget;
widget.disposed.connect((w: Widget) => {
let index = widgets.indexOf(w);
widgets.splice(index, 1);
});
}
};
let docRegistry = new DocumentRegistry();
let docManager = new DocumentManager({
registry: docRegistry,
manager,
opener
});
let editorServices = {
factoryService: new CodeMirrorEditorFactory(),
mimeTypeService: new CodeMirrorMimeTypeService()
};
let wFactory = new FileEditorFactory({
editorServices,
factoryOptions: {
name: 'Editor',
modelName: 'text',
fileTypes: ['*'],
defaultFor: ['*'],
preferKernel: false,
canStartKernel: true
}
});
docRegistry.addWidgetFactory(wFactory);
let commands = new CommandRegistry();
function _createDefaultEditorFactory(): CodeEditor.Factory {
let editorServices = new CodeMirrorEditorFactory();
return editorServices.newInlineEditor;
}