This repository was archived by the owner on Mar 4, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,12 @@ import { Accessibility } from '../../types'
2
2
import * as keyboardKey from 'keyboard-key'
3
3
4
4
/**
5
+ * @description
6
+ * Adds attribute 'tabIndex=0' to 'root' slot if 'active' property and 'navigation' property is true. Sets the attribute to '-1' otherwise.
7
+ *
5
8
* @specification
6
9
* Adds attribute 'role=tabpanel' to 'root' slot if 'navigation' property is true. Sets the attribute to 'group' otherwise.
7
10
* Adds attribute 'aria-hidden=false' to 'root' slot if 'active' property is true. Sets the attribute to 'true' otherwise.
8
- * Adds attribute 'tabIndex=0' to 'root' slot if 'active' property is true. Sets the attribute to '-1' otherwise.
9
11
*/
10
12
const carouselItemBehavior : Accessibility < CarouselItemProps > = props => ( {
11
13
attributes : {
Original file line number Diff line number Diff line change
1
+ import { carouselItemBehavior } from '@fluentui/accessibility'
2
+
3
+ describe ( 'carouselItemBehavior.ts' , ( ) => {
4
+ test ( 'set tabIndex="0" when carousel has navigation and item is visible ' , ( ) => {
5
+ const expectedResult = carouselItemBehavior ( { navigation : true , active : true } )
6
+ expect ( expectedResult . attributes . root . tabIndex ) . toEqual ( 0 )
7
+ } )
8
+
9
+ test ( 'set tabIndex="-1" when carousel has navigation and item is NOT visible ' , ( ) => {
10
+ const expectedResult = carouselItemBehavior ( { navigation : true , active : false } )
11
+ expect ( expectedResult . attributes . root . tabIndex ) . toEqual ( - 1 )
12
+ } )
13
+
14
+ test ( 'set tabIndex="-1" when carousel has NO navigation and item is visible' , ( ) => {
15
+ const expectedResult = carouselItemBehavior ( { navigation : false , active : true } )
16
+ expect ( expectedResult . attributes . root . tabIndex ) . toEqual ( - 1 )
17
+ } )
18
+
19
+ test ( 'set tabIndex="-1" when carousel has NO navigation and item is NOT visible' , ( ) => {
20
+ const expectedResult = carouselItemBehavior ( { navigation : false , active : false } )
21
+ expect ( expectedResult . attributes . root . tabIndex ) . toEqual ( - 1 )
22
+ } )
23
+ } )
You can’t perform that action at this time.
0 commit comments