mirror of https://github.com/sveltejs/svelte
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
610 B
30 lines
610 B
8 years ago
|
export default {
|
||
|
data: {
|
||
8 years ago
|
user: {
|
||
|
name: 'alice'
|
||
|
}
|
||
8 years ago
|
},
|
||
8 years ago
|
|
||
8 years ago
|
html: `<input>\n<p>hello alice</p>`,
|
||
8 years ago
|
|
||
8 years ago
|
test ( assert, component, target, window ) {
|
||
8 years ago
|
const input = target.querySelector( 'input' );
|
||
8 years ago
|
|
||
8 years ago
|
assert.equal( input.value, 'alice' );
|
||
8 years ago
|
|
||
|
const event = new window.Event( 'input' );
|
||
|
|
||
8 years ago
|
input.value = 'bob';
|
||
|
input.dispatchEvent( event );
|
||
8 years ago
|
|
||
8 years ago
|
assert.equal( target.innerHTML, `<input>\n<p>hello bob</p>` );
|
||
8 years ago
|
|
||
8 years ago
|
const user = component.get( 'user' );
|
||
|
user.name = 'carol';
|
||
8 years ago
|
|
||
8 years ago
|
component.set({ user });
|
||
|
assert.equal( input.value, 'carol' );
|
||
|
assert.equal( target.innerHTML, `<input>\n<p>hello carol</p>` );
|
||
8 years ago
|
}
|
||
|
};
|