Skip to content

Commit e66a868

Browse files
committed
Add testcase
1 parent 5c41462 commit e66a868

File tree

4 files changed

+50
-1
lines changed

4 files changed

+50
-1
lines changed

libs/extractor/src/lib.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8169,5 +8169,39 @@ keyframes({
81698169
)
81708170
.unwrap()
81718171
));
8172+
8173+
reset_class_map();
8174+
assert_debug_snapshot!(ToBTreeSet::from(
8175+
extract(
8176+
"test.tsx",
8177+
r#"import {styled} from '@devup-ui/core'
8178+
const StyledDiv = styled("div")({ bg: "red" }, {})
8179+
"#,
8180+
ExtractOption {
8181+
package: "@devup-ui/core".to_string(),
8182+
css_dir: "@devup-ui/core".to_string(),
8183+
single_css: false,
8184+
import_main_css: false
8185+
}
8186+
)
8187+
.unwrap()
8188+
));
8189+
8190+
reset_class_map();
8191+
assert_debug_snapshot!(ToBTreeSet::from(
8192+
extract(
8193+
"test.tsx",
8194+
r#"import {styled} from '@devup-ui/core'
8195+
const StyledDiv = styled("div")({ bg: "red" }, {})``
8196+
"#,
8197+
ExtractOption {
8198+
package: "@devup-ui/core".to_string(),
8199+
css_dir: "@devup-ui/core".to_string(),
8200+
single_css: false,
8201+
import_main_css: false
8202+
}
8203+
)
8204+
.unwrap()
8205+
));
81728206
}
81738207
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
source: libs/extractor/src/lib.rs
3+
expression: "ToBTreeSet::from(extract(\"test.tsx\",\nr#\"import {styled} from '@devup-ui/core'\n const StyledDiv = styled(\"div\")({ bg: \"red\" }, {})\n \"#,\nExtractOption\n{\n package: \"@devup-ui/core\".to_string(), css_dir:\n \"@devup-ui/core\".to_string(), single_css: false, import_main_css: false\n}).unwrap())"
4+
---
5+
ToBTreeSet {
6+
styles: {},
7+
code: "const StyledDiv = styled(\"div\")({ bg: \"red\" }, {});\n",
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
source: libs/extractor/src/lib.rs
3+
expression: "ToBTreeSet::from(extract(\"test.tsx\",\nr#\"import {styled} from '@devup-ui/core'\n const StyledDiv = styled(\"div\")({ bg: \"red\" }, {})``\n \"#,\nExtractOption\n{\n package: \"@devup-ui/core\".to_string(), css_dir:\n \"@devup-ui/core\".to_string(), single_css: false, import_main_css: false\n}).unwrap())"
4+
---
5+
ToBTreeSet {
6+
styles: {},
7+
code: "const StyledDiv = styled(\"div\")({ bg: \"red\" }, {})``;\n",
8+
}

libs/extractor/src/visit.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ impl<'a> VisitMut<'a> for DevupVisitor<'a> {
173173
self.styles
174174
.extend(result.styles.into_iter().flat_map(|ex| ex.extract()));
175175
*it = new_expr;
176-
return;
177176
}
178177
}
179178

0 commit comments

Comments
 (0)