Skip to content
Open
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
46 changes: 27 additions & 19 deletions packages/react-native/Libraries/Modal/__tests__/Modal-itest.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ const DEFAULT_MODAL_CHILD_VIEW = (
);

describe('<Modal>', () => {
let root: Fantom.Root;

afterEach(() => {
root.destroy();
});

describe('props', () => {
it('renders a Modal with the default values when no props are passed', () => {
const root = Fantom.createRoot();
root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal />);
Expand All @@ -44,7 +50,7 @@ describe('<Modal>', () => {
});
describe('animationType', () => {
it('renders a Modal with animationType="none" by default', () => {
const root = Fantom.createRoot();
root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal animationType="none" />);
Expand All @@ -61,7 +67,7 @@ describe('<Modal>', () => {

(['slide', 'fade'] as const).forEach(animationType => {
it(`renders a Modal with animationType="${animationType}"`, () => {
const root = Fantom.createRoot();
root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal animationType={animationType} />);
Expand All @@ -80,7 +86,7 @@ describe('<Modal>', () => {

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

Fantom.runTask(() => {
root.render(<Modal presentationStyle="fullScreen" />);
Expand All @@ -98,7 +104,7 @@ describe('<Modal>', () => {
(['pageSheet', 'formSheet', 'overFullScreen'] as const).forEach(
presentationStyle => {
it(`renders a Modal with presentationStyle="${presentationStyle}"`, () => {
const root = Fantom.createRoot();
root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal presentationStyle={presentationStyle} />);
Expand All @@ -117,7 +123,7 @@ describe('<Modal>', () => {
});
describe('transparent', () => {
it('renders a Modal with transparent="true"', () => {
const root = Fantom.createRoot();
root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal transparent={true} />);
Expand All @@ -137,7 +143,7 @@ describe('<Modal>', () => {
});

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

Fantom.runTask(() => {
root.render(<Modal transparent={false} />);
Expand All @@ -156,7 +162,7 @@ describe('<Modal>', () => {
});
describe('statusBarTranslucent', () => {
it('renders a Modal with statusBarTranslucent="true"', () => {
const root = Fantom.createRoot();
root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal statusBarTranslucent={true} />);
Expand All @@ -171,7 +177,7 @@ describe('<Modal>', () => {
);
});
it('renders a Modal with statusBarTranslucent="false"', () => {
const root = Fantom.createRoot();
root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal statusBarTranslucent={false} />);
Expand All @@ -188,7 +194,7 @@ describe('<Modal>', () => {
});
describe('navigationBarTranslucent', () => {
it('renders a Modal with navigationBarTranslucent="true" and statusBarTranslucent="true"', () => {
const root = Fantom.createRoot();
root = Fantom.createRoot();

Fantom.runTask(() => {
// navigationBarTranslucent=true with statusBarTranslucent=false is not supported
Expand Down Expand Up @@ -216,7 +222,7 @@ describe('<Modal>', () => {
);
});
it('renders a Modal with navigationBarTranslucent="false"', () => {
const root = Fantom.createRoot();
root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal navigationBarTranslucent={false} />);
Expand All @@ -238,7 +244,7 @@ describe('<Modal>', () => {

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

Fantom.runTask(() => {
root.render(<Modal hardwareAccelerated={true} />);
Expand All @@ -253,7 +259,7 @@ describe('<Modal>', () => {
);
});
it('renders a Modal with hardwareAccelerated="false"', () => {
const root = Fantom.createRoot();
root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal hardwareAccelerated={false} />);
Expand All @@ -271,7 +277,7 @@ describe('<Modal>', () => {

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

Fantom.runTask(() => {
root.render(<Modal visible={true} />);
Expand All @@ -283,8 +289,9 @@ describe('<Modal>', () => {
</rn-modalHostView>,
);
});

it('renders nothing when visible="false"', () => {
const root = Fantom.createRoot();
root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal visible={false} />);
Expand All @@ -296,7 +303,7 @@ describe('<Modal>', () => {

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

Fantom.runTask(() => {
root.render(<Modal allowSwipeDismissal={true} />);
Expand All @@ -311,7 +318,7 @@ describe('<Modal>', () => {
);
});
it('renders a Modal with allowSwipeDismissal="false"', () => {
const root = Fantom.createRoot();
root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal allowSwipeDismissal={false} />);
Expand All @@ -332,7 +339,7 @@ describe('<Modal>', () => {
// The 'animated' prop is deprecated and ignored when the Modal is rendered
// Users should use the 'animationType' prop instead.
it(`[DEPRECATED] renders a Modal with animated="${animated ? 'true' : 'false'}"`, () => {
const root = Fantom.createRoot();
root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal animated={animated} />);
Expand All @@ -356,7 +363,8 @@ describe('<Modal>', () => {
describe('instance', () => {
it('uses the "RN:ModalHostView" tag name', () => {
const elementRef = createRef<HostInstance>();
const root = Fantom.createRoot();
root = Fantom.createRoot();

Fantom.runTask(() => {
root.render(<Modal ref={elementRef} />);
});
Expand Down
Loading