@@ -427,10 +427,10 @@ if (_.inBrowser) {
427427 _ . nextTick ( function ( ) {
428428 expect ( el . firstChild . innerHTML ) . toBe (
429429 '<optgroup label="X">' +
430- '<option value="x">x</option><option value="y">y</option>' +
430+ '<option value="x">x</option><option value="y">y</option>' +
431431 '</optgroup>' +
432432 '<optgroup label="Y">' +
433- '<option value="z">z</option>' +
433+ '<option value="z">z</option>' +
434434 '</optgroup>'
435435 )
436436 var opts = el . firstChild . options
@@ -441,6 +441,33 @@ if (_.inBrowser) {
441441 } )
442442 } )
443443
444+ it ( 'select + options + optgroup + default option' , function ( done ) {
445+ var vm = new Vue ( {
446+ el : el ,
447+ data : {
448+ test : '' ,
449+ opts : [
450+ { label : 'A' , options : [ 'a' , 'b' ] } ,
451+ { label : 'B' , options : [ 'c' ] }
452+ ]
453+ } ,
454+ template : '<select v-model="test" options="opts"><option value=""></option></select>'
455+ } )
456+ var opts = el . firstChild . options
457+ expect ( opts [ 0 ] . selected ) . toBe ( true )
458+ expect ( el . firstChild . value ) . toBe ( '' )
459+ vm . opts = [
460+ { label : 'X' , options : [ 'x' , 'y' ] } ,
461+ { label : 'Y' , options : [ 'z' ] }
462+ ]
463+ _ . nextTick ( function ( ) {
464+ var opts = el . firstChild . options
465+ expect ( opts [ 0 ] . selected ) . toBe ( true )
466+ expect ( el . firstChild . value ) . toBe ( '' )
467+ done ( )
468+ } )
469+ } )
470+
444471 it ( 'select + options with Object value' , function ( done ) {
445472 var vm = new Vue ( {
446473 el : el ,
0 commit comments