Procházet zdrojové kódy

Fixed usage of sinon.

Maciej Bukowski před 7 roky
rodič
revize
d0e437b241

+ 6 - 7
packages/ckeditor5-engine/tests/dev-utils/model.js

@@ -13,14 +13,13 @@ import Position from '../../src/model/position';
 import count from '@ckeditor/ckeditor5-utils/src/count';
 
 describe( 'model test utils', () => {
-	let model, document, root, selection, sandbox;
+	let model, document, root, selection;
 
 	beforeEach( () => {
 		model = new Model();
 		document = model.document;
 		root = document.createRoot();
 		selection = document.selection;
-		sandbox = sinon.sandbox.create();
 
 		model.change( writer => {
 			writer.setSelection( null );
@@ -51,12 +50,12 @@ describe( 'model test utils', () => {
 	} );
 
 	afterEach( () => {
-		sandbox.restore();
+		sinon.restore();
 	} );
 
 	describe( 'getData', () => {
 		it( 'should use stringify method', () => {
-			const stringifySpy = sandbox.spy( getData, '_stringify' );
+			const stringifySpy = sinon.spy( getData, '_stringify' );
 			root._appendChild( new Element( 'b', null, new Text( 'btext' ) ) );
 
 			expect( getData( model, { withoutSelection: true } ) ).to.equal( '<b>btext</b>' );
@@ -65,7 +64,7 @@ describe( 'model test utils', () => {
 		} );
 
 		it( 'should use stringify method with selection', () => {
-			const stringifySpy = sandbox.spy( getData, '_stringify' );
+			const stringifySpy = sinon.spy( getData, '_stringify' );
 			root._appendChild( new Element( 'b', null, new Text( 'btext' ) ) );
 			model.change( writer => {
 				writer.setSelection( Range.createFromParentsAndOffsets( root, 0, root, 1 ) );
@@ -84,7 +83,7 @@ describe( 'model test utils', () => {
 
 	describe( 'setData', () => {
 		it( 'should use parse method', () => {
-			const parseSpy = sandbox.spy( setData, '_parse' );
+			const parseSpy = sinon.spy( setData, '_parse' );
 			const options = {};
 			const data = '<b>btext</b>text';
 
@@ -97,7 +96,7 @@ describe( 'model test utils', () => {
 		} );
 
 		it( 'should use parse method with selection', () => {
-			const parseSpy = sandbox.spy( setData, '_parse' );
+			const parseSpy = sinon.spy( setData, '_parse' );
 			const options = {};
 			const data = '[<b>btext</b>]';
 

+ 5 - 11
packages/ckeditor5-engine/tests/dev-utils/view.js

@@ -22,20 +22,14 @@ import createViewRoot from '../view/_utils/createroot';
 
 describe( 'view test utils', () => {
 	describe( 'getData, setData', () => {
-		let sandbox;
-
-		beforeEach( () => {
-			sandbox = sinon.sandbox.create();
-		} );
-
 		afterEach( () => {
-			sandbox.restore();
+			sinon.restore();
 		} );
 
 		describe( 'getData', () => {
 			it( 'should use stringify method', () => {
 				const element = document.createElement( 'div' );
-				const stringifySpy = sandbox.spy( getData, '_stringify' );
+				const stringifySpy = sinon.spy( getData, '_stringify' );
 				const view = new View();
 				const viewDocument = view.document;
 				const options = {
@@ -62,7 +56,7 @@ describe( 'view test utils', () => {
 
 			it( 'should use stringify method with selection', () => {
 				const element = document.createElement( 'div' );
-				const stringifySpy = sandbox.spy( getData, '_stringify' );
+				const stringifySpy = sinon.spy( getData, '_stringify' );
 				const view = new View();
 				const viewDocument = view.document;
 				const options = { showType: false, showPriority: false };
@@ -97,7 +91,7 @@ describe( 'view test utils', () => {
 				const view = new View();
 				const viewDocument = view.document;
 				const data = 'foobar<b>baz</b>';
-				const parseSpy = sandbox.spy( setData, '_parse' );
+				const parseSpy = sinon.spy( setData, '_parse' );
 
 				createAttachedRoot( viewDocument, document.createElement( 'div' ) );
 				setData( view, data );
@@ -116,7 +110,7 @@ describe( 'view test utils', () => {
 				const view = new View();
 				const viewDocument = view.document;
 				const data = '[<b>baz</b>]';
-				const parseSpy = sandbox.spy( setData, '_parse' );
+				const parseSpy = sinon.spy( setData, '_parse' );
 
 				createAttachedRoot( viewDocument, document.createElement( 'div' ) );
 				setData( view, data );