浏览代码

Clarified assertion errors.

Piotrek Koszuliński 9 年之前
父节点
当前提交
4d42b4b1ec
共有 1 个文件被更改,包括 7 次插入7 次删除
  1. 7 7
      dev/bender/plugins/ckeditor5/static/extensions.js

+ 7 - 7
dev/bender/plugins/ckeditor5/static/extensions.js

@@ -21,7 +21,7 @@
 		return load( context, moduleId, url );
 	};
 
-	// Extend ChaiJS with custom exception check.
+	// Extend ChaiJS with custom exception check `expect().to.throwCKEditorError( [ msg ] )`.
 	require( [ '/ckeditor5/utils/ckeditorerror.js', 'chai' ], function( CKEditorError, chai ) {
 		CKEditorError = CKEditorError.default;
 
@@ -129,8 +129,8 @@
 				if ( ( message !== null && message !== undefined ) && errMsg && errMsg instanceof RegExp ) {
 					this.assert(
 						errMsg.exec( message ),
-						'expected #{this} to throw error matching #{exp} but got #{act}',
-						'expected #{this} to throw error not matching #{exp}',
+						'expected #{this} to throw CKEditorError matching #{exp} but got #{act}',
+						'expected #{this} to throw CKEditorError not matching #{exp}',
 						errMsg,
 						message
 					);
@@ -141,8 +141,8 @@
 				} else if ( ( message !== null && message !== undefined ) && errMsg && typeof errMsg == 'string' ) {
 					this.assert(
 						message.indexOf( errMsg ) !== -1,
-						'expected #{this} to throw error including #{exp} but got #{act}',
-						'expected #{this} to throw error not including #{act}',
+						'expected #{this} to throw CKEditorError including #{exp} but got #{act}',
+						'expected #{this} to throw CKEditorError not including #{act}',
 						errMsg,
 						message
 					);
@@ -162,8 +162,8 @@
 
 			this.assert(
 				thrown === true,
-					'expected #{this} to throw an error' + actuallyGot,
-					'expected #{this} to not throw an error' + actuallyGot,
+					'expected #{this} to throw an CKEditorError' + actuallyGot,
+					'expected #{this} to not throw an CKEditorError' + actuallyGot,
 					'CKEditorError',
 					( thrownError instanceof Error ? thrownError.toString() : thrownError )
 			);