Przeglądaj źródła

Internal: Added unit test case for subsequent adding items with the same group names.

Marek Lewandowski 6 lat temu
rodzic
commit
d309ab806d

+ 0 - 1
packages/ckeditor5-special-characters/src/specialcharacters.js

@@ -103,7 +103,6 @@ export default class SpecialCharacters extends Plugin {
 	 * @param {String} groupName A name of group to create.
 	 */
 	_getGroup( groupName ) {
-		/* istanbul ignore else */
 		if ( !this._groups.has( groupName ) ) {
 			this._groups.set( groupName, new Set() );
 		}

+ 17 - 0
packages/ckeditor5-special-characters/tests/specialcharacters.js

@@ -54,6 +54,23 @@ describe( 'SpecialCharacters', () => {
 		} );
 	} );
 
+	describe( 'addItems()', () => {
+		it( 'works with subsequent calls to the same group', () => {
+			plugin.addItems( 'Mathematical', [ {
+				title: 'dot',
+				character: '.'
+			} ] );
+
+			plugin.addItems( 'Mathematical', [ {
+				title: ',',
+				character: 'comma'
+			} ] );
+
+			const groups = [ ...plugin.getGroups() ];
+			expect( groups ).to.deep.equal( [ 'Mathematical' ] );
+		} );
+	} );
+
 	describe( 'getCharactersForGroup()', () => {
 		it( 'returns a collection of defined special characters names', () => {
 			plugin.addItems( 'Mathematical', [