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 be the model used by the input area', () => {
const widget = new InputArea({ model });
expect(widget.model).to.equal(model);
});
});
it('should dispose of the resources used by the widget', () => {
const widget = new InputArea({ model });
widget.dispose();
expect(widget.isDisposed).to.equal(true);
widget.dispose();
expect(widget.isDisposed).to.equal(true);
});
});
it('should be called to show the editor', () => {
const widget = new InputArea({ model });
const rendered = new Widget();
Widget.attach(widget, document.body);
widget.renderInput(rendered);
widget.showEditor();
expect(rendered.isAttached).to.equal(false);
widget.dispose();
});
});
it('should be the code editor used by the cell', () => {
const widget = new InputArea({ model });
expect(widget.editor.host).to.equal(widget.editorWidget.node);
});
});
it('should create an input area widget', () => {
const widget = new InputArea({ model });
expect(widget).to.be.an.instanceof(InputArea);
});
});
it('should be the content factory used by the input area', () => {
const widget = new InputArea({ model });
expect(widget.contentFactory).to.equal(InputArea.defaultContentFactory);
});
});
it('should render the widget', () => {
const widget = new InputArea({ model });
const rendered = new Widget();
Widget.attach(widget, document.body);
widget.renderInput(rendered);
expect(rendered.isAttached).to.equal(true);
widget.dispose();
});
});
it('should change the value of the input prompt', () => {
const widget = new InputArea({ model });
const prompt = widget.node.querySelector(`.${PROMPT_CLASS}`);
expect(prompt.textContent).to.be.empty;
widget.setPrompt('foo');
expect(prompt.textContent).to.contain('foo');
});
});
it('should be the editor widget used by the input area', () => {
const widget = new InputArea({ model });
expect(widget.editorWidget).to.be.an.instanceof(CodeEditorWrapper);
});
});
it('should be the prompt node used by the cell', () => {
const widget = new InputArea({ model });
expect(widget.promptNode.className).to.contain('jp-InputPrompt');
});
});