Przeglądaj źródła

Increased model document CC.

Oskar Wróbel 8 lat temu
rodzic
commit
99e2108825

+ 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', () => {
 		const serialized = jsonParseStringify( doc );