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.
Fix sveltejs#4803 by changing setAttributes to set value as well as _…
…_value
- Loading branch information
Showing
5 changed files
with
54 additions
and
1 deletion.
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
15 changes: 15 additions & 0 deletions
15
test/runtime/samples/spread-element-input-bind-group-with-value-attr/_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,15 @@ | ||
export default { | ||
props: { | ||
props: { | ||
'data-foo': 'bar' | ||
} | ||
}, | ||
|
||
html: `<input data-foo="bar" type="radio" value="abc">`, | ||
|
||
async test({ assert, component, target, window }) { | ||
const input = target.querySelector('input'); | ||
assert.equal(input.value, 'abc'); | ||
assert.equal(input.__value, 'abc'); | ||
} | ||
}; |
6 changes: 6 additions & 0 deletions
6
test/runtime/samples/spread-element-input-bind-group-with-value-attr/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,6 @@ | ||
<script> | ||
export let props; | ||
let radioValue; | ||
</script> | ||
|
||
<input type="radio" value="abc" {...props} bind:group={radioValue} /> |
22 changes: 22 additions & 0 deletions
22
test/runtime/samples/spread-element-input-bind-group-with-value-in-spread/_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,22 @@ | ||
export default { | ||
// This fails because the test checks for __value being set on the node, which | ||
// bind:group requires to work, but when a spread is used to set `value` on the | ||
// element, the code that also sets `__value` on the node is not triggered. | ||
// This is issue #4808. | ||
skip: true, | ||
|
||
props: { | ||
props: { | ||
'data-foo': 'bar', | ||
value: 'abc' | ||
} | ||
}, | ||
|
||
html: `<input data-foo="bar" type="radio" value="abc">`, | ||
|
||
async test({ assert, component, target, window }) { | ||
const input = target.querySelector('input'); | ||
assert.equal(input.value, 'abc'); | ||
assert.equal(input.__value, 'abc'); | ||
} | ||
}; |
6 changes: 6 additions & 0 deletions
6
test/runtime/samples/spread-element-input-bind-group-with-value-in-spread/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,6 @@ | ||
<script> | ||
export let props; | ||
let radioValue; | ||
</script> | ||
|
||
<input type="radio" {...props} bind:group={radioValue} /> |