mirror of https://github.com/sveltejs/svelte
allow console.* calls in event handlers. fixes #782
parent
fbbaff5404
commit
58cc7f8ed1
@ -0,0 +1,3 @@
|
||||
const validCalleeObjects = new Set(['this', 'event', 'console']);
|
||||
|
||||
export default validCalleeObjects;
|
@ -0,0 +1,23 @@
|
||||
export default {
|
||||
data: {
|
||||
foo: 42
|
||||
},
|
||||
|
||||
html: `
|
||||
<button>click me</button>
|
||||
`,
|
||||
|
||||
test (assert, component, target, window) {
|
||||
const button = target.querySelector('button');
|
||||
const event = new window.MouseEvent('click');
|
||||
|
||||
const messages = [];
|
||||
|
||||
const log = console.log;
|
||||
console.log = msg => messages.push(msg);
|
||||
button.dispatchEvent(event);
|
||||
console.log = log;
|
||||
|
||||
assert.deepEqual(messages, [42]);
|
||||
}
|
||||
};
|
@ -0,0 +1 @@
|
||||
<button on:click='console.log(foo)'>click me</button>
|
Loading…
Reference in new issue