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 allow pre-selecting the delimiter', () => {
const wanted = DELIMITERS[DELIMITERS.length - 1];
const widget = new CSVDelimiter({ selected: wanted });
expect(widget.selectNode.value).to.equal(wanted);
widget.dispose();
});
});
it('should instantiate a `CSVDelimiter` toolbar widget', () => {
const widget = new CSVDelimiter({ selected: ',' });
expect(widget).to.be.an.instanceof(CSVDelimiter);
expect(Array.from(widget.node.classList)).to.contain('jp-CSVDelimiter');
widget.dispose();
});
it('should be safe to call multiple times', () => {
const widget = new CSVDelimiter({ selected: ',' });
expect(widget.isDisposed).to.equal(false);
widget.dispose();
widget.dispose();
expect(widget.isDisposed).to.equal(true);
});
});
it('should emit a value when the dropdown value changes', () => {
const widget = new CSVDelimiter({ selected: ',' });
let delimiter = '';
const index = DELIMITERS.length - 1;
const wanted = DELIMITERS[index];
widget.delimiterChanged.connect((s, value) => {
delimiter = value;
});
Widget.attach(widget, document.body);
widget.selectNode.selectedIndex = index;
simulate(widget.selectNode, 'change');
expect(delimiter).to.equal(wanted);
widget.dispose();
});
});