mirror of https://github.com/sveltejs/svelte
parent
9eec0fcd98
commit
abe486e7e3
@ -1 +0,0 @@
|
||||
<button on:click="{() => visible = !visible}" on:click="{() => ajax = false}"></button>
|
@ -1,96 +0,0 @@
|
||||
{
|
||||
"html": {
|
||||
"start": 0,
|
||||
"end": 87,
|
||||
"type": "Fragment",
|
||||
"children": [
|
||||
{
|
||||
"start": 0,
|
||||
"end": 87,
|
||||
"type": "Element",
|
||||
"name": "button",
|
||||
"attributes": [
|
||||
{
|
||||
"start": 8,
|
||||
"end": 45,
|
||||
"type": "EventHandler",
|
||||
"name": "click",
|
||||
"modifiers": [],
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start": 19,
|
||||
"end": 43,
|
||||
"id": null,
|
||||
"expression": true,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "AssignmentExpression",
|
||||
"start": 25,
|
||||
"end": 43,
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start": 25,
|
||||
"end": 32,
|
||||
"name": "visible"
|
||||
},
|
||||
"right": {
|
||||
"type": "UnaryExpression",
|
||||
"start": 35,
|
||||
"end": 43,
|
||||
"operator": "!",
|
||||
"prefix": true,
|
||||
"argument": {
|
||||
"type": "Identifier",
|
||||
"start": 36,
|
||||
"end": 43,
|
||||
"name": "visible"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"start": 46,
|
||||
"end": 77,
|
||||
"type": "EventHandler",
|
||||
"name": "click",
|
||||
"modifiers": [],
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start": 57,
|
||||
"end": 75,
|
||||
"id": null,
|
||||
"expression": true,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "AssignmentExpression",
|
||||
"start": 63,
|
||||
"end": 75,
|
||||
"operator": "=",
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start": 63,
|
||||
"end": 67,
|
||||
"name": "ajax"
|
||||
},
|
||||
"right": {
|
||||
"type": "Literal",
|
||||
"start": 70,
|
||||
"end": 75,
|
||||
"value": false,
|
||||
"raw": "false"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
export default {
|
||||
html: `
|
||||
<button>click me</button>
|
||||
`,
|
||||
|
||||
async test({ assert, component, target, window }) {
|
||||
const button = target.querySelector('button');
|
||||
const event = new window.MouseEvent('click');
|
||||
|
||||
await button.dispatchEvent(event);
|
||||
assert.equal(component.clickHandlerOne, 1);
|
||||
assert.equal(component.clickHandlerTwo, 1);
|
||||
}
|
||||
};
|
@ -0,0 +1,6 @@
|
||||
<script>
|
||||
export let clickHandlerOne = 0;
|
||||
export let clickHandlerTwo = 0;
|
||||
</script>
|
||||
|
||||
<button on:click='{() => clickHandlerOne++}' on:click='{() => clickHandlerTwo++}'>click me</button>
|
Loading…
Reference in new issue