File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ export function themeable(original = {}, mixin) {
178178
179179 //merging reducer
180180 ( result , key ) => {
181- const originalValue = original [ key ]
181+ const originalValue = original [ key ] || ''
182182 const mixinValue = mixin [ key ]
183183
184184 let newValue
@@ -189,7 +189,10 @@ export function themeable(original = {}, mixin) {
189189 newValue = themeable ( originalValue , mixinValue )
190190 } else {
191191 //either concat or take mixin value
192- newValue = originalValue ? `${ originalValue } ${ mixinValue } ` : mixinValue
192+ newValue = originalValue . split ( ' ' )
193+ . concat ( mixinValue . split ( ' ' ) )
194+ . filter ( ( item , pos , self ) => self . indexOf ( item ) === pos && item !== '' )
195+ . join ( ' ' )
193196 }
194197
195198 return {
Original file line number Diff line number Diff line change @@ -547,4 +547,12 @@ describe('themeable function', () => {
547547 const result = themeable ( themeA , themeB )
548548 expect ( result ) . toEqual ( expected )
549549 } )
550+
551+ it ( 'should skip dupplicated keys classNames' , ( ) => {
552+ const themeA = { test : 'test' }
553+ const themeB = { test : 'test test2' }
554+ const expected = { test : 'test test2' }
555+ const result = themeable ( themeA , themeB )
556+ expect ( result ) . toEqual ( expected )
557+ } )
550558} )
You can’t perform that action at this time.
0 commit comments