|
| 1 | +exports[`fixtures should add display names 1`] = ` |
| 2 | +"const Test = styled.div.withConfig({ |
| 3 | + displayName: \'Test\' |
| 4 | +})\`width:100%;\`; |
| 5 | +const Test2 = styled(\'div\').withConfig({ |
| 6 | + displayName: \'Test2\' |
| 7 | +})\`\`; |
| 8 | +const Test3 = true ? styled.div.withConfig({ |
| 9 | + displayName: \'Test3\' |
| 10 | +})\`\` : styled.div.withConfig({ |
| 11 | + displayName: \'Test3\' |
| 12 | +})\`\`; |
| 13 | +const styles = { One: styled.div.withConfig({ |
| 14 | + displayName: \'One\' |
| 15 | + })\`\` }; |
| 16 | +let Component; |
| 17 | +Component = styled.div.withConfig({ |
| 18 | + displayName: \'Component\' |
| 19 | +})\`\`; |
| 20 | +const WrappedComponent = styled(Inner).withConfig({ |
| 21 | + displayName: \'WrappedComponent\' |
| 22 | +})\`\`;" |
| 23 | +`; |
| 24 | +
|
| 25 | +exports[`fixtures should add identifier 1`] = ` |
| 26 | +"const Test = styled.div.withConfig({ |
| 27 | + componentId: \"f15zqz-0\" |
| 28 | +})\`width:100%;\`; |
| 29 | +const Test2 = true ? styled.div.withConfig({ |
| 30 | + componentId: \"f15zqz-1\" |
| 31 | +})\`\` : styled.div.withConfig({ |
| 32 | + componentId: \"f15zqz-2\" |
| 33 | +})\`\`; |
| 34 | +const styles = { One: styled.div.withConfig({ |
| 35 | + componentId: \"f15zqz-3\" |
| 36 | + })\`\` }; |
| 37 | +let Component; |
| 38 | +Component = styled.div.withConfig({ |
| 39 | + componentId: \"f15zqz-4\" |
| 40 | +})\`\`; |
| 41 | +const WrappedComponent = styled(Inner).withConfig({ |
| 42 | + componentId: \"f15zqz-5\" |
| 43 | +})\`\`;" |
| 44 | +`; |
| 45 | +
|
| 46 | +exports[`fixtures should add identifier and display name 1`] = ` |
| 47 | +"const Test = styled.div.withConfig({ |
| 48 | + displayName: \"Test\", |
| 49 | + componentId: \"s1j54k93-0\" |
| 50 | +})\`width:100%;\`; |
| 51 | +const Test2 = true ? styled.div.withConfig({ |
| 52 | + displayName: \"Test2\", |
| 53 | + componentId: \"s1j54k93-1\" |
| 54 | +})\`\` : styled.div.withConfig({ |
| 55 | + displayName: \"Test2\", |
| 56 | + componentId: \"s1j54k93-2\" |
| 57 | +})\`\`; |
| 58 | +const styles = { One: styled.div.withConfig({ |
| 59 | + displayName: \"One\", |
| 60 | + componentId: \"s1j54k93-3\" |
| 61 | + })\`\` }; |
| 62 | +let Component; |
| 63 | +Component = styled.div.withConfig({ |
| 64 | + displayName: \"Component\", |
| 65 | + componentId: \"s1j54k93-4\" |
| 66 | +})\`\`; |
| 67 | +const WrappedComponent = styled(Inner).withConfig({ |
| 68 | + displayName: \"WrappedComponent\", |
| 69 | + componentId: \"s1j54k93-5\" |
| 70 | +})\`\`;" |
| 71 | +`; |
| 72 | +
|
| 73 | +exports[`fixtures should allow chains of member calls 1`] = ` |
| 74 | +"const WithAttrs = styled.div.attrs({ some: \'value\' }).withConfig({ |
| 75 | + displayName: \'WithAttrs\' |
| 76 | +})\`\`; |
| 77 | +const WithAttrsWrapped = styled(Inner).attrs({ some: \'value\' }).withConfig({ |
| 78 | + displayName: \'WithAttrsWrapped\' |
| 79 | +})\`\`;" |
| 80 | +`; |
| 81 | +
|
| 82 | +exports[`fixtures should minify css in helpers 1`] = ` |
| 83 | +"import { css, keyframes } from \'styled-components\'; |
| 84 | +
|
| 85 | +const key = keyframes\`to{transform:rotate(360deg);}\`; |
| 86 | +
|
| 87 | +const color = css\`color:\${theColor};\`;" |
| 88 | +`; |
| 89 | +
|
| 90 | +exports[`fixtures should minify css to use with transpilation 1`] = ` |
| 91 | +"\'use strict\'; |
| 92 | +
|
| 93 | +var _templateObject = _taggedTemplateLiteral([\'width:100%;\'], [\'width:100%;\']), |
| 94 | + _templateObject2 = _taggedTemplateLiteral([\'content:\" \', \' \";\'], [\'content:\" \', \' \";\']), |
| 95 | + _templateObject3 = _taggedTemplateLiteral([\'content:\" \', \' \";color:red;\'], [\'content:\" \', \' \";color:red;\']), |
| 96 | + _templateObject4 = _taggedTemplateLiteral([\'color:red;\'], [\'color:red;\']), |
| 97 | + _templateObject5 = _taggedTemplateLiteral([\'&:hover{color:blue;}\'], [\'&:hover{color:blue;}\']); |
| 98 | +
|
| 99 | +var _styledComponents = require(\'styled-components\'); |
| 100 | +
|
| 101 | +var _styledComponents2 = _interopRequireDefault(_styledComponents); |
| 102 | +
|
| 103 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
| 104 | +
|
| 105 | +function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } |
| 106 | +
|
| 107 | +var Simple = _styledComponents2.default.div(_templateObject); |
| 108 | +
|
| 109 | +var Interpolation = _styledComponents2.default.div(_templateObject2, function (props) { |
| 110 | + return props.text; |
| 111 | +}); |
| 112 | +
|
| 113 | +var SpecialCharacters = _styledComponents2.default.div(_templateObject3, function (props) { |
| 114 | + return props.text; |
| 115 | +}); |
| 116 | +
|
| 117 | +var Comment = _styledComponents2.default.div(_templateObject4); |
| 118 | +
|
| 119 | +var Parens = _styledComponents2.default.div(_templateObject5);" |
| 120 | +`; |
| 121 | +
|
| 122 | +exports[`fixtures should minify css to use without transpilation 1`] = ` |
| 123 | +"import styled from \'styled-components\'; |
| 124 | +
|
| 125 | +const Simple = styled.div\`width:100%;\`; |
| 126 | +
|
| 127 | +const Interpolation = styled.div\`content:\"https://test.com/\${props => props.endpoint}\";\`; |
| 128 | +
|
| 129 | +const SpecialCharacters = styled.div\`content:\" \${props => props.text} \";color:red;\`; |
| 130 | +
|
| 131 | +const Comment = styled.div\`width:100%;color:red;\`; |
| 132 | +
|
| 133 | +const Parens = styled.div\`&:hover{color:blue;}color:red;\`; |
| 134 | +
|
| 135 | +const UrlComments = styled.div\`color:red;background:red;border:1px solid green;\`;" |
| 136 | +`; |
| 137 | +
|
| 138 | +exports[`fixtures should not preprocess import 1`] = ` |
| 139 | +"import styled from \'styled-components\'; |
| 140 | +require(\'styled-components\');" |
| 141 | +`; |
| 142 | +
|
| 143 | +exports[`fixtures should not use private api if not required 1`] = ` |
| 144 | +"import styled from \'styled-components\'; |
| 145 | +
|
| 146 | +const Test = styled.div\`width:100%;\`;" |
| 147 | +`; |
| 148 | +
|
| 149 | +exports[`fixtures should preprocess css 1`] = ` |
| 150 | +"const Simple = styled.div.withConfig({ |
| 151 | + displayName: \"before__Simple\" |
| 152 | +})([[\"{width:100%;}\"]]); |
| 153 | +
|
| 154 | +const Nested = styled.div.withConfig({ |
| 155 | + displayName: \"before__Nested\" |
| 156 | +})([[\"{width:100%;}\"], [\":hover{color:papayawhip;}\"], [\" > div{background:white;}\"]]); |
| 157 | +
|
| 158 | +const Interpolations = styled.div.withConfig({ |
| 159 | + displayName: \"before__Interpolations\" |
| 160 | +})([[\"{width:\", props => props.width, \";}\"]]); |
| 161 | +
|
| 162 | +const NestedAndInterpolations = styled.div.withConfig({ |
| 163 | + displayName: \"before__NestedAndInterpolations\" |
| 164 | +})([[\"{width:\", props => props.width, \";}\"], [\":hover{color:\", props => props.color, \";}\"]]); |
| 165 | +
|
| 166 | +const SelectorInterpolation = styled.div.withConfig({ |
| 167 | + displayName: \"before__SelectorInterpolation\" |
| 168 | +})([[\"{width:\", props => props.width, \";}\"], [\" \", props => props.selector, \"{color:papayawhip;}\"]]); |
| 169 | +
|
| 170 | +const RulesetInterpolationA = styled.div.withConfig({ |
| 171 | + displayName: \"before__RulesetInterpolationA\" |
| 172 | +})([[\"{width:\", props => props.width, \";\", props => props.ruleset, \";}\"], [\":hover{color:papayawhip;}\"]]); |
| 173 | +
|
| 174 | +const RulesetInterpolationB = styled.div.withConfig({ |
| 175 | + displayName: \"before__RulesetInterpolationB\" |
| 176 | +})([[\"{\", props => props.ruleset, \";width:\", props => props.width, \";}\"], [\":hover{color:papayawhip;}\"]]); |
| 177 | +
|
| 178 | +const Prefixes = styled.div.withConfig({ |
| 179 | + displayName: \"before__Prefixes\" |
| 180 | +})([[\"{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}\"]]); |
| 181 | +
|
| 182 | +const DoubleInterpolation = styled.div.withConfig({ |
| 183 | + displayName: \"before__DoubleInterpolation\" |
| 184 | +})([[\"{margin:\", props => props.vert, \" \", props => props.hori, \";}\"]]);" |
| 185 | +`; |
| 186 | +
|
| 187 | +exports[`fixtures should preprocess import 1`] = ` |
| 188 | +"import styled from \'styled-components/no-parser\'; |
| 189 | +require(\'styled-components/no-parser\');" |
| 190 | +`; |
| 191 | +
|
| 192 | +exports[`fixtures should preprocess inject global 1`] = `"injectGlobal([[\"\", glob, \"\\n/*! preserve comment */html,body{margin:100000px;padding:\", test, \";}@media (max-width:999px){html,body{margin:0;}}.root{width:100%;}\"]]);"`; |
| 193 | +
|
| 194 | +exports[`fixtures should preprocess keyframes 1`] = `"const Animation = keyframes([[\"@-webkit-keyframes \"], [\"{0%{opacity:0;}100%{opacity:1;}}@keyframes \"], [\"{0%{opacity:0;}100%{opacity:1;}}\"]]);"`; |
| 195 | +
|
| 196 | +exports[`fixtures should track the imported variable 1`] = ` |
| 197 | +"import s from \"styled-components\"; |
| 198 | +
|
| 199 | +const Test = s.div.withConfig({ |
| 200 | + displayName: \"Test\", |
| 201 | + componentId: \"syqrfc-0\" |
| 202 | +})\`width:100%;\`; |
| 203 | +const Test2 = true ? s.div.withConfig({ |
| 204 | + displayName: \"Test2\", |
| 205 | + componentId: \"syqrfc-1\" |
| 206 | +})\`\` : s.div.withConfig({ |
| 207 | + displayName: \"Test2\", |
| 208 | + componentId: \"syqrfc-2\" |
| 209 | +})\`\`; |
| 210 | +const styles = { One: s.div.withConfig({ |
| 211 | + displayName: \"One\", |
| 212 | + componentId: \"syqrfc-3\" |
| 213 | + })\`\` }; |
| 214 | +let Component; |
| 215 | +Component = s.div.withConfig({ |
| 216 | + displayName: \"Component\", |
| 217 | + componentId: \"syqrfc-4\" |
| 218 | +})\`\`; |
| 219 | +const WrappedComponent = s(Inner).withConfig({ |
| 220 | + displayName: \"WrappedComponent\", |
| 221 | + componentId: \"syqrfc-5\" |
| 222 | +})\`\`;" |
| 223 | +`; |
| 224 | +
|
| 225 | +exports[`fixtures should transpile require default 1`] = ` |
| 226 | +"const styled_default = require(\"styled-components/no-parser\"); |
| 227 | +
|
| 228 | +const TestNormal = styled.div.withConfig({ |
| 229 | + displayName: \"before__TestNormal\", |
| 230 | + componentId: \"y0c69d-0\" |
| 231 | +})([[\"{width:100%;}\"]]); |
| 232 | +
|
| 233 | +const Test = styled_default.default.div.withConfig({ |
| 234 | + displayName: \"before__Test\", |
| 235 | + componentId: \"y0c69d-1\" |
| 236 | +})([[\"{width:100%;}\"]]); |
| 237 | +
|
| 238 | +const TestCallExpression = styled_default.default(Test).withConfig({ |
| 239 | + displayName: \"before__TestCallExpression\", |
| 240 | + componentId: \"y0c69d-2\" |
| 241 | +})([[\"{height:20px;}\"]]);" |
| 242 | +`; |
| 243 | +
|
| 244 | +exports[`fixtures should transpile template literals with config 1`] = ` |
| 245 | +"\'use strict\'; |
| 246 | +
|
| 247 | +var _styledComponents = require(\'styled-components\'); |
| 248 | +
|
| 249 | +var _styledComponents2 = _interopRequireDefault(_styledComponents); |
| 250 | +
|
| 251 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
| 252 | +
|
| 253 | +var Named = _styledComponents2.default.div.withConfig({ |
| 254 | + displayName: \'before__Named\' |
| 255 | +})([\'\\n width: 100%;\\n\']); |
| 256 | +
|
| 257 | +var NamedWithInterpolation = _styledComponents2.default.div.withConfig({ |
| 258 | + displayName: \'before__NamedWithInterpolation\' |
| 259 | +})([\'\\n color: \', \';\\n\'], function (color) { |
| 260 | + return props.color; |
| 261 | +}); |
| 262 | +
|
| 263 | +var Wrapped = (0, _styledComponents2.default)(Inner).withConfig({ |
| 264 | + displayName: \'before__Wrapped\' |
| 265 | +})([\'color: red;\']);" |
| 266 | +`; |
| 267 | +
|
| 268 | +exports[`fixtures should transpile template literals without config 1`] = ` |
| 269 | +"\'use strict\'; |
| 270 | +
|
| 271 | +var _styledComponents = require(\'styled-components\'); |
| 272 | +
|
| 273 | +var _styledComponents2 = _interopRequireDefault(_styledComponents); |
| 274 | +
|
| 275 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
| 276 | +
|
| 277 | +var Named = _styledComponents2.default.div([\'\\n width: 100%;\\n\']); |
| 278 | +
|
| 279 | +var NamedWithInterpolation = _styledComponents2.default.div([\'\\n color: \', \';\\n\'], function (color) { |
| 280 | + return props.color; |
| 281 | +}); |
| 282 | +
|
| 283 | +var Wrapped = (0, _styledComponents2.default)(Inner)([\'color: red;\']);" |
| 284 | +`; |
| 285 | +
|
| 286 | +exports[`fixtures should use file name 1`] = ` |
| 287 | +"import styled from \"styled-components\"; |
| 288 | +
|
| 289 | +const Test = styled.div.withConfig({ |
| 290 | + displayName: \"before__Test\", |
| 291 | + componentId: \"s1x8c0g0-0\" |
| 292 | +})\`color:red;\`; |
| 293 | +const before = styled.div.withConfig({ |
| 294 | + displayName: \"before\", |
| 295 | + componentId: \"s1x8c0g0-1\" |
| 296 | +})\`color:blue;\`; |
| 297 | +styled.div.withConfig({ |
| 298 | + displayName: \"before\", |
| 299 | + componentId: \"s1x8c0g0-2\" |
| 300 | +})\`\`; |
| 301 | +export default styled.button.withConfig({ |
| 302 | + displayName: \"before\", |
| 303 | + componentId: \"s1x8c0g0-3\" |
| 304 | +})\`\`;" |
| 305 | +`; |
| 306 | +
|
| 307 | +exports[`fixtures should work with hoisted default as import 1`] = ` |
| 308 | +"const Test = s.div.withConfig({ |
| 309 | + displayName: \'before__Test\', |
| 310 | + componentId: \'s2wuo7o-0\' |
| 311 | +})\`width:100%;\`; |
| 312 | +import { default as s, css } from \'styled-components\';" |
| 313 | +`; |
0 commit comments