Updated tests

This commit is contained in:
Avinash Lingaloo
2021-10-08 15:29:58 +04:00
parent 7ae6fb9ebb
commit 45db4c26e6
6 changed files with 257 additions and 98 deletions

View File

@@ -3,7 +3,9 @@
exports[`DrawerItem should match snapshot 1`] = `
<View
accessible={true}
collapsable={false}
focusable={true}
nativeID="animatedComponent"
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
@@ -108,7 +110,9 @@ exports[`DrawerItem should match snapshot 1`] = `
exports[`DrawerItem should match snapshot without separator and centered false 1`] = `
<View
accessible={true}
collapsable={false}
focusable={true}
nativeID="animatedComponent"
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}

View File

@@ -0,0 +1,247 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`SearchBar should match snapshot 1`] = `
<View
style={
Array [
Object {
"alignItems": "center",
"flexDirection": "row",
"height": 20,
"justifyContent": "flex-start",
"overflow": "hidden",
},
Object {},
]
}
testID="search_bar"
>
<View
collapsable={false}
nativeID="animatedComponent"
style={
Object {
"flex": 1,
"height": 10,
"marginLeft": 0,
"marginRight": 5,
}
}
>
<View
style={
Object {
"alignItems": "center",
"backgroundColor": "#ffffff",
"flex": 1,
"flexDirection": "row",
"paddingBottom": 0,
"paddingTop": 0,
}
}
>
<View
style={
Object {
"paddingHorizontal": 0,
"width": "100%",
}
}
>
<View
collapsable={false}
nativeID="animatedComponent"
style={
Object {
"alignItems": "center",
"backgroundColor": undefined,
"borderBottomWidth": 0,
"borderColor": "#86939e",
"borderRadius": 2,
"flexDirection": "row",
"height": 10,
"marginLeft": 8,
"marginRight": 8,
"minHeight": 30,
"transform": Array [
Object {
"translateX": 0,
},
],
}
}
>
<View
style={
Object {
"alignItems": "center",
"height": 40,
"justifyContent": "center",
"marginLeft": 4,
"marginVertical": 4,
"paddingRight": 4,
"width": 30,
}
}
>
<Icon
name="magnify"
size={24}
style={
Object {
"color": "#bbbbbb",
"flex": 1,
"top": 8,
}
}
/>
</View>
<TextInput
autoCapitalize="auto-capitalize"
autoCorrect={false}
autoFocus={true}
blurOnSubmit={true}
cancelIcon={false}
disableFullscreenUI={true}
editable={true}
enablesReturnKeyAutomatically={true}
keyboardAppearance="keyboard-appearance"
keyboardType="keyboard-type"
onBlur={[Function]}
onCancel={[Function]}
onChangeText={[Function]}
onFocus={[Function]}
onSelectionChange={[Function]}
onSubmitEditing={[Function]}
placeholder="placeholder"
placeholderTextColor="#000000"
platform="ios"
returnKeyType="return-key-type"
selectionColor="#dddddd"
style={
Object {
"backgroundColor": "transparent",
"color": "#fff",
"flex": 1,
"fontSize": 14,
"height": 10,
"marginLeft": 4,
"marginTop": 0,
"minHeight": 40,
"overflow": "hidden",
"paddingTop": 0,
}
}
testID="search_bar.search.input"
underlineColorAndroid="transparent"
value="value"
/>
<View
style={
Object {
"alignItems": "center",
"height": 40,
"justifyContent": "center",
"marginRight": 8,
"marginVertical": 4,
"paddingRight": 4,
}
}
>
<View
style={
Object {
"flexDirection": "row",
}
}
>
<Icon
name="close-circle"
onPress={[Function]}
size={18}
style={
Object {
"color": "#cccccc",
}
}
testID="search_bar.search.clear.button"
/>
</View>
</View>
</View>
<Text
style={
Object {
"color": "#ff190c",
"fontSize": 12,
"height": 0,
"margin": 0,
"padding": 0,
}
}
/>
</View>
<View
onLayout={[Function]}
style={
Object {
"opacity": 0,
"position": "absolute",
"right": null,
}
}
>
<View
accessibilityRole="button"
accessible={true}
collapsable={false}
focusable={true}
nativeID="animatedComponent"
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"opacity": 1,
}
}
>
<View
style={
Array [
undefined,
undefined,
]
}
>
<Text
style={
Array [
Object {
"color": "#007aff",
"fontSize": 18,
"padding": 8,
"textAlign": "center",
},
undefined,
Object {
"color": "#aaaaaa",
"fontSize": 14,
},
undefined,
]
}
>
cancel title
</Text>
</View>
</View>
</View>
</View>
</View>
</View>
`;

View File

@@ -1,56 +0,0 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {shallowWithIntl} from '@test/intl-test-helper';
import SearchBar from './index';
jest.useFakeTimers();
describe('SearchBar', () => {
const baseProps = {
onBlur: jest.fn,
onFocus: jest.fn,
onSearchButtonPress: jest.fn,
onChangeText: jest.fn,
onCancelButtonPress: jest.fn,
onSelectionChange: jest.fn,
testID: 'search_bar',
backgroundColor: '#ffffff',
placeholderTextColor: '#000000',
titleCancelColor: '#aaaaaa',
tintColorSearch: '#bbbbbb',
tintColorDelete: '#cccccc',
selectionColor: '#dddddd',
inputStyle: {},
containerStyle: {},
cancelButtonStyle: {},
autoFocus: true,
placeholder: 'placeholder',
cancelTitle: 'cancel title',
returnKeyType: 'return-key-type',
keyboardType: 'keyboard-type',
autoCapitalize: 'auto-capitalize',
inputHeight: 10,
editable: true,
blurOnSubmit: true,
keyboardShouldPersist: true,
value: 'value',
keyboardAppearance: 'keyboard-appearance',
showArrow: true,
searchBarRightMargin: 5,
searchIconSize: 1,
backArrowSize: 1,
deleteIconSize: 1,
showCancel: true,
containerHeight: 20,
};
test('should match snapshot', () => {
const wrapper = shallowWithIntl(<SearchBar {...baseProps}/>);
expect(wrapper.getElement()).toMatchSnapshot();
});
});

View File

@@ -1,18 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`AddReaction should match snapshot 1`] = `
<View
style={
Object {
"flex": 1,
}
}
testID="add_reaction.screen"
>
<Connect(EmojiPicker)
deviceWidth={750}
onEmojiPress={[Function]}
testID="add_reaction.emoji_picker"
/>
</View>
`;

View File

@@ -1,24 +0,0 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {renderWithIntl} from '@test/intl-test-helper';
import AddReaction from './index';
describe('AddReaction', () => {
const baseProps = {
onEmojiPress: jest.fn(),
componentId: 'component-id',
closeButton: {},
};
test('should match snapshot', () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const wrapper = renderWithIntl(<AddReaction {...baseProps}/>);
expect(wrapper.toJSON()).toMatchSnapshot();
});
});

View File

@@ -64,7 +64,9 @@ exports[`OptionModalList should match snapshot 1`] = `
>
<View
accessible={true}
collapsable={false}
focusable={true}
nativeID="animatedComponent"
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
@@ -118,7 +120,9 @@ exports[`OptionModalList should match snapshot 1`] = `
>
<View
accessible={true}
collapsable={false}
focusable={true}
nativeID="animatedComponent"
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
@@ -177,7 +181,9 @@ exports[`OptionModalList should match snapshot 1`] = `
>
<View
accessible={true}
collapsable={false}
focusable={true}
nativeID="animatedComponent"
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}