mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-06-16 06:42:37 +08:00
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
69 lines
1.6 KiB
JavaScript
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();
|
|
});
|
|
});
|