mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add basic test for Modal (#53140)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53140 As per title, this change adds the boilerplate code for a Fantom test on Modal ## Changelog: [Internal] - Reviewed By: andrewdacenko Differential Revision: D79805808 fbshipit-source-id: c8c77e576a09b346cf29b290d68c75e540d5f146
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e547f466ee
commit
7035391b04
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
|
||||
import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';
|
||||
import type {HostInstance} from 'react-native';
|
||||
|
||||
import * as Fantom from '@react-native/fantom';
|
||||
import * as React from 'react';
|
||||
import {createRef} from 'react';
|
||||
import {Modal} from 'react-native';
|
||||
import ensureInstance from 'react-native/src/private/__tests__/utilities/ensureInstance';
|
||||
import ReactNativeElement from 'react-native/src/private/webapis/dom/nodes/ReactNativeElement';
|
||||
|
||||
describe('<Modal>', () => {
|
||||
describe('ref', () => {
|
||||
describe('exampleMethod()', () => {
|
||||
// more describe('<context>') or tests with it('<behaviour>')
|
||||
});
|
||||
// ... more methods
|
||||
describe('instance', () => {
|
||||
it('uses the "RN:ModalHostView" tag name', () => {
|
||||
const elementRef = createRef<HostInstance>();
|
||||
const root = Fantom.createRoot();
|
||||
Fantom.runTask(() => {
|
||||
root.render(<Modal ref={elementRef} />);
|
||||
});
|
||||
|
||||
expect(elementRef.current).toBeInstanceOf(ReactNativeElement);
|
||||
const element = ensureInstance(elementRef.current, ReactNativeElement);
|
||||
expect(element.tagName).toBe('RN:ModalHostView');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user