Files
react-native/Libraries/Components/SafeAreaView/__tests__/SafeAreaView-test.js
zhongwuzw cc2b3d0ebf Add setNativeProps support for SafeAreaView (#24589)
Summary:
Fixes #24576 .
cc. cpojer .

[iOS] [Fixed] - Add setNativeProps support for SafeAreaView
Pull Request resolved: https://github.com/facebook/react-native/pull/24589

Differential Revision: D15099303

Pulled By: cpojer

fbshipit-source-id: f694f19fd932236c001056f38cc976db38db68a6
2019-04-26 08:47:09 -07:00

69 lines
1.6 KiB
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @emails oncall+react_native
* @flow
*/
'use strict';
const React = require('React');
const SafeAreaView = require('SafeAreaView');
const render = require('../../../../jest/renderer');
const View = require('View');
const Text = require('Text');
describe('<SafeAreaView />', () => {
it('should render as <SafeAreaView> when mocked', () => {
const instance = render.create(
<SafeAreaView>
<View>
<Text>Hello World!</Text>
</View>
</SafeAreaView>,
);
expect(instance).toMatchSnapshot();
});
it('should shallow render as <ForwardRef(SafeAreaView)> when mocked', () => {
const output = render.shallow(
<SafeAreaView>
<View>
<Text>Hello World!</Text>
</View>
</SafeAreaView>,
);
expect(output).toMatchSnapshot();
});
it('should shallow render as <ForwardRef(SafeAreaView)> when not mocked', () => {
jest.dontMock('SafeAreaView');
const output = render.shallow(
<SafeAreaView>
<View>
<Text>Hello World!</Text>
</View>
</SafeAreaView>,
);
expect(output).toMatchSnapshot();
});
it('should render as <SafeAreaView> when not mocked', () => {
jest.dontMock('SafeAreaView');
const instance = render.create(
<SafeAreaView>
<View>
<Text>Hello World!</Text>
</View>
</SafeAreaView>,
);
expect(instance).toMatchSnapshot();
});
});