Skip to content
Closed
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 @@ -522,6 +522,115 @@ describe('<View>', () => {
).toEqual(null);
});
});
describe('aria-label', () => {
it('is mapped to accessibilityLabel', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<View aria-label="custom label" accessible={true} />);
});

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

describe('aria-live', () => {
it('is mapped to accessibilityLiveRegion', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<View aria-live="polite" accessible={true} />);
});

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

describe('aria-busy', () => {
it('is mapped to accessibilityState', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<View aria-busy={true} accessible={true} />);
});

expect(
root.getRenderedOutput({props: ['accessibilityState']}).toJSX(),
).toEqual(
<rn-view accessibilityState="{disabled:false,selected:false,checked:None,busy:true,expanded:null}" />,
);
});
});

describe('aria-disabled', () => {
it('is mapped to accessibilityState', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<View aria-disabled={true} accessible={true} />);
});

expect(
root.getRenderedOutput({props: ['accessibilityState']}).toJSX(),
).toEqual(
<rn-view accessibilityState="{disabled:true,selected:false,checked:None,busy:false,expanded:null}" />,
);
});
});

describe('aria-expanded', () => {
it('is mapped to accessibilityState', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<View aria-expanded={true} accessible={true} />);
});

expect(
root.getRenderedOutput({props: ['accessibilityState']}).toJSX(),
).toEqual(
<rn-view accessibilityState="{disabled:false,selected:false,checked:None,busy:false,expanded:true}" />,
);
});
});

describe('aria-selected', () => {
it('is mapped to accessibilityState', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<View aria-selected={true} accessible={true} />);
});

expect(
root.getRenderedOutput({props: ['accessibilityState']}).toJSX(),
).toEqual(
<rn-view accessibilityState="{disabled:false,selected:true,checked:None,busy:false,expanded:null}" />,
);
});
});

describe('aria-checked', () => {
it('is mapped to accessibilityState', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<View aria-checked={true} accessible={true} />);
});

expect(
root.getRenderedOutput({props: ['accessibilityState']}).toJSX(),
).toEqual(
<rn-view accessibilityState="{disabled:false,selected:false,checked:Checked,busy:false,expanded:null}" />,
);
});
});
});

describe('accessible', () => {
Expand All @@ -547,6 +656,22 @@ describe('<View>', () => {
});
});

describe('web compat props', () => {
describe('id', () => {
it('is mapped to nativeID', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<View id="my-id" collapsable={false} />);
});

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

describe('ref', () => {
it('is an element node', () => {
const elementRef = createRef<HostInstance>();
Expand Down
Loading