瀏覽代碼

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 );
+			} );
 		} );
 	} );
 } );