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/select-in-each/_config.js

34 lines
727 B

import { flushSync } from 'svelte';
import { ok, test } from '../../test';
export default test({
test({ assert, target, variant }) {
assert.htmlEqual(
target.innerHTML,
`
<select>
<option${variant === 'hydrate' ? ' selected' : ''} value="a">A</option$>
<option value="b">B</option>
</select>
selected: a
`
);
const select = target.querySelector('select');
ok(select);
const event = new window.Event('change');
select.value = 'b';
select.dispatchEvent(event);
flushSync();
assert.htmlEqual(
target.innerHTML,
`
<select>
<option${variant === 'hydrate' ? ' selected' : ''} value="a">A</option$>
<option value="b">B</option>
</select>
selected: b
`
);
}
});