File tree Expand file tree Collapse file tree 3 files changed +48
-3
lines changed
test/runtime/samples/binding-select-optgroup Expand file tree Collapse file tree 3 files changed +48
-3
lines changed Original file line number Diff line number Diff line change @@ -309,7 +309,7 @@ const preprocessors = {
309
309
stripWhitespace : boolean ,
310
310
nextSibling : Node
311
311
) => {
312
- if ( node . name === 'slot' ) {
312
+ if ( node . name === 'slot' || node . name === 'option' ) {
313
313
cannotUseInnerHTML ( node ) ;
314
314
}
315
315
@@ -369,8 +369,6 @@ const preprocessors = {
369
369
// so that if `foo.qux` changes, we know that we need to
370
370
// mark `bar` and `baz` as dirty too
371
371
if ( node . name === 'select' ) {
372
- cannotUseInnerHTML ( node ) ;
373
-
374
372
const value = node . attributes . find (
375
373
( attribute : Node ) => attribute . name === 'value'
376
374
) ;
Original file line number Diff line number Diff line change
1
+ export default {
2
+ skip : true , // JSDOM
3
+
4
+ html : `
5
+ <h1>Hello Harry!</h1>
6
+
7
+ <select>
8
+ <option value="Harry">Harry</option>
9
+ <optgroup label="Group">
10
+ <option value="World">World</option>
11
+ </optgroup>
12
+ </select>
13
+ ` ,
14
+
15
+ test ( assert , component , target , window ) {
16
+ const select = target . querySelector ( 'select' ) ;
17
+ const options = [ ...target . querySelectorAll ( 'option' ) ] ;
18
+
19
+ assert . deepEqual ( options , select . options ) ;
20
+ assert . equal ( component . get ( 'name' ) , 'Harry' ) ;
21
+
22
+ const change = new window . Event ( 'change' ) ;
23
+
24
+ options [ 1 ] . selected = true ;
25
+ select . dispatchEvent ( change ) ;
26
+
27
+ assert . equal ( component . get ( 'name' ) , 'World' ) ;
28
+ assert . htmlEqual ( target . innerHTML , `
29
+ <h1>Hello World!</h1>
30
+
31
+ <select>
32
+ <option value="Harry">Harry</option>
33
+ <optgroup label="Group">
34
+ <option value="World">World</option>
35
+ </optgroup>
36
+ </select>
37
+ ` ) ;
38
+ } ,
39
+ } ;
Original file line number Diff line number Diff line change
1
+ < h1 > Hello {{name}}!</ h1 >
2
+
3
+ < select bind:value ="name ">
4
+ < option value ="Harry "> Harry</ option >
5
+ < optgroup label ="Group ">
6
+ < option value ="World "> World</ option >
7
+ </ optgroup >
8
+ </ select >
You can’t perform that action at this time.
0 commit comments