@hero-design/rn 7.21.0 → 7.22.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 (67) hide show
  1. package/.eslintrc.js +11 -0
  2. package/.turbo/turbo-build.log +9 -9
  3. package/babel.config.js +1 -1
  4. package/es/index.js +377 -263
  5. package/lib/index.js +380 -266
  6. package/package.json +7 -15
  7. package/src/components/BottomNavigation/__tests__/index.spec.tsx +1 -1
  8. package/src/components/BottomNavigation/index.tsx +3 -3
  9. package/src/components/BottomSheet/StyledBottomSheet.tsx +10 -0
  10. package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +326 -292
  11. package/src/components/BottomSheet/index.tsx +46 -26
  12. package/src/components/Box/helpers.ts +1 -1
  13. package/src/components/Calendar/index.tsx +9 -9
  14. package/src/components/Collapse/index.tsx +1 -1
  15. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +176 -159
  16. package/src/components/Drawer/DragableDrawer/helpers.ts +7 -3
  17. package/src/components/FAB/ActionGroup/index.tsx +1 -1
  18. package/src/components/Icon/HeroIcon/selection.json +7029 -1
  19. package/src/components/PinInput/index.tsx +1 -1
  20. package/src/components/RichTextEditor/EditorToolbar.tsx +3 -3
  21. package/src/components/RichTextEditor/RichTextEditor.tsx +5 -5
  22. package/src/components/RichTextEditor/__tests__/EditorToolbar.spec.tsx +2 -2
  23. package/src/components/RichTextEditor/__tests__/MentionList.spec.tsx +1 -1
  24. package/src/components/Select/MultiSelect/OptionList.tsx +1 -1
  25. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +4691 -4606
  26. package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +1 -1
  27. package/src/components/Select/MultiSelect/index.tsx +3 -3
  28. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +4245 -4160
  29. package/src/components/Select/SingleSelect/index.tsx +3 -3
  30. package/src/components/Select/helpers.tsx +4 -4
  31. package/src/components/Slider/index.tsx +1 -1
  32. package/src/components/Switch/SelectorSwitch/Option.tsx +67 -0
  33. package/src/components/Switch/SelectorSwitch/StyledSelectorSwitch.tsx +25 -0
  34. package/src/components/Switch/SelectorSwitch/__tests__/Option.spec.tsx +61 -0
  35. package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/Option.spec.tsx.snap +195 -0
  36. package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/index.spec.tsx.snap +121 -0
  37. package/src/components/Switch/SelectorSwitch/__tests__/index.spec.tsx +62 -0
  38. package/src/components/Switch/SelectorSwitch/index.tsx +60 -0
  39. package/src/components/Switch/index.tsx +4 -1
  40. package/src/components/Tabs/ScrollableTabs.tsx +12 -5
  41. package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +1 -1
  42. package/src/components/Tabs/__tests__/index.spec.tsx +1 -1
  43. package/src/components/Tabs/index.tsx +13 -6
  44. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +3 -1
  45. package/src/components/TextInput/__tests__/index.spec.tsx +114 -112
  46. package/src/components/TextInput/index.tsx +29 -30
  47. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +176 -159
  48. package/src/components/Toast/ToastContainer.tsx +6 -6
  49. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +14 -12
  50. package/src/theme/components/switch.ts +14 -18
  51. package/testUtils/setup.tsx +1 -1
  52. package/tsconfig.json +1 -1
  53. package/types/components/BottomSheet/StyledBottomSheet.d.ts +8 -2
  54. package/types/components/BottomSheet/index.d.ts +6 -1
  55. package/types/components/Slider/index.d.ts +1 -1
  56. package/types/components/Switch/SelectorSwitch/Option.d.ts +10 -0
  57. package/types/components/Switch/SelectorSwitch/StyledSelectorSwitch.d.ts +19 -0
  58. package/types/components/Switch/SelectorSwitch/__tests__/Option.spec.d.ts +1 -0
  59. package/types/components/Switch/SelectorSwitch/__tests__/index.spec.d.ts +1 -0
  60. package/types/components/Switch/SelectorSwitch/index.d.ts +37 -0
  61. package/types/components/Switch/index.d.ts +5 -3
  62. package/types/components/Tabs/ScrollableTabs.d.ts +1 -1
  63. package/types/components/Tabs/index.d.ts +2 -2
  64. package/types/components/TextInput/index.d.ts +4 -4
  65. package/types/theme/components/switch.d.ts +14 -12
  66. package/.eslintrc.json +0 -62
  67. package/.prettierrc.json +0 -8
@@ -63,12 +63,15 @@ const ScrollableTab = ({
63
63
  barStyle,
64
64
  lazy = false,
65
65
  lazyPreloadDistance = 1,
66
+ testID: componentTestID,
66
67
  }: TabsProps) => {
67
68
  const flatListRef = React.useRef<FlatList>(null);
68
69
  const pagerViewRef = React.useRef<PagerView>(null);
69
70
  const insets = useSafeAreaInsets();
70
71
  const theme = useTheme();
71
- const selectedTabIndex = tabs.findIndex(item => item.key === selectedTabKey);
72
+ const selectedTabIndex = tabs.findIndex(
73
+ (item) => item.key === selectedTabKey
74
+ );
72
75
  const tabsAnims = useAnimatedValueArray(
73
76
  tabs.map((_, i) => (i === selectedTabIndex ? 1 : 0))
74
77
  );
@@ -97,13 +100,17 @@ const ScrollableTab = ({
97
100
  }, [selectedTabIndex]);
98
101
 
99
102
  return (
100
- <TabContainer style={containerStyle}>
101
- <HeaderTabWrapper themeInsets={insets} style={barStyle}>
103
+ <TabContainer style={containerStyle} testID={componentTestID}>
104
+ <HeaderTabWrapper
105
+ themeInsets={insets}
106
+ style={barStyle}
107
+ testID={componentTestID ? `${componentTestID}-tab-bar` : undefined}
108
+ >
102
109
  <FlatList<TabType>
103
110
  ref={flatListRef}
104
111
  horizontal
105
112
  data={tabs}
106
- keyExtractor={tab => String(tab.key)}
113
+ keyExtractor={(tab) => String(tab.key)}
107
114
  showsHorizontalScrollIndicator={false}
108
115
  onScrollToIndexFailed={({ index }) => {
109
116
  setTimeout(
@@ -184,7 +191,7 @@ const ScrollableTab = ({
184
191
  <ContentWrapper
185
192
  initialPage={selectedTabIndex}
186
193
  ref={pagerViewRef}
187
- onPageSelected={e => {
194
+ onPageSelected={(e) => {
188
195
  const index = e.nativeEvent.position;
189
196
  const selectedItem = tabs[index];
190
197
  if (selectedItem) {
@@ -62,7 +62,7 @@ const TestTabsComponent = (
62
62
  {...props}
63
63
  tabs={tabs}
64
64
  selectedTabKey={selectedTabKey}
65
- onTabPress={newTabKey => setSelectedTabKey(newTabKey)}
65
+ onTabPress={(newTabKey) => setSelectedTabKey(newTabKey)}
66
66
  />
67
67
  </SafeAreaProvider>
68
68
  );
@@ -59,7 +59,7 @@ const TestTabsComponent = (
59
59
  {...props}
60
60
  tabs={tabs}
61
61
  selectedTabKey={selectedTabKey}
62
- onTabPress={newTabKey => setSelectedTabKey(newTabKey)}
62
+ onTabPress={(newTabKey) => setSelectedTabKey(newTabKey)}
63
63
  />
64
64
  </SafeAreaProvider>
65
65
  );
@@ -105,11 +105,14 @@ const Tabs = ({
105
105
  barStyle,
106
106
  lazy = false,
107
107
  lazyPreloadDistance = 1,
108
+ testID: componentTestID,
108
109
  }: TabsProps): JSX.Element => {
109
110
  const theme = useTheme();
110
111
  const insets = useSafeAreaInsets();
111
112
  const pagerViewRef = React.useRef<PagerView>(null);
112
- const selectedTabIndex = tabs.findIndex(item => item.key === selectedTabKey);
113
+ const selectedTabIndex = tabs.findIndex(
114
+ (item) => item.key === selectedTabKey
115
+ );
113
116
  const scrollOffsetAnimatedValue = React.useRef(new Animated.Value(0)).current;
114
117
  const positionAnimatedValue = React.useRef(new Animated.Value(0)).current;
115
118
  const [tabsWidth, setTabsWidth] = React.useState<number>(0);
@@ -121,18 +124,22 @@ const Tabs = ({
121
124
  }, [selectedTabIndex]);
122
125
 
123
126
  return (
124
- <TabContainer style={containerStyle}>
125
- <HeaderTabWrapper themeInsets={insets} style={barStyle}>
127
+ <TabContainer style={containerStyle} testID={componentTestID}>
128
+ <HeaderTabWrapper
129
+ themeInsets={insets}
130
+ style={barStyle}
131
+ testID={componentTestID ? `${componentTestID}-tab-bar` : undefined}
132
+ >
126
133
  <View>
127
134
  <HeaderTab
128
- onLayout={e => {
135
+ onLayout={(e) => {
129
136
  const { width } = e.nativeEvent.layout;
130
137
  if (tabsWidth !== width) {
131
138
  setTabsWidth(width);
132
139
  }
133
140
  }}
134
141
  >
135
- {tabs.map(tab => {
142
+ {tabs.map((tab) => {
136
143
  const {
137
144
  key,
138
145
  testID,
@@ -180,7 +187,7 @@ const Tabs = ({
180
187
  <ContentWrapper
181
188
  initialPage={selectedTabIndex}
182
189
  ref={pagerViewRef}
183
- onPageSelected={e => {
190
+ onPageSelected={(e) => {
184
191
  const index = e.nativeEvent.position;
185
192
  const selectedItem = tabs[index];
186
193
  if (selectedItem) {
@@ -1396,7 +1396,9 @@ exports[`TextInput idle renders correctly 1`] = `
1396
1396
  "right": 0,
1397
1397
  "top": 0,
1398
1398
  },
1399
- undefined,
1399
+ Object {
1400
+ "borderColor": "#de350b",
1401
+ },
1400
1402
  ]
1401
1403
  }
1402
1404
  themeVariant="default"
@@ -1,20 +1,21 @@
1
- import { fireEvent, within } from '@testing-library/react-native';
2
- import React from 'react';
3
- import renderWithTheme from '../../../testHelpers/renderWithTheme';
4
- import Icon from '../../Icon';
5
- import TextInput, { getVariant } from '../index';
6
-
7
- describe('getVariant', () => {
1
+ import { fireEvent, within } from "@testing-library/react-native";
2
+ import React from "react";
3
+ import { theme } from "../../..";
4
+ import renderWithTheme from "../../../testHelpers/renderWithTheme";
5
+ import Icon from "../../Icon";
6
+ import TextInput, { getVariant } from "../index";
7
+
8
+ describe("getVariant", () => {
8
9
  it.each`
9
10
  disabled | error | editable | loading | isFocused | isEmptyValue | expected
10
- ${false} | ${undefined} | ${true} | ${false} | ${false} | ${true} | ${'default'}
11
- ${false} | ${undefined} | ${true} | ${false} | ${false} | ${false} | ${'filled'}
12
- ${false} | ${undefined} | ${true} | ${false} | ${true} | ${true} | ${'focused'}
13
- ${false} | ${undefined} | ${false} | ${true} | ${true} | ${true} | ${'readonly'}
14
- ${false} | ${'This field is required'} | ${false} | ${false} | ${true} | ${true} | ${'error'}
15
- ${true} | ${'This field is required'} | ${false} | ${false} | ${true} | ${true} | ${'disabled'}
11
+ ${false} | ${undefined} | ${true} | ${false} | ${false} | ${true} | ${"default"}
12
+ ${false} | ${undefined} | ${true} | ${false} | ${false} | ${false} | ${"filled"}
13
+ ${false} | ${undefined} | ${true} | ${false} | ${true} | ${true} | ${"focused"}
14
+ ${false} | ${undefined} | ${false} | ${true} | ${true} | ${true} | ${"readonly"}
15
+ ${false} | ${"This field is required"} | ${false} | ${false} | ${true} | ${true} | ${"error"}
16
+ ${true} | ${"This field is required"} | ${false} | ${false} | ${true} | ${true} | ${"disabled"}
16
17
  `(
17
- 'should return the correct variant when disabled $disabled, errorMessage $errorMessage, editable $false, isFocused $isFocused, isEmptyValue $isEmptyValue',
18
+ "should return the correct variant when disabled $disabled, errorMessage $errorMessage, editable $false, isFocused $isFocused, isEmptyValue $isEmptyValue",
18
19
  ({
19
20
  disabled,
20
21
  error,
@@ -38,38 +39,39 @@ describe('getVariant', () => {
38
39
  );
39
40
  });
40
41
 
41
- describe('TextInput', () => {
42
- describe('idle', () => {
43
- it('renders correctly', () => {
42
+ describe("TextInput", () => {
43
+ describe("idle", () => {
44
+ it("renders correctly", () => {
44
45
  const { getByTestId, toJSON } = renderWithTheme(
45
46
  <TextInput
46
47
  label="Amount (AUD)"
47
48
  prefix="dollar-sign"
48
49
  suffix="arrow-down"
49
50
  testID="idle-text-input"
51
+ style={{ borderColor: theme.colors.danger }}
50
52
  />
51
53
  );
52
54
 
53
55
  expect(toJSON()).toMatchSnapshot();
54
- expect(getByTestId('idle-text-input')).toBeTruthy();
56
+ expect(getByTestId("idle-text-input")).toBeTruthy();
55
57
  expect(
56
- within(getByTestId('idle-text-input')).queryAllByTestId('text-input')
58
+ within(getByTestId("idle-text-input")).queryAllByTestId("text-input")
57
59
  ).toHaveLength(1);
58
60
  expect(
59
- within(getByTestId('idle-text-input')).queryAllByText('Amount (AUD)')
61
+ within(getByTestId("idle-text-input")).queryAllByText("Amount (AUD)")
60
62
  ).toHaveLength(1);
61
63
  expect(
62
- within(getByTestId('idle-text-input')).queryAllByTestId('input-label')
64
+ within(getByTestId("idle-text-input")).queryAllByTestId("input-label")
63
65
  ).toHaveLength(1);
64
66
  expect(
65
- within(getByTestId('idle-text-input')).queryAllByTestId('input-prefix')
67
+ within(getByTestId("idle-text-input")).queryAllByTestId("input-prefix")
66
68
  ).toHaveLength(1);
67
69
  expect(
68
- within(getByTestId('idle-text-input')).queryAllByTestId('input-suffix')
70
+ within(getByTestId("idle-text-input")).queryAllByTestId("input-suffix")
69
71
  ).toHaveLength(1);
70
72
  });
71
73
 
72
- it('should not render input-label if label is empty', () => {
74
+ it("should not render input-label if label is empty", () => {
73
75
  const { getByTestId } = renderWithTheme(
74
76
  <TextInput
75
77
  prefix="dollar-sign"
@@ -78,13 +80,13 @@ describe('TextInput', () => {
78
80
  />
79
81
  );
80
82
 
81
- expect(getByTestId('idle-text-input')).toBeTruthy();
83
+ expect(getByTestId("idle-text-input")).toBeTruthy();
82
84
  expect(
83
- within(getByTestId('idle-text-input')).queryAllByTestId('input-label')
85
+ within(getByTestId("idle-text-input")).queryAllByTestId("input-label")
84
86
  ).toHaveLength(0);
85
87
  });
86
88
 
87
- it('onChangeText, onBlur, onFocus', () => {
89
+ it("onChangeText, onBlur, onFocus", () => {
88
90
  const onChangeText = jest.fn();
89
91
  const onBlur = jest.fn();
90
92
  const onFocus = jest.fn();
@@ -100,23 +102,23 @@ describe('TextInput', () => {
100
102
  />
101
103
  );
102
104
 
103
- const testInput = within(getByTestId('idle-text-input')).getByTestId(
104
- 'text-input'
105
+ const testInput = within(getByTestId("idle-text-input")).getByTestId(
106
+ "text-input"
105
107
  );
106
108
 
107
- fireEvent.changeText(testInput, 'Thong Quach');
108
- expect(onChangeText).toHaveBeenCalledWith('Thong Quach');
109
+ fireEvent.changeText(testInput, "Thong Quach");
110
+ expect(onChangeText).toHaveBeenCalledWith("Thong Quach");
109
111
 
110
- fireEvent(testInput, 'blur');
112
+ fireEvent(testInput, "blur");
111
113
  expect(onBlur).toHaveBeenCalledTimes(1);
112
114
 
113
- fireEvent(testInput, 'focus');
115
+ fireEvent(testInput, "focus");
114
116
  expect(onFocus).toHaveBeenCalledTimes(1);
115
117
  });
116
118
  });
117
119
 
118
- describe('idle with suffix and prefix are React Element', () => {
119
- it('renders correctly', () => {
120
+ describe("idle with suffix and prefix are React Element", () => {
121
+ it("renders correctly", () => {
120
122
  const { toJSON, queryAllByTestId, queryAllByText } = renderWithTheme(
121
123
  <TextInput
122
124
  label="Amount (AUD)"
@@ -127,16 +129,16 @@ describe('TextInput', () => {
127
129
  );
128
130
 
129
131
  expect(toJSON()).toMatchSnapshot();
130
- expect(queryAllByText('Amount (AUD)')).toHaveLength(1);
131
- expect(queryAllByText('*')).toHaveLength(1);
132
- expect(queryAllByTestId('input-label')).toHaveLength(1);
133
- expect(queryAllByTestId('prefix-element')).toHaveLength(1);
134
- expect(queryAllByTestId('suffix-element')).toHaveLength(1);
135
- expect(queryAllByTestId('text-input')).toHaveLength(1);
132
+ expect(queryAllByText("Amount (AUD)")).toHaveLength(1);
133
+ expect(queryAllByText("*")).toHaveLength(1);
134
+ expect(queryAllByTestId("input-label")).toHaveLength(1);
135
+ expect(queryAllByTestId("prefix-element")).toHaveLength(1);
136
+ expect(queryAllByTestId("suffix-element")).toHaveLength(1);
137
+ expect(queryAllByTestId("text-input")).toHaveLength(1);
136
138
  });
137
139
  });
138
- describe('required', () => {
139
- it('renders correctly', () => {
140
+ describe("required", () => {
141
+ it("renders correctly", () => {
140
142
  const { toJSON, queryAllByTestId, queryAllByText } = renderWithTheme(
141
143
  <TextInput
142
144
  label="Amount (AUD)"
@@ -147,17 +149,17 @@ describe('TextInput', () => {
147
149
  );
148
150
 
149
151
  expect(toJSON()).toMatchSnapshot();
150
- expect(queryAllByText('Amount (AUD)')).toHaveLength(1);
151
- expect(queryAllByText('*')).toHaveLength(1);
152
- expect(queryAllByTestId('input-label')).toHaveLength(1);
153
- expect(queryAllByTestId('input-prefix')).toHaveLength(1);
154
- expect(queryAllByTestId('input-suffix')).toHaveLength(1);
155
- expect(queryAllByTestId('text-input')).toHaveLength(1);
152
+ expect(queryAllByText("Amount (AUD)")).toHaveLength(1);
153
+ expect(queryAllByText("*")).toHaveLength(1);
154
+ expect(queryAllByTestId("input-label")).toHaveLength(1);
155
+ expect(queryAllByTestId("input-prefix")).toHaveLength(1);
156
+ expect(queryAllByTestId("input-suffix")).toHaveLength(1);
157
+ expect(queryAllByTestId("text-input")).toHaveLength(1);
156
158
  });
157
159
  });
158
160
 
159
- describe('filled', () => {
160
- it('renders correctly', () => {
161
+ describe("filled", () => {
162
+ it("renders correctly", () => {
161
163
  const {
162
164
  toJSON,
163
165
  queryAllByTestId,
@@ -173,17 +175,17 @@ describe('TextInput', () => {
173
175
  );
174
176
 
175
177
  expect(toJSON()).toMatchSnapshot();
176
- expect(queryAllByText('Amount (AUD)')).toHaveLength(1);
177
- expect(queryAllByDisplayValue('100')).toHaveLength(1);
178
- expect(queryAllByTestId('input-label')).toHaveLength(1);
179
- expect(queryAllByTestId('input-prefix')).toHaveLength(1);
180
- expect(queryAllByTestId('input-suffix')).toHaveLength(1);
181
- expect(queryAllByTestId('text-input')).toHaveLength(1);
178
+ expect(queryAllByText("Amount (AUD)")).toHaveLength(1);
179
+ expect(queryAllByDisplayValue("100")).toHaveLength(1);
180
+ expect(queryAllByTestId("input-label")).toHaveLength(1);
181
+ expect(queryAllByTestId("input-prefix")).toHaveLength(1);
182
+ expect(queryAllByTestId("input-suffix")).toHaveLength(1);
183
+ expect(queryAllByTestId("text-input")).toHaveLength(1);
182
184
  });
183
185
  });
184
186
 
185
- describe('readonly', () => {
186
- it('renders correctly', () => {
187
+ describe("readonly", () => {
188
+ it("renders correctly", () => {
187
189
  const onChangeText = jest.fn();
188
190
  const {
189
191
  toJSON,
@@ -204,31 +206,31 @@ describe('TextInput', () => {
204
206
  );
205
207
 
206
208
  expect(toJSON()).toMatchSnapshot();
207
- expect(queryAllByText('Amount (AUD)')).toHaveLength(1);
208
- expect(queryAllByDisplayValue('100')).toHaveLength(1);
209
- expect(queryAllByTestId('input-label')).toHaveLength(1);
210
- expect(queryAllByTestId('input-prefix')).toHaveLength(1);
211
- expect(queryAllByTestId('input-suffix')).toHaveLength(1);
212
- expect(queryAllByTestId('text-input')).toHaveLength(1);
213
-
214
- expect(getByTestId('text-input')).not.toHaveProp('editable', 'false');
209
+ expect(queryAllByText("Amount (AUD)")).toHaveLength(1);
210
+ expect(queryAllByDisplayValue("100")).toHaveLength(1);
211
+ expect(queryAllByTestId("input-label")).toHaveLength(1);
212
+ expect(queryAllByTestId("input-prefix")).toHaveLength(1);
213
+ expect(queryAllByTestId("input-suffix")).toHaveLength(1);
214
+ expect(queryAllByTestId("text-input")).toHaveLength(1);
215
+
216
+ expect(getByTestId("text-input")).not.toHaveProp("editable", "false");
215
217
  });
216
218
  });
217
219
 
218
- describe('loading', () => {
219
- it('renders correctly', () => {
220
+ describe("loading", () => {
221
+ it("renders correctly", () => {
220
222
  const { toJSON, queryAllByTestId, getByTestId } = renderWithTheme(
221
223
  <TextInput suffix="arrow-down" loading />
222
224
  );
223
225
 
224
226
  expect(toJSON()).toMatchSnapshot();
225
- expect(queryAllByTestId('text-input')).toHaveLength(1);
226
- expect(getByTestId('input-suffix')).toHaveProp('name', 'loading');
227
+ expect(queryAllByTestId("text-input")).toHaveLength(1);
228
+ expect(getByTestId("input-suffix")).toHaveProp("name", "loading");
227
229
  });
228
230
  });
229
231
 
230
- describe('max length', () => {
231
- it('renders correctly', () => {
232
+ describe("max length", () => {
233
+ it("renders correctly", () => {
232
234
  const {
233
235
  toJSON,
234
236
  queryAllByTestId,
@@ -247,18 +249,18 @@ describe('TextInput', () => {
247
249
  );
248
250
 
249
251
  expect(toJSON()).toMatchSnapshot();
250
- expect(queryAllByText('Shout out')).toHaveLength(1);
251
- expect(queryAllByDisplayValue('shout out Tung Van')).toHaveLength(1);
252
- expect(queryAllByText('18/255')).toHaveLength(1);
253
- expect(queryAllByTestId('input-label')).toHaveLength(1);
254
- expect(queryAllByTestId('text-input')).toHaveLength(1);
252
+ expect(queryAllByText("Shout out")).toHaveLength(1);
253
+ expect(queryAllByDisplayValue("shout out Tung Van")).toHaveLength(1);
254
+ expect(queryAllByText("18/255")).toHaveLength(1);
255
+ expect(queryAllByTestId("input-label")).toHaveLength(1);
256
+ expect(queryAllByTestId("text-input")).toHaveLength(1);
255
257
 
256
- expect(getByTestId('text-input')).not.toHaveProp('multiline', 'true');
258
+ expect(getByTestId("text-input")).not.toHaveProp("multiline", "true");
257
259
  });
258
260
  });
259
261
 
260
- describe('disabled', () => {
261
- it('renders correctly', () => {
262
+ describe("disabled", () => {
263
+ it("renders correctly", () => {
262
264
  const { toJSON, queryAllByTestId, queryAllByText, getByTestId } =
263
265
  renderWithTheme(
264
266
  <TextInput
@@ -271,17 +273,17 @@ describe('TextInput', () => {
271
273
  );
272
274
 
273
275
  expect(toJSON()).toMatchSnapshot();
274
- expect(queryAllByText('Amount (AUD)')).toHaveLength(1);
275
- expect(queryAllByTestId('input-label')).toHaveLength(1);
276
- expect(queryAllByTestId('text-input')).toHaveLength(1);
277
- expect(getByTestId('disabled-text-input')).toBeDisabled();
276
+ expect(queryAllByText("Amount (AUD)")).toHaveLength(1);
277
+ expect(queryAllByTestId("input-label")).toHaveLength(1);
278
+ expect(queryAllByTestId("text-input")).toHaveLength(1);
279
+ expect(getByTestId("disabled-text-input")).toBeDisabled();
278
280
 
279
- expect(getByTestId('text-input')).not.toHaveProp('multiline', 'true');
281
+ expect(getByTestId("text-input")).not.toHaveProp("multiline", "true");
280
282
  });
281
283
  });
282
284
 
283
- describe('error', () => {
284
- it('renders correctly', () => {
285
+ describe("error", () => {
286
+ it("renders correctly", () => {
285
287
  const { toJSON, queryAllByText } = renderWithTheme(
286
288
  <TextInput
287
289
  label="Amount (AUD)"
@@ -292,12 +294,12 @@ describe('TextInput', () => {
292
294
  );
293
295
 
294
296
  expect(toJSON()).toMatchSnapshot();
295
- expect(queryAllByText('Amount (AUD)')).toHaveLength(1);
296
- expect(queryAllByText('This field is required')).toHaveLength(1);
297
+ expect(queryAllByText("Amount (AUD)")).toHaveLength(1);
298
+ expect(queryAllByText("This field is required")).toHaveLength(1);
297
299
  });
298
300
  });
299
- describe('helper text', () => {
300
- it('renders correctly', () => {
301
+ describe("helper text", () => {
302
+ it("renders correctly", () => {
301
303
  const { toJSON, queryAllByText } = renderWithTheme(
302
304
  <TextInput
303
305
  label="Amount (AUD)"
@@ -308,14 +310,14 @@ describe('TextInput', () => {
308
310
  );
309
311
 
310
312
  expect(toJSON()).toMatchSnapshot();
311
- expect(queryAllByText('Amount (AUD)')).toHaveLength(1);
312
- expect(queryAllByText('This is helper text')).toHaveLength(1);
313
+ expect(queryAllByText("Amount (AUD)")).toHaveLength(1);
314
+ expect(queryAllByText("This is helper text")).toHaveLength(1);
313
315
  });
314
316
  });
315
317
 
316
- describe('placeholder', () => {
317
- describe('TextInput is idle', () => {
318
- it('renders correctly', () => {
318
+ describe("placeholder", () => {
319
+ describe("TextInput is idle", () => {
320
+ it("renders correctly", () => {
319
321
  const wrapper = renderWithTheme(
320
322
  <TextInput
321
323
  label="Amount (AUD)"
@@ -327,20 +329,20 @@ describe('TextInput', () => {
327
329
  );
328
330
 
329
331
  expect(wrapper.toJSON()).toMatchSnapshot();
330
- expect(wrapper.queryByPlaceholderText('Enter Amount')).toBeFalsy();
332
+ expect(wrapper.queryByPlaceholderText("Enter Amount")).toBeFalsy();
331
333
 
332
- fireEvent(wrapper.getByTestId('text-input'), 'focus');
333
- expect(wrapper.queryByPlaceholderText('Enter Amount')).toBeTruthy();
334
+ fireEvent(wrapper.getByTestId("text-input"), "focus");
335
+ expect(wrapper.queryByPlaceholderText("Enter Amount")).toBeTruthy();
334
336
 
335
- fireEvent(wrapper.getByTestId('text-input'), 'blur');
336
- expect(wrapper.queryByPlaceholderText('Enter Amount')).toBeFalsy();
337
+ fireEvent(wrapper.getByTestId("text-input"), "blur");
338
+ expect(wrapper.queryByPlaceholderText("Enter Amount")).toBeFalsy();
337
339
  });
338
340
  });
339
341
  });
340
342
 
341
- describe('defaultValue', () => {
342
- describe('TextInput is idle', () => {
343
- it('renders correctly', () => {
343
+ describe("defaultValue", () => {
344
+ describe("TextInput is idle", () => {
345
+ it("renders correctly", () => {
344
346
  const wrapper = renderWithTheme(
345
347
  <TextInput
346
348
  label="Amount (AUD)"
@@ -354,13 +356,13 @@ describe('TextInput', () => {
354
356
  );
355
357
 
356
358
  expect(wrapper.toJSON()).toMatchSnapshot();
357
- expect(wrapper.queryByDisplayValue('1000')).toBeTruthy();
358
- expect(wrapper.queryByText('4/255')).toBeTruthy();
359
+ expect(wrapper.queryByDisplayValue("1000")).toBeTruthy();
360
+ expect(wrapper.queryByText("4/255")).toBeTruthy();
359
361
  });
360
362
  });
361
363
 
362
- describe('default Value and Value', () => {
363
- it('renders correctly with 2000', () => {
364
+ describe("default Value and Value", () => {
365
+ it("renders correctly with 2000", () => {
364
366
  const wrapper = renderWithTheme(
365
367
  <TextInput
366
368
  label="Amount (AUD)"
@@ -375,9 +377,9 @@ describe('TextInput', () => {
375
377
  );
376
378
 
377
379
  expect(wrapper.toJSON()).toMatchSnapshot();
378
- expect(wrapper.queryByDisplayValue('2000')).toBeTruthy();
379
- expect(wrapper.queryByDisplayValue('1000')).toBeFalsy();
380
- expect(wrapper.queryByText('4/255')).toBeTruthy();
380
+ expect(wrapper.queryByDisplayValue("2000")).toBeTruthy();
381
+ expect(wrapper.queryByDisplayValue("1000")).toBeFalsy();
382
+ expect(wrapper.queryByText("4/255")).toBeTruthy();
381
383
  });
382
384
  });
383
385
  });