mirror of https://github.com/sveltejs/svelte
Merge pull request #499 from sveltejs/gh-495
Deconflict variable names used in binding event handlerspull/506/head
commit
0ed26a8076
@ -0,0 +1,35 @@
|
||||
export default {
|
||||
data: {
|
||||
component: {
|
||||
name: 'world'
|
||||
}
|
||||
},
|
||||
|
||||
html: `
|
||||
<h1>Hello world!</h1>
|
||||
<input>
|
||||
`,
|
||||
|
||||
test ( assert, component, target, window ) {
|
||||
const input = target.querySelector( 'input' );
|
||||
assert.equal( input.value, 'world' );
|
||||
|
||||
const event = new window.Event( 'input' );
|
||||
|
||||
input.value = 'everybody';
|
||||
input.dispatchEvent( event );
|
||||
|
||||
assert.equal( input.value, 'everybody' );
|
||||
assert.htmlEqual( target.innerHTML, `
|
||||
<h1>Hello everybody!</h1>
|
||||
<input>
|
||||
` );
|
||||
|
||||
component.set({ component: { name: 'goodbye' } });
|
||||
assert.equal( input.value, 'goodbye' );
|
||||
assert.htmlEqual( target.innerHTML, `
|
||||
<h1>Hello goodbye!</h1>
|
||||
<input>
|
||||
` );
|
||||
}
|
||||
};
|
@ -0,0 +1,2 @@
|
||||
<h1>Hello {{component.name}}!</h1>
|
||||
<input bind:value="component.name"/>
|
Loading…
Reference in new issue