Skip to content

Commit

Permalink
Add repro for #233 and accept problematic baselines
Browse files Browse the repository at this point in the history
  • Loading branch information
Igorbek committed Jul 9, 2021
1 parent 2dddad3 commit 393a593
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 0 deletions.
67 changes: 67 additions & 0 deletions src/__tests__/baselines/minification-only/issue233.ts.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`issue233.ts 1`] = `

File: issue233.ts
Source code:

declare const styled: any;

// repro from #233
const ValueCalc = styled.div\`
height: calc(var(--line-height) - 5px);
width: calc(100% - 5px);
\`;

// another case from #233
styled.div\`--padding-button: calc(var(--padding-button-vertical) - 2px) calc(var(--padding-button-horizontal) - 2px);\`

// a few more cases
styled.div\`
width: calc( 1%)
width: calc( 1% + var(--a) - calc(2%))
width: calc( 1% + var(--a) - calc(2%) + calc( 1px + calc(1px + 2px) + var(--a)))
\`


TypeScript before transform:

declare const styled: any;
// repro from #233
const ValueCalc = styled.div \`
height: calc(var(--line-height) - 5px);
width: calc(100% - 5px);
\`;
// another case from #233
styled.div \`--padding-button: calc(var(--padding-button-vertical) - 2px) calc(var(--padding-button-horizontal) - 2px);\`;
// a few more cases
styled.div \`
width: calc( 1%)
width: calc( 1% + var(--a) - calc(2%))
width: calc( 1% + var(--a) - calc(2%) + calc( 1px + calc(1px + 2px) + var(--a)))
\`;


TypeScript after transform:

declare const styled: any;
// repro from #233
const ValueCalc = styled.div \`height:calc(var(--line-height)- 5px);width:calc(100% - 5px);\`;
// another case from #233
styled.div \`--padding-button:calc(var(--padding-button-vertical)- 2px) calc(var(--padding-button-horizontal)- 2px);\`;
// a few more cases
styled.div \`width:calc( 1%)width:calc( 1% + var(--a)- calc(2%)) width:calc( 1% + var(--a)- calc(2%)+ calc( 1px + calc(1px + 2px)+ var(--a)))\`;


TypeScript after transpile module:

// repro from #233
const ValueCalc = styled.div \`height:calc(var(--line-height)- 5px);width:calc(100% - 5px);\`;
// another case from #233
styled.div \`--padding-button:calc(var(--padding-button-vertical)- 2px) calc(var(--padding-button-horizontal)- 2px);\`;
// a few more cases
styled.div \`width:calc( 1%)width:calc( 1% + var(--a)- calc(2%)) width:calc( 1% + var(--a)- calc(2%)+ calc( 1px + calc(1px + 2px)+ var(--a)))\`;



`;
67 changes: 67 additions & 0 deletions src/__tests__/baselines/minification/issue233.ts.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`issue233.ts 1`] = `

File: issue233.ts
Source code:

declare const styled: any;

// repro from #233
const ValueCalc = styled.div\`
height: calc(var(--line-height) - 5px);
width: calc(100% - 5px);
\`;

// another case from #233
styled.div\`--padding-button: calc(var(--padding-button-vertical) - 2px) calc(var(--padding-button-horizontal) - 2px);\`

// a few more cases
styled.div\`
width: calc( 1%)
width: calc( 1% + var(--a) - calc(2%))
width: calc( 1% + var(--a) - calc(2%) + calc( 1px + calc(1px + 2px) + var(--a)))
\`


TypeScript before transform:

declare const styled: any;
// repro from #233
const ValueCalc = styled.div \`
height: calc(var(--line-height) - 5px);
width: calc(100% - 5px);
\`;
// another case from #233
styled.div \`--padding-button: calc(var(--padding-button-vertical) - 2px) calc(var(--padding-button-horizontal) - 2px);\`;
// a few more cases
styled.div \`
width: calc( 1%)
width: calc( 1% + var(--a) - calc(2%))
width: calc( 1% + var(--a) - calc(2%) + calc( 1px + calc(1px + 2px) + var(--a)))
\`;


TypeScript after transform:

declare const styled: any;
// repro from #233
const ValueCalc = styled.div.withConfig({ displayName: "ValueCalc" }) \`height:calc(var(--line-height)- 5px);width:calc(100% - 5px);\`;
// another case from #233
styled.div \`--padding-button:calc(var(--padding-button-vertical)- 2px) calc(var(--padding-button-horizontal)- 2px);\`;
// a few more cases
styled.div \`width:calc( 1%)width:calc( 1% + var(--a)- calc(2%)) width:calc( 1% + var(--a)- calc(2%)+ calc( 1px + calc(1px + 2px)+ var(--a)))\`;


TypeScript after transpile module:

// repro from #233
const ValueCalc = styled.div.withConfig({ displayName: "ValueCalc" }) \`height:calc(var(--line-height)- 5px);width:calc(100% - 5px);\`;
// another case from #233
styled.div \`--padding-button:calc(var(--padding-button-vertical)- 2px) calc(var(--padding-button-horizontal)- 2px);\`;
// a few more cases
styled.div \`width:calc( 1%)width:calc( 1% + var(--a)- calc(2%)) width:calc( 1% + var(--a)- calc(2%)+ calc( 1px + calc(1px + 2px)+ var(--a)))\`;



`;
17 changes: 17 additions & 0 deletions src/__tests__/fixtures/minification/issue233.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
declare const styled: any;

// repro from #233
const ValueCalc = styled.div`
height: calc(var(--line-height) - 5px);
width: calc(100% - 5px);
`;

// another case from #233
styled.div`--padding-button: calc(var(--padding-button-vertical) - 2px) calc(var(--padding-button-horizontal) - 2px);`

// a few more cases
styled.div`
width: calc( 1%)
width: calc( 1% + var(--a) - calc(2%))
width: calc( 1% + var(--a) - calc(2%) + calc( 1px + calc(1px + 2px) + var(--a)))
`

0 comments on commit 393a593

Please sign in to comment.