-
-
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.
Browse files
Browse the repository at this point in the history
recognise dependencies in class directives
- Loading branch information
Showing
6 changed files
with
63 additions
and
16 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
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: { | ||
things: ['one', 'two', 'three'], | ||
selected: 'two' | ||
}, | ||
|
||
html: ` | ||
<div></div> | ||
<div class="selected"></div> | ||
<div></div> | ||
`, | ||
|
||
test(assert, component, target) { | ||
component.set({ selected: 'three' }); | ||
assert.htmlEqual(target.innerHTML, ` | ||
<div></div> | ||
<div class=""></div> | ||
<div class="selected"></div> | ||
`); | ||
} | ||
}; |
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,3 @@ | ||
{#each things as thing} | ||
<div class:selected="selected === thing"></div> | ||
{/each} |
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> |