Skip to content

Commit 23100aa

Browse files
authored
Merge pull request #85 from liqueflies/master
[+] Updated stylis to 3.x closing issue #28
2 parents 671ce00 + 7c9d0e2 commit 23100aa

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"glamor": "^2.20.24",
3838
"inline-style-prefixer": "^2.0.5",
3939
"lodash.isplainobject": "^4.0.6",
40-
"stylis": "^2.0.3"
40+
"stylis": "^3.5.4"
4141
},
4242
"devDependencies": {
4343
"@babel/cli": "^7.4.4",

src/models/ComponentStyle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default (nameGenerator) => {
2727
if (!inserted[hash]) {
2828
const selector = nameGenerator(hash)
2929
inserted[hash] = selector
30-
const css = stylis(`.${selector}`, flatCSS, false, false)
30+
const css = stylis(`.${selector}`, flatCSS)
3131
this.insertedRule.appendRule(css)
3232
}
3333
return inserted[hash]

src/test/keyframes.test.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,9 @@ describe('css features', () => {
2121
}
2222
`
2323

24-
const Comp = styled.div`
25-
animation: ${rotate} 2s linear infinite;
26-
`
27-
28-
const vm = new Vue(Comp).$mount()
29-
3024
expectCSSMatches(
31-
'@keyframes iVXCSc { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } .a {-webkit-animation:iVXCSc 2s linear infinite;animation:iVXCSc 2s linear infinite;}'
25+
'@keyframes iVXCSc { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }',
26+
{ rotate }
3227
)
3328
})
3429
})

src/test/utils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,18 @@ export const resetStyled = () => {
1919
return _styled(_styledComponent(_ComponentStyle(classNames)))
2020
}
2121

22-
const stripWhitespace = str => str.trim().replace(/\s+/g, ' ')
22+
const stripWhitespace = str => str.trim()
23+
.replace(/\s+/g, ' ')
24+
.replace(/\s+\{/g, '{')
25+
.replace(/\:\s+/g, ':')
2326

2427
export const expectCSSMatches = (
2528
expectation,
2629
opts = {}
2730
) => {
2831
const { ignoreWhitespace = true, styleSheet = mainStyleSheet } = opts
2932
const css = styleSheet.rules().map(rule => rule.cssText).join('\n')
33+
3034
if (ignoreWhitespace) {
3135
expect(stripWhitespace(css)).toEqual(stripWhitespace(expectation))
3236
} else {

0 commit comments

Comments
 (0)