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.
35 lines
610 B
35 lines
610 B
8 years ago
|
export default {
|
||
|
data: {
|
||
|
items: [],
|
||
|
selected: null
|
||
|
},
|
||
|
|
||
|
html: `
|
||
|
<select></select>
|
||
|
<p>selected: nothing</p>
|
||
|
`,
|
||
|
|
||
|
test ( assert, component, target ) {
|
||
|
component.set({
|
||
|
items: [ 'one', 'two', 'three' ],
|
||
|
selected: 'two'
|
||
|
});
|
||
|
|
||
|
const options = target.querySelectorAll( 'option' );
|
||
|
assert.ok( !options[0].selected );
|
||
|
assert.ok( options[1].selected );
|
||
|
assert.ok( !options[2].selected );
|
||
|
|
||
|
assert.htmlEqual( target.innerHTML, `
|
||
|
<select>
|
||
|
<option>one</option>
|
||
|
<option>two</option>
|
||
|
<option>three</option>
|
||
|
</select>
|
||
|
<p>selected: two</p>
|
||
|
` );
|
||
|
|
||
|
component.destroy();
|
||
|
}
|
||
|
};
|