-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
treat component events the same as element events - fixes #1278
- Loading branch information
1 parent
8717ff8
commit 029e952
Showing
4 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<button on:click>click me</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export default { | ||
html: '<button>click me</button>', | ||
|
||
test(assert, component, target) { | ||
const button = target.querySelector('button'); | ||
const messages = []; | ||
|
||
const log = console.log; | ||
console.log = msg => { | ||
messages.push(msg); | ||
}; | ||
|
||
try { | ||
button.dispatchEvent(new window.MouseEvent('click')); | ||
assert.deepEqual(messages, [ | ||
'clicked' | ||
]); | ||
} catch (err) { | ||
console.log = log; | ||
throw err; | ||
} | ||
|
||
console.log = log; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Widget on:click="console.log('clicked')"/> | ||
|
||
<script> | ||
import Widget from './Widget.html'; | ||
|
||
export default { | ||
components: { Widget } | ||
}; | ||
</script> |