@hero-design/rn 7.13.0 → 7.14.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.
Files changed (155) hide show
  1. package/.eslintrc.json +3 -1
  2. package/.turbo/turbo-build.log +9 -8
  3. package/assets/fonts/hero-icons.ttf +0 -0
  4. package/babel.config.js +16 -0
  5. package/es/index.js +26977 -7611
  6. package/lib/assets/fonts/hero-icons.ttf +0 -0
  7. package/lib/index.js +26983 -7613
  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 +14 -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,109 @@
1
+ import { FlatList, Text } from 'react-native';
2
+ import React from 'react';
3
+
4
+ import {
5
+ act,
6
+ fireEvent,
7
+ render,
8
+ RenderAPI,
9
+ } from '@testing-library/react-native';
10
+ import MentionList from '../MentionList';
11
+ import { emitter as editorEventEmitter } from '../EditorEvent';
12
+ import * as Events from '../utils/events';
13
+
14
+ const SuggestionListData: Array<{ id: string; name: string }> = [
15
+ { id: '1', name: 'Kien Tran' },
16
+ { id: '2', name: 'Minh Dinh' },
17
+ { id: '3', name: 'Hieu Pham' },
18
+ { id: '4', name: 'Hau' },
19
+ { id: '5', name: 'Tung Ten' },
20
+ { id: '6', name: 'Thong Quach' },
21
+ ];
22
+
23
+ const SuggestionList = ({
24
+ searchValue,
25
+ onSelect,
26
+ }: {
27
+ searchValue: string;
28
+ onSelect: (id: string, name: string) => void;
29
+ }) => {
30
+ const filteredData = SuggestionListData.filter(item =>
31
+ item.name.includes(searchValue)
32
+ );
33
+
34
+ return (
35
+ <FlatList
36
+ keyboardShouldPersistTaps="handled"
37
+ data={filteredData}
38
+ renderItem={({ item }) => (
39
+ <Text onPress={() => onSelect(item.id, item.name)}>{item.name}</Text>
40
+ )}
41
+ />
42
+ );
43
+ };
44
+
45
+ describe('MentionList', () => {
46
+ describe('when search string is empty', () => {
47
+ it('should not render mention list', () => {
48
+ const wrapper = render(
49
+ <MentionList
50
+ name="give-shout-out"
51
+ render={() => <Text>Mention List</Text>}
52
+ />
53
+ );
54
+
55
+ expect(wrapper.toJSON()).toBeNull();
56
+ });
57
+ });
58
+
59
+ describe('when search string is not empty', () => {
60
+ let wrapper: RenderAPI;
61
+
62
+ beforeEach(() => {
63
+ wrapper = render(
64
+ <MentionList
65
+ name="give-shout-out"
66
+ render={(
67
+ searchValue: string,
68
+ onSelect: (id: string, name: string) => void
69
+ ) => <SuggestionList searchValue={searchValue} onSelect={onSelect} />}
70
+ />
71
+ );
72
+ act(() => {
73
+ editorEventEmitter.emit('give-shout-out/mention-search', {
74
+ search: 'Hieu',
75
+ target: 'give-shout-out',
76
+ });
77
+ });
78
+ });
79
+
80
+ it('should render mention list showing filtered results', () => {
81
+ expect(wrapper.toJSON()).toMatchSnapshot();
82
+ expect(wrapper.queryAllByText('Hieu Pham')).toHaveLength(1);
83
+ expect(wrapper.queryAllByText('Kien Tran')).toHaveLength(0);
84
+ expect(wrapper.queryAllByText('Minh Dinh')).toHaveLength(0);
85
+ expect(wrapper.queryAllByText('Hau')).toHaveLength(0);
86
+ expect(wrapper.queryAllByText('Tung Teng')).toHaveLength(0);
87
+ expect(wrapper.queryAllByText('Thong Quach')).toHaveLength(0);
88
+ });
89
+
90
+ describe('onPress suggesstion item', () => {
91
+ it('should emit action metion-only', () => {
92
+ const result: { id: string; name: string; target: string }[] = [];
93
+ act(() => {
94
+ Events.on(
95
+ editorEventEmitter,
96
+ 'give-shout-out/mention-apply',
97
+ (data: any) => {
98
+ result.push(data);
99
+ }
100
+ );
101
+ });
102
+ fireEvent(wrapper.getByText('Hieu Pham'), 'press');
103
+ expect(result).toMatchObject([
104
+ { id: '3', name: 'Hieu Pham', target: 'give-shout-out' },
105
+ ]);
106
+ });
107
+ });
108
+ });
109
+ });
@@ -0,0 +1,245 @@
1
+ import React, {
2
+ ComponentType,
3
+ forwardRef,
4
+ ReactElement,
5
+ useEffect,
6
+ } from 'react';
7
+
8
+ import { act, RenderAPI } from '@testing-library/react-native';
9
+
10
+ import { View } from 'react-native';
11
+ import { ThemeProvider } from '@emotion/react';
12
+ import * as Events from '../utils/events';
13
+ import { emitter as EditorEventEmitter } from '../EditorEvent';
14
+ import RichTextEditor from '../RichTextEditor';
15
+ import renderWithTheme from '../../../testHelpers/renderWithTheme';
16
+ import { theme } from '../../../index';
17
+
18
+ type OnMessageCallback = (event: {
19
+ nativeEvent: { data: string };
20
+ }) => void | undefined;
21
+
22
+ interface MockWebViewProps {
23
+ onMessage: OnMessageCallback;
24
+ children: ReactElement;
25
+ }
26
+
27
+ let onMessageOfLatestRendering: OnMessageCallback;
28
+
29
+ jest.mock('react-native-webview', () => {
30
+ const MockWebView: ComponentType<{
31
+ onMessage: OnMessageCallback;
32
+ children: ReactElement;
33
+ }> = forwardRef<View, MockWebViewProps>(
34
+ ({ onMessage, ...restProps }, ref) => {
35
+ useEffect(() => {
36
+ onMessageOfLatestRendering = onMessage;
37
+ });
38
+ return <View ref={ref} testID="webview" {...restProps} />;
39
+ }
40
+ );
41
+
42
+ return {
43
+ WebView: MockWebView,
44
+ default: MockWebView,
45
+ };
46
+ });
47
+
48
+ const postMessageMock = jest.fn();
49
+ jest.mock('../utils/rnWebView', () => ({
50
+ postMessage: (_element: ReactElement, message: string) => {
51
+ postMessageMock(message);
52
+ },
53
+ }));
54
+
55
+ describe('RichTextEditor', () => {
56
+ it('should render correctly', () => {
57
+ const wrapper = renderWithTheme(
58
+ <RichTextEditor
59
+ name="rich-text-editor"
60
+ label="Rich Text Editor"
61
+ onChange={jest.fn()}
62
+ onCursorChange={jest.fn()}
63
+ error="this is error"
64
+ style={{ backgroundColor: 'yellow' }}
65
+ />
66
+ );
67
+
68
+ expect(wrapper.toJSON()).toMatchSnapshot();
69
+ expect(wrapper.queryAllByText('this is error')).toHaveLength(1);
70
+ expect(wrapper.queryAllByTestId('webview')).toHaveLength(1);
71
+ expect(wrapper.queryByTestId('webview')).toHaveStyle({
72
+ backgroundColor: 'yellow',
73
+ });
74
+ });
75
+
76
+ describe('onMessage', () => {
77
+ const onChangeMock = jest.fn();
78
+ const onCursorChangeMock = jest.fn();
79
+ let wrapper: RenderAPI;
80
+
81
+ beforeEach(() => {
82
+ wrapper = renderWithTheme(
83
+ <RichTextEditor
84
+ name="rich-text-editor"
85
+ label="Rich Text Editor"
86
+ onChange={onChangeMock}
87
+ onCursorChange={onCursorChangeMock}
88
+ error="this is error"
89
+ style={{ backgroundColor: 'yellow' }}
90
+ />
91
+ );
92
+ });
93
+
94
+ describe('recevied event editor-focus', () => {
95
+ it('should emit correct data', () => {
96
+ const emittedEvents: string[] = [];
97
+ Events.on(EditorEventEmitter, 'rich-text-editor/editor-focus', () => {
98
+ emittedEvents.push('called');
99
+ });
100
+ onMessageOfLatestRendering({
101
+ nativeEvent: {
102
+ data: '{"type": "@hero-editor/webview/editor-focus", "data" : {}}',
103
+ },
104
+ });
105
+ expect(emittedEvents).toMatchObject(['called']);
106
+ });
107
+ });
108
+
109
+ describe('recevied event editor-blur', () => {
110
+ it('should emit correct data', () => {
111
+ const emittedEvents: string[] = [];
112
+ Events.on(EditorEventEmitter, 'rich-text-editor/editor-blur', () => {
113
+ emittedEvents.push('called');
114
+ });
115
+ onMessageOfLatestRendering({
116
+ nativeEvent: {
117
+ data: '{"type": "@hero-editor/webview/editor-blur", "data" : {}}',
118
+ },
119
+ });
120
+ expect(emittedEvents).toMatchObject(['called']);
121
+ });
122
+ });
123
+
124
+ describe('recevied event mention-search', () => {
125
+ it('should emit correct data', () => {
126
+ const emittedEvents: string[] = [];
127
+ Events.on(EditorEventEmitter, 'rich-text-editor/mention-search', () => {
128
+ emittedEvents.push('called');
129
+ });
130
+ onMessageOfLatestRendering({
131
+ nativeEvent: {
132
+ data:
133
+ '{"type": "@hero-editor/webview/mention-search", "data" : {}}',
134
+ },
135
+ });
136
+ expect(emittedEvents).toMatchObject(['called']);
137
+ });
138
+ });
139
+
140
+ describe('recevied event editor-change', () => {
141
+ beforeEach(() => {
142
+ onChangeMock.mockReset();
143
+ });
144
+
145
+ it('should call onChange', () => {
146
+ onMessageOfLatestRendering({
147
+ nativeEvent: {
148
+ data:
149
+ '{"type": "@hero-editor/webview/editor-change", "data" : { "value": "text"}}',
150
+ },
151
+ });
152
+ expect(onChangeMock).lastCalledWith('text');
153
+ });
154
+ });
155
+
156
+ describe('recevied event cursor-change', () => {
157
+ beforeEach(() => {
158
+ onCursorChangeMock.mockReset();
159
+ });
160
+
161
+ it('should call onCursorChange', () => {
162
+ onMessageOfLatestRendering({
163
+ nativeEvent: {
164
+ data:
165
+ '{"type": "@hero-editor/webview/cursor-change", "data" : { "position": 32}}',
166
+ },
167
+ });
168
+ expect(onCursorChangeMock).lastCalledWith({ position: 32 });
169
+ });
170
+ });
171
+
172
+ describe('recevied event editor-layout', () => {
173
+ it('should update height', () => {
174
+ act(() => {
175
+ onMessageOfLatestRendering({
176
+ nativeEvent: {
177
+ data:
178
+ '{"type": "@hero-editor/webview/editor-layout", "data" : { "width": 320, "height": 480}}',
179
+ },
180
+ });
181
+ });
182
+
183
+ wrapper.update(
184
+ <ThemeProvider theme={theme}>
185
+ <RichTextEditor
186
+ onChange={jest.fn()}
187
+ label="Rich Text Editor"
188
+ name="rich-text-editor"
189
+ error="this is error"
190
+ style={{ backgroundColor: 'yellow' }}
191
+ />
192
+ </ThemeProvider>
193
+ );
194
+
195
+ expect(wrapper.toJSON()).toMatchSnapshot();
196
+ expect(wrapper.getByTestId('webview')).toHaveStyle({ height: 480 });
197
+ });
198
+ });
199
+ });
200
+
201
+ describe('postMessageToWebview', () => {
202
+ const onChangeMock = jest.fn();
203
+ const onCursorChangeMock = jest.fn();
204
+
205
+ beforeEach(() => {
206
+ postMessageMock.mockReset();
207
+ renderWithTheme(
208
+ <RichTextEditor
209
+ label="Rich Text Editor"
210
+ name="rich-text-editor"
211
+ onChange={onChangeMock}
212
+ onCursorChange={onCursorChangeMock}
213
+ error="this is error"
214
+ style={{ backgroundColor: 'yellow' }}
215
+ />
216
+ );
217
+ });
218
+
219
+ it.each`
220
+ emittedEventName | data | expectedMessageType | expectedMessageData
221
+ ${'rich-text-editor/bold'} | ${null} | ${'@hero-editor/webview/bold'} | ${null}
222
+ ${'rich-text-editor/italic'} | ${null} | ${'@hero-editor/webview/italic'} | ${null}
223
+ ${'rich-text-editor/underline'} | ${null} | ${'@hero-editor/webview/underline'} | ${null}
224
+ ${'rich-text-editor/bulleted-list'} | ${null} | ${'@hero-editor/webview/bulleted-list'} | ${null}
225
+ ${'rich-text-editor/numbered-list'} | ${null} | ${'@hero-editor/webview/numbered-list'} | ${null}
226
+ ${'rich-text-editor/heading-one'} | ${null} | ${'@hero-editor/webview/heading-one'} | ${null}
227
+ ${'rich-text-editor/heading-two'} | ${null} | ${'@hero-editor/webview/heading-two'} | ${null}
228
+ ${'rich-text-editor/mention-apply'} | ${'Minh Dinh'} | ${'@hero-editor/webview/mention-apply'} | ${'Minh Dinh'}
229
+ `(
230
+ 'Events emit $emittedEventName should postMessage $expectedMessageType',
231
+ ({
232
+ emittedEventName,
233
+ data,
234
+ expectedMessageType,
235
+ expectedMessageData,
236
+ }) => {
237
+ EditorEventEmitter.emit(emittedEventName, data);
238
+ expect(postMessageMock).toHaveBeenCalledWith({
239
+ data: expectedMessageData,
240
+ type: expectedMessageType,
241
+ });
242
+ }
243
+ );
244
+ });
245
+ });
@@ -0,0 +1,324 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`EditorToolbar when the editor is focused should render toolbar 1`] = `
4
+ <View
5
+ style={
6
+ Array [
7
+ Object {
8
+ "alignItems": "center",
9
+ "backgroundColor": "#fafbfb",
10
+ "borderTopColor": "#dadbde",
11
+ "borderTopWidth": 0.5,
12
+ "flexDirection": "row",
13
+ "paddingHorizontal": 8,
14
+ },
15
+ undefined,
16
+ ]
17
+ }
18
+ testID="toolbar"
19
+ >
20
+ <View
21
+ accessible={true}
22
+ collapsable={false}
23
+ focusable={true}
24
+ nativeID="animatedComponent"
25
+ onClick={[Function]}
26
+ onResponderGrant={[Function]}
27
+ onResponderMove={[Function]}
28
+ onResponderRelease={[Function]}
29
+ onResponderTerminate={[Function]}
30
+ onResponderTerminationRequest={[Function]}
31
+ onStartShouldSetResponder={[Function]}
32
+ style={
33
+ Object {
34
+ "alignItems": "center",
35
+ "backgroundColor": undefined,
36
+ "height": 48,
37
+ "justifyContent": "center",
38
+ "opacity": 1,
39
+ "width": 48,
40
+ }
41
+ }
42
+ testID="format-bold"
43
+ >
44
+ <HeroIcon
45
+ name="format-bold"
46
+ style={
47
+ Array [
48
+ Object {
49
+ "color": "#292a2b",
50
+ "fontSize": 20,
51
+ },
52
+ undefined,
53
+ ]
54
+ }
55
+ themeIntent="text"
56
+ themeSize="small"
57
+ />
58
+ </View>
59
+ <View
60
+ accessible={true}
61
+ collapsable={false}
62
+ focusable={true}
63
+ nativeID="animatedComponent"
64
+ onClick={[Function]}
65
+ onResponderGrant={[Function]}
66
+ onResponderMove={[Function]}
67
+ onResponderRelease={[Function]}
68
+ onResponderTerminate={[Function]}
69
+ onResponderTerminationRequest={[Function]}
70
+ onStartShouldSetResponder={[Function]}
71
+ style={
72
+ Object {
73
+ "alignItems": "center",
74
+ "backgroundColor": undefined,
75
+ "height": 48,
76
+ "justifyContent": "center",
77
+ "opacity": 1,
78
+ "width": 48,
79
+ }
80
+ }
81
+ testID="format-italic"
82
+ >
83
+ <HeroIcon
84
+ name="format-italic"
85
+ style={
86
+ Array [
87
+ Object {
88
+ "color": "#292a2b",
89
+ "fontSize": 20,
90
+ },
91
+ undefined,
92
+ ]
93
+ }
94
+ themeIntent="text"
95
+ themeSize="small"
96
+ />
97
+ </View>
98
+ <View
99
+ accessible={true}
100
+ collapsable={false}
101
+ focusable={true}
102
+ nativeID="animatedComponent"
103
+ onClick={[Function]}
104
+ onResponderGrant={[Function]}
105
+ onResponderMove={[Function]}
106
+ onResponderRelease={[Function]}
107
+ onResponderTerminate={[Function]}
108
+ onResponderTerminationRequest={[Function]}
109
+ onStartShouldSetResponder={[Function]}
110
+ style={
111
+ Object {
112
+ "alignItems": "center",
113
+ "backgroundColor": undefined,
114
+ "height": 48,
115
+ "justifyContent": "center",
116
+ "opacity": 1,
117
+ "width": 48,
118
+ }
119
+ }
120
+ testID="format-underlined"
121
+ >
122
+ <HeroIcon
123
+ name="format-underlined"
124
+ style={
125
+ Array [
126
+ Object {
127
+ "color": "#292a2b",
128
+ "fontSize": 20,
129
+ },
130
+ undefined,
131
+ ]
132
+ }
133
+ themeIntent="text"
134
+ themeSize="small"
135
+ />
136
+ </View>
137
+ <View
138
+ style={
139
+ Array [
140
+ Object {
141
+ "alignItems": "center",
142
+ "backgroundColor": "#dadbde",
143
+ "flexDirection": "row",
144
+ "height": 16,
145
+ "marginHorizontal": 8,
146
+ "width": 1,
147
+ },
148
+ undefined,
149
+ ]
150
+ }
151
+ />
152
+ <View
153
+ accessible={true}
154
+ collapsable={false}
155
+ focusable={true}
156
+ nativeID="animatedComponent"
157
+ onClick={[Function]}
158
+ onResponderGrant={[Function]}
159
+ onResponderMove={[Function]}
160
+ onResponderRelease={[Function]}
161
+ onResponderTerminate={[Function]}
162
+ onResponderTerminationRequest={[Function]}
163
+ onStartShouldSetResponder={[Function]}
164
+ style={
165
+ Object {
166
+ "alignItems": "center",
167
+ "backgroundColor": undefined,
168
+ "height": 48,
169
+ "justifyContent": "center",
170
+ "opacity": 1,
171
+ "width": 48,
172
+ }
173
+ }
174
+ testID="format-list-bulleted"
175
+ >
176
+ <HeroIcon
177
+ name="format-list-bulleted"
178
+ style={
179
+ Array [
180
+ Object {
181
+ "color": "#292a2b",
182
+ "fontSize": 20,
183
+ },
184
+ undefined,
185
+ ]
186
+ }
187
+ themeIntent="text"
188
+ themeSize="small"
189
+ />
190
+ </View>
191
+ <View
192
+ accessible={true}
193
+ collapsable={false}
194
+ focusable={true}
195
+ nativeID="animatedComponent"
196
+ onClick={[Function]}
197
+ onResponderGrant={[Function]}
198
+ onResponderMove={[Function]}
199
+ onResponderRelease={[Function]}
200
+ onResponderTerminate={[Function]}
201
+ onResponderTerminationRequest={[Function]}
202
+ onStartShouldSetResponder={[Function]}
203
+ style={
204
+ Object {
205
+ "alignItems": "center",
206
+ "backgroundColor": undefined,
207
+ "height": 48,
208
+ "justifyContent": "center",
209
+ "opacity": 1,
210
+ "width": 48,
211
+ }
212
+ }
213
+ testID="format-list-numbered"
214
+ >
215
+ <HeroIcon
216
+ name="format-list-numbered"
217
+ style={
218
+ Array [
219
+ Object {
220
+ "color": "#292a2b",
221
+ "fontSize": 20,
222
+ },
223
+ undefined,
224
+ ]
225
+ }
226
+ themeIntent="text"
227
+ themeSize="small"
228
+ />
229
+ </View>
230
+ <View
231
+ style={
232
+ Array [
233
+ Object {
234
+ "alignItems": "center",
235
+ "backgroundColor": "#dadbde",
236
+ "flexDirection": "row",
237
+ "height": 16,
238
+ "marginHorizontal": 8,
239
+ "width": 1,
240
+ },
241
+ undefined,
242
+ ]
243
+ }
244
+ />
245
+ <View
246
+ accessible={true}
247
+ collapsable={false}
248
+ focusable={true}
249
+ nativeID="animatedComponent"
250
+ onClick={[Function]}
251
+ onResponderGrant={[Function]}
252
+ onResponderMove={[Function]}
253
+ onResponderRelease={[Function]}
254
+ onResponderTerminate={[Function]}
255
+ onResponderTerminationRequest={[Function]}
256
+ onStartShouldSetResponder={[Function]}
257
+ style={
258
+ Object {
259
+ "alignItems": "center",
260
+ "backgroundColor": undefined,
261
+ "height": 48,
262
+ "justifyContent": "center",
263
+ "opacity": 1,
264
+ "width": 48,
265
+ }
266
+ }
267
+ testID="format-heading1"
268
+ >
269
+ <HeroIcon
270
+ name="format-heading1"
271
+ style={
272
+ Array [
273
+ Object {
274
+ "color": "#292a2b",
275
+ "fontSize": 20,
276
+ },
277
+ undefined,
278
+ ]
279
+ }
280
+ themeIntent="text"
281
+ themeSize="small"
282
+ />
283
+ </View>
284
+ <View
285
+ accessible={true}
286
+ collapsable={false}
287
+ focusable={true}
288
+ nativeID="animatedComponent"
289
+ onClick={[Function]}
290
+ onResponderGrant={[Function]}
291
+ onResponderMove={[Function]}
292
+ onResponderRelease={[Function]}
293
+ onResponderTerminate={[Function]}
294
+ onResponderTerminationRequest={[Function]}
295
+ onStartShouldSetResponder={[Function]}
296
+ style={
297
+ Object {
298
+ "alignItems": "center",
299
+ "backgroundColor": undefined,
300
+ "height": 48,
301
+ "justifyContent": "center",
302
+ "opacity": 1,
303
+ "width": 48,
304
+ }
305
+ }
306
+ testID="format-heading2"
307
+ >
308
+ <HeroIcon
309
+ name="format-heading2"
310
+ style={
311
+ Array [
312
+ Object {
313
+ "color": "#292a2b",
314
+ "fontSize": 20,
315
+ },
316
+ undefined,
317
+ ]
318
+ }
319
+ themeIntent="text"
320
+ themeSize="small"
321
+ />
322
+ </View>
323
+ </View>
324
+ `;