@@ -1838,6 +1838,7 @@ describe('ui-select tests', function() {
1838
1838
if ( attrs . taggingLabel !== undefined ) { attrsHtml += ' tagging-label="' + attrs . taggingLabel + '"' ; }
1839
1839
if ( attrs . inputId !== undefined ) { attrsHtml += ' input-id="' + attrs . inputId + '"' ; }
1840
1840
if ( attrs . groupBy !== undefined ) { choicesAttrsHtml += ' group-by="' + attrs . groupBy + '"' ; }
1841
+ if ( attrs . uiDisableChoice !== undefined ) { choicesAttrsHtml += ' ui-disable-choice="' + attrs . uiDisableChoice + '"' ; }
1841
1842
if ( attrs . lockChoice !== undefined ) { matchesAttrsHtml += ' ui-lock-choice="' + attrs . lockChoice + '"' ; }
1842
1843
if ( attrs . removeSelected !== undefined ) { attrsHtml += ' remove-selected="' + attrs . removeSelected + '"' ; }
1843
1844
if ( attrs . resetSearchInput !== undefined ) { attrsHtml += ' reset-search-input="' + attrs . resetSearchInput + '"' ; }
@@ -2831,6 +2832,36 @@ describe('ui-select tests', function() {
2831
2832
$timeout . flush ( ) ;
2832
2833
expect ( scope . $model . name ) . toEqual ( 'Natasha' ) ;
2833
2834
expect ( el . scope ( ) . $select . selected . length ) . toEqual ( 2 ) ;
2835
+
2836
+ it ( 'should ignore disable items key up with tagging on false' , function ( ) {
2837
+ var el = createUiSelectMultiple ( { uiDisableChoice :"person.age == 12" , tagging :false } ) ;
2838
+ openDropdown ( el ) ;
2839
+ var searchInput = el . find ( '.ui-select-search' ) ;
2840
+ expect ( el . scope ( ) . $select . activeIndex ) . toBe ( - 1 ) ;
2841
+ triggerKeydown ( searchInput , Key . Down ) ;
2842
+ triggerKeydown ( searchInput , Key . Enter ) ;
2843
+ expect ( el . scope ( ) . $select . activeIndex ) . toBe ( 2 ) ;
2844
+ } ) ;
2845
+
2846
+ it ( 'should ignore disable items key up with tagging on true' , function ( ) {
2847
+ var el = createUiSelectMultiple ( { uiDisableChoice :"person.age == 12" , tagging :true } ) ;
2848
+ openDropdown ( el ) ;
2849
+ var searchInput = el . find ( '.ui-select-search' ) ;
2850
+ expect ( el . scope ( ) . $select . activeIndex ) . toBe ( - 1 ) ;
2851
+ triggerKeydown ( searchInput , Key . Down ) ;
2852
+ expect ( el . scope ( ) . $select . activeIndex ) . toBe ( 2 ) ;
2853
+ triggerKeydown ( searchInput , Key . Up ) ;
2854
+ expect ( el . scope ( ) . $select . activeIndex ) . toBe ( - 1 ) ;
2855
+ } ) ;
2856
+
2857
+ it ( 'should ignore disable items key down' , function ( ) {
2858
+ var el = createUiSelectMultiple ( { uiDisableChoice :"person.age == 12" } ) ;
2859
+ openDropdown ( el ) ;
2860
+ var searchInput = el . find ( '.ui-select-search' ) ;
2861
+ expect ( el . scope ( ) . $select . activeIndex ) . toBe ( 0 ) ;
2862
+ triggerKeydown ( searchInput , Key . Down ) ;
2863
+ triggerKeydown ( searchInput , Key . Enter ) ;
2864
+ expect ( el . scope ( ) . $select . activeIndex ) . toBe ( 2 ) ;
2834
2865
} ) ;
2835
2866
2836
2867
describe ( 'resetSearchInput option multiple' , function ( ) {
@@ -2842,6 +2873,7 @@ describe('ui-select tests', function() {
2842
2873
expect ( createUiSelectMultiple ( { resetSearchInput : false } ) . scope ( ) . $select . resetSearchInput ) . toBe ( false ) ;
2843
2874
} ) ;
2844
2875
} ) ;
2876
+
2845
2877
2846
2878
describe ( 'Reset the search value' , function ( ) {
2847
2879
it ( 'should clear the search input when resetSearchInput is true' , function ( ) {
@@ -3189,6 +3221,37 @@ describe('ui-select tests', function() {
3189
3221
triggerKeydown ( searchInput , Key . Up ) ;
3190
3222
expect ( el . scope ( ) . $select . activeIndex ) . toBe ( 0 ) ;
3191
3223
} ) ;
3192
- } ) ;
3193
3224
3225
+ it ( 'should ignore disable items key up with tagging on true' , function ( ) {
3226
+ var el = createUiSelect ( { uiDisableChoice :"person.age == 12" , tagging :true } ) ;
3227
+ openDropdown ( el ) ;
3228
+ var searchInput = el . find ( '.ui-select-search' ) ;
3229
+ expect ( el . scope ( ) . $select . activeIndex ) . toBe ( - 1 ) ;
3230
+ triggerKeydown ( searchInput , Key . Down ) ;
3231
+ expect ( el . scope ( ) . $select . activeIndex ) . toBe ( 2 ) ;
3232
+ triggerKeydown ( searchInput , Key . Up ) ;
3233
+ expect ( el . scope ( ) . $select . activeIndex ) . toBe ( - 1 ) ;
3234
+ } ) ;
3235
+
3236
+ it ( 'should ignore disable items key up with tagging on false' , function ( ) {
3237
+ var el = createUiSelect ( { uiDisableChoice :"person.age == 12" , tagging :false } ) ;
3238
+ openDropdown ( el ) ;
3239
+ var searchInput = el . find ( '.ui-select-search' ) ;
3240
+ expect ( el . scope ( ) . $select . activeIndex ) . toBe ( - 1 ) ;
3241
+ triggerKeydown ( searchInput , Key . Down ) ;
3242
+ triggerKeydown ( searchInput , Key . Enter ) ;
3243
+ expect ( el . scope ( ) . $select . activeIndex ) . toBe ( 2 ) ;
3244
+ } ) ;
3245
+
3246
+ it ( 'should ignore disable items key up with tagging on true with custom tag' , function ( ) {
3247
+ var el = createUiSelect ( { uiDisableChoice :"person.age == 12" , tagging :true , taggingLabel :'custom tag' } ) ;
3248
+ openDropdown ( el ) ;
3249
+ var searchInput = el . find ( '.ui-select-search' ) ;
3250
+ expect ( el . scope ( ) . $select . activeIndex ) . toBe ( - 1 ) ;
3251
+ triggerKeydown ( searchInput , Key . Down ) ;
3252
+ triggerKeydown ( searchInput , Key . Enter ) ;
3253
+ expect ( el . scope ( ) . $select . activeIndex ) . toBe ( 2 ) ;
3254
+ } ) ;
3255
+ } ) ;
3256
+ } ) ;
3194
3257
} ) ;
0 commit comments