File tree Expand file tree Collapse file tree 4 files changed +8
-10
lines changed Expand file tree Collapse file tree 4 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -11,13 +11,11 @@ import {pressKeys} from '../util/index';
11
11
12
12
describe ( 'tabs' , ( ) => {
13
13
describe ( 'basic behavior' , ( ) => {
14
- let tabGroup : ElementFinder ;
15
14
let tabLabels : ElementArrayFinder ;
16
15
let tabBodies : ElementArrayFinder ;
17
16
18
17
beforeEach ( ( ) => {
19
18
browser . get ( '/tabs' ) ;
20
- tabGroup = element ( by . css ( 'mat-tab-group' ) ) ;
21
19
tabLabels = element . all ( by . css ( '.mat-tab-label' ) ) ;
22
20
tabBodies = element . all ( by . css ( 'mat-tab-body' ) ) ;
23
21
} ) ;
@@ -51,17 +49,11 @@ describe('tabs', () => {
51
49
pressKeys ( right ) ;
52
50
expect ( await getFocusStates ( tabLabels ) ) . toEqual ( [ false , false , true ] ) ;
53
51
54
- pressKeys ( right ) ;
55
- expect ( await getFocusStates ( tabLabels ) ) . toEqual ( [ false , false , true ] ) ;
56
-
57
52
pressKeys ( left ) ;
58
53
expect ( await getFocusStates ( tabLabels ) ) . toEqual ( [ false , true , false ] ) ;
59
54
60
55
pressKeys ( left ) ;
61
56
expect ( await getFocusStates ( tabLabels ) ) . toEqual ( [ true , false , false ] ) ;
62
-
63
- pressKeys ( left ) ;
64
- expect ( await getFocusStates ( tabLabels ) ) . toEqual ( [ true , false , false ] ) ;
65
57
} ) ;
66
58
} ) ;
67
59
} ) ;
Original file line number Diff line number Diff line change @@ -284,6 +284,7 @@ describe('MatTabGroup', () => {
284
284
fixture . detectChanges ( ) ;
285
285
const labels = fixture . debugElement . queryAll ( By . css ( '.mat-tab-disabled' ) ) ;
286
286
expect ( labels . length ) . toBe ( 1 ) ;
287
+ expect ( labels [ 0 ] . nativeElement . getAttribute ( 'aria-disabled' ) ) . toBe ( 'true' ) ;
287
288
} ) ;
288
289
289
290
it ( 'should set the disabled flag on tab' , ( ) => {
@@ -293,13 +294,16 @@ describe('MatTabGroup', () => {
293
294
let labels = fixture . debugElement . queryAll ( By . css ( '.mat-tab-disabled' ) ) ;
294
295
expect ( tabs [ 2 ] . disabled ) . toBe ( false ) ;
295
296
expect ( labels . length ) . toBe ( 1 ) ;
297
+ expect ( labels [ 0 ] . nativeElement . getAttribute ( 'aria-disabled' ) ) . toBe ( 'true' ) ;
296
298
297
299
fixture . componentInstance . isDisabled = true ;
298
300
fixture . detectChanges ( ) ;
299
301
300
302
expect ( tabs [ 2 ] . disabled ) . toBe ( true ) ;
301
303
labels = fixture . debugElement . queryAll ( By . css ( '.mat-tab-disabled' ) ) ;
302
304
expect ( labels . length ) . toBe ( 2 ) ;
305
+ expect ( labels . every ( label => label . nativeElement . getAttribute ( 'aria-disabled' ) === 'true' ) )
306
+ . toBe ( true ) ;
303
307
} ) ;
304
308
} ) ;
305
309
Original file line number Diff line number Diff line change @@ -198,7 +198,8 @@ export class MatTabHeader extends _MatTabHeaderMixinBase
198
198
} ;
199
199
200
200
this . _keyManager = new FocusKeyManager ( this . _labelWrappers )
201
- . withHorizontalOrientation ( this . _getLayoutDirection ( ) ) ;
201
+ . withHorizontalOrientation ( this . _getLayoutDirection ( ) )
202
+ . withWrap ( ) ;
202
203
203
204
this . _keyManager . updateActiveItemIndex ( 0 ) ;
204
205
Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ export const _MatTabLabelWrapperMixinBase = mixinDisabled(MatTabLabelWrapperBase
22
22
selector : '[matTabLabelWrapper]' ,
23
23
inputs : [ 'disabled' ] ,
24
24
host : {
25
- '[class.mat-tab-disabled]' : 'disabled'
25
+ '[class.mat-tab-disabled]' : 'disabled' ,
26
+ '[attr.aria-disabled]' : '!!disabled' ,
26
27
}
27
28
} )
28
29
export class MatTabLabelWrapper extends _MatTabLabelWrapperMixinBase implements CanDisable {
You can’t perform that action at this time.
0 commit comments