Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Align code to introduced error context #39

Merged
merged 2 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/decouplededitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ export default class DecoupledEditor extends Editor {

if ( isHTMLElement && sourceElementOrData.tagName === 'TEXTAREA' ) {
// Documented in core/editor/editor.js
throw new CKEditorError( 'editor-wrong-element: This type of editor cannot be initialized inside <textarea> element.' );
throw new CKEditorError(
'editor-wrong-element: This type of editor cannot be initialized inside <textarea> element.', null );
}

const editor = new this( sourceElementOrData, config );
Expand All @@ -233,7 +234,8 @@ export default class DecoupledEditor extends Editor {
// Documented in core/editor/editorconfig.jdoc.
throw new CKEditorError(
'editor-create-initial-data: ' +
'The config.initialData option cannot be used together with initial data passed in Editor.create().'
'The config.initialData option cannot be used together with initial data passed in Editor.create().',
null
);
}

Expand Down
13 changes: 9 additions & 4 deletions tests/decouplededitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import log from '@ckeditor/ckeditor5-utils/src/log';

import { describeMemoryUsage, testMemoryUsage } from '@ckeditor/ckeditor5-core/tests/_utils/memory';
import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
import { assertCKEditorError } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';

const editorData = '<p><strong>foo</strong> bar</p>';

Expand Down Expand Up @@ -135,9 +136,11 @@ describe( 'DecoupledEditor', () => {
expect.fail( 'Decoupled editor should throw an error when both initial data are passed' );
},
err => {
expect( err ).to.be.an( 'error' ).with.property( 'message' ).and
assertCKEditorError( err,
// eslint-disable-next-line max-len
.match( /^editor-create-initial-data: The config\.initialData option cannot be used together with initial data passed in Editor\.create\(\)\./ );
/^editor-create-initial-data: The config\.initialData option cannot be used together with initial data passed in Editor\.create\(\)\./,
null
);
}
)
.then( done )
Expand All @@ -151,8 +154,10 @@ describe( 'DecoupledEditor', () => {
expect.fail( 'Decoupled editor should throw an error when is initialized in textarea.' );
},
err => {
expect( err ).to.be.an( 'error' ).with.property( 'message' ).and
.match( /^editor-wrong-element: This type of editor cannot be initialized inside <textarea> element\./ );
assertCKEditorError( err,
/^editor-wrong-element: This type of editor cannot be initialized inside <textarea> element\./,
null
);
}
)
.then( done )
Expand Down
4 changes: 2 additions & 2 deletions tests/decouplededitorui.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import DecoupledEditorUIView from '../src/decouplededitoruiview';

import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
import utils from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
import { assertBinding } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
import { isElement } from 'lodash-es';

describe( 'DecoupledEditorUI', () => {
Expand Down Expand Up @@ -67,7 +67,7 @@ describe( 'DecoupledEditorUI', () => {
} );

it( 'binds view.editable#isFocused', () => {
utils.assertBinding(
assertBinding(
view.editable,
{ isFocused: false },
[
Expand Down