Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix const declared without let: binding get ignored (#7434)
- Loading branch information
Showing
4 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
test/runtime/samples/const-tag-component-without-let/Component.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<slot name="box1" /> | ||
<slot /> |
15 changes: 15 additions & 0 deletions
15
test/runtime/samples/const-tag-component-without-let/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export default { | ||
html: ` | ||
<div>static dynamic</div> | ||
<div>static dynamic</div> | ||
<div>static dynamic</div> | ||
`, | ||
async test({ component, target, assert }) { | ||
component.props = 'xxx'; | ||
assert.htmlEqual(target.innerHTML, ` | ||
<div>static xxx</div> | ||
<div>static xxx</div> | ||
<div>static xxx</div> | ||
`); | ||
} | ||
}; |
24 changes: 24 additions & 0 deletions
24
test/runtime/samples/const-tag-component-without-let/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<script> | ||
import Component from './Component.svelte'; | ||
export let props = "dynamic"; | ||
</script> | ||
|
||
<Component> | ||
<svelte:fragment slot="box1"> | ||
{@const foo = "static"} | ||
{@const bar = props} | ||
<div>{foo} {bar}</div> | ||
</svelte:fragment> | ||
|
||
<svelte:fragment> | ||
{@const foo = "static"} | ||
{@const bar = props} | ||
<div>{foo} {bar}</div> | ||
</svelte:fragment> | ||
</Component> | ||
|
||
<Component> | ||
{@const foo = "static"} | ||
{@const bar = props} | ||
<div>{foo} {bar}</div> | ||
</Component> |