Add Jest snapshot tests to TextInput
Summary: $title Changelog: [Internal] Reviewed By: yungsters Differential Revision: D18536359 fbshipit-source-id: 382c81c094c0ae28ec3e203cb0726bdbccf755dc
This commit is contained in:
Родитель
20a3bb52ce
Коммит
e483bd4d49
|
@ -18,7 +18,10 @@ const ReactNative = require('../../../Renderer/shims/ReactNative');
|
|||
|
||||
import Component from '@reactions/component';
|
||||
|
||||
const {enter} = require('../../../Utilities/ReactNativeTestTools');
|
||||
const {
|
||||
enter,
|
||||
expectRendersMatchingSnapshot,
|
||||
} = require('../../../Utilities/ReactNativeTestTools');
|
||||
|
||||
jest.unmock('../TextInput');
|
||||
|
||||
|
@ -150,4 +153,14 @@ describe('TextInput tests', () => {
|
|||
expect(textInputRe2.current.isFocused()).toBe(true);
|
||||
expect(TextInput.State.currentlyFocusedField()).toBe(inputTag2);
|
||||
});
|
||||
|
||||
it('should render as expected', () => {
|
||||
expectRendersMatchingSnapshot(
|
||||
'TextInput',
|
||||
() => <TextInput />,
|
||||
() => {
|
||||
jest.dontMock('../TextInput');
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`TextInput tests should render as expected: should deep render when mocked (please verify output manually) 1`] = `
|
||||
<RCTSinglelineTextInputView
|
||||
accessible={true}
|
||||
allowFontScaling={true}
|
||||
focusable={true}
|
||||
forwardedRef={null}
|
||||
onBlur={[Function]}
|
||||
onChange={[Function]}
|
||||
onClick={[Function]}
|
||||
onFocus={[Function]}
|
||||
onResponderGrant={[Function]}
|
||||
onResponderMove={[Function]}
|
||||
onResponderRelease={[Function]}
|
||||
onResponderTerminate={[Function]}
|
||||
onResponderTerminationRequest={[Function]}
|
||||
onScroll={[Function]}
|
||||
onSelectionChange={[Function]}
|
||||
onSelectionChangeShouldSetResponder={[Function]}
|
||||
onStartShouldSetResponder={[Function]}
|
||||
rejectResponderTermination={true}
|
||||
selection={null}
|
||||
text=""
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`TextInput tests should render as expected: should deep render when not mocked (please verify output manually) 1`] = `
|
||||
<RCTSinglelineTextInputView
|
||||
accessible={true}
|
||||
allowFontScaling={true}
|
||||
focusable={true}
|
||||
forwardedRef={null}
|
||||
onBlur={[Function]}
|
||||
onChange={[Function]}
|
||||
onClick={[Function]}
|
||||
onFocus={[Function]}
|
||||
onResponderGrant={[Function]}
|
||||
onResponderMove={[Function]}
|
||||
onResponderRelease={[Function]}
|
||||
onResponderTerminate={[Function]}
|
||||
onResponderTerminationRequest={[Function]}
|
||||
onScroll={[Function]}
|
||||
onSelectionChange={[Function]}
|
||||
onSelectionChangeShouldSetResponder={[Function]}
|
||||
onStartShouldSetResponder={[Function]}
|
||||
rejectResponderTermination={true}
|
||||
selection={null}
|
||||
text=""
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`TextInput tests should render as expected: should shallow render as <TextInput /> when mocked 1`] = `
|
||||
<ForwardRef(TextInput)
|
||||
allowFontScaling={true}
|
||||
rejectResponderTermination={true}
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`TextInput tests should render as expected: should shallow render as <TextInput /> when not mocked 1`] = `
|
||||
<ForwardRef(TextInput)
|
||||
allowFontScaling={true}
|
||||
rejectResponderTermination={true}
|
||||
underlineColorAndroid="transparent"
|
||||
/>
|
||||
`;
|
Загрузка…
Ссылка в новой задаче