mirror of https://github.com/sveltejs/svelte
parent
3560bbe85e
commit
fa60968ae1
@ -0,0 +1,23 @@
|
|||||||
|
import * as assert from 'assert';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data: {
|
||||||
|
name: 'world'
|
||||||
|
},
|
||||||
|
html: `<input>\n<p>hello world</p>`,
|
||||||
|
test ( 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, `<input>\n<p>hello everybody</p>` );
|
||||||
|
|
||||||
|
component.set({ name: 'goodbye' });
|
||||||
|
assert.equal( input.value, 'goodbye' );
|
||||||
|
assert.equal( target.innerHTML, `<input>\n<p>hello goodbye</p>` );
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
<input bind:value='name'>
|
||||||
|
<p>hello {{name}}</p>
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<input bind:value='name'>
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"html": {
|
||||||
|
"start": 0,
|
||||||
|
"end": 25,
|
||||||
|
"type": "Fragment",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"start": 0,
|
||||||
|
"end": 25,
|
||||||
|
"type": "Element",
|
||||||
|
"name": "input",
|
||||||
|
"attributes": [
|
||||||
|
{
|
||||||
|
"start": 7,
|
||||||
|
"end": 24,
|
||||||
|
"type": "Binding",
|
||||||
|
"name": "value",
|
||||||
|
"value": "name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"children": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"css": null,
|
||||||
|
"js": null
|
||||||
|
}
|
||||||
Loading…
Reference in new issue