-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix] handle undefined select value with spread (#6687)
- Loading branch information
1 parent
5df60e7
commit fc9241f
Showing
4 changed files
with
35 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
12 changes: 12 additions & 0 deletions
12
test/runtime/samples/spread-element-select-value-undefined/Select.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,12 @@ | ||
<script> | ||
export let options = []; | ||
export let value = ""; | ||
export let label = ""; | ||
</script> | ||
|
||
<select bind:value {...$$restProps}> | ||
{#each options as option} | ||
<option>{option}</option> | ||
{/each} | ||
</select> | ||
<p>{label}</p> |
11 changes: 11 additions & 0 deletions
11
test/runtime/samples/spread-element-select-value-undefined/_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,11 @@ | ||
export default { | ||
async test({ assert, component, target, window }) { | ||
const select = target.querySelector('select'); | ||
|
||
assert.equal(select.value, '1'); | ||
|
||
component.label = 'hoge'; | ||
|
||
assert.equal(select.value, '1'); | ||
} | ||
}; |
11 changes: 11 additions & 0 deletions
11
test/runtime/samples/spread-element-select-value-undefined/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,11 @@ | ||
<script> | ||
import Select from "./Select.svelte"; | ||
let value = { | ||
a: "1", | ||
b: "1", | ||
}; | ||
const options = ["1", "2", "3"]; | ||
export let label = "test"; | ||
</script> | ||
|
||
<Select bind:value={value.a} {options} label={label} /> |