@@ -73,7 +73,7 @@ describe('RenderHTML a11y', () => {
7373 } ) ;
7474 } ) ;
7575 describe ( 'regarding images' , ( ) => {
76- it ( 'should provide accessibility properties to <img> renderer' , async ( ) => {
76+ it ( 'should provide accessibility properties to <img> renderer when alt attribute is defined ' , async ( ) => {
7777 const element = (
7878 < RenderHTML
7979 source = { {
@@ -88,6 +88,29 @@ describe('RenderHTML a11y', () => {
8888 const image = getByA11yRole ( 'image' ) ;
8989 expect ( image ) . toHaveProp ( 'accessibilityRole' , 'image' ) ;
9090 expect ( image ) . toHaveProp ( 'accessibilityLabel' , 'An image' ) ;
91+
92+ // Waiting for AccessibilityEngine to support async udpates
93+ // see https://github.com/aryella-lacerda/react-native-accessibility-engine/issues/97
94+ // await waitFor(() =>
95+ // expect(() => AccessibilityEngine.check(element)).not.toThrow()
96+ // );
97+ } ) ;
98+ it ( '<img> should not be accessible when alt attribute is missing' , async ( ) => {
99+ const element = (
100+ < RenderHTML
101+ source = { {
102+ html : '<img src="https://img.com/1x1" />'
103+ } }
104+ debug = { false }
105+ contentWidth = { 200 }
106+ />
107+ ) ;
108+ const { getByTestId, findByTestId } = render ( element ) ;
109+ await findByTestId ( 'image-success' ) ;
110+ const image = getByTestId ( 'img' ) ;
111+ expect ( image ) . toHaveProp ( 'accessibilityRole' , 'none' ) ;
112+ expect ( image ) . not . toHaveProp ( 'accessibilityLabel' ) ;
113+
91114 // Waiting for AccessibilityEngine to support async udpates
92115 // see https://github.com/aryella-lacerda/react-native-accessibility-engine/issues/97
93116 // await waitFor(() =>
0 commit comments