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/event-handler-each/_config.js

33 lines
562 B

export default {
data: {
items: [
'foo',
'bar',
'baz'
],
selected: 'foo'
},
html: `
<button>foo</button>
<button>bar</button>
<button>baz</button>
<p>selected: foo</p>
`,
test ( assert, component, target, window ) {
const buttons = target.querySelectorAll( 'button' );
const event = new window.MouseEvent( 'click' );
buttons[1].dispatchEvent( event );
assert.htmlEqual( target.innerHTML, `
<button>foo</button>
<button>bar</button>
<button>baz</button>
<p>selected: bar</p>
` );
component.destroy();
}
};