8
0
Просмотр исходного кода

Tests: Properly use sinon sandbox in tests.

Maciej Gołaszewski 7 лет назад
Родитель
Сommit
adcfa076de

+ 2 - 2
packages/ckeditor5-ui/tests/bindings/clickoutsidehandler.js

@@ -11,11 +11,11 @@ import DomEmitterMixin from '@ckeditor/ckeditor5-utils/src/dom/emittermixin';
 
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 
-testUtils.createSinonSandbox();
-
 describe( 'clickOutsideHandler', () => {
 	let activator, actionSpy, contextElement1, contextElement2;
 
+	testUtils.createSinonSandbox();
+
 	beforeEach( () => {
 		activator = testUtils.sinon.stub().returns( false );
 		contextElement1 = document.createElement( 'div' );

+ 2 - 2
packages/ckeditor5-ui/tests/bindings/submithandler.js

@@ -10,11 +10,11 @@ import submitHandler from '../../src/bindings/submithandler';
 import View from '../../src/view';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 
-testUtils.createSinonSandbox();
-
 describe( 'submitHandler', () => {
 	let view;
 
+	testUtils.createSinonSandbox();
+
 	beforeEach( () => {
 		view = new View();
 		view.element = document.createElement( 'div' );

+ 2 - 2
packages/ckeditor5-ui/tests/button/buttonview.js

@@ -12,11 +12,11 @@ import TooltipView from '../../src/tooltip/tooltipview';
 import View from '../../src/view';
 import ViewCollection from '../../src/viewcollection';
 
-testUtils.createSinonSandbox();
-
 describe( 'ButtonView', () => {
 	let locale, view;
 
+	testUtils.createSinonSandbox();
+
 	beforeEach( () => {
 		locale = { t() {} };
 

+ 2 - 2
packages/ckeditor5-ui/tests/dropdown/button/dropdownbuttonview.js

@@ -7,11 +7,11 @@ import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import IconView from '../../../src/icon/iconview';
 import DropdownButtonView from '../../../src/dropdown/button/dropdownbuttonview';
 
-testUtils.createSinonSandbox();
-
 describe( 'DropdownButtonView', () => {
 	let locale, view;
 
+	testUtils.createSinonSandbox();
+
 	beforeEach( () => {
 		locale = { t() {} };
 

+ 2 - 2
packages/ckeditor5-ui/tests/dropdown/button/splitbuttonview.js

@@ -8,11 +8,11 @@ import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
 import ButtonView from '../../../src/button/buttonview';
 import SplitButtonView from '../../../src/dropdown/button/splitbuttonview';
 
-testUtils.createSinonSandbox();
-
 describe( 'SplitButtonView', () => {
 	let locale, view;
 
+	testUtils.createSinonSandbox();
+
 	beforeEach( () => {
 		locale = { t() {} };
 

+ 2 - 2
packages/ckeditor5-ui/tests/editableui/editableuiview.js

@@ -10,11 +10,11 @@ import View from '../../src/view';
 import Locale from '@ckeditor/ckeditor5-utils/src/locale';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 
-testUtils.createSinonSandbox();
-
 describe( 'EditableUIView', () => {
 	let view, editableElement, locale;
 
+	testUtils.createSinonSandbox();
+
 	beforeEach( () => {
 		locale = new Locale( 'en' );
 		editableElement = document.createElement( 'div' );

+ 2 - 2
packages/ckeditor5-ui/tests/editorui/editoruiview.js

@@ -10,11 +10,11 @@ import EditorUIView from '../../src/editorui/editoruiview';
 import ViewCollection from '../../src/viewcollection';
 import Locale from '@ckeditor/ckeditor5-utils/src/locale';
 
-testUtils.createSinonSandbox();
-
 describe( 'EditorUIView', () => {
 	let view, locale;
 
+	testUtils.createSinonSandbox();
+
 	beforeEach( () => {
 		locale = new Locale( 'en' );
 		view = new EditorUIView( locale );

+ 2 - 2
packages/ckeditor5-ui/tests/focuscycler.js

@@ -11,11 +11,11 @@ import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
 import global from '@ckeditor/ckeditor5-utils/src/dom/global';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 
-testUtils.createSinonSandbox();
-
 describe( 'FocusCycler', () => {
 	let focusables, focusTracker, cycler;
 
+	testUtils.createSinonSandbox();
+
 	beforeEach( () => {
 		focusables = new ViewCollection();
 		focusTracker = {

+ 2 - 2
packages/ckeditor5-ui/tests/panel/balloon/balloonpanelview.js

@@ -10,11 +10,11 @@ import BalloonPanelView from '../../../src/panel/balloon/balloonpanelview';
 import ButtonView from '../../../src/button/buttonview';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 
-testUtils.createSinonSandbox();
-
 describe( 'BalloonPanelView', () => {
 	let view;
 
+	testUtils.createSinonSandbox();
+
 	beforeEach( () => {
 		view = new BalloonPanelView();
 		view.render();

+ 2 - 2
packages/ckeditor5-ui/tests/panel/sticky/stickypanelview.js

@@ -13,11 +13,11 @@ import ViewCollection from '../../../src/viewcollection';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import DomEmitterMixin from '@ckeditor/ckeditor5-utils/src/dom/emittermixin';
 
-testUtils.createSinonSandbox();
-
 describe( 'StickyPanelView', () => {
 	let view, element, contentElement, placeholderElement, limiterElement, locale, windowStub;
 
+	testUtils.createSinonSandbox();
+
 	beforeEach( () => {
 		locale = {};
 		limiterElement = document.createElement( 'div' );

+ 2 - 2
packages/ckeditor5-ui/tests/template.js

@@ -16,12 +16,12 @@ import DomEmitterMixin from '@ckeditor/ckeditor5-utils/src/dom/emittermixin';
 import normalizeHtml from '@ckeditor/ckeditor5-utils/tests/_utils/normalizehtml';
 import log from '@ckeditor/ckeditor5-utils/src/log';
 
-testUtils.createSinonSandbox();
-
 let el, text;
 const injectedElements = [];
 
 describe( 'Template', () => {
+	testUtils.createSinonSandbox();
+
 	// Clean-up document.body from the rendered elements.
 	afterEach( () => {
 		for ( const el of injectedElements ) {

+ 2 - 2
packages/ckeditor5-ui/tests/toolbar/block/blocktoolbar.js

@@ -23,11 +23,11 @@ import { setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 
-testUtils.createSinonSandbox();
-
 describe( 'BlockToolbar', () => {
 	let editor, element, blockToolbar;
 
+	testUtils.createSinonSandbox();
+
 	beforeEach( () => {
 		element = document.createElement( 'div' );
 		document.body.appendChild( element );

+ 2 - 2
packages/ckeditor5-ui/tests/view.js

@@ -15,9 +15,9 @@ import normalizeHtml from '@ckeditor/ckeditor5-utils/tests/_utils/normalizehtml'
 
 let TestView, view, childA, childB;
 
-testUtils.createSinonSandbox();
-
 describe( 'View', () => {
+	testUtils.createSinonSandbox();
+
 	afterEach( () => {
 		if ( view.element ) {
 			view.element.remove();

+ 2 - 2
packages/ckeditor5-ui/tests/viewcollection.js

@@ -13,9 +13,9 @@ import normalizeHtml from '@ckeditor/ckeditor5-utils/tests/_utils/normalizehtml'
 
 let collection;
 
-testUtils.createSinonSandbox();
-
 describe( 'ViewCollection', () => {
+	testUtils.createSinonSandbox();
+
 	beforeEach( createTestCollection );
 
 	describe( 'constructor()', () => {