Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,38 @@ describe('ActivityIndicator', () => {
root.getRenderedOutput({props: ['accessibilityLabel']}).toJSX(),
).toEqual(<rn-androidProgressBar accessibilityLabel="Loading orders" />);
});

it('maps aria-hidden to importantForAccessibility', () => {
const root = Fantom.createRoot();
Fantom.runTask(() => {
root.render(<ActivityIndicator aria-hidden={true} />);
});

expect(
root.getRenderedOutput({props: ['importantForAccessibility']}).toJSX(),
).toEqual(
<rn-androidProgressBar importantForAccessibility="no-hide-descendants" />,
);
});

it('resets importantForAccessibility when aria-hidden is removed', () => {
const root = Fantom.createRoot();
Fantom.runTask(() => {
root.render(<ActivityIndicator aria-hidden={true} />);
});

expect(
root.getRenderedOutput({props: ['importantForAccessibility']}).toJSX(),
).toEqual(
<rn-androidProgressBar importantForAccessibility="no-hide-descendants" />,
);

Fantom.runTask(() => {
root.render(<ActivityIndicator />);
});

expect(
root.getRenderedOutput({props: ['importantForAccessibility']}).toJSX(),
).toEqual(<rn-androidProgressBar />);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,84 @@ describe('<ScrollView>', () => {
</rn-scrollView>,
);
});

it('maps aria-hidden to importantForAccessibility', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<ScrollView aria-hidden={true} />);
});

expect(
root.getRenderedOutput({props: ['importantForAccessibility']}).toJSX(),
).toEqual(
<rn-scrollView importantForAccessibility="no-hide-descendants">
<rn-view />
</rn-scrollView>,
);
});

it('resets importantForAccessibility when aria-hidden is removed', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<ScrollView aria-hidden={true} />);
});

expect(
root.getRenderedOutput({props: ['importantForAccessibility']}).toJSX(),
).toEqual(
<rn-scrollView importantForAccessibility="no-hide-descendants">
<rn-view />
</rn-scrollView>,
);

Fantom.runTask(() => {
root.render(<ScrollView />);
});

expect(
root.getRenderedOutput({props: ['importantForAccessibility']}).toJSX(),
).toEqual(
<rn-scrollView>
<rn-view />
</rn-scrollView>,
);
});

it('keeps an explicit importantForAccessibility when aria-hidden is absent', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<ScrollView importantForAccessibility="no" />);
});

expect(
root.getRenderedOutput({props: ['importantForAccessibility']}).toJSX(),
).toEqual(
<rn-scrollView importantForAccessibility="no">
<rn-view />
</rn-scrollView>,
);
});

it('keeps an explicit importantForAccessibility when aria-hidden is false', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(
<ScrollView aria-hidden={false} importantForAccessibility="yes" />,
);
});

expect(
root.getRenderedOutput({props: ['importantForAccessibility']}).toJSX(),
).toEqual(
<rn-scrollView importantForAccessibility="yes">
<rn-view />
</rn-scrollView>,
);
});
});

describe('hitSlop', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import * as React from 'react';
import {createRef, useEffect, useRef, useState} from 'react';
import {
AccessibilityInfo,
ActivityIndicator,
Alert,
Button,
Image,
Expand Down Expand Up @@ -2269,6 +2270,16 @@ function AriaHiddenExample(): React.Node {
source={require('../../assets/like.png')}
style={styles.button}
/>

<ScrollView aria-hidden={ariaHidden} style={{maxHeight: 60}}>
<RNTesterText>
{ariaHidden
? 'ScrollView content that should be hidden'
: 'ScrollView content that should be accessible'}
</RNTesterText>
</ScrollView>

<ActivityIndicator aria-hidden={ariaHidden} />
</View>
);
}
Expand Down
Loading