-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extend dependency tracking to all directives
- Loading branch information
1 parent
3258779
commit 073c876
Showing
3 changed files
with
36 additions
and
7 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
21 changes: 21 additions & 0 deletions
21
test/runtime/samples/event-handler-each-context/_config.js
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,21 @@ | ||
export default { | ||
data: { | ||
items: [ | ||
'whatever' | ||
], | ||
foo: 'wrong', | ||
bar: 'right' | ||
}, | ||
|
||
test(assert, component, target, window) { | ||
const button = target.querySelector('button'); | ||
const event = new window.MouseEvent('click'); | ||
|
||
button.dispatchEvent(event); | ||
assert.equal(component.get().foo, 'right'); | ||
|
||
component.set({ bar: 'left' }); | ||
button.dispatchEvent(event); | ||
assert.equal(component.get().foo, 'left'); | ||
} | ||
}; |
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,5 @@ | ||
{#each items as item} | ||
<button on:click='set({ foo: bar })'>{item}</button> | ||
{/each} | ||
|
||
<p>foo: {foo}</p> |