@@ -1812,6 +1812,7 @@ describe('ui-select tests', function() {
18121812 if ( attrs . groupBy !== undefined ) { choicesAttrsHtml += ' group-by="' + attrs . groupBy + '"' ; }
18131813 if ( attrs . lockChoice !== undefined ) { matchesAttrsHtml += ' ui-lock-choice="' + attrs . lockChoice + '"' ; }
18141814 if ( attrs . removeSelected !== undefined ) { attrsHtml += ' remove-selected="' + attrs . removeSelected + '"' ; }
1815+ if ( attrs . resetSearchInput !== undefined ) { attrsHtml += ' reset-search-input="' + attrs . resetSearchInput + '"' ; }
18151816 }
18161817
18171818 return compileTemplate (
@@ -2756,6 +2757,39 @@ describe('ui-select tests', function() {
27562757 clickItem ( el , 'Wladimir' ) ;
27572758 expect ( el . scope ( ) . $select . selected . length ) . toBe ( 2 ) ;
27582759 } ) ;
2760+
2761+ describe ( 'resetSearchInput option multiple' , function ( ) {
2762+ it ( 'should be false by default' , function ( ) {
2763+ expect ( createUiSelectMultiple ( ) . scope ( ) . $select . resetSearchInput ) . toBe ( false ) ;
2764+ } ) ;
2765+
2766+ it ( 'should be true when set.' , function ( ) {
2767+ expect ( createUiSelectMultiple ( { resetSearchInput : true } ) . scope ( ) . $select . resetSearchInput ) . toBe ( true ) ;
2768+ } ) ;
2769+ } ) ;
2770+
2771+ describe ( 'Reset the search value' , function ( ) {
2772+ it ( 'should clear the search input when resetSearchInput is true' , function ( ) {
2773+ var el = createUiSelectMultiple ( { resetSearchInput : true } ) ;
2774+ $ ( el ) . scope ( ) . $select . search = 'idontexist' ;
2775+ $ ( el ) . scope ( ) . $select . select ( 'idontexist' ) ;
2776+ expect ( $ ( el ) . scope ( ) . $select . search ) . toEqual ( '' ) ;
2777+ } ) ;
2778+
2779+ it ( 'should not clear the search input when resetSearchInput is false' , function ( ) {
2780+ var el = createUiSelectMultiple ( { resetSearchInput : false } ) ;
2781+ $ ( el ) . scope ( ) . $select . search = 'idontexist' ;
2782+ $ ( el ) . scope ( ) . $select . select ( 'idontexist' ) ;
2783+ expect ( $ ( el ) . scope ( ) . $select . search ) . toEqual ( 'idontexist' ) ;
2784+ } ) ;
2785+
2786+ it ( 'should not clear the search input when resetSearchInput is default set' , function ( ) {
2787+ var el = createUiSelectMultiple ( ) ;
2788+ $ ( el ) . scope ( ) . $select . search = 'idontexist' ;
2789+ $ ( el ) . scope ( ) . $select . select ( 'idontexist' ) ;
2790+ expect ( $ ( el ) . scope ( ) . $select . search ) . toEqual ( 'idontexist' ) ;
2791+ } ) ;
2792+ } ) ;
27592793 } ) ;
27602794
27612795 it ( 'should add an id to the search input field' , function ( ) {
0 commit comments