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
191 changes: 191 additions & 0 deletions packages/react-native/Libraries/Modal/__tests__/Modal-itest.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,197 @@ describe('<Modal>', () => {
});
});
});

describe('presentationStyle', () => {
it('renders a Modal with presentationStyle="fullScreen" by default', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal presentationStyle="fullScreen" />);
});

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

(['pageSheet', 'formSheet', 'overFullScreen'] as const).forEach(
presentationStyle => {
it(`renders a Modal with presentationStyle="${presentationStyle}"`, () => {
const root = Fantom.createRoot();

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

expect(
root.getRenderedOutput({props: ['presentationStyle']}).toJSX(),
).toEqual(
<rn-modalHostView presentationStyle={presentationStyle}>
<rn-view />
</rn-modalHostView>,
);
});
},
);
});
describe('transparent', () => {
it('renders a Modal with transparent="true"', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal transparent={true} />);
});

expect(
root
.getRenderedOutput({props: ['transparent', 'presentationStyle']})
.toJSX(),
).toEqual(
<rn-modalHostView
transparent="true"
presentationStyle="overFullScreen">
<rn-view />
</rn-modalHostView>,
);
});

it('renders a Modal with transparent="false"', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal transparent={false} />);
});

expect(
root
.getRenderedOutput({props: ['transparent', 'presentationStyle']})
.toJSX(),
).toEqual(
<rn-modalHostView>
<rn-view />
</rn-modalHostView>,
);
});
});
describe('statusBarTranslucent', () => {
it('renders a Modal with statusBarTranslucent="true"', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal statusBarTranslucent={true} />);
});

expect(
root.getRenderedOutput({props: ['statusBarTranslucent']}).toJSX(),
).toEqual(
<rn-modalHostView statusBarTranslucent="true">
<rn-view />
</rn-modalHostView>,
);
});
it('renders a Modal with statusBarTranslucent="false"', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal statusBarTranslucent={false} />);
});

expect(
root.getRenderedOutput({props: ['statusBarTranslucent']}).toJSX(),
).toEqual(
<rn-modalHostView>
<rn-view />
</rn-modalHostView>,
);
});
});
describe('navigationBarTranslucent', () => {
it('renders a Modal with navigationBarTranslucent="true" and statusBarTranslucent="true"', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
// navigationBarTranslucent=true with statusBarTranslucent=false is not supported
// and it emits a warning.
root.render(
<Modal
navigationBarTranslucent={true}
statusBarTranslucent={true}
/>,
);
});

expect(
root
.getRenderedOutput({
props: ['navigationBarTranslucent', 'statusBarTranslucent'],
})
.toJSX(),
).toEqual(
<rn-modalHostView
navigationBarTranslucent="true"
statusBarTranslucent="true">
<rn-view />
</rn-modalHostView>,
);
});
it('renders a Modal with navigationBarTranslucent="false"', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal navigationBarTranslucent={false} />);
});

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

describe('hardwareAccelerated', () => {
it('renders a Modal with hardwareAccelerated="true"', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal hardwareAccelerated={true} />);
});

expect(
root.getRenderedOutput({props: ['hardwareAccelerated']}).toJSX(),
).toEqual(
<rn-modalHostView hardwareAccelerated="true">
<rn-view />
</rn-modalHostView>,
);
});
it('renders a Modal with hardwareAccelerated="false"', () => {
const root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal hardwareAccelerated={false} />);
});

expect(
root.getRenderedOutput({props: ['hardwareAccelerated']}).toJSX(),
).toEqual(
<rn-modalHostView>
<rn-view />
</rn-modalHostView>,
);
});
});
// ... more props
});
describe('ref', () => {
Expand Down
Loading