8
0
Oskar Wróbel 8 лет назад
Родитель
Сommit
99e2108825
1 измененных файлов с 27 добавлено и 0 удалено
  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', () => {
 		const serialized = jsonParseStringify( doc );