Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should create a new content factory with a new IModelDB', () => {
let modelDB = new ModelDB();
let factory = new NotebookModel.ContentFactory({ modelDB });
expect(factory.modelDB).to.be(modelDB);
let newModelDB = new ModelDB();
let newFactory = factory.clone(newModelDB);
expect(newFactory.modelDB).to.be(newModelDB);
expect(newFactory.codeCellContentFactory)
.to.be(factory.codeCellContentFactory);
});
it('should be settable in the constructor', () => {
const codeCellContentFactory = new CodeCellModel.ContentFactory();
factory = new NotebookModel.ContentFactory({
codeCellContentFactory
});
expect(factory.codeCellContentFactory).to.equal(
codeCellContentFactory
);
});
});
it('should be settable in the constructor', () => {
let codeCellContentFactory = new CodeCellModel.ContentFactory();
factory = new NotebookModel.ContentFactory({ codeCellContentFactory });
expect(factory.codeCellContentFactory).to.be(codeCellContentFactory);
});
it('should accept a notebook model content factory', () => {
const contentFactory = new NotebookModel.ContentFactory({});
const factory = new NotebookModelFactory({ contentFactory });
expect(factory.contentFactory).to.equal(contentFactory);
});
});
it('should create a new content factory with a new IModelDB', () => {
const modelDB = new ModelDB();
const factory = new NotebookModel.ContentFactory({ modelDB });
expect(factory.modelDB).to.equal(modelDB);
const newModelDB = new ModelDB();
const newFactory = factory.clone(newModelDB);
expect(newFactory.modelDB).to.equal(newModelDB);
expect(newFactory.codeCellContentFactory).to.equal(
factory.codeCellContentFactory
);
});
});
describe('.ContentFactory', () => {
let factory = new NotebookModel.ContentFactory({});
context('#codeCellContentFactory', () => {
it('should be a code cell content factory', () => {
expect(factory.codeCellContentFactory).to.be(CodeCellModel.defaultContentFactory);
});
it('should be settable in the constructor', () => {
let codeCellContentFactory = new CodeCellModel.ContentFactory();
factory = new NotebookModel.ContentFactory({ codeCellContentFactory });
expect(factory.codeCellContentFactory).to.be(codeCellContentFactory);
});
});
context('#createCodeCell()', () => {
it('should accept an optional factory', () => {
const contentFactory = new NotebookModel.ContentFactory({});
const model = new NotebookModel({ contentFactory });
expect(model.contentFactory.codeCellContentFactory).to.equal(
contentFactory.codeCellContentFactory
);
});
});
it('should create a new content factory with a new IModelDB', () => {
const modelDB = new ModelDB();
const factory = new NotebookModel.ContentFactory({ modelDB });
expect(factory.modelDB).to.equal(modelDB);
const newModelDB = new ModelDB();
const newFactory = factory.clone(newModelDB);
expect(newFactory.modelDB).to.equal(newModelDB);
expect(newFactory.codeCellContentFactory).to.equal(
factory.codeCellContentFactory
);
});
});
it('should accept an optional factory', () => {
const contentFactory = new NotebookModel.ContentFactory({});
const model = new NotebookModel({ contentFactory });
expect(model.contentFactory.codeCellContentFactory).to.equal(
contentFactory.codeCellContentFactory
);
});
});
describe('.ContentFactory', () => {
let factory = new NotebookModel.ContentFactory({});
context('#codeCellContentFactory', () => {
it('should be a code cell content factory', () => {
expect(factory.codeCellContentFactory).to.equal(
CodeCellModel.defaultContentFactory
);
});
it('should be settable in the constructor', () => {
const codeCellContentFactory = new CodeCellModel.ContentFactory();
factory = new NotebookModel.ContentFactory({
codeCellContentFactory
});
expect(factory.codeCellContentFactory).to.equal(
codeCellContentFactory
);