forked from sveltejs/svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sveltejs#2446 - apply directives in order
- Loading branch information
1 parent
ec74b21
commit 6f491a5
Showing
3 changed files
with
230 additions
and
2 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,37 @@ | ||
export default { | ||
props: { | ||
value: '' | ||
}, | ||
|
||
html: ` | ||
<input> | ||
<p></p> | ||
`, | ||
|
||
ssrHtml: ` | ||
<input> | ||
<p></p> | ||
`, | ||
|
||
async test({ assert, component, target, window }) { | ||
const input = target.querySelector('input'); | ||
|
||
const event = new window.Event('input'); | ||
input.value = 'h'; | ||
await input.dispatchEvent(event); | ||
|
||
assert.equal(input.value, 'H'); | ||
assert.htmlEqual(target.innerHTML, ` | ||
<input> | ||
<p>H</p> | ||
`); | ||
|
||
input.value = 'he'; | ||
await input.dispatchEvent(event); | ||
assert.equal(input.value, 'HE'); | ||
assert.htmlEqual(target.innerHTML, ` | ||
<input> | ||
<p>HE</p> | ||
`); | ||
}, | ||
}; |
10 changes: 10 additions & 0 deletions
10
test/runtime/samples/apply-directives-in-order/main.svelte
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 @@ | ||
<script> | ||
export let value; | ||
|
||
function uppercase(event) { | ||
event.target.value = event.target.value.toUpperCase() | ||
} | ||
</script> | ||
|
||
<input on:input={uppercase} bind:value> | ||
<p>{value}</p> |