-
-
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.
component store bindings - fixes #1100
- Loading branch information
1 parent
29a1569
commit 99fbb69
Showing
4 changed files
with
87 additions
and
19 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 @@ | ||
<input bind:value> |
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,28 @@ | ||
import { Store } from '../../../../store.js'; | ||
|
||
const store = new Store({ | ||
name: 'world' | ||
}); | ||
|
||
export default { | ||
store, | ||
|
||
html: ` | ||
<h1>Hello world!</h1> | ||
<input> | ||
`, | ||
|
||
test(assert, component, target, window) { | ||
const input = target.querySelector('input'); | ||
const event = new window.Event('input'); | ||
|
||
input.value = 'everybody'; | ||
input.dispatchEvent(event); | ||
|
||
assert.equal(store.get('name'), 'everybody'); | ||
assert.htmlEqual(target.innerHTML, ` | ||
<h1>Hello everybody!</h1> | ||
<input> | ||
`); | ||
} | ||
}; |
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,10 @@ | ||
<h1>Hello {{$name}}!</h1> | ||
<TextInput bind:value=$name/> | ||
|
||
<script> | ||
import TextInput from './TextInput.html'; | ||
|
||
export default { | ||
components: { TextInput } | ||
}; | ||
</script> |