export default {
props: {
items: ['foo', 'bar', 'baz'],
},
html: `
`,
test({ assert, component, target, window }) {
const buttons = target.querySelectorAll('button');
const event = new window.MouseEvent('click');
const clicked = [];
component.$on('clicked', event => {
clicked.push(event.detail.node);
});
buttons[1].dispatchEvent(event);
assert.equal(clicked.length, 1);
assert.equal(clicked[0].nodeName, 'BUTTON');
assert.equal(clicked[0].textContent, 'bar');
}
};