@@ -66,6 +66,7 @@ describe('ui-select tests', function() {
6666 if ( attrs . disabled !== undefined ) { attrsHtml += ' ng-disabled="' + attrs . disabled + '"' ; }
6767 if ( attrs . required !== undefined ) { attrsHtml += ' ng-required="' + attrs . required + '"' ; }
6868 if ( attrs . theme !== undefined ) { attrsHtml += ' theme="' + attrs . theme + '"' ; }
69+ if ( attrs . tabindex !== undefined ) { attrsHtml += ' tabindex="' + attrs . tabindex + '"' ; }
6970 }
7071
7172 return compileTemplate (
@@ -204,7 +205,28 @@ describe('ui-select tests', function() {
204205
205206 el . find ( ".ui-select-toggle" ) . click ( ) ;
206207 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}}' } ) ;
207220
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 ) ;
208230 } ) ;
209231
210232 it ( 'should be disabled if the attribute says so' , function ( ) {
@@ -751,6 +773,7 @@ describe('ui-select tests', function() {
751773 if ( attrs !== undefined ) {
752774 if ( attrs . disabled !== undefined ) { attrsHtml += ' ng-disabled="' + attrs . disabled + '"' ; }
753775 if ( attrs . required !== undefined ) { attrsHtml += ' ng-required="' + attrs . required + '"' ; }
776+ if ( attrs . tabindex !== undefined ) { attrsHtml += ' tabindex="' + attrs . tabindex + '"' ; }
754777 }
755778
756779 return compileTemplate (
@@ -796,6 +819,31 @@ describe('ui-select tests', function() {
796819 // $timeout.flush();
797820 } ) ;
798821
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+
799847 it ( 'should update size of search input after removing an item' , function ( ) {
800848 scope . selection . selectedMultiple = [ scope . people [ 4 ] , scope . people [ 5 ] ] ; //Wladimir & Samantha
801849 var el = createUiSelectMultiple ( ) ;
0 commit comments