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 serialize the model to a string', () => {
const model = new DocumentModel();
expect(model.toString()).to.equal('');
});
});
it('should be safe to call more than once', () => {
const model = new DocumentModel();
model.dispose();
model.dispose();
expect(model.isDisposed).to.equal(true);
});
});
it('should serialize the model to a string', () => {
const model = new DocumentModel();
expect(model.toString()).to.equal('');
});
});
it('should emit `stateChanged` when changed', () => {
const model = new DocumentModel();
let called = false;
model.stateChanged.connect((sender, args) => {
expect(sender).to.equal(model);
expect(args.name).to.equal('readOnly');
expect(args.oldValue).to.equal(false);
expect(args.newValue).to.equal(true);
called = true;
});
model.readOnly = true;
expect(called).to.equal(true);
});
it('should accept an optional language preference', () => {
const model = new DocumentModel('foo');
expect(model.defaultKernelLanguage).to.equal('foo');
});
});
it('should be emitted when the content of the model changes', () => {
let model = new DocumentModel();
let called = false;
model.contentChanged.connect((sender, args) => {
expect(sender).to.be(model);
expect(args).to.be(void 0);
called = true;
});
model.fromString('foo');
expect(called).to.be(true);
});
it('should get the default kernel langauge of the document', () => {
let model = new DocumentModel();
expect(model.defaultKernelLanguage).to.be('');
});
it('should get the read only state of the document', () => {
let model = new DocumentModel();
expect(model.readOnly).to.be(false);
});
it('should be set by the constructor arg', () => {
let model = new DocumentModel('foo');
expect(model.defaultKernelLanguage).to.be('foo');
});
it('should get the dirty state of the document', () => {
const model = new DocumentModel();
expect(model.dirty).to.equal(false);
});