@@ -18,9 +18,9 @@ import rule from '../../../src/rules/has-accessibility-props';
1818
1919const ruleTester = new RuleTester ( ) ;
2020
21- const expectedError = touchable => ( {
21+ const expectedError = ( touchable ) => ( {
2222 message : `<${ touchable } > must only have either the accessibilityRole prop or both accessibilityTraits and accessibilityComponentType props set` ,
23- type : 'JSXOpeningElement'
23+ type : 'JSXOpeningElement' ,
2424} ) ;
2525
2626ruleTester . run ( 'has-accessibility-props' , rule , {
@@ -30,122 +30,122 @@ ruleTester.run('has-accessibility-props', rule, {
3030 { code : '<TouchableOpacitys />;' } ,
3131 {
3232 code :
33- '<Touchable accessibilityTraits="none" accessibilityComponentType="none"/>;'
33+ '<Touchable accessibilityTraits="none" accessibilityComponentType="none"/>;' ,
3434 } ,
3535 {
3636 code :
37- '<TouchableOpacity accessibilityTraits="none" accessibilityComponentType="none"/>;'
37+ '<TouchableOpacity accessibilityTraits="none" accessibilityComponentType="none"/>;' ,
3838 } ,
3939 {
4040 code :
41- '<TouchableHighlight accessibilityTraits="none" accessibilityComponentType="none"/>;'
41+ '<TouchableHighlight accessibilityTraits="none" accessibilityComponentType="none"/>;' ,
4242 } ,
4343 {
4444 code :
45- '<TouchableWithoutFeedback accessibilityTraits="none" accessibilityComponentType="none"/>;'
45+ '<TouchableWithoutFeedback accessibilityTraits="none" accessibilityComponentType="none"/>;' ,
4646 } ,
4747 {
4848 code :
49- '<TouchableNativeFeedback accessibilityTraits="none" accessibilityComponentType="none"/>;'
49+ '<TouchableNativeFeedback accessibilityTraits="none" accessibilityComponentType="none"/>;' ,
5050 } ,
5151 {
5252 code :
53- '<div><TouchableNativeFeedback accessibilityTraits="none" accessibilityComponentType="none"/></div>;'
53+ '<div><TouchableNativeFeedback accessibilityTraits="none" accessibilityComponentType="none"/></div>;' ,
5454 } ,
5555 {
56- code : '<div><TouchableNativeFeedback accessibilityRole="none"/></div>;'
56+ code : '<div><TouchableNativeFeedback accessibilityRole="none"/></div>;' ,
5757 } ,
5858 {
59- code : '<div><TouchableNativeFeedback accessible={false}/></div>;'
59+ code : '<div><TouchableNativeFeedback accessible={false}/></div>;' ,
6060 } ,
6161 {
62- code : '<div><TouchableNativeFeedback accessibilityRole="none"/></div>;'
62+ code : '<div><TouchableNativeFeedback accessibilityRole="none"/></div>;' ,
6363 } ,
6464 {
65- code : '<Touchable />;'
65+ code : '<Touchable />;' ,
6666 } ,
6767 {
68- code : '<TouchableOpacity />;'
68+ code : '<TouchableOpacity />;' ,
6969 } ,
7070 {
71- code : '<TouchableHighlight />;'
71+ code : '<TouchableHighlight />;' ,
7272 } ,
7373 {
74- code : '<TouchableWithoutFeedback />;'
74+ code : '<TouchableWithoutFeedback />;' ,
7575 } ,
7676 {
77- code : '<TouchableNativeFeedback />;'
77+ code : '<TouchableNativeFeedback />;' ,
7878 } ,
7979 {
80- code : '<div><TouchableOpacity /></div>;'
80+ code : '<div><TouchableOpacity /></div>;' ,
8181 } ,
8282 {
83- code : '<div><TouchableOpacity accessible={true}/></div>;'
83+ code : '<div><TouchableOpacity accessible={true}/></div>;' ,
8484 } ,
8585 {
8686 code : '<div><TouchableFoo accessible={true}/></div>;' ,
8787 options : [
8888 {
89- touchables : [ 'TouchableFoo' ]
90- }
91- ]
89+ touchables : [ 'TouchableFoo' ] ,
90+ } ,
91+ ] ,
9292 } ,
9393 {
9494 code : '<div><FooTouchable accessible={true}/></div>;' ,
9595 options : [
9696 {
97- touchables : [ 'FooTouchable' ]
98- }
99- ]
100- }
97+ touchables : [ 'FooTouchable' ] ,
98+ } ,
99+ ] ,
100+ } ,
101101 ] . map ( parserOptionsMapper ) ,
102102 invalid : [
103103 {
104104 code : '<TouchableOpacity accessibilityTraits="none"/>;' ,
105- errors : [ expectedError ( 'TouchableOpacity' ) ]
105+ errors : [ expectedError ( 'TouchableOpacity' ) ] ,
106106 } ,
107107 {
108108 code : '<TouchableOpacity accessibilityComponentType="none"/>;' ,
109- errors : [ expectedError ( 'TouchableOpacity' ) ]
109+ errors : [ expectedError ( 'TouchableOpacity' ) ] ,
110110 } ,
111111 {
112112 code : '<TouchableHighlight accessibilityComponentType="none"/>;' ,
113- errors : [ expectedError ( 'TouchableHighlight' ) ]
113+ errors : [ expectedError ( 'TouchableHighlight' ) ] ,
114114 } ,
115115 {
116116 code : '<TouchableHighlight accessibilityComponentType="none"/>;' ,
117- errors : [ expectedError ( 'TouchableHighlight' ) ]
117+ errors : [ expectedError ( 'TouchableHighlight' ) ] ,
118118 } ,
119119 {
120120 code : '<TouchableWithoutFeedback accessibilityComponentType="none"/>;' ,
121- errors : [ expectedError ( 'TouchableWithoutFeedback' ) ]
121+ errors : [ expectedError ( 'TouchableWithoutFeedback' ) ] ,
122122 } ,
123123 {
124124 code : '<TouchableWithoutFeedback accessibilityComponentType="none"/>;' ,
125- errors : [ expectedError ( 'TouchableWithoutFeedback' ) ]
125+ errors : [ expectedError ( 'TouchableWithoutFeedback' ) ] ,
126126 } ,
127127 {
128128 code : '<TouchableNativeFeedback accessibilityComponentType="none"/>;' ,
129- errors : [ expectedError ( 'TouchableNativeFeedback' ) ]
129+ errors : [ expectedError ( 'TouchableNativeFeedback' ) ] ,
130130 } ,
131131 {
132132 code : '<TouchableNativeFeedback accessibilityComponentType="none"/>;' ,
133- errors : [ expectedError ( 'TouchableNativeFeedback' ) ]
133+ errors : [ expectedError ( 'TouchableNativeFeedback' ) ] ,
134134 } ,
135135 {
136136 code :
137137 '<TouchableOpacity accessibilityRole="none" accessibilityComponentType="none" />;' ,
138- errors : [ expectedError ( 'TouchableOpacity' ) ]
138+ errors : [ expectedError ( 'TouchableOpacity' ) ] ,
139139 } ,
140140 {
141141 code :
142142 '<TouchableOpacity accessibilityRole="none" accessibilityTraits="none" />;' ,
143- errors : [ expectedError ( 'TouchableOpacity' ) ]
143+ errors : [ expectedError ( 'TouchableOpacity' ) ] ,
144144 } ,
145145 {
146146 code :
147147 '<TouchableOpacity accessibilityRole="none" accessibilityComponentType="none" accessibilityTraits="none" />;' ,
148- errors : [ expectedError ( 'TouchableOpacity' ) ]
149- }
150- ] . map ( parserOptionsMapper )
148+ errors : [ expectedError ( 'TouchableOpacity' ) ] ,
149+ } ,
150+ ] . map ( parserOptionsMapper ) ,
151151} ) ;
0 commit comments