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/packages/svelte/tests/runtime-legacy/samples/binding-select-initial-valu.../_config.js

29 lines
585 B

import { ok, test } from '../../test';
export default test({
mode: ['client', 'hydrate'],
html: `
<p>selected: b</p>
<select>
<option>a</option>
<option selected="">b</option>
<option>c</option>
</select>
<p>selected: b</p>
`,
test({ assert, component, target }) {
assert.equal(component.selected, 'b');
const select = target.querySelector('select');
ok(select);
const options = [...target.querySelectorAll('option')];
// option with selected attribute should be selected
assert.equal(select.value, 'b');
assert.ok(options[1].selected);
}
});