瀏覽代碼

Revert "Merge pull request #65 from ckeditor/t/64"

This reverts commit 116c534da37e6f17f314f3e1e92edec6765e9099, reversing
changes made to 04a2b107760bb1a1b7e9078ad64a3715c8db72fd.
Maksymilian Barnaś 9 年之前
父節點
當前提交
d29eed00ee

+ 2 - 1
packages/ckeditor5-ui/tests/componentfactory.js

@@ -7,6 +7,7 @@
 
 import Editor from '/ckeditor5/core/editor/editor.js';
 import ComponentFactory from '/ckeditor5/ui/componentfactory.js';
+import CKEditorError from '/ckeditor5/utils/ckeditorerror.js';
 
 describe( 'ComponentFactory', () => {
 	let editor, factory;
@@ -28,7 +29,7 @@ describe( 'ComponentFactory', () => {
 
 			expect( () => {
 				factory.add( 'foo', class {}, class {}, {} );
-			} ).to.throwCKEditorError( /^componentfactory-item-exists/ );
+			} ).to.throw( CKEditorError, /^componentfactory-item-exists/ );
 		} );
 	} );
 

+ 1 - 1
packages/ckeditor5-ui/tests/controller.js

@@ -50,7 +50,7 @@ describe( 'Controller', () => {
 					throw new Error( 'This should not be executed.' );
 				} )
 				.catch( ( err ) => {
-					expect( CKEditorError.isCKEditorError( err ) ).to.be.true;
+					expect( err ).to.be.instanceof( CKEditorError );
 					expect( err.message ).to.match( /ui-controller-init-re/ );
 				} );
 		} );

+ 4 - 3
packages/ckeditor5-ui/tests/controllercollection.js

@@ -13,6 +13,7 @@ import Collection from '/ckeditor5/utils/collection.js';
 import Model from '/ckeditor5/ui/model.js';
 import View from '/ckeditor5/ui/view.js';
 import Template from '/ckeditor5/ui/template.js';
+import CKEditorError from '/ckeditor5/utils/ckeditorerror.js';
 
 testUtils.createSinonSandbox();
 
@@ -276,15 +277,15 @@ describe( 'ControllerCollection', () => {
 
 			expect( () => {
 				collection.delegate();
-			} ).to.throwCKEditorError( /ui-controllercollection-delegate-wrong-events/ );
+			} ).to.throw( CKEditorError, /ui-controllercollection-delegate-wrong-events/ );
 
 			expect( () => {
 				collection.delegate( new Date() );
-			} ).to.throwCKEditorError( /ui-controllercollection-delegate-wrong-events/ );
+			} ).to.throw( CKEditorError, /ui-controllercollection-delegate-wrong-events/ );
 
 			expect( () => {
 				collection.delegate( 'color', new Date() );
-			} ).to.throwCKEditorError( /ui-controllercollection-delegate-wrong-events/ );
+			} ).to.throw( CKEditorError, /ui-controllercollection-delegate-wrong-events/ );
 		} );
 
 		it( 'returns object', () => {

+ 8 - 7
packages/ckeditor5-ui/tests/template.js

@@ -9,6 +9,7 @@
 import testUtils from '/tests/core/_utils/utils.js';
 import Template from '/ckeditor5/ui/template.js';
 import Model from '/ckeditor5/ui/model.js';
+import CKEditorError from '/ckeditor5/utils/ckeditorerror.js';
 import EmitterMixin from '/ckeditor5/utils/emittermixin.js';
 import DOMEmitterMixin from '/ckeditor5/ui/domemittermixin.js';
 
@@ -108,14 +109,14 @@ describe( 'Template', () => {
 		it( 'throws when wrong template definition', () => {
 			expect( () => {
 				new Template( {} ).render();
-			} ).to.throwCKEditorError( /ui-template-wrong-syntax/ );
+			} ).to.throw( CKEditorError, /ui-template-wrong-syntax/ );
 
 			expect( () => {
 				new Template( {
 					tag: 'p',
 					text: 'foo'
 				} ).render();
-			} ).to.throwCKEditorError( /ui-template-wrong-syntax/ );
+			} ).to.throw( CKEditorError, /ui-template-wrong-syntax/ );
 		} );
 
 		it( 'creates HTMLElement', () => {
@@ -461,7 +462,7 @@ describe( 'Template', () => {
 					tag: 'p',
 					text: 'foo'
 				} ).apply( el );
-			} ).to.throwCKEditorError( /ui-template-wrong-syntax/ );
+			} ).to.throw( CKEditorError, /ui-template-wrong-syntax/ );
 		} );
 
 		it( 'throws when no HTMLElement passed', () => {
@@ -469,7 +470,7 @@ describe( 'Template', () => {
 				new Template( {
 					tag: 'p'
 				} ).apply();
-			} ).to.throwCKEditorError( /ui-template-wrong-node/ );
+			} ).to.throw( CKEditorError, /ui-template-wrong-node/ );
 		} );
 
 		it( 'accepts empty template definition', () => {
@@ -1756,7 +1757,7 @@ describe( 'Template', () => {
 						},
 						'it should fail'
 					);
-				} ).to.throwCKEditorError( /ui-template-extend-children-mismatch/ );
+				} ).to.throw( CKEditorError, /ui-template-extend-children-mismatch/ );
 			} );
 
 			it( 'should throw when no children in target but extending one', () => {
@@ -1774,7 +1775,7 @@ describe( 'Template', () => {
 						},
 						'it should fail'
 					);
-				} ).to.throwCKEditorError( /ui-template-extend-children-mismatch/ );
+				} ).to.throw( CKEditorError, /ui-template-extend-children-mismatch/ );
 			} );
 
 			it( 'should throw when the number of children does not correspond on some deeper level', () => {
@@ -1817,7 +1818,7 @@ describe( 'Template', () => {
 						},
 						'it should fail'
 					);
-				} ).to.throwCKEditorError( /ui-template-extend-children-mismatch/ );
+				} ).to.throw( CKEditorError, /ui-template-extend-children-mismatch/ );
 			} );
 
 			it( 'extends existing - simple', () => {

+ 6 - 5
packages/ckeditor5-ui/tests/view.js

@@ -10,6 +10,7 @@ import testUtils from '/tests/core/_utils/utils.js';
 import View from '/ckeditor5/ui/view.js';
 import Template from '/ckeditor5/ui/template.js';
 import Region from '/ckeditor5/ui/region.js';
+import CKEditorError from '/ckeditor5/utils/ckeditorerror.js';
 
 let TestView, view;
 
@@ -140,30 +141,30 @@ describe( 'View', () => {
 		it( 'should throw when first argument is neither Region instance nor string', () => {
 			expect( () => {
 				view.register( new Date() );
-			} ).to.throwCKEditorError( /ui-view-register-wrongtype/ );
+			} ).to.throw( CKEditorError, /ui-view-register-wrongtype/ );
 		} );
 
 		it( 'should throw when missing the selector argument', () => {
 			expect( () => {
 				view.register( 'x' );
-			} ).to.throwCKEditorError( /ui-view-register-badselector/ );
+			} ).to.throw( CKEditorError, /ui-view-register-badselector/ );
 		} );
 
 		it( 'should throw when selector argument is of a wrong type', () => {
 			expect( () => {
 				view.register( 'x', new Date() );
-			} ).to.throwCKEditorError( /ui-view-register-badselector/ );
+			} ).to.throw( CKEditorError, /ui-view-register-badselector/ );
 
 			expect( () => {
 				view.register( 'x', false );
-			} ).to.throwCKEditorError( /ui-view-register-badselector/ );
+			} ).to.throw( CKEditorError, /ui-view-register-badselector/ );
 		} );
 
 		it( 'should throw when overriding an existing region but without override flag set', () => {
 			expect( () => {
 				view.register( 'x', true );
 				view.register( new Region( 'x' ), true );
-			} ).to.throwCKEditorError( /ui-view-register-override/ );
+			} ).to.throw( CKEditorError, /ui-view-register-override/ );
 		} );
 
 		it( 'should register a new region with region name as a first argument', () => {