Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('CodeCell', () => {
const contentFactory = NBTestUtils.createCodeCellFactory();
const model = new CodeCellModel({});
describe('#constructor()', () => {
it('should create a code cell widget', () => {
const widget = new CodeCell({ model, rendermime, contentFactory });
widget.initializeState();
expect(widget).toBeInstanceOf(CodeCell);
});
it('should accept a custom contentFactory', () => {
const contentFactory = NBTestUtils.createCodeCellFactory();
const widget = new CodeCell({ model, contentFactory, rendermime });
widget.initializeState();
expect(widget).toBeInstanceOf(CodeCell);
});
});
it('should add a code cell to the content widget', () => {
const contentFactory = NBTestUtils.createCodeCellFactory();
const model = new CodeCellModel({});
const cell = new CodeCell({
model,
contentFactory,
rendermime
}).initializeState();
Widget.attach(widget, document.body);
expect(widget.cells.length).to.equal(0);
widget.addCell(cell);
expect(widget.cells.length).to.equal(1);
});
});
it('should add a code cell to the content widget', () => {
const contentFactory = NBTestUtils.createCodeCellFactory();
const model = new CodeCellModel({});
const cell = new CodeCell({
model,
contentFactory,
rendermime
}).initializeState();
Widget.attach(widget, document.body);
expect(widget.cells.length).to.equal(0);
widget.addCell(cell);
expect(widget.cells.length).to.equal(1);
});
});
it('should accept a custom contentFactory', () => {
const contentFactory = NBTestUtils.createCodeCellFactory();
const widget = new CodeCell({ model, contentFactory, rendermime });
widget.initializeState();
expect(widget).toBeInstanceOf(CodeCell);
});
});
it('should add a code cell to the content widget', () => {
const contentFactory = NBTestUtils.createCodeCellFactory();
const model = new CodeCellModel({});
const cell = new CodeCell({
model,
contentFactory,
rendermime
}).initializeState();
Widget.attach(widget, document.body);
expect(widget.cells.length).to.equal(0);
widget.addCell(cell);
expect(widget.cells.length).to.equal(1);
});
});
constructor() {
super({
model: new CodeCellModel({}),
contentFactory: NBTestUtils.createCodeCellFactory(),
rendermime
});
}
createCodeCell(): CodeCell {
const contentFactory = NBTestUtils.createCodeCellFactory();
const model = new CodeCellModel({});
const cell = new CodeCell({
model,
rendermime,
contentFactory
}).initializeState();
return cell;
}
createCodeCell(): CodeCell {
const contentFactory = NBTestUtils.createCodeCellFactory();
const model = new CodeCellModel({});
const cell = new CodeCell({
model,
rendermime,
contentFactory
}).initializeState();
return cell;
}
constructor() {
super({
model: new CodeCellModel({}),
contentFactory: NBTestUtils.createCodeCellFactory(),
rendermime
});
}