Преглед на файлове

Merge pull request #178 from ckeditor/t/plugintestfix

Tests: Remove global hooks from plugin tests.
Kamil Piechaczek преди 6 години
родител
ревизия
d9824773c7
променени са 1 файла, в които са добавени 20 реда и са изтрити 18 реда
  1. 20 18
      packages/ckeditor5-core/tests/plugin.js

+ 20 - 18
packages/ckeditor5-core/tests/plugin.js

@@ -6,33 +6,35 @@
 import Plugin from '../src/plugin';
 import Editor from '../src/editor/editor';
 
-let editor;
+describe( 'Plugin', () => {
+	let editor;
 
-before( () => {
-	editor = new Editor();
-} );
-
-describe( 'constructor()', () => {
-	it( 'should set the `editor` property', () => {
-		const plugin = new Plugin( editor );
-
-		expect( plugin ).to.have.property( 'editor' ).to.equal( editor );
+	beforeEach( () => {
+		editor = new Editor();
 	} );
 
-	describe( 'destroy()', () => {
-		it( 'should be defined', () => {
+	describe( 'constructor()', () => {
+		it( 'should set the `editor` property', () => {
 			const plugin = new Plugin( editor );
 
-			expect( plugin.destroy ).to.be.a( 'function' );
+			expect( plugin ).to.have.property( 'editor' ).to.equal( editor );
 		} );
 
-		it( 'should stop listening', () => {
-			const plugin = new Plugin( editor );
-			const stopListeningSpy = sinon.spy( plugin, 'stopListening' );
+		describe( 'destroy()', () => {
+			it( 'should be defined', () => {
+				const plugin = new Plugin( editor );
+
+				expect( plugin.destroy ).to.be.a( 'function' );
+			} );
+
+			it( 'should stop listening', () => {
+				const plugin = new Plugin( editor );
+				const stopListeningSpy = sinon.spy( plugin, 'stopListening' );
 
-			plugin.destroy();
+				plugin.destroy();
 
-			expect( stopListeningSpy.calledOnce ).to.equal( true );
+				expect( stopListeningSpy.calledOnce ).to.equal( true );
+			} );
 		} );
 	} );
 } );