浏览代码

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

This reverts commit 54a934b5ff740ae5bbe7ad449b013da14b6191ce, reversing
changes made to b90007f5d569cc33f2ae5ed4c17e022ca6f846a2.
Maksymilian Barnaś 9 年之前
父节点
当前提交
ec9c50b026

+ 7 - 6
packages/ckeditor5-utils/tests/collection.js

@@ -5,6 +5,7 @@
 
 import testUtils from '/tests/core/_utils/utils.js';
 import Collection from '/ckeditor5/utils/collection.js';
+import CKEditorError from '/ckeditor5/utils/ckeditorerror.js';
 
 testUtils.createSinonSandbox();
 
@@ -124,7 +125,7 @@ describe( 'Collection', () => {
 
 			expect( () => {
 				collection.add( item2 );
-			} ).to.throwCKEditorError( /^collection-add-item-already-exists/ );
+			} ).to.throw( CKEditorError, /^collection-add-item-already-exists/ );
 		} );
 
 		it( 'should throw when item\'s id is not a string', () => {
@@ -132,7 +133,7 @@ describe( 'Collection', () => {
 
 			expect( () => {
 				collection.add( item );
-			} ).to.throwCKEditorError( /^collection-add-invalid-id/ );
+			} ).to.throw( CKEditorError, /^collection-add-invalid-id/ );
 		} );
 
 		it(
@@ -294,7 +295,7 @@ describe( 'Collection', () => {
 		it( 'should throw if neither string or number given', () => {
 			expect( () => {
 				collection.get( true );
-			} ).to.throwCKEditorError( /^collection-get-invalid-arg/ );
+			} ).to.throw( CKEditorError, /^collection-get-invalid-arg/ );
 		} );
 	} );
 
@@ -399,7 +400,7 @@ describe( 'Collection', () => {
 
 			expect( () => {
 				collection.remove( 1 );
-			} ).to.throwCKEditorError( /^collection-remove-404/ );
+			} ).to.throw( CKEditorError, /^collection-remove-404/ );
 
 			expect( collection ).to.have.length( 1 );
 		} );
@@ -409,7 +410,7 @@ describe( 'Collection', () => {
 
 			expect( () => {
 				collection.remove( 'bar' );
-			} ).to.throwCKEditorError( /^collection-remove-404/ );
+			} ).to.throw( CKEditorError, /^collection-remove-404/ );
 
 			expect( collection ).to.have.length( 1 );
 		} );
@@ -419,7 +420,7 @@ describe( 'Collection', () => {
 
 			expect( () => {
 				collection.remove( getItem( 'bar' ) );
-			} ).to.throwCKEditorError( /^collection-remove-404/ );
+			} ).to.throw( CKEditorError, /^collection-remove-404/ );
 
 			expect( collection ).to.have.length( 1 );
 		} );

+ 3 - 2
packages/ckeditor5-utils/tests/keyboard.js

@@ -4,6 +4,7 @@
  */
 
 import { keyCodes, getCode, parseKeystroke } from '/ckeditor5/utils/keyboard.js';
+import CKEditorError from '/ckeditor5/utils/ckeditorerror.js';
 
 describe( 'Keyboard', () => {
 	describe( 'keyCodes', () => {
@@ -42,7 +43,7 @@ describe( 'Keyboard', () => {
 		it( 'throws when passed unknown key name', () => {
 			expect( () => {
 				getCode( 'foo' );
-			} ).to.throwCKEditorError( /^keyboard-unknown-key:/ );
+			} ).to.throw( CKEditorError, /^keyboard-unknown-key:/ );
 		} );
 
 		it( 'gets code of a keystroke info', () => {
@@ -83,7 +84,7 @@ describe( 'Keyboard', () => {
 		it( 'throws on unknown name', () => {
 			expect( () => {
 				parseKeystroke( 'foo' );
-			} ).to.throwCKEditorError( /^keyboard-unknown-key:/ );
+			} ).to.throw( CKEditorError, /^keyboard-unknown-key:/ );
 		} );
 	} );
 } );

+ 23 - 22
packages/ckeditor5-utils/tests/observablemixin.js

@@ -8,6 +8,7 @@ import utilsTestUtils from '/tests/utils/_utils/utils.js';
 import ObservableMixin from '/ckeditor5/utils/observablemixin.js';
 import EmitterMixin from '/ckeditor5/utils/emittermixin.js';
 import EventInfo from '/ckeditor5/utils/eventinfo.js';
+import CKEditorError from '/ckeditor5/utils/ckeditorerror.js';
 import mix from '/ckeditor5/utils/mix.js';
 
 const assertBinding = utilsTestUtils.assertBinding;
@@ -145,7 +146,7 @@ describe( 'Observable', () => {
 
 			expect( () => {
 				car.set( 'normalProperty', 2 );
-			} ).to.throwCKEditorError( /^observable-set-cannot-override/ );
+			} ).to.throw( CKEditorError, /^observable-set-cannot-override/ );
 
 			expect( car ).to.have.property( 'normalProperty', 1 );
 		} );
@@ -159,7 +160,7 @@ describe( 'Observable', () => {
 
 			expect( () => {
 				car.set( 'method', 2 );
-			} ).to.throwCKEditorError( /^observable-set-cannot-override/ );
+			} ).to.throw( CKEditorError, /^observable-set-cannot-override/ );
 
 			expect( car.method ).to.be.a( 'function' );
 		} );
@@ -197,28 +198,28 @@ describe( 'Observable', () => {
 		it( 'should throw when attributes are not strings', () => {
 			expect( () => {
 				car.bind();
-			} ).to.throwCKEditorError( /observable-bind-wrong-attrs/ );
+			} ).to.throw( CKEditorError, /observable-bind-wrong-attrs/ );
 
 			expect( () => {
 				car.bind( new Date() );
-			} ).to.throwCKEditorError( /observable-bind-wrong-attrs/ );
+			} ).to.throw( CKEditorError, /observable-bind-wrong-attrs/ );
 
 			expect( () => {
 				car.bind( 'color', new Date() );
-			} ).to.throwCKEditorError( /observable-bind-wrong-attrs/ );
+			} ).to.throw( CKEditorError, /observable-bind-wrong-attrs/ );
 		} );
 
 		it( 'should throw when the same attribute is used than once', () => {
 			expect( () => {
 				car.bind( 'color', 'color' );
-			} ).to.throwCKEditorError( /observable-bind-duplicate-attrs/ );
+			} ).to.throw( CKEditorError, /observable-bind-duplicate-attrs/ );
 		} );
 
 		it( 'should throw when binding the same attribute more than once', () => {
 			expect( () => {
 				car.bind( 'color' );
 				car.bind( 'color' );
-			} ).to.throwCKEditorError( /observable-bind-rebind/ );
+			} ).to.throw( CKEditorError, /observable-bind-rebind/ );
 		} );
 
 		describe( 'to', () => {
@@ -233,7 +234,7 @@ describe( 'Observable', () => {
 					car = new Car();
 
 					car.bind( 'color' ).to();
-				} ).to.throwCKEditorError( /observable-bind-to-parse-error/ );
+				} ).to.throw( CKEditorError, /observable-bind-to-parse-error/ );
 			} );
 
 			it( 'should throw when binding multiple attributes to multiple observables', () => {
@@ -243,31 +244,31 @@ describe( 'Observable', () => {
 
 				expect( () => {
 					vehicle.bind( 'color', 'year' ).to( car1, 'color', car2, 'year' );
-				} ).to.throwCKEditorError( /observable-bind-to-no-callback/ );
+				} ).to.throw( CKEditorError, /observable-bind-to-no-callback/ );
 
 				expect( () => {
 					vehicle = new Car();
 
 					vehicle.bind( 'color', 'year' ).to( car1, car2 );
-				} ).to.throwCKEditorError( /observable-bind-to-no-callback/ );
+				} ).to.throw( CKEditorError, /observable-bind-to-no-callback/ );
 
 				expect( () => {
 					vehicle = new Car();
 
 					vehicle.bind( 'color', 'year' ).to( car1, car2, 'year' );
-				} ).to.throwCKEditorError( /observable-bind-to-no-callback/ );
+				} ).to.throw( CKEditorError, /observable-bind-to-no-callback/ );
 
 				expect( () => {
 					vehicle = new Car();
 
 					vehicle.bind( 'color', 'year' ).to( car1, 'color', car2 );
-				} ).to.throwCKEditorError( /observable-bind-to-no-callback/ );
+				} ).to.throw( CKEditorError, /observable-bind-to-no-callback/ );
 
 				expect( () => {
 					vehicle = new Car();
 
 					vehicle.bind( 'color', 'year', 'custom' ).to( car, car );
-				} ).to.throwCKEditorError( /observable-bind-to-no-callback/ );
+				} ).to.throw( CKEditorError, /observable-bind-to-no-callback/ );
 			} );
 
 			it( 'should throw when binding multiple attributes but passed a callback', () => {
@@ -275,13 +276,13 @@ describe( 'Observable', () => {
 
 				expect( () => {
 					vehicle.bind( 'color', 'year' ).to( car, () => {} );
-				} ).to.throwCKEditorError( /observable-bind-to-extra-callback/ );
+				} ).to.throw( CKEditorError, /observable-bind-to-extra-callback/ );
 
 				expect( () => {
 					vehicle = new Car();
 
 					vehicle.bind( 'color', 'year' ).to( car, car, () => {} );
-				} ).to.throwCKEditorError( /observable-bind-to-extra-callback/ );
+				} ).to.throw( CKEditorError, /observable-bind-to-extra-callback/ );
 			} );
 
 			it( 'should throw when binding a single attribute but multiple callbacks', () => {
@@ -289,13 +290,13 @@ describe( 'Observable', () => {
 
 				expect( () => {
 					vehicle.bind( 'color' ).to( car, () => {}, () => {} );
-				} ).to.throwCKEditorError( /observable-bind-to-parse-error/ );
+				} ).to.throw( CKEditorError, /observable-bind-to-parse-error/ );
 
 				expect( () => {
 					vehicle = new Car();
 
 					vehicle.bind( 'color' ).to( car, car, () => {}, () => {} );
-				} ).to.throwCKEditorError( /observable-bind-to-parse-error/ );
+				} ).to.throw( CKEditorError, /observable-bind-to-parse-error/ );
 			} );
 
 			it( 'should throw when a number of attributes does not match', () => {
@@ -303,25 +304,25 @@ describe( 'Observable', () => {
 
 				expect( () => {
 					vehicle.bind( 'color' ).to( car, 'color', 'year' );
-				} ).to.throwCKEditorError( /observable-bind-to-attrs-length/ );
+				} ).to.throw( CKEditorError, /observable-bind-to-attrs-length/ );
 
 				expect( () => {
 					vehicle = new Car();
 
 					vehicle.bind( 'color', 'year' ).to( car, 'color' );
-				} ).to.throwCKEditorError( /observable-bind-to-attrs-length/ );
+				} ).to.throw( CKEditorError, /observable-bind-to-attrs-length/ );
 
 				expect( () => {
 					vehicle = new Car();
 
 					vehicle.bind( 'color' ).to( car, 'color', 'year', () => {} );
-				} ).to.throwCKEditorError( /observable-bind-to-attrs-length/ );
+				} ).to.throw( CKEditorError, /observable-bind-to-attrs-length/ );
 
 				expect( () => {
 					vehicle = new Car();
 
 					vehicle.bind( 'color' ).to( car, 'color', car, 'color', 'year', () => {} );
-				} ).to.throwCKEditorError( /observable-bind-to-attrs-length/ );
+				} ).to.throw( CKEditorError, /observable-bind-to-attrs-length/ );
 			} );
 
 			it( 'should work when attributes don\'t exist in to() observable #1', () => {
@@ -738,7 +739,7 @@ describe( 'Observable', () => {
 		it( 'should throw when non-string attribute is passed', () => {
 			expect( () => {
 				car.unbind( new Date() );
-			} ).to.throwCKEditorError( /observable-unbind-wrong-attrs/ );
+			} ).to.throw( CKEditorError, /observable-unbind-wrong-attrs/ );
 		} );
 
 		it( 'should remove all bindings', () => {