Skip to content

Commit 5980f07

Browse files
committed
fix element spread SSR
1 parent 60305dd commit 5980f07

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

src/generators/server-side-rendering/visitors/Element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default function visitElement(
5656
block.contextualise(attribute.value[0].expression);
5757
args.push(`{ ${quoteIfNecessary(attribute.name)}: ${attribute.value[0].metadata.snippet} }`);
5858
} else {
59-
args.push(`{ ${quoteIfNecessary(attribute.name)}: "${stringifyAttributeValue(block, attribute.value)}" }`);
59+
args.push(`{ ${quoteIfNecessary(attribute.name)}: \`${stringifyAttributeValue(block, attribute.value)}\` }`);
6060
}
6161
}
6262
});
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
export default {
2+
data: {
3+
a: {
4+
'data-one': 1,
5+
'data-two': 2,
6+
},
7+
c: {
8+
'data-b': 'overridden',
9+
},
10+
d: 'deeeeee',
11+
},
12+
13+
html: `
14+
<div data-one="1" data-two="2" data-b="overridden" data-d="deeeeee" >test</div>
15+
`,
16+
17+
test(assert, component, target) {
18+
component.set({
19+
a: {
20+
'data-one': 10
21+
},
22+
c: {
23+
'data-c': 'new'
24+
},
25+
d: 'DEEEEEE'
26+
});
27+
28+
assert.htmlEqual(
29+
target.innerHTML,
30+
`<div data-one="10" data-b="b" data-c="new" data-d="DEEEEEE" >test</div>`
31+
);
32+
},
33+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div {{...a}} data-b="b" {{...c}} data-d={{d}} >test</div>

0 commit comments

Comments
 (0)