mirror of https://github.com/sveltejs/svelte
failing test for #495
parent
f9432d1a69
commit
52a30dc8e3
@ -0,0 +1,36 @@
|
|||||||
|
export default {
|
||||||
|
solo: true,
|
||||||
|
|
||||||
|
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( target.innerHTML, `
|
||||||
|
<h1>Hello everybody!</h1>
|
||||||
|
<input>
|
||||||
|
` );
|
||||||
|
|
||||||
|
component.set({ name: 'goodbye' });
|
||||||
|
assert.equal( input.value, 'goodbye' );
|
||||||
|
assert.equal( 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