Browse Source

Increased model document CC.

Oskar Wróbel 8 years ago
parent
commit
99e2108825
1 changed files with 27 additions and 0 deletions
  1. 27 0
      packages/ckeditor5-engine/tests/model/document/document.js

+ 27 - 0
packages/ckeditor5-engine/tests/model/document/document.js

@@ -487,6 +487,33 @@ describe( 'Document', () => {
 		} );
 		} );
 	} );
 	} );
 
 
+	describe( 'destroy()', () => {
+		it( 'should destroy selection instance', () => {
+			const spy = sinon.spy( doc.selection, 'destroy' );
+
+			doc.destroy();
+
+			sinon.assert.calledOnce( spy );
+		} );
+
+		it( 'should stop listening to events', () => {
+			const spy = sinon.spy();
+
+			doc.listenTo( model, 'something', spy );
+
+			model.fire( 'something' );
+
+			sinon.assert.calledOnce( spy );
+
+			doc.destroy();
+
+			model.fire( 'something' );
+
+			// Still once.
+			sinon.assert.calledOnce( spy );
+		} );
+	} );
+
 	it( 'should be correctly converted to json', () => {
 	it( 'should be correctly converted to json', () => {
 		const serialized = jsonParseStringify( doc );
 		const serialized = jsonParseStringify( doc );