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/component-events-fire-finally/_config.js

24 lines
539 B

export default {
test(assert, component) {
const events = [];
component.on('foo', (shouldThrow) => {
events.push(shouldThrow);
if (shouldThrow) {
throw new Error();
}
});
component.fire('foo', false);
assert.equal(events.toString(), 'false');
let threw = false;
try {
component.fire('foo', true);
} catch (err) {
threw = true;
}
assert.equal(threw, true);
assert.equal(events.toString(), 'false,true');
component.fire('foo', false);
assert.equal(events.toString(), 'false,true,false');
},
};