File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
modules/angular2/test/forms Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -193,6 +193,31 @@ export function main() {
193193 } ) ;
194194 } ) ) ;
195195
196+ it ( "should support select" , inject ( [ AsyncTestCompleter ] , ( async ) => {
197+ var ctx = new MyComp ( new ControlGroup ( { "city" : new Control ( "SF" ) } ) ) ;
198+
199+ var t = `<div [control-group]="form">
200+ <select control="city">
201+ <option value="SF"></option>
202+ <option value="NYC"></option>
203+ </select>
204+ </div>` ;
205+
206+ compile ( MyComp , t , ctx , ( view ) => {
207+ var select = queryView ( view , "select" )
208+ var sfOption = queryView ( view , "option" )
209+ expect ( select . value ) . toEqual ( 'SF' ) ;
210+ expect ( sfOption . selected ) . toBe ( true ) ;
211+
212+ select . value = 'NYC' ;
213+ dispatchEvent ( select , "change" ) ;
214+
215+ expect ( ctx . form . value ) . toEqual ( { "city" : 'NYC' } ) ;
216+ expect ( sfOption . selected ) . toBe ( false ) ;
217+ async . done ( ) ;
218+ } ) ;
219+ } ) ) ;
220+
196221 it ( "should support custom value accessors" , inject ( [ AsyncTestCompleter ] , ( async ) => {
197222 var ctx = new MyComp ( new ControlGroup ( { "name" : new Control ( "aa" ) } ) ) ;
198223
You can’t perform that action at this time.
0 commit comments