Skip to content

Commit 47ff2bb

Browse files
committed
test(transformer/styled-components): add failing test case for comment removal (#12202)
Failing test case which demonstrates a bug with comments removal from CSS. The last 2 expressions are in wrong order. Problem is likely `swap_remove`, which alters order of the `Vec`'s elements: https://github.com/oxc-project/oxc/blob/86eb10882eeacbe05a0dc5e0e3adfad9a9890821/crates/oxc_transformer/src/plugins/styled_components.rs#L407-L412
1 parent 9a20cde commit 47ff2bb

File tree

3 files changed

+18
-3
lines changed
  • tasks/transform_conformance
    • snapshots
    • tests/plugin-styled-components/test/fixtures/styled-components/minify-single-line-comments-with-interpolations

3 files changed

+18
-3
lines changed

tasks/transform_conformance/snapshots/oxc.snap.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
commit: 1d4546bc
22

3-
Passed: 176/293
3+
Passed: 175/293
44

55
# All Passed:
66
* babel-plugin-transform-class-static-block
@@ -1417,7 +1417,7 @@ after transform: ["Function", "babelHelpers"]
14171417
rebuilt : ["babelHelpers", "dec"]
14181418

14191419

1420-
# plugin-styled-components (20/34)
1420+
# plugin-styled-components (19/34)
14211421
* styled-components/add-identifier-with-top-level-import-paths/input.js
14221422
x Output mismatch
14231423

@@ -1439,6 +1439,9 @@ x Output mismatch
14391439
* styled-components/does-not-replace-native-with-no-tags/input.js
14401440
x Output mismatch
14411441

1442+
* styled-components/minify-single-line-comments-with-interpolations/input.js
1443+
x Output mismatch
1444+
14421445
* styled-components/pre-transpiled/input.js
14431446
x Output mismatch
14441447

tasks/transform_conformance/tests/plugin-styled-components/test/fixtures/styled-components/minify-single-line-comments-with-interpolations/input.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,10 @@ const Test7 = styled.div`
3838
${'green'} // color: ${'red'}${'blue'};
3939
height: ${p => p.props.height};
4040
`
41+
42+
const Test8 = styled.div`
43+
width: 100%;
44+
// color: ${'red'};
45+
color: ${'blue'};
46+
height: ${123};
47+
`

tasks/transform_conformance/tests/plugin-styled-components/test/fixtures/styled-components/minify-single-line-comments-with-interpolations/output.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@ const Test7 = styled.div.withConfig({ displayName: "input__Test7", componentId:
1414
p => p.props.width,
1515
'green',
1616
p => p.props.height,
17-
);
17+
);
18+
const Test8 = styled.div.withConfig({ displayName: "input__Test8", componentId: "sc-clieju-7" })(
19+
["width:100%;color:", ";height:", ";"],
20+
"blue",
21+
123,
22+
);

0 commit comments

Comments
 (0)