@hero-design/rn 7.13.0 → 7.14.0

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.
Files changed (155) hide show
  1. package/.eslintrc.json +3 -1
  2. package/.turbo/turbo-build.log +3 -2
  3. package/assets/fonts/hero-icons.ttf +0 -0
  4. package/babel.config.js +16 -0
  5. package/es/index.js +26957 -7622
  6. package/lib/assets/fonts/hero-icons.ttf +0 -0
  7. package/lib/index.js +26963 -7624
  8. package/package.json +9 -4
  9. package/rollup.config.js +1 -0
  10. package/src/components/Accordion/AccordionItem.tsx +50 -0
  11. package/src/components/Accordion/StyledAccordion.tsx +29 -0
  12. package/src/components/Accordion/__tests__/AccordionItem.spec.tsx +56 -0
  13. package/src/components/Accordion/__tests__/StyledAccordion.spec.tsx +17 -0
  14. package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.spec.tsx.snap +529 -0
  15. package/src/components/Accordion/__tests__/__snapshots__/StyledAccordion.spec.tsx.snap +33 -0
  16. package/src/components/Accordion/__tests__/__snapshots__/index.spec.tsx.snap +822 -0
  17. package/src/components/Accordion/__tests__/index.spec.tsx +54 -0
  18. package/src/components/Accordion/index.tsx +82 -0
  19. package/src/components/Accordion/utils.tsx +11 -0
  20. package/src/components/Button/IconButton.tsx +1 -1
  21. package/src/components/Calendar/CalendarRowItem.tsx +54 -0
  22. package/src/components/Calendar/StyledCalendar.tsx +76 -0
  23. package/src/components/Calendar/__tests__/CalendarRowItem.spec.tsx +76 -0
  24. package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +411 -0
  25. package/src/components/Calendar/__tests__/helper.spec.ts +50 -0
  26. package/src/components/Calendar/__tests__/index.spec.tsx +99 -0
  27. package/src/components/Calendar/helpers.ts +29 -0
  28. package/src/components/Calendar/index.tsx +217 -0
  29. package/src/components/Collapse/index.tsx +13 -15
  30. package/src/components/ContentNavigator/index.tsx +6 -0
  31. package/src/components/Empty/StyledEmpty.tsx +47 -0
  32. package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +66 -0
  33. package/src/components/Empty/__tests__/index.spec.tsx +17 -0
  34. package/src/components/Empty/index.tsx +53 -0
  35. package/src/components/FAB/ActionGroup/ActionItem.tsx +6 -2
  36. package/src/components/FAB/ActionGroup/StyledActionGroup.tsx +1 -0
  37. package/src/components/FAB/ActionGroup/StyledActionItem.tsx +7 -1
  38. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +84 -22
  39. package/src/components/FAB/ActionGroup/index.tsx +8 -1
  40. package/src/components/Icon/HeroIcon/selection.json +1 -1
  41. package/src/components/Icon/IconList.ts +13 -0
  42. package/src/components/List/BasicListItem.tsx +44 -34
  43. package/src/components/List/ListItem.tsx +67 -58
  44. package/src/components/List/StyledBasicListItem.tsx +2 -3
  45. package/src/components/List/StyledListItem.tsx +2 -2
  46. package/src/components/List/__tests__/StyledBasicListItem.spec.tsx +5 -2
  47. package/src/components/List/__tests__/StyledListItem.spec.tsx +4 -1
  48. package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +15 -10
  49. package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +52 -32
  50. package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +128 -48
  51. package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +132 -52
  52. package/src/components/RichTextEditor/EditorEvent.ts +7 -0
  53. package/src/components/RichTextEditor/EditorToolbar.tsx +220 -0
  54. package/src/components/RichTextEditor/MentionList.tsx +69 -0
  55. package/src/components/RichTextEditor/RichTextEditor.tsx +396 -0
  56. package/src/components/RichTextEditor/StyledRichTextEditor.ts +20 -0
  57. package/src/components/RichTextEditor/StyledToolbar.ts +32 -0
  58. package/src/components/RichTextEditor/__tests__/EditorToolbar.spec.tsx +130 -0
  59. package/src/components/RichTextEditor/__tests__/MentionList.spec.tsx +109 -0
  60. package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +245 -0
  61. package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +324 -0
  62. package/src/components/RichTextEditor/__tests__/__snapshots__/MentionList.spec.tsx.snap +45 -0
  63. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +526 -0
  64. package/src/components/RichTextEditor/constants.ts +20 -0
  65. package/src/components/RichTextEditor/hero-editor.d.ts +8 -0
  66. package/src/components/RichTextEditor/index.tsx +8 -0
  67. package/src/components/RichTextEditor/utils/events.ts +31 -0
  68. package/src/components/RichTextEditor/utils/rnWebView.ts +19 -0
  69. package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +77 -0
  70. package/src/components/SectionHeading/__tests__/index.spec.tsx +14 -0
  71. package/src/components/SectionHeading/index.tsx +16 -9
  72. package/src/components/Tag/StyledTag.tsx +12 -2
  73. package/src/components/Tag/__tests__/Tag.spec.tsx +35 -8
  74. package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +118 -4
  75. package/src/components/Tag/index.tsx +9 -2
  76. package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +1 -0
  77. package/src/components/Typography/Text/StyledText.tsx +2 -1
  78. package/src/components/Typography/Text/__tests__/StyledText.spec.tsx +1 -0
  79. package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +22 -0
  80. package/src/components/Typography/Text/index.tsx +2 -1
  81. package/src/index.ts +8 -0
  82. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +101 -4
  83. package/src/theme/components/accordion.ts +19 -0
  84. package/src/theme/components/calendar.ts +34 -0
  85. package/src/theme/components/card.ts +1 -1
  86. package/src/theme/components/empty.ts +38 -0
  87. package/src/theme/components/fab.ts +4 -3
  88. package/src/theme/components/list.ts +1 -0
  89. package/src/theme/components/pinInput.ts +1 -1
  90. package/src/theme/components/richTextEditor.ts +34 -0
  91. package/src/theme/components/tag.ts +8 -2
  92. package/src/theme/components/typography.ts +1 -0
  93. package/src/theme/global/borders.ts +6 -6
  94. package/src/theme/global/colors.ts +4 -1
  95. package/src/theme/index.ts +12 -0
  96. package/testUtils/setup.tsx +17 -0
  97. package/types/components/Accordion/AccordionItem.d.ts +14 -0
  98. package/types/components/Accordion/StyledAccordion.d.ts +32 -0
  99. package/types/components/Accordion/__tests__/AccordionItem.spec.d.ts +1 -0
  100. package/types/components/Accordion/__tests__/StyledAccordion.spec.d.ts +1 -0
  101. package/types/components/Accordion/__tests__/index.spec.d.ts +1 -0
  102. package/types/components/Accordion/index.d.ts +38 -0
  103. package/types/components/Accordion/utils.d.ts +1 -0
  104. package/types/components/Button/IconButton.d.ts +1 -1
  105. package/types/components/Calendar/CalendarRowItem.d.ts +10 -0
  106. package/types/components/Calendar/StyledCalendar.d.ts +54 -0
  107. package/types/components/Calendar/__tests__/CalendarRowItem.spec.d.ts +1 -0
  108. package/types/components/Calendar/__tests__/helper.spec.d.ts +1 -0
  109. package/types/components/Calendar/__tests__/index.spec.d.ts +1 -0
  110. package/types/components/Calendar/helpers.d.ts +3 -0
  111. package/types/components/Calendar/index.d.ts +40 -0
  112. package/types/components/Collapse/index.d.ts +1 -1
  113. package/types/components/ContentNavigator/index.d.ts +5 -1
  114. package/types/components/Empty/StyledEmpty.d.ts +31 -0
  115. package/types/components/Empty/__tests__/index.spec.d.ts +1 -0
  116. package/types/components/Empty/index.d.ts +26 -0
  117. package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +6 -1
  118. package/types/components/FAB/ActionGroup/index.d.ts +6 -1
  119. package/types/components/FAB/index.d.ts +1 -1
  120. package/types/components/Icon/IconList.d.ts +1 -1
  121. package/types/components/Icon/utils.d.ts +1 -1
  122. package/types/components/List/StyledBasicListItem.d.ts +3 -3
  123. package/types/components/List/StyledListItem.d.ts +3 -3
  124. package/types/components/RichTextEditor/EditorEvent.d.ts +3 -0
  125. package/types/components/RichTextEditor/EditorToolbar.d.ts +17 -0
  126. package/types/components/RichTextEditor/MentionList.d.ts +12 -0
  127. package/types/components/RichTextEditor/RichTextEditor.d.ts +65 -0
  128. package/types/components/RichTextEditor/StyledRichTextEditor.d.ts +16 -0
  129. package/types/components/RichTextEditor/StyledToolbar.d.ts +21 -0
  130. package/types/components/RichTextEditor/__tests__/EditorToolbar.spec.d.ts +1 -0
  131. package/types/components/RichTextEditor/__tests__/MentionList.spec.d.ts +1 -0
  132. package/types/components/RichTextEditor/__tests__/RichTextEditor.spec.d.ts +1 -0
  133. package/types/components/RichTextEditor/constants.d.ts +19 -0
  134. package/types/components/RichTextEditor/index.d.ts +5 -0
  135. package/types/components/RichTextEditor/utils/events.d.ts +8 -0
  136. package/types/components/RichTextEditor/utils/rnWebView.d.ts +7 -0
  137. package/types/components/SectionHeading/index.d.ts +2 -2
  138. package/types/components/Select/MultiSelect/OptionList.d.ts +1 -1
  139. package/types/components/Select/SingleSelect/OptionList.d.ts +1 -1
  140. package/types/components/Tag/StyledTag.d.ts +1 -1
  141. package/types/components/Tag/index.d.ts +1 -1
  142. package/types/components/Typography/Text/StyledText.d.ts +1 -1
  143. package/types/components/Typography/Text/index.d.ts +1 -1
  144. package/types/index.d.ts +5 -1
  145. package/types/theme/components/accordion.d.ts +13 -0
  146. package/types/theme/components/calendar.d.ts +26 -0
  147. package/types/theme/components/empty.d.ts +28 -0
  148. package/types/theme/components/fab.d.ts +1 -0
  149. package/types/theme/components/list.d.ts +1 -0
  150. package/types/theme/components/richTextEditor.d.ts +26 -0
  151. package/types/theme/components/tag.d.ts +8 -2
  152. package/types/theme/components/typography.d.ts +1 -0
  153. package/types/theme/global/colors.d.ts +4 -1
  154. package/types/theme/global/index.d.ts +4 -1
  155. package/types/theme/index.d.ts +8 -0
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import renderWithTheme from '../../../testHelpers/renderWithTheme';
3
+ import Typography from '../../Typography';
4
+ import Accordion, { AccordionProps } from '..';
5
+
6
+ const AccordionExample = (props: Omit<AccordionProps<string>, 'items'>) => (
7
+ <Accordion
8
+ items={[
9
+ {
10
+ header: 'Accordion header 1',
11
+ content: <Typography.Text>Accordion content 1</Typography.Text>,
12
+ key: 'acc1',
13
+ },
14
+ {
15
+ header: 'Accordion header 2',
16
+ content: <Typography.Text>Accordion content 2</Typography.Text>,
17
+ key: 'acc2',
18
+ },
19
+ ]}
20
+ {...props}
21
+ />
22
+ );
23
+
24
+ const ControlledAccordionExample = () => {
25
+ const [activeItem, setActiveItem] = React.useState('acc2');
26
+ return (
27
+ <AccordionExample activeItemKey={activeItem} onItemPress={setActiveItem} />
28
+ );
29
+ };
30
+
31
+ describe('Accordion', () => {
32
+ it('renders correctly', () => {
33
+ const wrapper = renderWithTheme(<AccordionExample />);
34
+
35
+ expect(wrapper.getAllByText('Accordion header 1')).toHaveLength(1);
36
+ expect(wrapper.getAllByText('Accordion header 2')).toHaveLength(1);
37
+ expect(wrapper.toJSON()).toMatchSnapshot();
38
+ });
39
+
40
+ it('allows fully controlled', () => {
41
+ const wrapper = renderWithTheme(<ControlledAccordionExample />);
42
+
43
+ expect(wrapper.getAllByText('Accordion header 1')).toHaveLength(1);
44
+ expect(wrapper.getAllByText('Accordion header 2')).toHaveLength(1);
45
+ expect(wrapper.toJSON()).toMatchSnapshot();
46
+ });
47
+
48
+ it('renders correctly when variant is card', () => {
49
+ const wrapper = renderWithTheme(<AccordionExample variant="card" />);
50
+
51
+ expect(wrapper.getAllByTestId('accordion-spacer')).toHaveLength(1);
52
+ expect(wrapper.toJSON()).toMatchSnapshot();
53
+ });
54
+ });
@@ -0,0 +1,82 @@
1
+ import React, { Key, ReactElement, useMemo } from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ import AccordionItem from './AccordionItem';
4
+ import { Spacer, StyledWrapper } from './StyledAccordion';
5
+ import { usePropsOrInternalState } from './utils';
6
+
7
+ export interface AccordionProps<K extends Key> {
8
+ /**
9
+ * List of accordion items to be rendered. Each item must have an unique key.
10
+ */
11
+ items: {
12
+ header: string | ReactElement;
13
+ content: ReactElement;
14
+ key: K;
15
+ style?: StyleProp<ViewStyle>;
16
+ testID?: string;
17
+ }[];
18
+ /**
19
+ * Key of the active item.
20
+ * When activeItemKey and onItemPress is passed, the component is fully controlled.
21
+ * Otherwise, it would be uncontrolled.
22
+ */
23
+ activeItemKey?: K;
24
+ /**
25
+ * Callback invoked when an item is pressed.
26
+ */
27
+ onItemPress?: (key: K) => void;
28
+ /**
29
+ * Item type.
30
+ */
31
+ variant?: 'default' | 'card';
32
+ /**
33
+ * Additional style.
34
+ */
35
+ style?: StyleProp<ViewStyle>;
36
+ /**
37
+ * Testing id of the component.
38
+ */
39
+ testID?: string;
40
+ }
41
+
42
+ const Accordion = <K extends Key>({
43
+ items,
44
+ activeItemKey,
45
+ onItemPress,
46
+ variant = 'default',
47
+ style,
48
+ testID,
49
+ }: AccordionProps<K>) => {
50
+ const defaultValue = useMemo(
51
+ () => (typeof activeItemKey === 'number' ? NaN : '') as K,
52
+ [activeItemKey]
53
+ );
54
+ const [_activeItemKey, _onItemPress] = usePropsOrInternalState<K>(
55
+ defaultValue,
56
+ activeItemKey,
57
+ onItemPress
58
+ );
59
+
60
+ return (
61
+ <StyledWrapper style={style} testID={testID}>
62
+ {items.map(({ key, ...props }, index) => {
63
+ const open = _activeItemKey === key;
64
+ return (
65
+ <React.Fragment key={key}>
66
+ {variant === 'card' && index !== 0 && (
67
+ <Spacer testID="accordion-spacer" />
68
+ )}
69
+ <AccordionItem
70
+ {...props}
71
+ open={open}
72
+ onPress={() => _onItemPress(open ? defaultValue : key)}
73
+ variant={variant}
74
+ />
75
+ </React.Fragment>
76
+ );
77
+ })}
78
+ </StyledWrapper>
79
+ );
80
+ };
81
+
82
+ export default Accordion;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+
3
+ export function usePropsOrInternalState<T>(
4
+ initialState: T,
5
+ state: T | undefined,
6
+ setState: ((val: T) => void) | undefined
7
+ ): [T, (val: T) => void] {
8
+ const [internalState, setInternalState] = React.useState<T>(initialState);
9
+
10
+ return [state || internalState, setState || setInternalState];
11
+ }
@@ -29,7 +29,7 @@ export interface IconButtonProps {
29
29
  /**
30
30
  * Set the handler to handle press event.
31
31
  */
32
- onPress: () => void;
32
+ onPress?: () => void;
33
33
  /**
34
34
  * Size of the Icon.
35
35
  */
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import Typography from '../Typography';
3
+ import {
4
+ StyledCalendarCell,
5
+ StyledCalendarRowItem,
6
+ StyledMark,
7
+ } from './StyledCalendar';
8
+
9
+ const getCellVariant = (
10
+ isSelected: boolean = false,
11
+ isCurrent: boolean = false
12
+ ) => {
13
+ if (isSelected) return 'selected';
14
+ if (isCurrent) return 'current';
15
+
16
+ return 'default';
17
+ };
18
+
19
+ export interface CalendarRowItemProps {
20
+ date?: Date;
21
+ onPress?: () => void;
22
+ isCurrent?: boolean;
23
+ isSelected?: boolean;
24
+ textIntent?: 'body' | 'subdued';
25
+ marked?: boolean;
26
+ }
27
+
28
+ const CalendarRowItem = ({
29
+ date,
30
+ onPress,
31
+ isCurrent,
32
+ isSelected,
33
+ textIntent = 'body',
34
+ marked = false,
35
+ }: CalendarRowItemProps) => (
36
+ <StyledCalendarRowItem testID="calendar-date-cell">
37
+ <StyledCalendarCell
38
+ variant={getCellVariant(isSelected, isCurrent)}
39
+ onPress={onPress}
40
+ >
41
+ <Typography.Text intent={isSelected ? 'inverted' : textIntent}>
42
+ {date ? date.getDate() : ''}
43
+ </Typography.Text>
44
+ {marked ? (
45
+ <StyledMark
46
+ testID="calendar-date-mark"
47
+ variant={isSelected ? 'inverted' : 'primary'}
48
+ />
49
+ ) : null}
50
+ </StyledCalendarCell>
51
+ </StyledCalendarRowItem>
52
+ );
53
+
54
+ export default CalendarRowItem;
@@ -0,0 +1,76 @@
1
+ import styled from '@emotion/native';
2
+ import { TouchableOpacity, View, ViewProps } from 'react-native';
3
+
4
+ const StyledContainer = styled(View)(({ theme }) => ({
5
+ backgroundColor: theme.__hd__.calendar.colors.background,
6
+ }));
7
+
8
+ const StyledCalendarHeader = styled(View)(({ theme }) => ({
9
+ flexDirection: 'row',
10
+ paddingHorizontal: theme.__hd__.calendar.space.headerHorizontalPadding,
11
+ paddingVertical: theme.__hd__.calendar.space.headerVerticalPadding,
12
+ }));
13
+
14
+ const StyledCalendarDayNameCell = styled(View)<ViewProps>(({ theme }) => ({
15
+ width: theme.__hd__.calendar.sizes.cellWidth,
16
+ height: theme.__hd__.calendar.sizes.cellHeight,
17
+ alignItems: 'center',
18
+ justifyContent: 'center',
19
+ }));
20
+
21
+ const StyledCalendarCell = styled(TouchableOpacity)<{
22
+ variant?: 'default' | 'current' | 'selected';
23
+ }>(({ theme, variant = 'default' }) => ({
24
+ borderColor: theme.__hd__.calendar.colors.border,
25
+ borderWidth: variant === 'current' ? 1 : 0,
26
+ borderRadius: theme.__hd__.calendar.radii.default,
27
+ alignItems: 'center',
28
+ justifyContent: 'center',
29
+ backgroundColor:
30
+ variant === 'selected' ? theme.__hd__.calendar.colors.primary : undefined,
31
+ width: theme.__hd__.calendar.sizes.cellCircleWidth,
32
+ height: theme.__hd__.calendar.sizes.cellCircleHeight,
33
+ }));
34
+
35
+ const StyledCalendarRow = styled(View)<ViewProps>(({ theme }) => ({
36
+ flexDirection: 'row',
37
+ paddingHorizontal: theme.__hd__.calendar.space.rowVerticalPadding,
38
+ flexWrap: 'wrap',
39
+ }));
40
+
41
+ const StyledCalendarRowItem = styled(View)<ViewProps>(({ theme }) => ({
42
+ flexBasis: `${Math.floor(100.0 / 7.0).toString()}%`,
43
+ alignItems: 'center',
44
+ width: theme.__hd__.calendar.sizes.cellWidth,
45
+ height: theme.__hd__.calendar.sizes.cellHeight,
46
+ justifyContent: 'center',
47
+ }));
48
+
49
+ const StyledDisabledCalendarRowItem = styled(View)<ViewProps>(({ theme }) => ({
50
+ flexBasis: `${Math.floor(100.0 / 7.0).toString()}%`,
51
+ alignItems: 'center',
52
+ width: theme.__hd__.calendar.sizes.cellWidth,
53
+ height: theme.__hd__.calendar.sizes.cellHeight,
54
+ }));
55
+
56
+ const StyledMark = styled(View)<{ variant: 'primary' | 'inverted' }>(
57
+ ({ theme, variant = 'primary' }) => ({
58
+ width: theme.__hd__.calendar.sizes.markWidth,
59
+ height: theme.__hd__.calendar.sizes.markHeight,
60
+ borderRadius: theme.__hd__.calendar.radii.default,
61
+ backgroundColor: theme.__hd__.calendar.colors[variant],
62
+ position: 'absolute',
63
+ bottom: '10%',
64
+ })
65
+ );
66
+
67
+ export {
68
+ StyledContainer,
69
+ StyledCalendarHeader,
70
+ StyledCalendarRow,
71
+ StyledCalendarRowItem,
72
+ StyledDisabledCalendarRowItem,
73
+ StyledCalendarDayNameCell,
74
+ StyledCalendarCell,
75
+ StyledMark,
76
+ };
@@ -0,0 +1,76 @@
1
+ import React from 'react';
2
+ import renderWithTheme from '../../../testHelpers/renderWithTheme';
3
+ import CalendarRowItem from '../CalendarRowItem';
4
+
5
+ describe('CalendarRowItem', () => {
6
+ it.each`
7
+ textIntent
8
+ ${'body'}
9
+ ${'subdued'}
10
+ `('renders correctly', ({ textIntent }) => {
11
+ const { toJSON } = renderWithTheme(
12
+ <CalendarRowItem
13
+ date={new Date(2022, 10, 10)}
14
+ onPress={jest.fn()}
15
+ textIntent={textIntent}
16
+ marked
17
+ />
18
+ );
19
+
20
+ expect(toJSON()).toMatchSnapshot();
21
+ });
22
+
23
+ it.each`
24
+ isCurrent
25
+ ${true}
26
+ ${false}
27
+ `(
28
+ 'renders correctly when selected, and is current date equal to $current',
29
+ ({ isCurrent }) => {
30
+ const { toJSON } = renderWithTheme(
31
+ <CalendarRowItem
32
+ date={new Date(2022, 10, 10)}
33
+ onPress={jest.fn()}
34
+ marked
35
+ isSelected
36
+ isCurrent={isCurrent}
37
+ />
38
+ );
39
+
40
+ expect(toJSON()).toMatchSnapshot();
41
+ }
42
+ );
43
+
44
+ it('renders correctly when is current date', () => {
45
+ const { toJSON } = renderWithTheme(
46
+ <CalendarRowItem
47
+ date={new Date(2022, 10, 10)}
48
+ onPress={jest.fn()}
49
+ marked
50
+ isSelected
51
+ />
52
+ );
53
+
54
+ expect(toJSON()).toMatchSnapshot();
55
+ });
56
+
57
+ it('renders mark when date is marked', () => {
58
+ const { queryByTestId } = renderWithTheme(
59
+ <CalendarRowItem
60
+ date={new Date(2022, 10, 10)}
61
+ onPress={jest.fn()}
62
+ marked
63
+ />
64
+ );
65
+
66
+ expect(queryByTestId('calendar-date-mark')).toBeTruthy();
67
+ });
68
+
69
+ it('not renders mark when date is not marked', () => {
70
+ const { queryByTestId } = renderWithTheme(
71
+ <CalendarRowItem date={new Date(2022, 10, 10)} onPress={jest.fn()} />
72
+ );
73
+
74
+ expect(queryByTestId('calendar-date-mark')).toBeNull();
75
+ });
76
+ });