@@ -1812,6 +1812,7 @@ describe('ui-select tests', function() {
1812
1812
if ( attrs . groupBy !== undefined ) { choicesAttrsHtml += ' group-by="' + attrs . groupBy + '"' ; }
1813
1813
if ( attrs . lockChoice !== undefined ) { matchesAttrsHtml += ' ui-lock-choice="' + attrs . lockChoice + '"' ; }
1814
1814
if ( attrs . removeSelected !== undefined ) { attrsHtml += ' remove-selected="' + attrs . removeSelected + '"' ; }
1815
+ if ( attrs . resetSearchInput !== undefined ) { attrsHtml += ' reset-search-input="' + attrs . resetSearchInput + '"' ; }
1815
1816
}
1816
1817
1817
1818
return compileTemplate (
@@ -2756,6 +2757,39 @@ describe('ui-select tests', function() {
2756
2757
clickItem ( el , 'Wladimir' ) ;
2757
2758
expect ( el . scope ( ) . $select . selected . length ) . toBe ( 2 ) ;
2758
2759
} ) ;
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
+ } ) ;
2759
2793
} ) ;
2760
2794
2761
2795
it ( 'should add an id to the search input field' , function ( ) {
0 commit comments