Skip to content

Commit e0f53dc

Browse files
committed
fix undefined mixin value cases
1 parent 9e04787 commit e0f53dc

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/components/themr.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ function merge(original = {}, mixin = {}) {
207207
break
208208
}
209209

210+
case 'undefined': //fallthrough - handles accidentally unset values which may come from props
210211
case 'function': {
211212
//this handles issue when isomorphic-style-loader addes helper functions to css-module
212213
break //just skip

test/components/themr.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,4 +607,16 @@ describe('themeable function', () => {
607607
const result = themeable(a, b, c)
608608
expect(result).toEqual(expected)
609609
})
610+
611+
it('should skip undefined mixin values', () => {
612+
const a = {
613+
test: 'a'
614+
}
615+
const b = {
616+
test: undefined
617+
}
618+
const expected = a
619+
const result = themeable(a, b)
620+
expect(result).toEqual(expected)
621+
})
610622
})

0 commit comments

Comments
 (0)