@@ -388,4 +388,58 @@ describe('LiveController rendering Tests', () => {
388
388
// verify the component *did* render ok
389
389
expect ( test . element ) . toHaveTextContent ( 'The season is: autumn' ) ;
390
390
} ) ;
391
+
392
+ it ( 'select the placeholder option tag after render' , async ( ) => {
393
+ const test = await createTest ( { } , ( data : any ) => `
394
+ <div ${ initComponent ( data ) } >
395
+ <form>
396
+ <select id="select_option_1">
397
+ <option value="">Choose option 1</option>
398
+ <option value="1">One</option>
399
+ <option value="2">Two</option>
400
+ <option value="3">Three</option>
401
+ </select>
402
+
403
+ <select id="select_option_2">
404
+ <option value="">Choose option 2</option>
405
+ <option value="1_1">One - One</option>
406
+ <option value="1_2">One - Two</option>
407
+ <option value="2_1">Two - One</option>
408
+ <option value="2_2">Two - Two</option>
409
+ <option value="3_1">Three - One</option>
410
+ <option value="3_2">Three - Two</option>
411
+ </select>
412
+ </form>
413
+ </div>
414
+ ` ) ;
415
+
416
+ test . expectsAjaxCall ( )
417
+ . willReturn ( ( data ) => `
418
+ <div ${ initComponent ( data ) } >
419
+ <form>
420
+ <select id="select_option_1">
421
+ <option value="">Choose option 1</option>
422
+ <option value="1">One</option>
423
+ <option value="2" selected>Two</option>
424
+ <option value="3">Three</option>
425
+ </select>
426
+
427
+ <select id="select_option_2">
428
+ <option value="">Choose option 2</option>
429
+ <option value="2_1">Two - One</option>
430
+ <option value="2_2">Two - Two</option>
431
+ </select>
432
+ </form>
433
+ </div>
434
+ ` ) ;
435
+
436
+ await test . component . render ( ) ;
437
+ const selectOption2 = test . element . querySelector ( '#select_option_2' ) as HTMLSelectElement ;
438
+
439
+ // verify the placeholder of the select option 2 is selected
440
+ expect ( selectOption2 . children [ 0 ] . hasAttribute ( 'selected' ) ) . toBe ( true ) ;
441
+
442
+ // verify the selectedIndex of the select option 2 is 0
443
+ expect ( selectOption2 . selectedIndex ) . toBe ( 0 ) ;
444
+ } ) ;
391
445
} ) ;
0 commit comments