@@ -66,6 +66,7 @@ describe('ui-select tests', function() {
66
66
if ( attrs . disabled !== undefined ) { attrsHtml += ' ng-disabled="' + attrs . disabled + '"' ; }
67
67
if ( attrs . required !== undefined ) { attrsHtml += ' ng-required="' + attrs . required + '"' ; }
68
68
if ( attrs . theme !== undefined ) { attrsHtml += ' theme="' + attrs . theme + '"' ; }
69
+ if ( attrs . tabindex !== undefined ) { attrsHtml += ' tabindex="' + attrs . tabindex + '"' ; }
69
70
}
70
71
71
72
return compileTemplate (
@@ -204,7 +205,28 @@ describe('ui-select tests', function() {
204
205
205
206
el . find ( ".ui-select-toggle" ) . click ( ) ;
206
207
expect ( $select . open ) . toEqual ( false ) ;
208
+ } ) ;
209
+
210
+ it ( 'should pass tabindex to focusser' , function ( ) {
211
+ var el = createUiSelect ( { tabindex : 5 } ) ;
212
+
213
+ expect ( $ ( el ) . find ( '.ui-select-focusser' ) . attr ( 'tabindex' ) ) . toEqual ( '5' ) ;
214
+ expect ( $ ( el ) . attr ( 'tabindex' ) ) . toEqual ( undefined ) ;
215
+ } ) ;
216
+
217
+ it ( 'should pass tabindex to focusser when tabindex is an expression' , function ( ) {
218
+ scope . tabValue = 22 ;
219
+ var el = createUiSelect ( { tabindex : '{{tabValue + 10}}' } ) ;
207
220
221
+ expect ( $ ( el ) . find ( '.ui-select-focusser' ) . attr ( 'tabindex' ) ) . toEqual ( '32' ) ;
222
+ expect ( $ ( el ) . attr ( 'tabindex' ) ) . toEqual ( undefined ) ;
223
+ } ) ;
224
+
225
+ it ( 'should not give focusser a tabindex when ui-select does not have one' , function ( ) {
226
+ var el = createUiSelect ( ) ;
227
+
228
+ expect ( $ ( el ) . find ( '.ui-select-focusser' ) . attr ( 'tabindex' ) ) . toEqual ( undefined ) ;
229
+ expect ( $ ( el ) . attr ( 'tabindex' ) ) . toEqual ( undefined ) ;
208
230
} ) ;
209
231
210
232
it ( 'should be disabled if the attribute says so' , function ( ) {
@@ -751,6 +773,7 @@ describe('ui-select tests', function() {
751
773
if ( attrs !== undefined ) {
752
774
if ( attrs . disabled !== undefined ) { attrsHtml += ' ng-disabled="' + attrs . disabled + '"' ; }
753
775
if ( attrs . required !== undefined ) { attrsHtml += ' ng-required="' + attrs . required + '"' ; }
776
+ if ( attrs . tabindex !== undefined ) { attrsHtml += ' tabindex="' + attrs . tabindex + '"' ; }
754
777
}
755
778
756
779
return compileTemplate (
@@ -796,6 +819,31 @@ describe('ui-select tests', function() {
796
819
// $timeout.flush();
797
820
} ) ;
798
821
822
+ it ( 'should pass tabindex to searchInput' , function ( ) {
823
+ var el = createUiSelectMultiple ( { tabindex : 5 } ) ;
824
+ var searchInput = el . find ( '.ui-select-search' ) ;
825
+
826
+ expect ( searchInput . attr ( 'tabindex' ) ) . toEqual ( '5' ) ;
827
+ expect ( $ ( el ) . attr ( 'tabindex' ) ) . toEqual ( undefined ) ;
828
+ } ) ;
829
+
830
+ it ( 'should pass tabindex to searchInput when tabindex is an expression' , function ( ) {
831
+ scope . tabValue = 22 ;
832
+ var el = createUiSelectMultiple ( { tabindex : '{{tabValue + 10}}' } ) ;
833
+ var searchInput = el . find ( '.ui-select-search' ) ;
834
+
835
+ expect ( searchInput . attr ( 'tabindex' ) ) . toEqual ( '32' ) ;
836
+ expect ( $ ( el ) . attr ( 'tabindex' ) ) . toEqual ( undefined ) ;
837
+ } ) ;
838
+
839
+ it ( 'should not give searchInput a tabindex when ui-select does not have one' , function ( ) {
840
+ var el = createUiSelectMultiple ( ) ;
841
+ var searchInput = el . find ( '.ui-select-search' ) ;
842
+
843
+ expect ( searchInput . attr ( 'tabindex' ) ) . toEqual ( undefined ) ;
844
+ expect ( $ ( el ) . attr ( 'tabindex' ) ) . toEqual ( undefined ) ;
845
+ } ) ;
846
+
799
847
it ( 'should update size of search input after removing an item' , function ( ) {
800
848
scope . selection . selectedMultiple = [ scope . people [ 4 ] , scope . people [ 5 ] ] ; //Wladimir & Samantha
801
849
var el = createUiSelectMultiple ( ) ;
0 commit comments