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

Commit

Permalink
Merge pull request #290 from ckeditor/t/289
Browse files Browse the repository at this point in the history
Fix: The `Template` class should not throw an error when a child view in the definition has an `id` attribute set without a value. Closes #289.
  • Loading branch information
oleq committed Aug 23, 2017
2 parents 7d01939 + 8b0a5b7 commit d7072ba
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
import mix from '@ckeditor/ckeditor5-utils/src/mix';
import EmitterMixin from '@ckeditor/ckeditor5-utils/src/emittermixin';
import Collection from '@ckeditor/ckeditor5-utils/src/collection';
import View from './view';
import ViewCollection from './viewcollection';
import cloneDeepWith from '@ckeditor/ckeditor5-utils/src/lib/lodash/cloneDeepWith';
Expand Down Expand Up @@ -1081,7 +1080,7 @@ function normalize( def ) {
normalizeAttributes( def.attributes );
}

const children = new Collection();
const children = new ViewCollection();

if ( def.children ) {
if ( isViewCollection( def.children ) ) {
Expand Down
18 changes: 18 additions & 0 deletions tests/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,24 @@ describe( 'Template', () => {
'<p><a></a><b></b><i>foo</i></p>'
);
} );

// https://github.com/ckeditor/ckeditor5-ui/issues/289
it( 'does not throw when child does not have an "id" property', () => {
const strongView = getView( {
tag: 'strong'
} );

strongView.set( 'id' );

expect( () => {
getView( {
tag: 'div',
children: [
strongView
]
} );
} ).to.not.throw();
} );
} );

describe( 'bindings', () => {
Expand Down

0 comments on commit d7072ba

Please sign in to comment.