Skip to content

Commit 8bc484b

Browse files
committed
Fix codestyle and conditional rules update
1 parent 12601ea commit 8bc484b

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

src/styled.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,8 @@ const styled = ({tagName, elementStyle, mountSheet}: StyledArgs) => {
7676
for (ruleIndex; ruleIndex < classMap[this.dynamicTagName].length; ruleIndex++) {
7777
rule = classMap[this.dynamicTagName][ruleIndex]
7878

79-
if (rule.name)
80-
this.sheet.update(rule.name, props)
81-
else
82-
this.sheet.update(props)
79+
if (rule.name) this.sheet.update(rule.name, props)
80+
if (rule.rules) rule.rules.update(props)
8381
}
8482
}
8583

src/tests/functional.spec.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,17 @@ describe('functional tests', () => {
113113

114114
it('should update all dynamic props', () => {
115115
const Button = styled('button')({
116-
padding: props => props.spaced ? 10 : 0,
116+
padding: props => (props.spaced ? 10 : 0),
117117

118118
'@media screen': {
119-
margin: props => props.spaced ? 10 : 0
119+
margin: props => (props.spaced ? 10 : 0)
120120
}
121121
})
122122

123-
const wrapper = mount(<Button spaced={true} />)
123+
const wrapper = mount(<Button spaced />)
124124

125125
expect(styled.mountSheet().toString()).toMatchSnapshot()
126-
wrapper.setProps({ spaced: false })
126+
wrapper.setProps({spaced: false})
127127
expect(styled.mountSheet().toString()).toMatchSnapshot()
128128

129129
wrapper.unmount()

0 commit comments

Comments
 (0)