@@ -245,11 +245,13 @@ describe('Combobox', () => {
245245 it ( 'should close then clear the completion string' , ( ) => {
246246 fixture . componentInstance . filterMode . set ( 'highlight' ) ;
247247 focus ( ) ;
248- input ( 'A ' ) ;
248+ input ( 'Ala ' ) ;
249249 expect ( inputElement . value ) . toBe ( 'Alabama' ) ;
250250 expect ( inputElement . getAttribute ( 'aria-expanded' ) ) . toBe ( 'true' ) ;
251251 escape ( ) ;
252252 expect ( inputElement . value ) . toBe ( 'Alabama' ) ;
253+ expect ( inputElement . selectionEnd ) . toBe ( 7 ) ;
254+ expect ( inputElement . selectionStart ) . toBe ( 3 ) ;
253255 expect ( inputElement . getAttribute ( 'aria-expanded' ) ) . toBe ( 'false' ) ; // close
254256 escape ( ) ;
255257 expect ( inputElement . value ) . toBe ( '' ) ; // clear input
@@ -460,15 +462,15 @@ describe('Combobox', () => {
460462 // TODO(wagnermaciel): Add unit tests for disabled options.
461463
462464 describe ( 'Filtering' , ( ) => {
463- beforeEach ( ( ) => setupCombobox ( ) ) ;
464-
465465 it ( 'should lazily render options' , ( ) => {
466+ setupCombobox ( ) ;
466467 expect ( getOptions ( ) . length ) . toBe ( 0 ) ;
467468 focus ( ) ;
468469 expect ( getOptions ( ) . length ) . toBe ( 50 ) ;
469470 } ) ;
470471
471472 it ( 'should filter the options based on the input value' , ( ) => {
473+ setupCombobox ( ) ;
472474 focus ( ) ;
473475 input ( 'New' ) ;
474476
@@ -481,13 +483,15 @@ describe('Combobox', () => {
481483 } ) ;
482484
483485 it ( 'should show no options if nothing matches' , ( ) => {
486+ setupCombobox ( ) ;
484487 focus ( ) ;
485488 input ( 'xyz' ) ;
486489 const options = getOptions ( ) ;
487490 expect ( options . length ) . toBe ( 0 ) ;
488491 } ) ;
489492
490493 it ( 'should show all options when the input is cleared' , ( ) => {
494+ setupCombobox ( ) ;
491495 focus ( ) ;
492496 input ( 'Alabama' ) ;
493497 expect ( getOptions ( ) . length ) . toBe ( 1 ) ;
0 commit comments