-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dont use innerHTML for options inside optgroups - fixes #915
- Loading branch information
1 parent
be0837e
commit d28942d
Showing
3 changed files
with
48 additions
and
3 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,39 @@ | ||
export default { | ||
skip: true, // JSDOM | ||
|
||
html: ` | ||
<h1>Hello Harry!</h1> | ||
<select> | ||
<option value="Harry">Harry</option> | ||
<optgroup label="Group"> | ||
<option value="World">World</option> | ||
</optgroup> | ||
</select> | ||
`, | ||
|
||
test(assert, component, target, window) { | ||
const select = target.querySelector('select'); | ||
const options = [...target.querySelectorAll('option')]; | ||
|
||
assert.deepEqual(options, select.options); | ||
assert.equal(component.get('name'), 'Harry'); | ||
|
||
const change = new window.Event('change'); | ||
|
||
options[1].selected = true; | ||
select.dispatchEvent(change); | ||
|
||
assert.equal(component.get('name'), 'World'); | ||
assert.htmlEqual(target.innerHTML, ` | ||
<h1>Hello World!</h1> | ||
<select> | ||
<option value="Harry">Harry</option> | ||
<optgroup label="Group"> | ||
<option value="World">World</option> | ||
</optgroup> | ||
</select> | ||
`); | ||
}, | ||
}; |
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,8 @@ | ||
<h1>Hello {{name}}!</h1> | ||
|
||
<select bind:value="name"> | ||
<option value="Harry">Harry</option> | ||
<optgroup label="Group"> | ||
<option value="World">World</option> | ||
</optgroup> | ||
</select> |