-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle component binding mutation
- Loading branch information
1 parent
2cb78ac
commit 8a7e540
Showing
5 changed files
with
57 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"svelte": patch | ||
--- | ||
|
||
fix: handle component binding mutation |
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
5 changes: 5 additions & 0 deletions
5
packages/svelte/tests/runtime-legacy/samples/component-binding-deep2/Widget.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,5 @@ | ||
<script> | ||
export let value; | ||
</script> | ||
|
||
<input bind:value={value.name}> |
32 changes: 32 additions & 0 deletions
32
packages/svelte/tests/runtime-legacy/samples/component-binding-deep2/_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,32 @@ | ||
import { ok, test } from '../../test'; | ||
|
||
export default test({ | ||
html: ` | ||
<input> | ||
<p>foo</p> | ||
`, | ||
|
||
ssrHtml: ` | ||
<input value=foo> | ||
<p>foo</p> | ||
`, | ||
|
||
async test({ assert, component, target, window }) { | ||
const event = new window.MouseEvent('input'); | ||
const input = target.querySelector('input'); | ||
ok(input); | ||
|
||
input.value = 'blah'; | ||
await input.dispatchEvent(event); | ||
await Promise.resolve(); | ||
|
||
assert.deepEqual(component.deep, { name: 'blah' }); | ||
assert.htmlEqual( | ||
target.innerHTML, | ||
` | ||
<input> | ||
<p>blah</p> | ||
` | ||
); | ||
} | ||
}); |
11 changes: 11 additions & 0 deletions
11
packages/svelte/tests/runtime-legacy/samples/component-binding-deep2/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,11 @@ | ||
<script> | ||
import Widget from './Widget.svelte'; | ||
export let deep = { | ||
name: 'foo' | ||
}; | ||
</script> | ||
|
||
<Widget bind:value={deep}/> | ||
|
||
<p>{deep.name}</p> |