it('should not be emitted if the content does not change', () => { let model = new DocumentModel(); let called = false; model.contentChanged.connect(() => { called = true; }); model.fromString(''); expect(called).to.be(false); });
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 deserialize the model from JSON', () => { let model = new DocumentModel(); let data = null; model.fromJSON(data); expect(model.toString()).to.be('null'); });
it('should serialize the model to JSON', () => { let model = new DocumentModel(); let data = { 'foo': 1 }; model.fromJSON(data); expect(model.toJSON()).to.eql(data); });
it('should deserialize the model from a string', () => { let model = new DocumentModel(); model.fromString('foo'); expect(model.toString()).to.be('foo'); });
it('should serialize the model to a string', () => { let model = new DocumentModel(); expect(model.toString()).to.be(''); });
it('should be safe to call more than once', () => { let model = new DocumentModel(); model.dispose(); model.dispose(); expect(model.isDisposed).to.be(true); });
it('should dispose of the resources held by the document manager', () => { let model = new DocumentModel(); model.dispose(); expect(model.isDisposed).to.be(true); });
it('should get whether the model has been disposed', () => { let model = new DocumentModel(); expect(model.isDisposed).to.be(false); model.dispose(); expect(model.isDisposed).to.be(true); });
it('should deserialize the model from JSON', () => { const model = new DocumentModel(); const data: null = null; model.fromJSON(data); expect(model.toString()).to.equal('null'); });