forked from sveltejs/svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix allow let scoped to root element (sveltejs#4266)
- Loading branch information
1 parent
69bbbd7
commit e1536d2
Showing
5 changed files
with
63 additions
and
16 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
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
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,5 @@ | ||
<script> | ||
export let x; | ||
</script> | ||
|
||
<slot name="foo" reflected={x}/> |
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,22 @@ | ||
export default { | ||
html: ` | ||
<span slot="foo" class="1">1</span> | ||
0 | ||
`, | ||
async test({ assert, target, component, window }) { | ||
component.x = 2; | ||
|
||
assert.htmlEqual(target.innerHTML, ` | ||
<span slot="foo" class="2">2</span> | ||
0 | ||
`); | ||
|
||
const span = target.querySelector('span'); | ||
await span.dispatchEvent(new window.MouseEvent('click')); | ||
|
||
assert.htmlEqual(target.innerHTML, ` | ||
<span slot="foo" class="2">2</span> | ||
2 | ||
`); | ||
} | ||
}; |
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,17 @@ | ||
<script> | ||
import A from './A.svelte'; | ||
export let x = 1; | ||
let y = 0; | ||
</script> | ||
|
||
<A {x}> | ||
<span | ||
on:click={() => y = reflected} | ||
slot="foo" | ||
let:reflected | ||
class={reflected} | ||
> | ||
{reflected} | ||
</span> | ||
</A> | ||
{ y } |