@@ -373,10 +373,10 @@ if (_.inBrowser) {
373373 _ . nextTick ( function ( ) {
374374 expect ( el . firstChild . innerHTML ) . toBe (
375375 '<optgroup label="X">' +
376- '<option value="x">x</option><option value="y">y</option>' +
376+ '<option value="x">x</option><option value="y">y</option>' +
377377 '</optgroup>' +
378378 '<optgroup label="Y">' +
379- '<option value="z">z</option>' +
379+ '<option value="z">z</option>' +
380380 '</optgroup>'
381381 )
382382 var opts = el . firstChild . options
@@ -387,6 +387,33 @@ if (_.inBrowser) {
387387 } )
388388 } )
389389
390+ it ( 'select + options + optgroup + default option' , function ( done ) {
391+ var vm = new Vue ( {
392+ el : el ,
393+ data : {
394+ test : '' ,
395+ opts : [
396+ { label : 'A' , options : [ 'a' , 'b' ] } ,
397+ { label : 'B' , options : [ 'c' ] }
398+ ]
399+ } ,
400+ template : '<select v-model="test" options="opts"><option value=""></option></select>'
401+ } )
402+ var opts = el . firstChild . options
403+ expect ( opts [ 0 ] . selected ) . toBe ( true )
404+ expect ( el . firstChild . value ) . toBe ( '' )
405+ vm . opts = [
406+ { label : 'X' , options : [ 'x' , 'y' ] } ,
407+ { label : 'Y' , options : [ 'z' ] }
408+ ]
409+ _ . nextTick ( function ( ) {
410+ var opts = el . firstChild . options
411+ expect ( opts [ 0 ] . selected ) . toBe ( true )
412+ expect ( el . firstChild . value ) . toBe ( '' )
413+ done ( )
414+ } )
415+ } )
416+
390417 it ( 'select + options with Object value' , function ( done ) {
391418 var vm = new Vue ( {
392419 el : el ,
0 commit comments