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 handle all bundle types', () => {
for (let i = 0; i < NBTestUtils.DEFAULT_OUTPUTS.length; i++) {
const output = NBTestUtils.DEFAULT_OUTPUTS[i];
const bundle = OutputModel.getData(output);
expect(Object.keys(bundle).length).to.not.equal(0);
}
});
});
it('should accept options', () => {
const contentFactory = new OutputAreaModel.ContentFactory();
model = new OutputAreaModel({
values: NBTestUtils.DEFAULT_OUTPUTS,
contentFactory,
trusted: true
});
expect(model.contentFactory).to.equal(contentFactory);
expect(model.trusted).to.equal(true);
});
});
it('should handle an added output', () => {
widget.model.clear();
widget.methods = [];
widget.model.add(NBTestUtils.DEFAULT_OUTPUTS[0]);
expect(widget.methods).to.contain('onModelChanged');
expect(widget.widgets.length).to.equal(1);
});
it('should cause all of the cells to `set`', () => {
let called = 0;
model.add(NBTestUtils.DEFAULT_OUTPUTS[0]);
model.add(NBTestUtils.DEFAULT_OUTPUTS[1]);
model.changed.connect(() => {
called++;
});
model.trusted = true;
expect(called).to.equal(2);
});
});
it('should update the trusted state of the output models', () => {
const model = new CodeCellModel({});
model.outputs.add(NBTestUtils.DEFAULT_OUTPUTS[0]);
expect(model.outputs.get(0).trusted).to.equal(false);
model.trusted = true;
expect(model.outputs.get(0).trusted).to.equal(true);
});
});
it('should handle all bundle types', () => {
for (let i = 0; i < NBTestUtils.DEFAULT_OUTPUTS.length; i++) {
const output = NBTestUtils.DEFAULT_OUTPUTS[i];
const bundle = OutputModel.getData(output);
expect(Object.keys(bundle).length).to.not.equal(0);
}
});
});
it('should handle a set', () => {
widget.model.clear();
widget.model.add(NBTestUtils.DEFAULT_OUTPUTS[0]);
widget.methods = [];
widget.model.add(NBTestUtils.DEFAULT_OUTPUTS[0]);
expect(widget.methods).to.contain('onModelChanged');
expect(widget.widgets.length).to.equal(1);
});
it('should update the trusted state of the output models', () => {
const model = new CodeCellModel({});
model.outputs.add(NBTestUtils.DEFAULT_OUTPUTS[0]);
expect(model.outputs.get(0).trusted).to.equal(false);
model.trusted = true;
expect(model.outputs.get(0).trusted).to.equal(true);
});
});
beforeEach(() => {
model = new OutputAreaModel({
values: NBTestUtils.DEFAULT_OUTPUTS,
trusted: true
});
widget = new LogOutputArea({ rendermime, model });
});
beforeEach(() => {
model = new OutputAreaModel({
values: NBTestUtils.DEFAULT_OUTPUTS,
trusted: true
});
widget = new LogOutputArea({ rendermime, model });
});