mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add Snapshot Rendering Test to ScrollView
Summary: As title. Changelog: [Added] Add snapshot rendering test to ScrollView Reviewed By: zackargyle, TheSavior Differential Revision: D20037673 fbshipit-source-id: 4270bc63a6065789f072893756468b67deae169d
This commit is contained in:
committed by
Facebook Github Bot
parent
8bb78553a2
commit
aebeb3b0a9
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* 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 strict-local
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const React = require('react');
|
||||
const ScrollView = require('../ScrollView');
|
||||
const ReactNativeTestTools = require('../../../Utilities/ReactNativeTestTools');
|
||||
const View = require('../../View/View');
|
||||
const Text = require('../../../Text/Text');
|
||||
|
||||
describe('<ScrollView />', () => {
|
||||
it('should render as expected', () => {
|
||||
ReactNativeTestTools.expectRendersMatchingSnapshot(
|
||||
'ScrollView',
|
||||
() => (
|
||||
<ScrollView>
|
||||
<View>
|
||||
<Text>Hello World!</Text>
|
||||
</View>
|
||||
</ScrollView>
|
||||
),
|
||||
() => {
|
||||
jest.dontMock('../ScrollView');
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,90 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`<ScrollView /> should render as expected: should deep render when mocked (please verify output manually) 1`] = `
|
||||
<RCTScrollView>
|
||||
<View>
|
||||
<View>
|
||||
<Text>
|
||||
Hello World!
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
</RCTScrollView>
|
||||
`;
|
||||
|
||||
exports[`<ScrollView /> should render as expected: should deep render when not mocked (please verify output manually) 1`] = `
|
||||
<RCTScrollView
|
||||
DEPRECATED_sendUpdatedChildFrames={false}
|
||||
alwaysBounceVertical={true}
|
||||
onContentSizeChange={null}
|
||||
onLayout={[Function]}
|
||||
onMomentumScrollBegin={[Function]}
|
||||
onMomentumScrollEnd={[Function]}
|
||||
onResponderGrant={[Function]}
|
||||
onResponderReject={[Function]}
|
||||
onResponderRelease={[Function]}
|
||||
onResponderTerminationRequest={[Function]}
|
||||
onScroll={[Function]}
|
||||
onScrollBeginDrag={[Function]}
|
||||
onScrollEndDrag={[Function]}
|
||||
onScrollShouldSetResponder={[Function]}
|
||||
onStartShouldSetResponder={[Function]}
|
||||
onStartShouldSetResponderCapture={[Function]}
|
||||
onTouchCancel={[Function]}
|
||||
onTouchEnd={[Function]}
|
||||
onTouchMove={[Function]}
|
||||
onTouchStart={[Function]}
|
||||
pagingEnabled={false}
|
||||
scrollBarThumbImage={null}
|
||||
sendMomentumEvents={false}
|
||||
snapToEnd={true}
|
||||
snapToStart={true}
|
||||
style={
|
||||
Array [
|
||||
Object {
|
||||
"flexDirection": "column",
|
||||
"flexGrow": 1,
|
||||
"flexShrink": 1,
|
||||
"overflow": "scroll",
|
||||
},
|
||||
undefined,
|
||||
]
|
||||
}
|
||||
>
|
||||
<RCTScrollContentView
|
||||
collapsable={false}
|
||||
style={
|
||||
Array [
|
||||
false,
|
||||
undefined,
|
||||
]
|
||||
}
|
||||
>
|
||||
<View>
|
||||
<Text>
|
||||
Hello World!
|
||||
</Text>
|
||||
</View>
|
||||
</RCTScrollContentView>
|
||||
</RCTScrollView>
|
||||
`;
|
||||
|
||||
exports[`<ScrollView /> should render as expected: should shallow render as <ScrollView /> when mocked 1`] = `
|
||||
<ScrollView>
|
||||
<View>
|
||||
<Text>
|
||||
Hello World!
|
||||
</Text>
|
||||
</View>
|
||||
</ScrollView>
|
||||
`;
|
||||
|
||||
exports[`<ScrollView /> should render as expected: should shallow render as <ScrollView /> when not mocked 1`] = `
|
||||
<ScrollView>
|
||||
<View>
|
||||
<Text>
|
||||
Hello World!
|
||||
</Text>
|
||||
</View>
|
||||
</ScrollView>
|
||||
`;
|
||||
Reference in New Issue
Block a user