Example #1
0
 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);
 });
Example #2
0
 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);
 });
Example #3
0
 it('should deserialize the model from JSON', () => {
   let model = new DocumentModel();
   let data = null;
   model.fromJSON(data);
   expect(model.toString()).to.be('null');
 });
Example #4
0
 it('should serialize the model to JSON', () => {
   let model = new DocumentModel();
   let data = { 'foo': 1 };
   model.fromJSON(data);
   expect(model.toJSON()).to.eql(data);
 });
Example #5
0
 it('should deserialize the model from a string', () => {
   let model = new DocumentModel();
   model.fromString('foo');
   expect(model.toString()).to.be('foo');
 });
Example #6
0
 it('should serialize the model to a string', () => {
   let model = new DocumentModel();
   expect(model.toString()).to.be('');
 });
Example #7
0
 it('should be safe to call more than once', () => {
   let model = new DocumentModel();
   model.dispose();
   model.dispose();
   expect(model.isDisposed).to.be(true);
 });
Example #8
0
 it('should dispose of the resources held by the document manager', () => {
   let model = new DocumentModel();
   model.dispose();
   expect(model.isDisposed).to.be(true);
 });
Example #9
0
 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);
 });
Example #10
0
 it('should deserialize the model from JSON', () => {
   const model = new DocumentModel();
   const data: null = null;
   model.fromJSON(data);
   expect(model.toString()).to.equal('null');
 });