mirror of https://github.com/sveltejs/svelte
in .fire always set calling flag back to false (#1573)
parent
7774c6d92a
commit
39930dcbcc
@ -0,0 +1,23 @@
|
|||||||
|
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');
|
||||||
|
},
|
||||||
|
};
|
@ -0,0 +1 @@
|
|||||||
|
Foo
|
Loading…
Reference in new issue