react-native-gifted-chat 2.8.1 → 2.8.2-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -17
- package/package.json +41 -35
- package/src/Bubble/index.tsx +15 -39
- package/src/Bubble/types.ts +5 -5
- package/src/Composer.tsx +19 -26
- package/src/Constant.ts +0 -1
- package/src/GiftedAvatar.tsx +29 -36
- package/src/GiftedChat/index.tsx +34 -65
- package/src/GiftedChat/types.ts +8 -53
- package/src/InputToolbar.tsx +25 -8
- package/src/LoadEarlier.tsx +19 -17
- package/src/MessageAudio.tsx +19 -7
- package/src/MessageContainer/components/DayAnimated/index.tsx +14 -9
- package/src/MessageContainer/components/Item/index.tsx +7 -1
- package/src/MessageContainer/index.tsx +104 -64
- package/src/MessageContainer/styles.ts +3 -2
- package/src/MessageContainer/types.ts +36 -14
- package/src/MessageImage.tsx +18 -6
- package/src/MessageText.tsx +88 -128
- package/src/MessageVideo.tsx +19 -7
- package/src/QuickReplies.tsx +17 -10
- package/src/Send.tsx +7 -1
- package/src/SystemMessage.tsx +12 -2
- package/src/Time.tsx +9 -2
- package/src/TypingIndicator/index.tsx +2 -1
- package/src/TypingIndicator/types.ts +3 -0
- package/src/__tests__/Actions.test.tsx +3 -4
- package/src/__tests__/Avatar.test.tsx +5 -6
- package/src/__tests__/Bubble.test.tsx +14 -19
- package/src/__tests__/Composer.test.tsx +3 -4
- package/src/__tests__/Day.test.tsx +5 -8
- package/src/__tests__/DayAnimated.test.tsx +52 -0
- package/src/__tests__/GiftedAvatar.test.tsx +3 -8
- package/src/__tests__/GiftedChat.test.tsx +37 -21
- package/src/__tests__/InputToolbar.test.tsx +3 -4
- package/src/__tests__/LoadEarlier.test.tsx +3 -4
- package/src/__tests__/Message.test.tsx +51 -58
- package/src/__tests__/MessageContainer.test.tsx +39 -5
- package/src/__tests__/MessageImage.test.tsx +12 -15
- package/src/__tests__/MessageText.test.tsx +7 -4
- package/src/__tests__/Send.test.tsx +7 -8
- package/src/__tests__/SystemMessage.test.tsx +12 -15
- package/src/__tests__/Time.test.tsx +5 -8
- package/src/__tests__/__snapshots__/Bubble.test.tsx.snap +48 -50
- package/src/__tests__/__snapshots__/Composer.test.tsx.snap +1 -2
- package/src/__tests__/__snapshots__/Constant.test.tsx.snap +0 -1
- package/src/__tests__/__snapshots__/DayAnimated.test.tsx.snap +5 -0
- package/src/__tests__/__snapshots__/GiftedChat.test.tsx.snap +25 -0
- package/src/__tests__/__snapshots__/InputToolbar.test.tsx.snap +2 -2
- package/src/__tests__/__snapshots__/Message.test.tsx.snap +146 -150
- package/src/__tests__/__snapshots__/MessageImage.test.tsx.snap +12 -10
- package/src/__tests__/__snapshots__/MessageText.test.tsx.snap +12 -8
- package/src/__tests__/__snapshots__/Send.test.tsx.snap +2 -0
- package/src/reanimatedCompat.ts +27 -0
- package/src/types.ts +4 -0
- package/src/utils.ts +77 -1
- package/lib/Actions.d.ts +0 -14
- package/lib/Actions.js +0 -57
- package/lib/Actions.js.map +0 -1
- package/lib/Avatar.d.ts +0 -18
- package/lib/Avatar.js +0 -93
- package/lib/Avatar.js.map +0 -1
- package/lib/Bubble/index.d.ts +0 -6
- package/lib/Bubble/index.js +0 -257
- package/lib/Bubble/index.js.map +0 -1
- package/lib/Bubble/styles.d.ts +0 -69
- package/lib/Bubble/styles.js +0 -72
- package/lib/Bubble/styles.js.map +0 -1
- package/lib/Bubble/types.d.ts +0 -47
- package/lib/Bubble/types.js +0 -2
- package/lib/Bubble/types.js.map +0 -1
- package/lib/Color.d.ts +0 -18
- package/lib/Color.js +0 -18
- package/lib/Color.js.map +0 -1
- package/lib/Composer.d.ts +0 -20
- package/lib/Composer.js +0 -60
- package/lib/Composer.js.map +0 -1
- package/lib/Constant.d.ts +0 -10
- package/lib/Constant.js +0 -17
- package/lib/Constant.js.map +0 -1
- package/lib/Day/index.d.ts +0 -4
- package/lib/Day/index.js +0 -39
- package/lib/Day/index.js.map +0 -1
- package/lib/Day/styles.d.ts +0 -20
- package/lib/Day/styles.js +0 -22
- package/lib/Day/styles.js.map +0 -1
- package/lib/Day/types.d.ts +0 -9
- package/lib/Day/types.js +0 -2
- package/lib/Day/types.js.map +0 -1
- package/lib/GiftedAvatar.d.ts +0 -11
- package/lib/GiftedAvatar.js +0 -104
- package/lib/GiftedAvatar.js.map +0 -1
- package/lib/GiftedChat/index.d.ts +0 -26
- package/lib/GiftedChat/index.js +0 -302
- package/lib/GiftedChat/index.js.map +0 -1
- package/lib/GiftedChat/styles.d.ts +0 -6
- package/lib/GiftedChat/styles.js +0 -7
- package/lib/GiftedChat/styles.js.map +0 -1
- package/lib/GiftedChat/types.d.ts +0 -117
- package/lib/GiftedChat/types.js +0 -2
- package/lib/GiftedChat/types.js.map +0 -1
- package/lib/GiftedChatContext.d.ts +0 -9
- package/lib/GiftedChatContext.js +0 -9
- package/lib/GiftedChatContext.js.map +0 -1
- package/lib/InputToolbar.d.ts +0 -23
- package/lib/InputToolbar.js +0 -56
- package/lib/InputToolbar.js.map +0 -1
- package/lib/LoadEarlier.d.ts +0 -14
- package/lib/LoadEarlier.js +0 -45
- package/lib/LoadEarlier.js.map +0 -1
- package/lib/Message/index.d.ts +0 -6
- package/lib/Message/index.js +0 -80
- package/lib/Message/index.js.map +0 -1
- package/lib/Message/styles.d.ts +0 -21
- package/lib/Message/styles.js +0 -22
- package/lib/Message/styles.js.map +0 -1
- package/lib/Message/types.d.ts +0 -22
- package/lib/Message/types.js +0 -2
- package/lib/Message/types.js.map +0 -1
- package/lib/MessageAudio.d.ts +0 -2
- package/lib/MessageAudio.js +0 -14
- package/lib/MessageAudio.js.map +0 -1
- package/lib/MessageContainer/components/DayAnimated/index.d.ts +0 -5
- package/lib/MessageContainer/components/DayAnimated/index.js +0 -85
- package/lib/MessageContainer/components/DayAnimated/index.js.map +0 -1
- package/lib/MessageContainer/components/DayAnimated/styles.d.ts +0 -11
- package/lib/MessageContainer/components/DayAnimated/styles.js +0 -12
- package/lib/MessageContainer/components/DayAnimated/styles.js.map +0 -1
- package/lib/MessageContainer/components/DayAnimated/types.d.ts +0 -17
- package/lib/MessageContainer/components/DayAnimated/types.js +0 -2
- package/lib/MessageContainer/components/DayAnimated/types.js.map +0 -1
- package/lib/MessageContainer/components/Item/index.d.ts +0 -23
- package/lib/MessageContainer/components/Item/index.js +0 -88
- package/lib/MessageContainer/components/Item/index.js.map +0 -1
- package/lib/MessageContainer/components/Item/types.d.ts +0 -17
- package/lib/MessageContainer/components/Item/types.js +0 -2
- package/lib/MessageContainer/components/Item/types.js.map +0 -1
- package/lib/MessageContainer/index.d.ts +0 -6
- package/lib/MessageContainer/index.js +0 -224
- package/lib/MessageContainer/index.js.map +0 -1
- package/lib/MessageContainer/styles.d.ts +0 -34
- package/lib/MessageContainer/styles.js +0 -31
- package/lib/MessageContainer/styles.js.map +0 -1
- package/lib/MessageContainer/types.d.ts +0 -54
- package/lib/MessageContainer/types.js +0 -2
- package/lib/MessageContainer/types.js.map +0 -1
- package/lib/MessageImage.d.ts +0 -13
- package/lib/MessageImage.js +0 -30
- package/lib/MessageImage.js.map +0 -1
- package/lib/MessageText.d.ts +0 -15
- package/lib/MessageText.js +0 -108
- package/lib/MessageText.js.map +0 -1
- package/lib/MessageVideo.d.ts +0 -2
- package/lib/MessageVideo.js +0 -14
- package/lib/MessageVideo.js.map +0 -1
- package/lib/QuickReplies.d.ts +0 -15
- package/lib/QuickReplies.js +0 -101
- package/lib/QuickReplies.js.map +0 -1
- package/lib/Send.d.ts +0 -15
- package/lib/Send.js +0 -34
- package/lib/Send.js.map +0 -1
- package/lib/SystemMessage.d.ts +0 -10
- package/lib/SystemMessage.js +0 -26
- package/lib/SystemMessage.js.map +0 -1
- package/lib/Time.d.ts +0 -11
- package/lib/Time.js +0 -56
- package/lib/Time.js.map +0 -1
- package/lib/TypingIndicator/index.d.ts +0 -5
- package/lib/TypingIndicator/index.js +0 -94
- package/lib/TypingIndicator/index.js.map +0 -1
- package/lib/TypingIndicator/styles.d.ts +0 -20
- package/lib/TypingIndicator/styles.js +0 -22
- package/lib/TypingIndicator/styles.js.map +0 -1
- package/lib/TypingIndicator/types.d.ts +0 -3
- package/lib/TypingIndicator/types.js +0 -2
- package/lib/TypingIndicator/types.js.map +0 -1
- package/lib/hooks/useUpdateLayoutEffect.d.ts +0 -8
- package/lib/hooks/useUpdateLayoutEffect.js +0 -17
- package/lib/hooks/useUpdateLayoutEffect.js.map +0 -1
- package/lib/index.d.ts +0 -4
- package/lib/index.js +0 -5
- package/lib/index.js.map +0 -1
- package/lib/logging.d.ts +0 -2
- package/lib/logging.js +0 -5
- package/lib/logging.js.map +0 -1
- package/lib/styles.d.ts +0 -10
- package/lib/styles.js +0 -11
- package/lib/styles.js.map +0 -1
- package/lib/types.d.ts +0 -67
- package/lib/types.js +0 -2
- package/lib/types.js.map +0 -1
- package/lib/utils.d.ts +0 -3
- package/lib/utils.js +0 -17
- package/lib/utils.js.map +0 -1
- package/src/__tests__/__snapshots__/MessageContainer.test.tsx.snap +0 -101
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import 'react-native'
|
|
2
1
|
import React from 'react'
|
|
3
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react-native'
|
|
4
3
|
|
|
5
4
|
import { GiftedChat } from '../GiftedChat'
|
|
6
5
|
import { useReanimatedKeyboardAnimation } from 'react-native-keyboard-controller'
|
|
@@ -18,25 +17,42 @@ const messages = [
|
|
|
18
17
|
]
|
|
19
18
|
|
|
20
19
|
it('should render <GiftedChat/> and compare with snapshot', () => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
20
|
+
(useReanimatedKeyboardAnimation as jest.Mock).mockReturnValue({
|
|
21
|
+
height: {
|
|
22
|
+
value: 0,
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const { toJSON } = render(
|
|
27
|
+
<GiftedChat
|
|
28
|
+
messages={messages}
|
|
29
|
+
onSend={() => {}}
|
|
30
|
+
user={{
|
|
31
|
+
_id: 1,
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
expect(toJSON()).toMatchSnapshot()
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('should render <GiftedChat/> with disableKeyboardController=true', () => {
|
|
40
|
+
(useReanimatedKeyboardAnimation as jest.Mock).mockReturnValue({
|
|
41
|
+
height: {
|
|
42
|
+
value: 0,
|
|
43
|
+
},
|
|
39
44
|
})
|
|
40
45
|
|
|
41
|
-
|
|
46
|
+
const { toJSON } = render(
|
|
47
|
+
<GiftedChat
|
|
48
|
+
messages={messages}
|
|
49
|
+
onSend={() => {}}
|
|
50
|
+
user={{
|
|
51
|
+
_id: 1,
|
|
52
|
+
}}
|
|
53
|
+
disableKeyboardController={true}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
expect(toJSON()).toMatchSnapshot()
|
|
42
58
|
})
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import 'react-native'
|
|
2
1
|
import React from 'react'
|
|
3
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react-native'
|
|
4
3
|
|
|
5
4
|
import { InputToolbar } from '../GiftedChat'
|
|
6
5
|
|
|
7
6
|
it('should render <InputToolbar /> and compare with snapshot', () => {
|
|
8
|
-
const
|
|
7
|
+
const { toJSON } = render(<InputToolbar />)
|
|
9
8
|
|
|
10
|
-
expect(
|
|
9
|
+
expect(toJSON()).toMatchSnapshot()
|
|
11
10
|
})
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import 'react-native'
|
|
2
1
|
import React from 'react'
|
|
3
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react-native'
|
|
4
3
|
|
|
5
4
|
import { LoadEarlier } from '../GiftedChat'
|
|
6
5
|
|
|
7
6
|
it('should render <LoadEarlier /> and compare with snapshot', () => {
|
|
8
|
-
const
|
|
7
|
+
const { toJSON } = render(<LoadEarlier />)
|
|
9
8
|
|
|
10
|
-
expect(
|
|
9
|
+
expect(toJSON()).toMatchSnapshot()
|
|
11
10
|
})
|
|
@@ -1,80 +1,73 @@
|
|
|
1
|
-
import 'react-native'
|
|
2
1
|
import React from 'react'
|
|
3
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react-native'
|
|
4
3
|
|
|
5
4
|
import { Message } from '../GiftedChat'
|
|
6
5
|
|
|
7
6
|
describe('Message component', () => {
|
|
8
7
|
it('should render <Message /> and compare with snapshot', () => {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
)
|
|
23
|
-
.toJSON()
|
|
8
|
+
const { toJSON } = render(
|
|
9
|
+
<Message
|
|
10
|
+
key='123'
|
|
11
|
+
user={{ _id: 1 }}
|
|
12
|
+
currentMessage={{
|
|
13
|
+
_id: 1,
|
|
14
|
+
text: 'test',
|
|
15
|
+
createdAt: 1554744013721,
|
|
16
|
+
user: { _id: 1 },
|
|
17
|
+
}}
|
|
18
|
+
position='left'
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
24
21
|
|
|
25
|
-
expect(
|
|
22
|
+
expect(toJSON()).toMatchSnapshot()
|
|
26
23
|
})
|
|
27
24
|
|
|
28
25
|
it('should NOT render <Message />', () => {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
const { toJSON } = render(
|
|
27
|
+
<Message key='123' user={{ _id: 1 }} currentMessage={null} position='left' />
|
|
28
|
+
)
|
|
32
29
|
|
|
33
|
-
expect(
|
|
30
|
+
expect(toJSON()).toMatchSnapshot()
|
|
34
31
|
})
|
|
35
32
|
|
|
36
33
|
it('should render <Message /> with Avatar', () => {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
)
|
|
52
|
-
.toJSON()
|
|
34
|
+
const { toJSON } = render(
|
|
35
|
+
<Message
|
|
36
|
+
key='123'
|
|
37
|
+
user={{ _id: 1 }}
|
|
38
|
+
currentMessage={{
|
|
39
|
+
_id: 1,
|
|
40
|
+
text: 'test',
|
|
41
|
+
createdAt: 1554744013721,
|
|
42
|
+
user: { _id: 1 },
|
|
43
|
+
}}
|
|
44
|
+
position='left'
|
|
45
|
+
showUserAvatar
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
53
48
|
|
|
54
|
-
expect(
|
|
49
|
+
expect(toJSON()).toMatchSnapshot()
|
|
55
50
|
})
|
|
56
51
|
|
|
57
52
|
it('should render null if user has no Avatar', () => {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
const { toJSON } = render(
|
|
54
|
+
<Message
|
|
55
|
+
key='123'
|
|
56
|
+
user={{ _id: 1 }}
|
|
57
|
+
currentMessage={{
|
|
58
|
+
_id: 1,
|
|
59
|
+
text: 'test',
|
|
60
|
+
createdAt: 1554744013721,
|
|
61
|
+
user: {
|
|
64
62
|
_id: 1,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
position='left'
|
|
73
|
-
showUserAvatar
|
|
74
|
-
/>
|
|
75
|
-
)
|
|
76
|
-
.toJSON()
|
|
63
|
+
avatar: null,
|
|
64
|
+
},
|
|
65
|
+
}}
|
|
66
|
+
position='left'
|
|
67
|
+
showUserAvatar
|
|
68
|
+
/>
|
|
69
|
+
)
|
|
77
70
|
|
|
78
|
-
expect(
|
|
71
|
+
expect(toJSON()).toMatchSnapshot()
|
|
79
72
|
})
|
|
80
73
|
})
|
|
@@ -1,11 +1,45 @@
|
|
|
1
|
-
import 'react-native'
|
|
2
1
|
import React from 'react'
|
|
3
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react-native'
|
|
4
3
|
|
|
5
4
|
import { MessageContainer } from '../GiftedChat'
|
|
5
|
+
import { DEFAULT_TEST_MESSAGE } from './data'
|
|
6
6
|
|
|
7
|
-
it('should render <MessageContainer />
|
|
8
|
-
|
|
7
|
+
it('should render <MessageContainer /> without crashing', () => {
|
|
8
|
+
render(
|
|
9
|
+
<MessageContainer
|
|
10
|
+
messages={[DEFAULT_TEST_MESSAGE]}
|
|
11
|
+
user={{ _id: 'test' }}
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
9
14
|
|
|
10
|
-
|
|
15
|
+
// Just verify it renders without throwing
|
|
16
|
+
expect(() => render(
|
|
17
|
+
<MessageContainer
|
|
18
|
+
messages={[DEFAULT_TEST_MESSAGE]}
|
|
19
|
+
user={{ _id: 'test' }}
|
|
20
|
+
/>
|
|
21
|
+
)).not.toThrow()
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it('should render <MessageContainer /> with multiple messages', () => {
|
|
25
|
+
const messages = [
|
|
26
|
+
{ ...DEFAULT_TEST_MESSAGE, _id: 'test1' },
|
|
27
|
+
{ ...DEFAULT_TEST_MESSAGE, _id: 'test2' },
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
expect(() => render(
|
|
31
|
+
<MessageContainer
|
|
32
|
+
messages={messages}
|
|
33
|
+
user={{ _id: 'test' }}
|
|
34
|
+
/>
|
|
35
|
+
)).not.toThrow()
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it('should render <MessageContainer /> with empty messages', () => {
|
|
39
|
+
expect(() => render(
|
|
40
|
+
<MessageContainer
|
|
41
|
+
messages={[]}
|
|
42
|
+
user={{ _id: 'test' }}
|
|
43
|
+
/>
|
|
44
|
+
)).not.toThrow()
|
|
11
45
|
})
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
import 'react-native'
|
|
2
1
|
import React from 'react'
|
|
3
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react-native'
|
|
4
3
|
|
|
5
4
|
import { MessageImage } from '../GiftedChat'
|
|
6
5
|
import { DEFAULT_TEST_MESSAGE } from './data'
|
|
7
6
|
|
|
8
7
|
describe('MessageImage', () => {
|
|
9
8
|
it('should not render <MessageImage /> and compare with snapshot', () => {
|
|
10
|
-
const
|
|
11
|
-
expect(
|
|
9
|
+
const { toJSON } = render(<MessageImage />)
|
|
10
|
+
expect(toJSON()).toMatchSnapshot()
|
|
12
11
|
})
|
|
13
12
|
|
|
14
13
|
it('should render <MessageImage /> and compare with snapshot', () => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
.toJSON()
|
|
25
|
-
expect(tree).toMatchSnapshot()
|
|
14
|
+
const { toJSON } = render(
|
|
15
|
+
<MessageImage
|
|
16
|
+
currentMessage={{
|
|
17
|
+
...DEFAULT_TEST_MESSAGE,
|
|
18
|
+
image: 'url://to/image.png',
|
|
19
|
+
}}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
expect(toJSON()).toMatchSnapshot()
|
|
26
23
|
})
|
|
27
24
|
})
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import 'react-native'
|
|
2
1
|
import React from 'react'
|
|
3
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react-native'
|
|
4
3
|
|
|
5
4
|
import { MessageText } from '../GiftedChat'
|
|
6
5
|
|
|
7
6
|
it('should render <MessageText /> and compare with snapshot', () => {
|
|
8
|
-
const
|
|
7
|
+
const { toJSON } = render(
|
|
8
|
+
<MessageText
|
|
9
|
+
currentMessage={{ _id: 1, createdAt: new Date(), text: 'test message' }}
|
|
10
|
+
/>
|
|
11
|
+
)
|
|
9
12
|
|
|
10
|
-
expect(
|
|
13
|
+
expect(toJSON()).toMatchSnapshot()
|
|
11
14
|
})
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import 'react-native'
|
|
2
1
|
import React from 'react'
|
|
3
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react-native'
|
|
4
3
|
|
|
5
4
|
import { Send } from '../GiftedChat'
|
|
6
5
|
|
|
7
6
|
describe('Send', () => {
|
|
8
7
|
it('should not render <Send /> and compare with snapshot', () => {
|
|
9
|
-
const
|
|
10
|
-
expect(
|
|
8
|
+
const { toJSON } = render(<Send />)
|
|
9
|
+
expect(toJSON()).toMatchSnapshot()
|
|
11
10
|
})
|
|
12
11
|
|
|
13
12
|
it('should always render <Send /> and compare with snapshot', () => {
|
|
14
|
-
const
|
|
15
|
-
expect(
|
|
13
|
+
const { toJSON } = render(<Send alwaysShowSend />)
|
|
14
|
+
expect(toJSON()).toMatchSnapshot()
|
|
16
15
|
})
|
|
17
16
|
|
|
18
17
|
it('should render <Send /> where there is input and compare with snapshot', () => {
|
|
19
|
-
const
|
|
20
|
-
expect(
|
|
18
|
+
const { toJSON } = render(<Send text='test input' />)
|
|
19
|
+
expect(toJSON()).toMatchSnapshot()
|
|
21
20
|
})
|
|
22
21
|
})
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
import 'react-native'
|
|
2
1
|
import React from 'react'
|
|
3
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react-native'
|
|
4
3
|
|
|
5
4
|
import { SystemMessage } from '../GiftedChat'
|
|
6
5
|
import { DEFAULT_TEST_MESSAGE } from './data'
|
|
7
6
|
|
|
8
7
|
describe('SystemMessage', () => {
|
|
9
8
|
it('should not render <SystemMessage /> and compare with snapshot', () => {
|
|
10
|
-
const
|
|
11
|
-
expect(
|
|
9
|
+
const { toJSON } = render(<SystemMessage />)
|
|
10
|
+
expect(toJSON()).toMatchSnapshot()
|
|
12
11
|
})
|
|
13
12
|
|
|
14
13
|
it('should render <SystemMessage /> and compare with snapshot', () => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
.toJSON()
|
|
25
|
-
expect(tree).toMatchSnapshot()
|
|
14
|
+
const { toJSON } = render(
|
|
15
|
+
<SystemMessage
|
|
16
|
+
currentMessage={{
|
|
17
|
+
...DEFAULT_TEST_MESSAGE,
|
|
18
|
+
system: true,
|
|
19
|
+
}}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
expect(toJSON()).toMatchSnapshot()
|
|
26
23
|
})
|
|
27
24
|
})
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import 'react-native'
|
|
2
1
|
import React from 'react'
|
|
3
|
-
import
|
|
2
|
+
import { render } from '@testing-library/react-native'
|
|
4
3
|
|
|
5
4
|
import { Time } from '../GiftedChat'
|
|
6
5
|
import { DEFAULT_TEST_MESSAGE } from './data'
|
|
7
6
|
|
|
8
7
|
describe('Time', () => {
|
|
9
8
|
it('should not render <Time /> and compare with snapshot', () => {
|
|
10
|
-
const
|
|
11
|
-
const tree = component.toJSON()
|
|
9
|
+
const { toJSON } = render(<Time />)
|
|
12
10
|
|
|
13
|
-
expect(
|
|
11
|
+
expect(toJSON()).toMatchSnapshot()
|
|
14
12
|
})
|
|
15
13
|
|
|
16
14
|
it('should render <Time /> and compare with snapshot', () => {
|
|
17
|
-
const
|
|
15
|
+
const { toJSON } = render(
|
|
18
16
|
<Time
|
|
19
17
|
currentMessage={{
|
|
20
18
|
...DEFAULT_TEST_MESSAGE,
|
|
@@ -22,8 +20,7 @@ describe('Time', () => {
|
|
|
22
20
|
}}
|
|
23
21
|
/>
|
|
24
22
|
)
|
|
25
|
-
const tree = component.toJSON()
|
|
26
23
|
|
|
27
|
-
expect(
|
|
24
|
+
expect(toJSON()).toMatchSnapshot()
|
|
28
25
|
})
|
|
29
26
|
})
|
|
@@ -31,7 +31,6 @@ exports[`should render <Bubble /> and compare with snapshot 1`] = `
|
|
|
31
31
|
}
|
|
32
32
|
>
|
|
33
33
|
<View
|
|
34
|
-
accessibilityRole="text"
|
|
35
34
|
accessibilityState={
|
|
36
35
|
{
|
|
37
36
|
"busy": undefined,
|
|
@@ -41,9 +40,20 @@ exports[`should render <Bubble /> and compare with snapshot 1`] = `
|
|
|
41
40
|
"selected": undefined,
|
|
42
41
|
}
|
|
43
42
|
}
|
|
43
|
+
accessibilityValue={
|
|
44
|
+
{
|
|
45
|
+
"max": undefined,
|
|
46
|
+
"min": undefined,
|
|
47
|
+
"now": undefined,
|
|
48
|
+
"text": undefined,
|
|
49
|
+
}
|
|
50
|
+
}
|
|
44
51
|
accessible={true}
|
|
52
|
+
collapsable={false}
|
|
45
53
|
focusable={true}
|
|
54
|
+
onBlur={[Function]}
|
|
46
55
|
onClick={[Function]}
|
|
56
|
+
onFocus={[Function]}
|
|
47
57
|
onResponderGrant={[Function]}
|
|
48
58
|
onResponderMove={[Function]}
|
|
49
59
|
onResponderRelease={[Function]}
|
|
@@ -52,93 +62,81 @@ exports[`should render <Bubble /> and compare with snapshot 1`] = `
|
|
|
52
62
|
onStartShouldSetResponder={[Function]}
|
|
53
63
|
>
|
|
54
64
|
<View>
|
|
55
|
-
<View
|
|
56
|
-
|
|
57
|
-
[
|
|
58
|
-
{},
|
|
59
|
-
undefined,
|
|
60
|
-
]
|
|
61
|
-
}
|
|
62
|
-
>
|
|
63
|
-
<Text
|
|
65
|
+
<View>
|
|
66
|
+
<View
|
|
64
67
|
style={
|
|
65
68
|
[
|
|
66
69
|
{
|
|
67
|
-
"color": "black",
|
|
68
|
-
"fontSize": 16,
|
|
69
|
-
"lineHeight": 20,
|
|
70
70
|
"marginBottom": 5,
|
|
71
71
|
"marginLeft": 10,
|
|
72
72
|
"marginRight": 10,
|
|
73
73
|
"marginTop": 5,
|
|
74
74
|
},
|
|
75
75
|
undefined,
|
|
76
|
-
undefined,
|
|
77
76
|
]
|
|
78
77
|
}
|
|
79
78
|
>
|
|
80
79
|
<Text
|
|
80
|
+
link={true}
|
|
81
81
|
style={
|
|
82
82
|
[
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"lineHeight": 20,
|
|
88
|
-
"marginBottom": 5,
|
|
89
|
-
"marginLeft": 10,
|
|
90
|
-
"marginRight": 10,
|
|
91
|
-
"marginTop": 5,
|
|
92
|
-
},
|
|
93
|
-
undefined,
|
|
94
|
-
undefined,
|
|
95
|
-
],
|
|
83
|
+
{
|
|
84
|
+
"color": "black",
|
|
85
|
+
},
|
|
86
|
+
undefined,
|
|
96
87
|
undefined,
|
|
97
88
|
]
|
|
98
89
|
}
|
|
90
|
+
user={
|
|
91
|
+
{
|
|
92
|
+
"_id": 1,
|
|
93
|
+
}
|
|
94
|
+
}
|
|
99
95
|
>
|
|
100
|
-
|
|
96
|
+
<Text>
|
|
97
|
+
test
|
|
98
|
+
</Text>
|
|
101
99
|
</Text>
|
|
102
|
-
</
|
|
100
|
+
</View>
|
|
103
101
|
</View>
|
|
104
|
-
</View>
|
|
105
|
-
<View
|
|
106
|
-
style={
|
|
107
|
-
[
|
|
108
|
-
{
|
|
109
|
-
"flexDirection": "row",
|
|
110
|
-
"justifyContent": "flex-start",
|
|
111
|
-
},
|
|
112
|
-
undefined,
|
|
113
|
-
]
|
|
114
|
-
}
|
|
115
|
-
>
|
|
116
102
|
<View
|
|
117
103
|
style={
|
|
118
104
|
[
|
|
119
105
|
{
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"marginRight": 10,
|
|
106
|
+
"flexDirection": "row",
|
|
107
|
+
"justifyContent": "flex-start",
|
|
123
108
|
},
|
|
124
109
|
undefined,
|
|
125
110
|
]
|
|
126
111
|
}
|
|
127
112
|
>
|
|
128
|
-
<
|
|
113
|
+
<View
|
|
129
114
|
style={
|
|
130
115
|
[
|
|
131
116
|
{
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
"
|
|
117
|
+
"marginBottom": 5,
|
|
118
|
+
"marginLeft": 10,
|
|
119
|
+
"marginRight": 10,
|
|
135
120
|
},
|
|
136
121
|
undefined,
|
|
137
122
|
]
|
|
138
123
|
}
|
|
139
124
|
>
|
|
140
|
-
|
|
141
|
-
|
|
125
|
+
<Text
|
|
126
|
+
style={
|
|
127
|
+
[
|
|
128
|
+
{
|
|
129
|
+
"color": "#aaa",
|
|
130
|
+
"fontSize": 10,
|
|
131
|
+
"textAlign": "right",
|
|
132
|
+
},
|
|
133
|
+
undefined,
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
>
|
|
137
|
+
7:20 PM
|
|
138
|
+
</Text>
|
|
139
|
+
</View>
|
|
142
140
|
</View>
|
|
143
141
|
</View>
|
|
144
142
|
</View>
|
|
@@ -4,8 +4,6 @@ exports[`should render <Composer /> and compare with snapshot 1`] = `
|
|
|
4
4
|
<TextInput
|
|
5
5
|
accessibilityLabel="Type a message..."
|
|
6
6
|
accessible={true}
|
|
7
|
-
autoFocus={false}
|
|
8
|
-
editable={true}
|
|
9
7
|
enablesReturnKeyAutomatically={true}
|
|
10
8
|
keyboardAppearance="default"
|
|
11
9
|
multiline={true}
|
|
@@ -25,6 +23,7 @@ exports[`should render <Composer /> and compare with snapshot 1`] = `
|
|
|
25
23
|
"marginTop": 6,
|
|
26
24
|
},
|
|
27
25
|
undefined,
|
|
26
|
+
undefined,
|
|
28
27
|
{
|
|
29
28
|
"height": 33,
|
|
30
29
|
},
|
|
@@ -26,3 +26,28 @@ exports[`should render <GiftedChat/> and compare with snapshot 1`] = `
|
|
|
26
26
|
</View>
|
|
27
27
|
</KeyboardProvider>
|
|
28
28
|
`;
|
|
29
|
+
|
|
30
|
+
exports[`should render <GiftedChat/> with disableKeyboardController=true 1`] = `
|
|
31
|
+
<View
|
|
32
|
+
style={
|
|
33
|
+
{
|
|
34
|
+
"flex": 1,
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
>
|
|
38
|
+
<View
|
|
39
|
+
onLayout={[Function]}
|
|
40
|
+
style={
|
|
41
|
+
[
|
|
42
|
+
{
|
|
43
|
+
"flex": 1,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"overflow": "hidden",
|
|
47
|
+
},
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
testID="GC_WRAPPER"
|
|
51
|
+
/>
|
|
52
|
+
</View>
|
|
53
|
+
`;
|