-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make event handler names unique across components - fixes #1919
- Loading branch information
Richard Harris
authored and
Richard Harris
committed
Dec 29, 2018
1 parent
ff2a21e
commit fc0b49e
Showing
3 changed files
with
43 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
37 changes: 37 additions & 0 deletions
37
test/runtime/samples/binding-input-text-contextual-deconflicted/_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,37 @@ | ||
export default { | ||
props: { | ||
foo: 'a', | ||
items: ['x'], | ||
}, | ||
|
||
html: ` | ||
<div><input><p>a</p></div> | ||
<div><input><p>x</p></div> | ||
`, | ||
|
||
ssrHtml: ` | ||
<div><input value=a><p>a</p></div> | ||
<div><input value=x><p>x</p></div> | ||
`, | ||
|
||
async test({ assert, component, target, window }) { | ||
const inputs = [...target.querySelectorAll('input')]; | ||
const items = component.items; | ||
const event = new window.Event('input'); | ||
|
||
assert.equal(inputs[0].value, 'a'); | ||
|
||
inputs[0].value = 'b'; | ||
inputs[1].value = 'y'; | ||
await inputs[0].dispatchEvent(event); | ||
await inputs[1].dispatchEvent(event); | ||
|
||
assert.equal(component.foo, 'b'); | ||
assert.equal(component.items[0], 'y'); | ||
|
||
assert.htmlEqual(target.innerHTML, ` | ||
<div><input><p>b</p></div> | ||
<div><input><p>y</p></div> | ||
`); | ||
}, | ||
}; |
5 changes: 5 additions & 0 deletions
5
test/runtime/samples/binding-input-text-contextual-deconflicted/main.html
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 @@ | ||
<div><input bind:value={foo}><p>{foo}</p></div> | ||
|
||
{#each items as bar} | ||
<div><input bind:value={bar}><p>{bar}</p></div> | ||
{/each} |