This repository was archived by the owner on Jun 26, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,9 @@ export default class ComponentFactory {
6262 * @returns {Iterable.<String> }
6363 */
6464 * names ( ) {
65- yield * this . _components . keys ( ) ;
65+ for ( const value of this . _components . values ( ) ) {
66+ yield value . originalName ;
67+ }
6668 }
6769
6870 /**
@@ -87,7 +89,7 @@ export default class ComponentFactory {
8789 ) ;
8890 }
8991
90- this . _components . set ( getNormalized ( name ) , callback ) ;
92+ this . _components . set ( getNormalized ( name ) , { callback, originalName : name } ) ;
9193 }
9294
9395 /**
@@ -115,7 +117,7 @@ export default class ComponentFactory {
115117 ) ;
116118 }
117119
118- return this . _components . get ( getNormalized ( name ) ) ( this . editor . locale ) ;
120+ return this . _components . get ( getNormalized ( name ) ) . callback ( this . editor . locale ) ;
119121 }
120122
121123 /**
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ describe( 'ComponentFactory', () => {
3333 factory . add ( 'bar' , ( ) => { } ) ;
3434 factory . add ( 'Baz' , ( ) => { } ) ;
3535
36- expect ( Array . from ( factory . names ( ) ) ) . to . have . members ( [ 'foo' , 'bar' , 'baz ' ] ) ;
36+ expect ( Array . from ( factory . names ( ) ) ) . to . have . members ( [ 'foo' , 'bar' , 'Baz ' ] ) ;
3737 } ) ;
3838 } ) ;
3939
@@ -53,6 +53,12 @@ describe( 'ComponentFactory', () => {
5353 factory . add ( 'foo' , ( ) => { } ) ;
5454 } ) . to . throw ( CKEditorError , / ^ c o m p o n e n t f a c t o r y - i t e m - e x i s t s / ) ;
5555 } ) ;
56+
57+ it ( 'does not normalize component names' , ( ) => {
58+ factory . add ( 'FoO' , ( ) => { } ) ;
59+
60+ expect ( Array . from ( factory . names ( ) ) ) . to . have . members ( [ 'FoO' ] ) ;
61+ } ) ;
5662 } ) ;
5763
5864 describe ( 'create()' , ( ) => {
You can’t perform that action at this time.
0 commit comments