Skip to content

Commit 428a080

Browse files
authored
Merge branch 'MOB-12193-add-tests-for-iterableinboxmessagedisplay' into MOB-12194-add-tests-for-iterableinboxemptystate
2 parents e73c2da + 178f4a0 commit 428a080

3 files changed

Lines changed: 279 additions & 117 deletions

File tree

src/inbox/components/IterableInboxMessageCell.tsx

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@ import type {
2020
import { ITERABLE_INBOX_COLORS } from '../constants';
2121

2222
export const inboxMessageCellTestIDs = {
23-
container: 'inbox-message-cell',
24-
unreadIndicator: 'inbox-message-cell-unread-indicator',
25-
thumbnail: 'inbox-message-cell-thumbnail',
26-
textContainer: 'inbox-message-cell-text-container',
27-
title: 'inbox-message-cell-title',
2823
body: 'inbox-message-cell-body',
24+
container: 'inbox-message-cell',
2925
createdAt: 'inbox-message-cell-created-at',
26+
defaultContainer: 'inbox-message-cell-default-container',
3027
deleteSlider: 'inbox-message-cell-delete-slider',
31-
selectButton: 'inbox-message-cell-select-button',
28+
select: 'inbox-message-cell-select',
29+
textContainer: 'inbox-message-cell-text-container',
30+
thumbnail: 'inbox-message-cell-thumbnail',
31+
title: 'inbox-message-cell-title',
32+
unreadIndicator: 'inbox-message-cell-unread-indicator',
3233
} as const;
3334

3435
/**
@@ -151,9 +152,17 @@ function defaultMessageListLayout(
151152
}
152153

153154
return (
154-
<View testID={inboxMessageCellTestIDs.container} style={messageRowStyle(rowViewModel) as ViewStyle}>
155+
<View
156+
testID={inboxMessageCellTestIDs.defaultContainer}
157+
style={messageRowStyle(rowViewModel) as ViewStyle}
158+
>
155159
<View style={unreadIndicatorContainer as ViewStyle}>
156-
{rowViewModel.read ? null : <View testID={inboxMessageCellTestIDs.unreadIndicator} style={unreadIndicator} />}
160+
{rowViewModel.read ? null : (
161+
<View
162+
testID={inboxMessageCellTestIDs.unreadIndicator}
163+
style={unreadIndicator}
164+
/>
165+
)}
157166
</View>
158167
<View
159168
style={
@@ -172,14 +181,29 @@ function defaultMessageListLayout(
172181
/>
173182
) : null}
174183
</View>
175-
<View testID={inboxMessageCellTestIDs.textContainer} style={messageContainer as ViewStyle}>
176-
<Text testID={inboxMessageCellTestIDs.title} numberOfLines={1} ellipsizeMode="tail" style={title}>
184+
<View
185+
testID={inboxMessageCellTestIDs.textContainer}
186+
style={messageContainer as ViewStyle}
187+
>
188+
<Text
189+
testID={inboxMessageCellTestIDs.title}
190+
numberOfLines={1}
191+
ellipsizeMode="tail"
192+
style={title}
193+
>
177194
{messageTitle}
178195
</Text>
179-
<Text testID={inboxMessageCellTestIDs.body} numberOfLines={3} ellipsizeMode="tail" style={body as TextStyle}>
196+
<Text
197+
testID={inboxMessageCellTestIDs.body}
198+
numberOfLines={3}
199+
ellipsizeMode="tail"
200+
style={body as TextStyle}
201+
>
180202
{messageBody}
181203
</Text>
182-
<Text testID={inboxMessageCellTestIDs.createdAt} style={createdAt}>{messageCreatedAt}</Text>
204+
<Text testID={inboxMessageCellTestIDs.createdAt} style={createdAt}>
205+
{messageCreatedAt}
206+
</Text>
183207
</View>
184208
</View>
185209
);
@@ -413,20 +437,25 @@ export const IterableInboxMessageCell = ({
413437

414438
return (
415439
<>
416-
<View style={styles.deleteSlider}>
440+
<View
441+
testID={inboxMessageCellTestIDs.deleteSlider}
442+
style={styles.deleteSlider}
443+
>
417444
<Text style={styles.textStyle}>DELETE</Text>
418445
</View>
419446
<Animated.View
447+
testID={inboxMessageCellTestIDs.container}
420448
style={[styles.textContainer, position.getLayout()]}
421449
{...panResponder.panHandlers}
422450
>
423451
<TouchableOpacity
452+
testID={inboxMessageCellTestIDs.select}
424453
activeOpacity={1}
425454
onPress={() => {
426455
handleMessageSelect(rowViewModel.inAppMessage.messageId, index);
427456
}}
428457
>
429-
{messageListItemLayout(last, rowViewModel)
458+
{messageListItemLayout?.(last, rowViewModel)
430459
? messageListItemLayout(last, rowViewModel)?.[0]
431460
: defaultMessageListLayout(
432461
last,

0 commit comments

Comments
 (0)