8
0
Quellcode durchsuchen

Fix error messages tests assertions.

Maciej Gołaszewski vor 5 Jahren
Ursprung
Commit
1a3b72a794
34 geänderte Dateien mit 102 neuen und 130 gelöschten Zeilen
  1. 1 1
      packages/ckeditor5-ckfinder/tests/ckfindercommand.js
  2. 1 1
      packages/ckeditor5-core/tests/_utils-tests/classictesteditor.js
  3. 1 1
      packages/ckeditor5-core/tests/commandcollection.js
  4. 3 3
      packages/ckeditor5-core/tests/context.js
  5. 2 2
      packages/ckeditor5-core/tests/editor/editor.js
  6. 9 9
      packages/ckeditor5-core/tests/plugincollection.js
  7. 3 12
      packages/ckeditor5-editor-balloon/tests/ballooneditor.js
  8. 3 10
      packages/ckeditor5-editor-decoupled/tests/decouplededitor.js
  9. 3 12
      packages/ckeditor5-editor-inline/tests/inlineeditor.js
  10. 6 6
      packages/ckeditor5-engine/tests/controller/datacontroller.js
  11. 1 1
      packages/ckeditor5-engine/tests/dev-utils/operationreplayer.js
  12. 2 2
      packages/ckeditor5-engine/tests/model/document.js
  13. 2 2
      packages/ckeditor5-engine/tests/model/markercollection.js
  14. 1 1
      packages/ckeditor5-engine/tests/model/nodelist.js
  15. 11 11
      packages/ckeditor5-engine/tests/model/position.js
  16. 6 6
      packages/ckeditor5-engine/tests/model/schema.js
  17. 5 5
      packages/ckeditor5-engine/tests/model/selection.js
  18. 8 8
      packages/ckeditor5-engine/tests/model/writer.js
  19. 5 5
      packages/ckeditor5-engine/tests/view/documentselection.js
  20. 3 3
      packages/ckeditor5-engine/tests/view/emptyelement.js
  21. 1 1
      packages/ckeditor5-engine/tests/view/position.js
  22. 3 3
      packages/ckeditor5-engine/tests/view/rawelement.js
  23. 5 5
      packages/ckeditor5-engine/tests/view/selection.js
  24. 3 3
      packages/ckeditor5-engine/tests/view/uielement.js
  25. 1 4
      packages/ckeditor5-image/tests/imageresize/imageresizebuttons.js
  26. 1 1
      packages/ckeditor5-image/tests/imagetoolbar.js
  27. 1 1
      packages/ckeditor5-ui/tests/view.js
  28. 2 2
      packages/ckeditor5-upload/tests/filerepository.js
  29. 1 1
      packages/ckeditor5-utils/tests/emittermixin.js
  30. 1 1
      packages/ckeditor5-utils/tests/focustracker.js
  31. 2 2
      packages/ckeditor5-utils/tests/keyboard.js
  32. 2 2
      packages/ckeditor5-utils/tests/locale.js
  33. 1 1
      packages/ckeditor5-utils/tests/observablemixin.js
  34. 2 2
      packages/ckeditor5-watchdog/tests/editorwatchdog.js

+ 1 - 1
packages/ckeditor5-ckfinder/tests/ckfindercommand.js

@@ -178,7 +178,7 @@ describe( 'CKFinderCommand', () => {
 
 			expectToThrowCKEditorError( () => {
 				command.execute();
-			}, /ckfinder-unknown-openerMethod/, editor );
+			}, 'ckfinder-unknown-openermethod', editor );
 		} );
 
 		it( 'should insert single chosen image', () => {

+ 1 - 1
packages/ckeditor5-core/tests/_utils-tests/classictesteditor.js

@@ -232,7 +232,7 @@ describe( 'ClassicTestEditor', () => {
 				.then( () => {
 					throw new Error( 'It should throw an error' );
 				}, err => {
-					assertCKEditorError( err, /^editor-create-initial-data:/, null );
+					assertCKEditorError( err, 'editor-create-initial-data', null );
 					removeEditorBodyOrphans();
 				} );
 		} );

+ 1 - 1
packages/ckeditor5-core/tests/commandcollection.js

@@ -75,7 +75,7 @@ describe( 'CommandCollection', () => {
 
 			expectToThrowCKEditorError( () => {
 				collection.execute( 'foo' );
-			}, /^commandcollection-command-not-found:/, editor );
+			}, 'commandcollection-command-not-found', editor );
 		} );
 	} );
 

+ 3 - 3
packages/ckeditor5-core/tests/context.js

@@ -113,7 +113,7 @@ describe( 'Context', () => {
 
 			expect( caughtError ).to.instanceof( CKEditorError );
 			expect( caughtError.message )
-				.match( /^context-initplugins-invalid-plugin:/ );
+				.match( /^context-initplugins-invalid-plugin/ );
 		} );
 
 		it( 'should throw when plugin added to the context is not marked as a ContextPlugin (Function)', async () => {
@@ -129,7 +129,7 @@ describe( 'Context', () => {
 
 			expect( caughtError ).to.instanceof( CKEditorError );
 			expect( caughtError.message )
-				.match( /^context-initplugins-invalid-plugin:/ );
+				.match( /^context-initplugins-invalid-plugin/ );
 		} );
 
 		it( 'should throw when plugin is added to the context by name', async () => {
@@ -143,7 +143,7 @@ describe( 'Context', () => {
 
 			expect( caughtError ).to.instanceof( CKEditorError );
 			expect( caughtError.message )
-				.match( /^context-initplugins-constructor-only:/ );
+				.match( /^context-initplugins-constructor-only/ );
 		} );
 
 		it( 'should not throw when plugin as a function, marked as a ContextPlugin is added to the context', async () => {

+ 2 - 2
packages/ckeditor5-core/tests/editor/editor.js

@@ -201,7 +201,7 @@ describe( 'Editor', () => {
 			expectToThrowCKEditorError( () => {
 				// eslint-disable-next-line no-new
 				new TestEditor( { context: editor._context } );
-			}, /^context-addEditor-private-context/ );
+			}, 'context-addeditor-private-context' );
 		} );
 
 		it( 'should destroy context created by the editor at the end of the editor destroy chain', async () => {
@@ -510,7 +510,7 @@ describe( 'Editor', () => {
 
 			expectToThrowCKEditorError( () => {
 				editor.execute( 'command' );
-			}, /^commandcollection-command-not-found:/, editor );
+			}, /^commandcollection-command-not-found/, editor );
 		} );
 
 		it( 'should rethrow native errors as they are in the debug=true mode', () => {

+ 9 - 9
packages/ckeditor5-core/tests/plugincollection.js

@@ -255,7 +255,7 @@ describe( 'PluginCollection', () => {
 					expect( err ).to.have.property( 'message', 'Some error inside a plugin' );
 
 					sinon.assert.calledOnce( consoleErrorStub );
-					expect( consoleErrorStub.args[ 0 ][ 0 ] ).to.match( /^plugincollection-load:/ );
+					expect( consoleErrorStub.args[ 0 ][ 0 ] ).to.match( /^plugincollection-load/ );
 				} );
 		} );
 
@@ -270,10 +270,10 @@ describe( 'PluginCollection', () => {
 					throw new Error( 'Test error: this promise should not be resolved successfully' );
 				} )
 				.catch( err => {
-					assertCKEditorError( err, /^plugincollection-plugin-not-found/, editor );
+					assertCKEditorError( err, 'plugincollection-plugin-not-found', editor );
 
 					sinon.assert.calledOnce( consoleErrorStub );
-					expect( consoleErrorStub.args[ 0 ][ 0 ] ).to.match( /^plugincollection-plugin-not-found:/ );
+					expect( consoleErrorStub.args[ 0 ][ 0 ] ).to.match( /^plugincollection-plugin-not-found/ );
 				} );
 		} );
 
@@ -409,7 +409,7 @@ describe( 'PluginCollection', () => {
 					throw new Error( 'The `init()` method should fail.' );
 				} )
 				.catch( err => {
-					assertCKEditorError( err, /^plugincollection-plugin-name-conflict:/, null, {
+					assertCKEditorError( err, /^plugincollection-plugin-name-conflict/, null, {
 						pluginName: 'Foo',
 						plugin1: PluginFoo,
 						plugin2: AnotherPluginFoo
@@ -429,7 +429,7 @@ describe( 'PluginCollection', () => {
 					throw new Error( 'The `init()` method should fail.' );
 				} )
 				.catch( err => {
-					assertCKEditorError( err, /^plugincollection-plugin-name-conflict:/, null );
+					assertCKEditorError( err, /^plugincollection-plugin-name-conflict/, null );
 
 					sinon.assert.calledOnce( consoleErrorStub );
 				} );
@@ -447,7 +447,7 @@ describe( 'PluginCollection', () => {
 					throw new Error( 'The `init()` method should fail.' );
 				} )
 				.catch( err => {
-					assertCKEditorError( err, /^plugincollection-plugin-name-conflict:/, null );
+					assertCKEditorError( err, /^plugincollection-plugin-name-conflict/, null );
 					sinon.assert.calledOnce( consoleErrorStub );
 				} );
 		} );
@@ -521,7 +521,7 @@ describe( 'PluginCollection', () => {
 
 			return plugins.init( [] ).then( () => {
 				expectToThrowCKEditorError( () => plugins.get( 'foo' ),
-					/^plugincollection-plugin-not-loaded:/, editor, { plugin: 'foo' }
+					/^plugincollection-plugin-not-loaded/, editor, { plugin: 'foo' }
 				);
 			} );
 		} );
@@ -534,7 +534,7 @@ describe( 'PluginCollection', () => {
 
 			return plugins.init( [] ).then( () => {
 				expectToThrowCKEditorError( () => plugins.get( SomePlugin ),
-					/^plugincollection-plugin-not-loaded:/, editor, { plugin: 'foo' } );
+					/^plugincollection-plugin-not-loaded/, editor, { plugin: 'foo' } );
 			} );
 		} );
 
@@ -545,7 +545,7 @@ describe( 'PluginCollection', () => {
 
 			return plugins.init( [] ).then( () => {
 				expectToThrowCKEditorError( () => plugins.get( SomePlugin ),
-					/^plugincollection-plugin-not-loaded:/,
+					/^plugincollection-plugin-not-loaded/,
 					editor, { plugin: 'SomePlugin' }
 				);
 			} );

+ 3 - 12
packages/ckeditor5-editor-balloon/tests/ballooneditor.js

@@ -96,9 +96,7 @@ describe( 'BalloonEditor', () => {
 						expect.fail( 'Balloon editor should not initialize on an element already used by other instance.' );
 					},
 					err => {
-						assertCKEditorError( err,
-							/^editor-source-element-already-used/
-						);
+						assertCKEditorError( err, 'editor-source-element-already-used' );
 					}
 				)
 				.then( done )
@@ -199,11 +197,7 @@ describe( 'BalloonEditor', () => {
 						expect.fail( 'Balloon editor should throw an error when both initial data are passed' );
 					},
 					err => {
-						assertCKEditorError( err,
-							// eslint-disable-next-line max-len
-							/^editor-create-initial-data: The config\.initialData option cannot be used together with initial data passed in Editor\.create\(\)\./,
-							null
-						);
+						assertCKEditorError( err, 'editor-create-initial-data', null );
 					}
 				)
 				.then( () => {
@@ -247,10 +241,7 @@ describe( 'BalloonEditor', () => {
 						expect.fail( 'Balloon editor should throw an error when is initialized in textarea.' );
 					},
 					err => {
-						assertCKEditorError( err,
-							/^editor-wrong-element: This type of editor cannot be initialized inside <textarea> element\./,
-							null
-						);
+						assertCKEditorError( err, 'editor-wrong-element', null );
 					}
 				)
 				.then( done )

+ 3 - 10
packages/ckeditor5-editor-decoupled/tests/decouplededitor.js

@@ -163,7 +163,7 @@ describe( 'DecoupledEditor', () => {
 						expect.fail( 'Decoupled editor should not initialize on an element already used by other instance.' );
 					},
 					err => {
-						assertCKEditorError( err, /^editor-source-element-already-used/ );
+						assertCKEditorError( err, 'editor-source-element-already-used' );
 					}
 				)
 				.then( done )
@@ -180,11 +180,7 @@ describe( 'DecoupledEditor', () => {
 						expect.fail( 'Decoupled editor should throw an error when both initial data are passed' );
 					},
 					err => {
-						assertCKEditorError( err,
-							// eslint-disable-next-line max-len
-							/^editor-create-initial-data: The config\.initialData option cannot be used together with initial data passed in Editor\.create\(\)\./,
-							null
-						);
+						assertCKEditorError( err, 'editor-create-initial-data' );
 					}
 				)
 				.then( () => {
@@ -201,10 +197,7 @@ describe( 'DecoupledEditor', () => {
 						expect.fail( 'Decoupled editor should throw an error when is initialized in textarea.' );
 					},
 					err => {
-						assertCKEditorError( err,
-							/^editor-wrong-element: This type of editor cannot be initialized inside <textarea> element\./,
-							null
-						);
+						assertCKEditorError( err, 'editor-wrong-element', null );
 					}
 				)
 				.then( done )

+ 3 - 12
packages/ckeditor5-editor-inline/tests/inlineeditor.js

@@ -97,9 +97,7 @@ describe( 'InlineEditor', () => {
 						expect.fail( 'Inline editor should not initialize on an element already used by other instance.' );
 					},
 					err => {
-						assertCKEditorError( err,
-							/^editor-source-element-already-used/
-						);
+						assertCKEditorError( err, 'editor-source-element-already-used' );
 					}
 				)
 				.then( done )
@@ -209,11 +207,7 @@ describe( 'InlineEditor', () => {
 						expect.fail( 'Inline editor should throw an error when both initial data are passed' );
 					},
 					err => {
-						assertCKEditorError( err,
-							/* eslint-disable-next-line max-len */
-							/^editor-create-initial-data: The config\.initialData option cannot be used together with initial data passed in Editor\.create\(\)\./,
-							null
-						);
+						assertCKEditorError( err, 'editor-create-initial-data', null );
 					}
 				)
 				.then( () => {
@@ -257,10 +251,7 @@ describe( 'InlineEditor', () => {
 						expect.fail( 'Inline editor should throw an error when is initialized in textarea.' );
 					},
 					err => {
-						assertCKEditorError( err,
-							/^editor-wrong-element: This type of editor cannot be initialized inside <textarea> element\./,
-							null
-						);
+						assertCKEditorError( err, 'editor-wrong-element', null );
 					}
 				)
 				.then( done )

+ 6 - 6
packages/ckeditor5-engine/tests/controller/datacontroller.js

@@ -189,7 +189,7 @@ describe( 'DataController', () => {
 
 			expectToThrowCKEditorError( () => {
 				data.init( '<p>Bar</p>' );
-			}, /datacontroller-init-document-not-empty:/, model );
+			}, /datacontroller-init-document-not-empty/, model );
 		} );
 
 		it( 'should set data to default main root', () => {
@@ -243,7 +243,7 @@ describe( 'DataController', () => {
 		it( 'should throw an error when non-existent root is used (single)', () => {
 			expectToThrowCKEditorError( () => {
 				data.init( { nonexistent: '<p>Bar</p>' } );
-			}, /^datacontroller-init-non-existent-root:/ );
+			}, 'datacontroller-init-non-existent-root' );
 		} );
 
 		it( 'should throw an error when non-existent root is used (one of many)', () => {
@@ -251,7 +251,7 @@ describe( 'DataController', () => {
 
 			expectToThrowCKEditorError( () => {
 				data.init( { main: 'bar', nonexistent: '<p>Bar</p>' } );
-			}, /^datacontroller-init-non-existent-root:/, model );
+			}, /^datacontroller-init-non-existent-root/, model );
 
 			expect( getData( model, { withoutSelection: true } ) ).to.equal( '' );
 		} );
@@ -332,7 +332,7 @@ describe( 'DataController', () => {
 		it( 'should throw an error when non-existent root is used (single)', () => {
 			expectToThrowCKEditorError( () => {
 				data.set( { nonexistent: '<p>Bar</p>' } );
-			}, /datacontroller-set-non-existent-root:/, model );
+			}, /datacontroller-set-non-existent-root/, model );
 		} );
 
 		it( 'should throw an error when non-existent root is used (one of many) without touching any roots data', () => {
@@ -341,7 +341,7 @@ describe( 'DataController', () => {
 
 			expectToThrowCKEditorError( () => {
 				data.set( { main: 'bar', nonexistent: '<p>Bar</p>' } );
-			}, /datacontroller-set-non-existent-root:/, model );
+			}, /datacontroller-set-non-existent-root/, model );
 
 			expect( getData( model, { withoutSelection: true } ) ).to.equal( 'foo' );
 		} );
@@ -452,7 +452,7 @@ describe( 'DataController', () => {
 		it( 'should throw an error when non-existent root is used', () => {
 			expectToThrowCKEditorError( () => {
 				data.get( { rootName: 'nonexistent' } );
-			}, /datacontroller-get-non-existent-root:/ );
+			}, 'datacontroller-get-non-existent-root' );
 		} );
 
 		it( 'should allow to provide additional options for retrieving data - insert conversion', () => {

+ 1 - 1
packages/ckeditor5-engine/tests/dev-utils/operationreplayer.js

@@ -148,7 +148,7 @@ describe( 'OperationReplayer', () => {
 				.then( () => {
 					throw new Error( 'It should throw an error' );
 				}, err => {
-					expect( err.message ).to.match( /^model-document-applyOperation-wrong-version/ );
+					expect( err.message ).to.match( /model-document-applyoperation-wrong-version/ );
 				} );
 		} );
 	} );

+ 2 - 2
packages/ckeditor5-engine/tests/model/document.js

@@ -87,7 +87,7 @@ describe( 'Document', () => {
 
 			expectToThrowCKEditorError( () => {
 				model.applyOperation( operation );
-			}, /^model-document-applyOperation-wrong-version/, model );
+			}, 'model-document-applyoperation-wrong-version', model );
 		} );
 	} );
 
@@ -130,7 +130,7 @@ describe( 'Document', () => {
 
 			expectToThrowCKEditorError( () => {
 				doc.createRoot( '$root', 'rootName' );
-			}, /model-document-createRoot-name-exists/, model );
+			}, 'model-document-createroot-name-exists', model );
 		} );
 	} );
 

+ 2 - 2
packages/ckeditor5-engine/tests/model/markercollection.js

@@ -127,7 +127,7 @@ describe( 'MarkerCollection', () => {
 		it( 'should throw if marker name with "," is added', () => {
 			expectToThrowCKEditorError( () => {
 				markers._set( 'foo,bar', range );
-			}, /^markercollection-incorrect-marker-name:/, markers );
+			}, 'markercollection-incorrect-marker-name', markers );
 		} );
 	} );
 
@@ -215,7 +215,7 @@ describe( 'MarkerCollection', () => {
 		it( 'should throw if marker does not exist', () => {
 			expectToThrowCKEditorError( () => {
 				markers._refresh( 'name' );
-			}, /^markercollection-refresh-marker-not-exists:/, markers );
+			}, 'markercollection-refresh-marker-not-exists', markers );
 		} );
 	} );
 

+ 1 - 1
packages/ckeditor5-engine/tests/model/nodelist.js

@@ -160,7 +160,7 @@ describe( 'NodeList', () => {
 		it( 'should throw if not a Node is inserted', () => {
 			expectToThrowCKEditorError( () => {
 				nodes._insertNodes( 0, [ 'foo' ] );
-			}, /nodelist-insertNodes-not-node/, nodes );
+			}, 'nodelist-insertnodes-not-node', nodes );
 		} );
 	} );
 

+ 11 - 11
packages/ckeditor5-engine/tests/model/position.js

@@ -158,7 +158,7 @@ describe( 'Position', () => {
 			it( 'should throw if no offset is passed', () => {
 				expectToThrowCKEditorError( () => {
 					Position._createAt( ul );
-				}, /model-createPositionAt-offset-required/, model );
+				}, 'model-createpositionat-offset-required', model );
 			} );
 
 			it( 'should create positions from positions', () => {
@@ -321,7 +321,7 @@ describe( 'Position', () => {
 
 			expectToThrowCKEditorError( () => {
 				position.parent;
-			}, /^model-position-path-incorrect:/, position, { position } );
+			}, 'model-position-path-incorrect', position, { position } );
 		} );
 
 		it( 'should throw when based on a path, the parent would be a text node', () => {
@@ -330,7 +330,7 @@ describe( 'Position', () => {
 
 			expectToThrowCKEditorError( () => {
 				position.parent;
-			}, /^model-position-path-incorrect:/, position, { position } );
+			}, 'model-position-path-incorrect', position, { position } );
 		} );
 	} );
 
@@ -388,7 +388,7 @@ describe( 'Position', () => {
 
 			expectToThrowCKEditorError( () => {
 				position.index;
-			}, /^model-position-path-incorrect:/, position, { position } );
+			}, 'model-position-path-incorrect', position, { position } );
 		} );
 	} );
 
@@ -419,7 +419,7 @@ describe( 'Position', () => {
 
 			expectToThrowCKEditorError( () => {
 				position.nodeBefore;
-			}, /^model-nodelist-offset-out-of-bounds:/, position );
+			}, 'model-nodelist-offset-out-of-bounds', position );
 		} );
 	} );
 
@@ -450,7 +450,7 @@ describe( 'Position', () => {
 
 			expectToThrowCKEditorError( () => {
 				position.nodeAfter;
-			}, /^model-nodelist-offset-out-of-bounds:/, position );
+			}, 'model-nodelist-offset-out-of-bounds', position );
 		} );
 	} );
 
@@ -486,7 +486,7 @@ describe( 'Position', () => {
 
 			expectToThrowCKEditorError( () => {
 				position.textNode;
-			}, /^model-nodelist-offset-out-of-bounds:/, position );
+			}, 'model-nodelist-offset-out-of-bounds', position );
 		} );
 	} );
 
@@ -1255,9 +1255,9 @@ describe( 'Position', () => {
 
 			root._appendChild( p );
 
-			const postion = new Position( root, [ 0, 3 ] ); // <p>foo^bar</p>
+			const position = new Position( root, [ 0, 3 ] ); // <p>foo^bar</p>
 
-			testAncestor( postion, postion, p );
+			testAncestor( position, position, p );
 		} );
 
 		it( 'for two positions in the same element returns the element', () => {
@@ -1284,9 +1284,9 @@ describe( 'Position', () => {
 
 			root._appendChild( p );
 
-			const postion = new Position( root, [ 0, 0 ] ); // <p>^<a></a></p>
+			const position = new Position( root, [ 0, 0 ] ); // <p>^<a></a></p>
 
-			testAncestor( postion, postion, p );
+			testAncestor( position, position, p );
 		} );
 
 		it( 'works fine with positions located in DocumentFragment', () => {

+ 6 - 6
packages/ckeditor5-engine/tests/model/schema.js

@@ -62,7 +62,7 @@ describe( 'Schema', () => {
 
 			expectToThrowCKEditorError( () => {
 				schema.register( 'foo' );
-			}, /^schema-cannot-register-item-twice:/, schema );
+			}, 'schema-cannot-register-item-twice', schema );
 		} );
 	} );
 
@@ -91,7 +91,7 @@ describe( 'Schema', () => {
 		it( 'throws when trying to extend a not yet registered item', () => {
 			expectToThrowCKEditorError( () => {
 				schema.extend( 'foo' );
-			}, /^schema-cannot-extend-missing-item:/, schema );
+			}, 'schema-cannot-extend-missing-item', schema );
 		} );
 	} );
 
@@ -960,7 +960,7 @@ describe( 'Schema', () => {
 
 			expectToThrowCKEditorError( () => {
 				expect( schema.checkMerge( position ) );
-			}, /^schema-check-merge-no-element-before:/, schema );
+			}, 'schema-check-merge-no-element-before', schema );
 		} );
 
 		it( 'throws an error if the node before the position is not the element', () => {
@@ -978,7 +978,7 @@ describe( 'Schema', () => {
 
 			expectToThrowCKEditorError( () => {
 				expect( schema.checkMerge( position ) );
-			}, /^schema-check-merge-no-element-before:/, schema );
+			}, 'schema-check-merge-no-element-before', schema );
 		} );
 
 		it( 'throws an error if there is no element after the position', () => {
@@ -995,7 +995,7 @@ describe( 'Schema', () => {
 
 			expectToThrowCKEditorError( () => {
 				expect( schema.checkMerge( position ) );
-			}, /^schema-check-merge-no-element-after:/, schema );
+			}, 'schema-check-merge-no-element-after', schema );
 		} );
 
 		it( 'throws an error if the node after the position is not the element', () => {
@@ -1013,7 +1013,7 @@ describe( 'Schema', () => {
 
 			expectToThrowCKEditorError( () => {
 				expect( schema.checkMerge( position ) );
-			}, /^schema-check-merge-no-element-before:/, schema );
+			}, 'schema-check-merge-no-element-before', schema );
 		} );
 
 		// This is an invalid case by definition – the baseElement should not contain disallowed elements

+ 5 - 5
packages/ckeditor5-engine/tests/model/selection.js

@@ -123,7 +123,7 @@ describe( 'Selection', () => {
 			expectToThrowCKEditorError( () => {
 				// eslint-disable-next-line no-new
 				new Selection( {} );
-			}, /model-selection-setTo-not-selectable/ );
+			}, 'model-selection-setto-not-selectable' );
 		} );
 	} );
 
@@ -307,13 +307,13 @@ describe( 'Selection', () => {
 		it( 'should throw an error when trying to set selection to not selectable', () => {
 			expectToThrowCKEditorError( () => {
 				selection.setTo( {} );
-			}, /model-selection-setTo-not-selectable/ );
+			}, 'model-selection-setto-not-selectable' );
 		} );
 
 		it( 'should throw an error when trying to set selection to not selectable #2', () => {
 			expectToThrowCKEditorError( () => {
 				selection.setTo();
-			}, /model-selection-setTo-not-selectable/ );
+			}, 'model-selection-setto-not-selectable' );
 		} );
 
 		it( 'should allow setting selection inside an element', () => {
@@ -379,7 +379,7 @@ describe( 'Selection', () => {
 			it( 'should throw if second parameter is not passed', () => {
 				expectToThrowCKEditorError( () => {
 					selection.setTo( root );
-				}, /model-selection-setTo-required-second-parameter/, model );
+				}, 'model-selection-setto-required-second-parameter', model );
 			} );
 
 			it( 'should set selection at given offset in given parent', () => {
@@ -465,7 +465,7 @@ describe( 'Selection', () => {
 
 			expectToThrowCKEditorError( () => {
 				selection.setFocus( endPos );
-			}, /model-selection-setFocus-no-ranges/, model );
+			}, 'model-selection-setfocus-no-ranges', model );
 		} );
 
 		it( 'modifies existing collapsed selection', () => {

+ 8 - 8
packages/ckeditor5-engine/tests/model/writer.js

@@ -2157,13 +2157,13 @@ describe( 'Writer', () => {
 		it( 'should throw if options.usingOperation is not defined', () => {
 			expectToThrowCKEditorError( () => {
 				addMarker( 'name' );
-			}, /^writer-addMarker-no-usingOperation/, model );
+			}, '^writer-addmarker-no-usingoperation', model );
 		} );
 
 		it( 'should throw if name and range is defined but options.usingOperation is not defined', () => {
 			expectToThrowCKEditorError( () => {
 				addMarker( 'name', { range } );
-			}, /^writer-addMarker-no-usingOperation/, model );
+			}, '^writer-addmarker-no-usingoperation', model );
 		} );
 
 		it( 'should add marker to the document marker collection', () => {
@@ -2215,7 +2215,7 @@ describe( 'Writer', () => {
 
 			expectToThrowCKEditorError( () => {
 				addMarker( 'name', { range: range2, usingOperation: false } );
-			}, /^writer-addMarker-marker-exists/, model );
+			}, 'writer-addmarker-marker-exists', model );
 		} );
 
 		it( 'should use operations when having set usingOperation to true', () => {
@@ -2235,13 +2235,13 @@ describe( 'Writer', () => {
 		it( 'should throw if marker with given name does not exist and range is not passed', () => {
 			expectToThrowCKEditorError( () => {
 				addMarker( 'name', { usingOperation: true } );
-			}, /^writer-addMarker-no-range/, model );
+			}, 'writer-addmarker-no-range', model );
 		} );
 
 		it( 'should throw if marker is set directly and range is not passed', () => {
 			expectToThrowCKEditorError( () => {
 				addMarker( 'name', { usingOperation: false } );
-			}, /^writer-addMarker-no-range/, model );
+			}, 'writer-addmarker-no-range', model );
 		} );
 
 		it( 'should throw when trying to use detached writer', () => {
@@ -2487,13 +2487,13 @@ describe( 'Writer', () => {
 			expectToThrowCKEditorError( () => {
 				addMarker( 'name', { range, usingOperation: false } );
 				updateMarker( 'name', {} );
-			}, /^writer-updateMarker-wrong-options/, model );
+			}, 'writer-updatemarker-wrong-options', model );
 		} );
 
 		it( 'should throw when marker provided by name does not exists', () => {
 			expectToThrowCKEditorError( () => {
 				updateMarker( 'name', { usingOperation: false } );
-			}, /^writer-updateMarker-marker-not-exists/, model );
+			}, 'writer-updatemarker-marker-not-exists', model );
 		} );
 
 		it( 'should only refresh the marker when there is no provided options to update', () => {
@@ -2540,7 +2540,7 @@ describe( 'Writer', () => {
 		it( 'should throw when trying to remove non existing marker', () => {
 			expectToThrowCKEditorError( () => {
 				removeMarker( 'name' );
-			}, /^writer-removeMarker-no-marker/, model );
+			}, 'writer-removemarker-no-marker', model );
 		} );
 
 		it( 'should throw when trying to use detached writer', () => {

+ 5 - 5
packages/ckeditor5-engine/tests/view/documentselection.js

@@ -125,7 +125,7 @@ describe( 'DocumentSelection', () => {
 			expectToThrowCKEditorError( () => {
 				// eslint-disable-next-line no-new
 				new DocumentSelection( {} );
-			}, /view-selection-setTo-not-selectable/ );
+			}, 'view-selection-setto-not-selectable' );
 		} );
 	} );
 
@@ -197,7 +197,7 @@ describe( 'DocumentSelection', () => {
 
 			expectToThrowCKEditorError( () => {
 				documentSelection._setFocus( endPos );
-			}, /view-selection-setFocus-no-ranges/, documentSelection );
+			}, 'view-selection-setfocus-no-ranges', documentSelection );
 		} );
 
 		it( 'modifies existing collapsed selection', () => {
@@ -802,7 +802,7 @@ describe( 'DocumentSelection', () => {
 
 				expectToThrowCKEditorError( () => {
 					otherSelection._setTo( {} );
-				}, /view-selection-setTo-not-selectable/ );
+				}, 'view-selection-setto-not-selectable' );
 			} );
 
 			it( 'should throw an error when trying to set to not selectable #2', () => {
@@ -810,7 +810,7 @@ describe( 'DocumentSelection', () => {
 
 				expectToThrowCKEditorError( () => {
 					otherSelection._setTo();
-				}, /view-selection-setTo-not-selectable/ );
+				}, 'view-selection-setto-not-selectable' );
 			} );
 		} );
 
@@ -854,7 +854,7 @@ describe( 'DocumentSelection', () => {
 
 				expectToThrowCKEditorError( () => {
 					documentSelection._setTo( foo );
-				}, /view-selection-setTo-required-second-parameter/, documentSelection );
+				}, 'view-selection-setto-required-second-parameter', documentSelection );
 			} );
 
 			it( 'should collapse selection at node and flag', () => {

+ 3 - 3
packages/ckeditor5-engine/tests/view/emptyelement.js

@@ -66,14 +66,14 @@ describe( 'EmptyElement', () => {
 
 		expectToThrowCKEditorError( () => {
 			new EmptyElement( document, 'img', null, [ el ] ); // eslint-disable-line no-new
-		}, 'view-emptyelement-cannot-add: Cannot add child nodes to EmptyElement instance.', el );
+		}, 'view-emptyelement-cannot-add', el );
 	} );
 
 	describe( '_appendChild', () => {
 		it( 'should throw when try to append new child element', () => {
 			expectToThrowCKEditorError( () => {
 				emptyElement._appendChild( element );
-			}, 'view-emptyelement-cannot-add: Cannot add child nodes to EmptyElement instance.', element );
+			}, 'view-emptyelement-cannot-add', element );
 		} );
 	} );
 
@@ -81,7 +81,7 @@ describe( 'EmptyElement', () => {
 		it( 'should throw when try to insert new child element', () => {
 			expectToThrowCKEditorError( () => {
 				emptyElement._insertChild( 0, element );
-			}, 'view-emptyelement-cannot-add: Cannot add child nodes to EmptyElement instance.', element );
+			}, 'view-emptyelement-cannot-add', element );
 		} );
 	} );
 

+ 1 - 1
packages/ckeditor5-engine/tests/view/position.js

@@ -417,7 +417,7 @@ describe( 'Position', () => {
 
 				expectToThrowCKEditorError( () => {
 					Position._createAt( element );
-				}, /view-createPositionAt-offset-required/ );
+				}, 'view-createpositionat-offset-required' );
 			} );
 
 			it( 'should create positions from positions', () => {

+ 3 - 3
packages/ckeditor5-engine/tests/view/rawelement.js

@@ -35,7 +35,7 @@ describe( 'RawElement', () => {
 		it( 'should throw if child elements are passed to constructor', () => {
 			expectToThrowCKEditorError( () => {
 				new RawElement( doc, 'img', null, [ new Element( doc, 'i' ) ] ); // eslint-disable-line no-new
-			}, 'view-rawelement-cannot-add: Cannot add child nodes to a RawElement instance.' );
+			}, 'view-rawelement-cannot-add' );
 		} );
 	} );
 
@@ -85,7 +85,7 @@ describe( 'RawElement', () => {
 		it( 'should throw when try to append new child element', () => {
 			expectToThrowCKEditorError( () => {
 				rawElement._appendChild( new Element( doc, 'i' ) );
-			}, 'view-rawelement-cannot-add: Cannot add child nodes to a RawElement instance.' );
+			}, 'view-rawelement-cannot-add' );
 		} );
 	} );
 
@@ -93,7 +93,7 @@ describe( 'RawElement', () => {
 		it( 'should throw when try to insert new child element', () => {
 			expectToThrowCKEditorError( () => {
 				rawElement._insertChild( 0, new Element( doc, 'i' ) );
-			}, 'view-rawelement-cannot-add: Cannot add child nodes to a RawElement instance.' );
+			}, 'view-rawelement-cannot-add' );
 		} );
 	} );
 

+ 5 - 5
packages/ckeditor5-engine/tests/view/selection.js

@@ -127,7 +127,7 @@ describe( 'Selection', () => {
 			expectToThrowCKEditorError( () => {
 				// eslint-disable-next-line no-new
 				new Selection( {} );
-			}, /view-selection-setTo-not-selectable/ );
+			}, 'view-selection-setto-not-selectable' );
 		} );
 	} );
 
@@ -199,7 +199,7 @@ describe( 'Selection', () => {
 
 			expectToThrowCKEditorError( () => {
 				selection.setFocus( endPos );
-			}, /view-selection-setFocus-no-ranges/ );
+			}, 'view-selection-setfocus-no-ranges' );
 		} );
 
 		it( 'modifies existing collapsed selection', () => {
@@ -678,7 +678,7 @@ describe( 'Selection', () => {
 
 				expectToThrowCKEditorError( () => {
 					otherSelection.setTo( {} );
-				}, /view-selection-setTo-not-selectable/ );
+				}, 'view-selection-setto-not-selectable' );
 			} );
 
 			it( 'should throw an error when trying to set to not selectable #2', () => {
@@ -686,7 +686,7 @@ describe( 'Selection', () => {
 
 				expectToThrowCKEditorError( () => {
 					otherSelection.setTo();
-				}, /view-selection-setTo-not-selectable/ );
+				}, 'view-selection-setto-not-selectable' );
 			} );
 		} );
 
@@ -730,7 +730,7 @@ describe( 'Selection', () => {
 
 				expectToThrowCKEditorError( () => {
 					selection.setTo( foo );
-				}, /view-selection-setTo-required-second-parameter/ );
+				}, 'view-selection-setto-required-second-parameter' );
 			} );
 
 			it( 'should collapse selection at node and flag', () => {

+ 3 - 3
packages/ckeditor5-engine/tests/view/uielement.js

@@ -37,7 +37,7 @@ describe( 'UIElement', () => {
 		it( 'should throw if child elements are passed to constructor', () => {
 			expectToThrowCKEditorError( () => {
 				new UIElement( doc, 'img', null, [ new Element( doc, 'i' ) ] ); // eslint-disable-line no-new
-			}, 'view-uielement-cannot-add: Cannot add child nodes to UIElement instance.' );
+			}, 'view-uielement-cannot-add' );
 		} );
 	} );
 
@@ -87,7 +87,7 @@ describe( 'UIElement', () => {
 		it( 'should throw when try to append new child element', () => {
 			expectToThrowCKEditorError( () => {
 				uiElement._appendChild( new Element( doc, 'i' ) );
-			}, 'view-uielement-cannot-add: Cannot add child nodes to UIElement instance.' );
+			}, 'view-uielement-cannot-add' );
 		} );
 	} );
 
@@ -95,7 +95,7 @@ describe( 'UIElement', () => {
 		it( 'should throw when try to insert new child element', () => {
 			expectToThrowCKEditorError( () => {
 				uiElement._insertChild( 0, new Element( doc, 'i' ) );
-			}, 'view-uielement-cannot-add: Cannot add child nodes to UIElement instance.' );
+			}, 'view-uielement-cannot-add' );
 		} );
 	} );
 

+ 1 - 4
packages/ckeditor5-image/tests/imageresize/imageresizebuttons.js

@@ -293,12 +293,9 @@ describe( 'ImageResizeButtons', () => {
 					}
 				} );
 
-			const errMsg = 'The resize option "imageResize:noicon" misses the "icon" property ' +
-				'or the property value doesn\'t match any of the available icons.';
-
 			expectToThrowCKEditorError( () => {
 				editor.ui.componentFactory.create( 'imageResize:noicon' );
-			}, errMsg, editor );
+			}, 'imageresizebuttons-missing-icon', editor );
 
 			editor.destroy();
 		} );

+ 1 - 1
packages/ckeditor5-image/tests/imagetoolbar.js

@@ -63,7 +63,7 @@ describe( 'ImageToolbar', () => {
 			.then( editor => {
 				expect( editor.plugins.get( ImageToolbar )._toolbar ).to.be.undefined;
 				expect( consoleWarnStub.calledOnce ).to.equal( true );
-				expect( consoleWarnStub.firstCall.args[ 0 ] ).to.match( /^widget-toolbar-no-items:/ );
+				expect( consoleWarnStub.firstCall.args[ 0 ] ).to.match( /widget-toolbar-no-items/ );
 
 				editorElement.remove();
 				return editor.destroy();

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

@@ -228,7 +228,7 @@ describe( 'View', () => {
 				throw new Error( 'This should not be executed.' );
 			} catch ( err ) {
 				// TODO
-				assertCKEditorError( err, /^ui-view-render-already-rendered:/, view );
+				assertCKEditorError( err, 'ui-view-render-already-rendered', view );
 			}
 		} );
 

+ 2 - 2
packages/ckeditor5-upload/tests/filerepository.js

@@ -484,7 +484,7 @@ describe( 'FileRepository', () => {
 
 				expect( () => {
 					loader.read();
-				} ).to.throw( 'filerepository-read-wrong-status: You cannot call read if the status is different than idle.' );
+				} ).to.throw( 'filerepository-read-wrong-status' );
 			} );
 
 			it( 'should return a promise', () => {
@@ -614,7 +614,7 @@ describe( 'FileRepository', () => {
 
 				expect( () => {
 					loader.upload();
-				} ).to.throw( 'filerepository-upload-wrong-status: You cannot call upload if the status is different than idle.' );
+				} ).to.throw( 'filerepository-upload-wrong-status' );
 			} );
 
 			it( 'should return a promise', () => {

+ 1 - 1
packages/ckeditor5-utils/tests/emittermixin.js

@@ -164,7 +164,7 @@ describe( 'EmitterMixin', () => {
 
 			expectToThrowCKEditorError( () => {
 				emitter.fire( 'test' );
-			}, /Foo/, null );
+			}, /foo/, null );
 		} );
 
 		it( 'should rethrow the native errors as they are in the dubug=true mode', () => {

+ 1 - 1
packages/ckeditor5-utils/tests/focustracker.js

@@ -68,7 +68,7 @@ describe( 'FocusTracker', () => {
 
 			expectToThrowCKEditorError( () => {
 				focusTracker.add( containerFirstInput );
-			}, /focusTracker-add-element-already-exist/, focusTracker );
+			}, 'focustracker-add-element-already-exist', focusTracker );
 		} );
 
 		describe( 'single element', () => {

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

@@ -65,7 +65,7 @@ describe( 'Keyboard', () => {
 		it( 'throws when passed unknown key name', () => {
 			expectToThrowCKEditorError( () => {
 				getCode( 'foo' );
-			}, /^keyboard-unknown-key:/, null );
+			}, 'keyboard-unknown-key', null );
 		} );
 
 		it( 'gets code of a keystroke info', () => {
@@ -106,7 +106,7 @@ describe( 'Keyboard', () => {
 		it( 'throws on unknown name', () => {
 			expectToThrowCKEditorError( () => {
 				parseKeystroke( 'foo' );
-			}, /^keyboard-unknown-key:/, null );
+			}, 'keyboard-unknown-key', null );
 		} );
 	} );
 

+ 2 - 2
packages/ckeditor5-utils/tests/locale.js

@@ -204,11 +204,11 @@ describe( 'Locale', () => {
 
 			expectToThrowCKEditorError( () => {
 				t( { string: 'Add space', plural: 'Add %0 spaces' }, 'space' );
-			}, /translation-service-quantity-not-a-number:/, null, { quantity: 'space' } );
+			}, 'translation-service-quantity-not-a-number', null, { quantity: 'space' } );
 
 			expectToThrowCKEditorError( () => {
 				t( { string: 'Add space', plural: 'Add %0 spaces' }, [ 'space' ] );
-			}, /translation-service-quantity-not-a-number:/, null, { quantity: 'space' } );
+			}, 'translation-service-quantity-not-a-number', null, { quantity: 'space' } );
 
 			expect( () => {
 				t( { string: 'Add space', plural: 'Add %0 spaces' }, [ 3 ] );

+ 1 - 1
packages/ckeditor5-utils/tests/observablemixin.js

@@ -1053,7 +1053,7 @@ describe( 'Observable', () => {
 
 			expectToThrowCKEditorError( () => {
 				foo.decorate( 'method' );
-			}, /^observablemixin-cannot-decorate-undefined:/ );
+			}, 'observablemixin-cannot-decorate-undefined' );
 		} );
 	} );
 } );

+ 2 - 2
packages/ckeditor5-watchdog/tests/editorwatchdog.js

@@ -810,7 +810,7 @@ describe( 'EditorWatchdog', () => {
 					setTimeout( () => {
 						window.onerror = originalErrorHandler;
 
-						expect( watchdog.crashes[ 0 ].message ).to.equal( 'foo' );
+						expect( watchdog.crashes[ 0 ].message ).to.match( /^foo/ );
 						expect( watchdog.crashes[ 0 ].stack ).to.be.a( 'string' );
 						expect( watchdog.crashes[ 0 ].date ).to.be.a( 'number' );
 						expect( watchdog.crashes[ 0 ].filename ).to.be.a( 'string' );
@@ -846,7 +846,7 @@ describe( 'EditorWatchdog', () => {
 						setTimeout( () => {
 							window.onerror = originalErrorHandler;
 
-							expect( watchdog.crashes[ 0 ].message ).to.equal( 'foo' );
+							expect( watchdog.crashes[ 0 ].message ).to.match( /^foo/ );
 							expect( watchdog.crashes[ 0 ].stack ).to.be.a( 'string' );
 							expect( watchdog.crashes[ 0 ].date ).to.be.a( 'number' );
 							expect( watchdog.crashes[ 0 ].filename ).to.be.an( 'undefined' );