Skip to content

Commit 7b12b45

Browse files
authored
Merge pull request #39 from Igorbek/bugfix/issue36
Fix minification issues #36
2 parents e77f358 + a8bee3f commit 7b12b45

File tree

11 files changed

+274
-7
lines changed

11 files changed

+274
-7
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`issue36-extended.ts 1`] = `
4+
5+
File: issue36-extended.ts
6+
Source code:
7+
8+
declare const styled: any;
9+
10+
export const A = styled.div\`
11+
border: \${'solid'} 10px;
12+
\`
13+
14+
styled.div\`
15+
border: \${'solid'}// comment here
16+
10px;
17+
border: solid// comment here
18+
10px;
19+
\`
20+
21+
styled.div\`
22+
border: \${'solid'}/* comment here
23+
*/10px;
24+
border: \${'solid'}/* comment here
25+
*/ 10px;
26+
\`
27+
28+
29+
TypeScript before transform:
30+
31+
declare const styled: any;
32+
export const A = styled.div \`\\n border: \${"solid"} 10px;\\n\`;
33+
styled.div \`\\n border: \${"solid"}// comment here\\n10px;\\n border: solid// comment here\\n10px;\\n\`;
34+
styled.div \`\\n border: \${"solid"}/* comment here\\n*/10px;\\n border: \${"solid"}/* comment here\\n*/ 10px;\\n\`;
35+
36+
37+
TypeScript after transform:
38+
39+
declare const styled: any;
40+
export const A = styled.div \`border:\${'solid'} 10px;\`;
41+
styled.div \`border:\${'solid'} 10px;border:solid 10px;\`;
42+
styled.div \`border:\${'solid'} 10px;border:\${'solid'} 10px;\`;
43+
44+
45+
46+
`;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`issue36.tsx 1`] = `
4+
5+
File: issue36.tsx
6+
Source code:
7+
8+
declare const keyframes: any;
9+
declare const styled: any;
10+
11+
const rotate360 = keyframes\`
12+
from {
13+
transform: rotate(0deg);
14+
}
15+
to {
16+
transform: rotate(360deg);
17+
}
18+
\`;
19+
20+
export const StyledDiv = styled.div\`
21+
width: 100px;
22+
height: 100px;
23+
background-color: greenyellow;
24+
animation: \${rotate360} 2s linear infinite;
25+
\`;
26+
27+
28+
TypeScript before transform:
29+
30+
declare const keyframes: any;
31+
declare const styled: any;
32+
const rotate360 = keyframes \`\\n from {\\n transform: rotate(0deg);\\n }\\n to {\\n transform: rotate(360deg);\\n }\\n\`;
33+
export const StyledDiv = styled.div \`\\n width: 100px;\\n height: 100px;\\n background-color: greenyellow;\\n animation: \${rotate360} 2s linear infinite;\\n\`;
34+
35+
36+
TypeScript after transform:
37+
38+
declare const keyframes: any;
39+
declare const styled: any;
40+
const rotate360 = keyframes \`from{transform:rotate(0deg);}to{transform:rotate(360deg);}\`;
41+
export const StyledDiv = styled.div \`width:100px;height:100px;background-color:greenyellow;animation:\${rotate360} 2s linear infinite;\`;
42+
43+
44+
45+
`;

src/__tests__/baselines/minification-only/minify-css-to-use-without-transpilation.ts.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ TypeScript after transform:
6565
const SpecialCharacters = styled.div \`content:" \${props => props.text} ";color:red;\`;
6666
const Comment = styled.div \`width:100%;color:red;\`;
6767
const Parens = styled.div \`&:hover{color:blue;}color:red;\`;
68-
const UrlComments = styled.div \`color:red; background:red;border:1px solid green;\`;
68+
const UrlComments = styled.div \`color:red;background:red;border:1px solid green;\`;
6969
export {};
7070

7171

src/__tests__/baselines/minification-only/simple.ts.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ TypeScript after transform:
158158
styled.div \`line one{line:two;}\`;
159159
// removes line comments at the end of lines of code
160160
// \`valid line with out comments\`
161-
styled.div \`valid line without comments\`;
161+
styled.div \`valid line with out comments\`;
162162
// preserves multi-line comments starting with /*!
163163
// \`this is a /*! dont ignore me please */ test\`
164164
styled.div \`this is a test\`;
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`issue36-extended.ts 1`] = `
4+
5+
File: issue36-extended.ts
6+
Source code:
7+
8+
declare const styled: any;
9+
10+
export const A = styled.div\`
11+
border: \${'solid'} 10px;
12+
\`
13+
14+
styled.div\`
15+
border: \${'solid'}// comment here
16+
10px;
17+
border: solid// comment here
18+
10px;
19+
\`
20+
21+
styled.div\`
22+
border: \${'solid'}/* comment here
23+
*/10px;
24+
border: \${'solid'}/* comment here
25+
*/ 10px;
26+
\`
27+
28+
29+
TypeScript before transform:
30+
31+
declare const styled: any;
32+
export const A = styled.div \`\\n border: \${"solid"} 10px;\\n\`;
33+
styled.div \`\\n border: \${"solid"}// comment here\\n10px;\\n border: solid// comment here\\n10px;\\n\`;
34+
styled.div \`\\n border: \${"solid"}/* comment here\\n*/10px;\\n border: \${"solid"}/* comment here\\n*/ 10px;\\n\`;
35+
36+
37+
TypeScript after transform:
38+
39+
declare const styled: any;
40+
export const A = styled.div.withConfig({ displayName: "A" }) \`border:\${'solid'} 10px;\`;
41+
styled.div \`border:\${'solid'} 10px;border:solid 10px;\`;
42+
styled.div \`border:\${'solid'} 10px;border:\${'solid'} 10px;\`;
43+
44+
45+
46+
`;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`issue36.tsx 1`] = `
4+
5+
File: issue36.tsx
6+
Source code:
7+
8+
declare const keyframes: any;
9+
declare const styled: any;
10+
11+
const rotate360 = keyframes\`
12+
from {
13+
transform: rotate(0deg);
14+
}
15+
to {
16+
transform: rotate(360deg);
17+
}
18+
\`;
19+
20+
export const StyledDiv = styled.div\`
21+
width: 100px;
22+
height: 100px;
23+
background-color: greenyellow;
24+
animation: \${rotate360} 2s linear infinite;
25+
\`;
26+
27+
28+
TypeScript before transform:
29+
30+
declare const keyframes: any;
31+
declare const styled: any;
32+
const rotate360 = keyframes \`\\n from {\\n transform: rotate(0deg);\\n }\\n to {\\n transform: rotate(360deg);\\n }\\n\`;
33+
export const StyledDiv = styled.div \`\\n width: 100px;\\n height: 100px;\\n background-color: greenyellow;\\n animation: \${rotate360} 2s linear infinite;\\n\`;
34+
35+
36+
TypeScript after transform:
37+
38+
declare const keyframes: any;
39+
declare const styled: any;
40+
const rotate360 = keyframes \`from{transform:rotate(0deg);}to{transform:rotate(360deg);}\`;
41+
export const StyledDiv = styled.div.withConfig({ displayName: "StyledDiv" }) \`width:100px;height:100px;background-color:greenyellow;animation:\${rotate360} 2s linear infinite;\`;
42+
43+
44+
45+
`;

src/__tests__/baselines/minification/minify-css-to-use-without-transpilation.ts.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ TypeScript after transform:
6565
const SpecialCharacters = styled.div.withConfig({ displayName: "SpecialCharacters" }) \`content:" \${props => props.text} ";color:red;\`;
6666
const Comment = styled.div.withConfig({ displayName: "Comment" }) \`width:100%;color:red;\`;
6767
const Parens = styled.div.withConfig({ displayName: "Parens" }) \`&:hover{color:blue;}color:red;\`;
68-
const UrlComments = styled.div.withConfig({ displayName: "UrlComments" }) \`color:red; background:red;border:1px solid green;\`;
68+
const UrlComments = styled.div.withConfig({ displayName: "UrlComments" }) \`color:red;background:red;border:1px solid green;\`;
6969
export {};
7070

7171

src/__tests__/baselines/minification/simple.ts.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ TypeScript after transform:
158158
styled.div \`line one{line:two;}\`;
159159
// removes line comments at the end of lines of code
160160
// \`valid line with out comments\`
161-
styled.div \`valid line without comments\`;
161+
styled.div \`valid line with out comments\`;
162162
// preserves multi-line comments starting with /*!
163163
// \`this is a /*! dont ignore me please */ test\`
164164
styled.div \`this is a test\`;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
declare const styled: any;
2+
3+
export const A = styled.div`
4+
border: ${'solid'} 10px;
5+
`
6+
7+
styled.div`
8+
border: ${'solid'}// comment here
9+
10px;
10+
border: solid// comment here
11+
10px;
12+
`
13+
14+
styled.div`
15+
border: ${'solid'}/* comment here
16+
*/10px;
17+
border: ${'solid'}/* comment here
18+
*/ 10px;
19+
`
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
declare const keyframes: any;
2+
declare const styled: any;
3+
4+
const rotate360 = keyframes`
5+
from {
6+
transform: rotate(0deg);
7+
}
8+
to {
9+
transform: rotate(360deg);
10+
}
11+
`;
12+
13+
export const StyledDiv = styled.div`
14+
width: 100px;
15+
height: 100px;
16+
background-color: greenyellow;
17+
animation: ${rotate360} 2s linear infinite;
18+
`;

0 commit comments

Comments
 (0)