Skip to content

Commit b80eb3e

Browse files
committed
fix
1 parent 5db4ea8 commit b80eb3e

File tree

1 file changed

+18
-2
lines changed
  • packages/svelte/tests/parser-modern

1 file changed

+18
-2
lines changed

packages/svelte/tests/parser-modern/test.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ function clean(ast: AST.SvelteNode) {
7272

7373
context.next();
7474
},
75+
StyleSheet(node, context) {
76+
return {
77+
type: node.type,
78+
attributes: node.attributes.map((attribute) => context.visit(attribute)),
79+
children: node.children.map((child) => context.visit(child)),
80+
content: {}
81+
} as AST.SvelteNode;
82+
},
7583
Fragment(node, context) {
7684
const nodes: AST.SvelteNode[] = [];
7785

@@ -80,11 +88,19 @@ function clean(ast: AST.SvelteNode) {
8088

8189
if (child.type === 'Text') {
8290
if (i === 0) {
83-
child = { ...child, data: child.data.trimStart() };
91+
child = {
92+
...child,
93+
data: child.data.trimStart(),
94+
raw: child.raw.trimStart()
95+
};
8496
}
8597

8698
if (i === node.nodes.length - 1) {
87-
child = { ...child, data: child.data.trimEnd() };
99+
child = {
100+
...child,
101+
data: child.data.trimEnd(),
102+
raw: child.raw.trimEnd()
103+
};
88104
}
89105

90106
if (!child.data) continue;

0 commit comments

Comments
 (0)