|
|
@@ -3,6 +3,8 @@
|
|
|
* For licensing, see LICENSE.md.
|
|
|
*/
|
|
|
|
|
|
+/* globals document */
|
|
|
+
|
|
|
'use strict';
|
|
|
|
|
|
var modules = bender.amd.require( 'ckeditorerror' );
|
|
|
@@ -36,7 +38,26 @@ describe( 'CKEditorError', function() {
|
|
|
var data = { bar: 1 };
|
|
|
var error = new CKEditorError( 'foo', data );
|
|
|
|
|
|
- expect( error ).to.have.property( 'message', 'foo' );
|
|
|
+ expect( error ).to.have.property( 'message', 'foo {"bar":1}' );
|
|
|
+ expect( error ).to.have.property( 'data', data );
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'appends stringified data to the message', function() {
|
|
|
+ class Foo {
|
|
|
+ constructor() {
|
|
|
+ this.x = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var CKEditorError = modules.ckeditorerror;
|
|
|
+ var data = {
|
|
|
+ bar: 'a',
|
|
|
+ bom: new Foo(),
|
|
|
+ bim: document.body
|
|
|
+ };
|
|
|
+ var error = new CKEditorError( 'foo', data );
|
|
|
+
|
|
|
+ expect( error ).to.have.property( 'message', 'foo {"bar":"a","bom":{"x":1},"bim":{}}' );
|
|
|
expect( error ).to.have.property( 'data', data );
|
|
|
} );
|
|
|
-} );
|
|
|
+} );
|