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-deconfli.../_config.js

37 lines
765 B

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