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.
svelte/test/runtime/samples/binding-select-initial-value/_config.js

38 lines
635 B

export default {
html: `
<p>selected: b</p>
<select>
7 years ago
<option value='a'>a</option>
<option value='b'>b</option>
<option value='c'>c</option>
</select>
<p>selected: b</p>
`,
ssrHtml: `
<p>selected: b</p>
<select value=b>
<option value='a'>a</option>
<option value='b'>b</option>
<option value='c'>c</option>
</select>
<p>selected: b</p>
`,
props: {
selected: 'b'
},
test({ assert, component, target }) {
const select = target.querySelector('select');
const options = [...target.querySelectorAll('option')];
assert.equal(select.value, 'b');
assert.ok(options[1].selected);
}
};