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) {
178
178
179
179
//merging reducer
180
180
( result , key ) => {
181
- const originalValue = original [ key ]
181
+ const originalValue = original [ key ] || ''
182
182
const mixinValue = mixin [ key ]
183
183
184
184
let newValue
@@ -189,7 +189,10 @@ export function themeable(original = {}, mixin) {
189
189
newValue = themeable ( originalValue , mixinValue )
190
190
} else {
191
191
//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 ( ' ' )
193
196
}
194
197
195
198
return {
Original file line number Diff line number Diff line change @@ -547,4 +547,12 @@ describe('themeable function', () => {
547
547
const result = themeable ( themeA , themeB )
548
548
expect ( result ) . toEqual ( expected )
549
549
} )
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
+ } )
550
558
} )
You can’t perform that action at this time.
0 commit comments