@madie/madie-design-system 1.2.62 → 2.0.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 (156) hide show
  1. package/.babelrc +14 -2
  2. package/.eslintrc.js +1 -1
  3. package/.storybook/.babelrc +2 -1
  4. package/.storybook/main.js +3 -11
  5. package/.storybook/preview.js +1 -1
  6. package/components/Accordion/index.jsx +32 -36
  7. package/components/AutoComplete/AutoComplete.jsx +2 -17
  8. package/components/Button/Button.stories.js +0 -7
  9. package/components/Button/index.js +34 -44
  10. package/components/DateField/DateField.jsx +2 -15
  11. package/components/DateField/DateField.stories.jsx +23 -10
  12. package/components/DateTimeField/DateTimeField.jsx +7 -11
  13. package/components/DateTimeField/DateTimeField.stories.jsx +29 -19
  14. package/components/InputLabel/index.jsx +1 -6
  15. package/components/Instant/Instant.stories.js +14 -6
  16. package/components/Instant/index.jsx +0 -16
  17. package/components/Link/index.js +14 -33
  18. package/components/MadieAlert/MadieAlert.stories.js +35 -29
  19. package/components/MadieAlert/index.jsx +5 -44
  20. package/components/MadieConfirmDialog/MadieConfirmDialog.stories.js +17 -32
  21. package/components/MadieConfirmDialog/index.jsx +0 -8
  22. package/components/MadieDeleteDialog/MadieDeleteDialog.stories.js +9 -24
  23. package/components/MadieDeleteDialog/index.jsx +0 -7
  24. package/components/MadieDialog/MadieDialog.stories.js +45 -121
  25. package/components/MadieDialog/index.jsx +4 -23
  26. package/components/MadieDiscardDialog/MadieDiscardDialog.stories.js +5 -12
  27. package/components/MadieDiscardDialog/index.jsx +0 -7
  28. package/components/MadieSpinner/MadieSpinner.stories.js +1 -9
  29. package/components/MadieSpinner/index.jsx +0 -5
  30. package/components/MadieTooltip/MadieTooltip.stories.js +7 -2
  31. package/components/MadieTooltip/index.jsx +0 -6
  32. package/components/MadieTooltipIcon/index.jsx +0 -5
  33. package/components/Modal/Modal.jsx +31 -43
  34. package/components/Modal/Modal.stories.js +18 -89
  35. package/components/Modal/index.jsx +6 -8
  36. package/components/NumberInput/NumberInput.stories.js +50 -67
  37. package/components/NumberInput/index.jsx +0 -13
  38. package/components/Pagination/index.jsx +0 -17
  39. package/components/Popover/Popover.stories.js +6 -14
  40. package/components/Popover/index.js +0 -23
  41. package/components/RadioButton/RadioButton.jsx +5 -15
  42. package/components/RadioButton/RadioButton.stories.jsx +6 -2
  43. package/components/ReadOnlyTextField/ReadOnlyTextField.stories.js +3 -8
  44. package/components/ReadOnlyTextField/index.jsx +1 -9
  45. package/components/RichTextEditor/RichTextEditor.stories.js +10 -8
  46. package/components/RichTextEditor/index.jsx +14 -30
  47. package/components/SanitizedContent/index.jsx +0 -8
  48. package/components/Search/Search.stories.js +2 -4
  49. package/components/Search/index.js +26 -40
  50. package/components/Select/Select.stories.js +59 -164
  51. package/components/Select/index.jsx +2 -17
  52. package/components/Tabs/Tab.js +29 -25
  53. package/components/Tabs/TabPanel.js +15 -19
  54. package/components/Tabs/Tabs.stories.js +43 -211
  55. package/components/Tabs/index.js +10 -28
  56. package/components/TextArea/TextArea.stories.js +87 -113
  57. package/components/TextArea/index.jsx +2 -14
  58. package/components/TextField/TextField.stories.js +100 -129
  59. package/components/TextField/index.jsx +2 -17
  60. package/components/TimeField/TimeField.jsx +0 -10
  61. package/components/TimeField/TimeField.stories.js +18 -8
  62. package/components/Toast/Toast.stories.js +42 -102
  63. package/components/Toast/index.jsx +0 -14
  64. package/components/TruncateText/TruncateText.stories.js +22 -17
  65. package/components/TruncateText/index.js +0 -8
  66. package/components/hooks/useGetConfig.js +2 -2
  67. package/components/{index.js → index.mjs} +37 -57
  68. package/dist/index.js +3 -1
  69. package/dist/index.js.LICENSE.txt +16 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/react/index.html +1 -1
  72. package/dist/react/index.mjs +103 -0
  73. package/dist/react/{index.js.LICENSE.txt → index.mjs.LICENSE.txt} +3 -52
  74. package/dist/react/index.mjs.map +1 -0
  75. package/dist/react/package.json +1 -0
  76. package/eslint.config.cjs +59 -0
  77. package/index.js +7 -9
  78. package/jest.config.mjs +10 -0
  79. package/lib/Chevron.jsx +2 -10
  80. package/package.json +57 -82
  81. package/styles/_main.scss +4 -3
  82. package/test/components/Accordion.test.js +1 -1
  83. package/test/components/AutoComplete.test.js +11 -6
  84. package/test/components/Button.test.js +13 -19
  85. package/test/components/DateField.test.js +25 -29
  86. package/test/components/DateTimeField.test.js +21 -25
  87. package/test/components/Instant.test.js +1 -1
  88. package/test/components/MadieAlert.test.js +22 -22
  89. package/test/components/MadieConfirmDialog.test.js +42 -64
  90. package/test/components/MadieDeleteDialog.test.js +51 -69
  91. package/test/components/MadieDialog.test.js +13 -13
  92. package/test/components/MadieDiscardDialog.test.js +28 -45
  93. package/test/components/MadieSpinner.test.js +12 -17
  94. package/test/components/Modal.test.js +115 -0
  95. package/test/components/Pagination.test.js +2 -2
  96. package/test/components/RadioButton.test.js +7 -7
  97. package/test/components/ReadOnlyTextField.test.js +4 -2
  98. package/test/components/RichTextEditor.test.js +90 -6
  99. package/test/components/Search.test.js +75 -0
  100. package/test/components/Select.test.js +97 -107
  101. package/test/components/Tabs.test.js +22 -24
  102. package/test/components/TextArea.test.js +78 -92
  103. package/test/components/TextField.test.js +128 -147
  104. package/test/components/Toast.test.js +67 -78
  105. package/test/components/TruncateText.test.js +75 -0
  106. package/test/components/index.test.js +23 -0
  107. package/webpack.config.mjs +79 -0
  108. package/webpack.config.react.mjs +72 -0
  109. package/.eslintignore +0 -5
  110. package/components/Alert/Alert.stories.js +0 -70
  111. package/components/Alert/index.js +0 -55
  112. package/components/Breadcrumb/Breadcrumb.md +0 -28
  113. package/components/Breadcrumb/Breadcrumb.stories.js +0 -76
  114. package/components/Breadcrumb/index.js +0 -92
  115. package/components/CalloutBox/CalloutBox.stories.js +0 -94
  116. package/components/CalloutBox/index.js +0 -109
  117. package/components/Card/Card.stories.js +0 -163
  118. package/components/Card/index.js +0 -144
  119. package/components/Dropdown/Dropdown.stories.js +0 -94
  120. package/components/Dropdown/index.js +0 -85
  121. package/components/Error/Collapsible.jsx +0 -93
  122. package/components/Error/ErrorUI.jsx +0 -31
  123. package/components/Error/error.js +0 -26
  124. package/components/FlashNotification/FlashNotificationUI.jsx +0 -91
  125. package/components/FlashNotification/index.js +0 -30
  126. package/components/Footer/Footer.stories.js +0 -20
  127. package/components/Footer/FooterUI.jsx +0 -137
  128. package/components/Footer/LegacyFooterUI.jsx +0 -204
  129. package/components/Footer/SocialLinks.jsx +0 -63
  130. package/components/Footer/Subscribe.jsx +0 -34
  131. package/components/Footer/footer.js +0 -30
  132. package/components/Infotip/Infotip.jsx +0 -75
  133. package/components/Infotip/Infotip.stories.js +0 -52
  134. package/components/Infotip/InfotipIcon.jsx +0 -41
  135. package/components/Infotip/index.js +0 -3
  136. package/components/Link/Link.stories.js +0 -82
  137. package/components/NotificationBanner/NotificationBanner.stories.js +0 -23
  138. package/components/NotificationBanner/index.js +0 -279
  139. package/components/Spinner/index.js +0 -9
  140. package/components/TextInput/TextInput.stories.js +0 -118
  141. package/components/TextInput/index.js +0 -137
  142. package/components/Tooltip/Tooltip.jsx +0 -88
  143. package/components/Tooltip/Tooltip.stories.js +0 -80
  144. package/components/Tooltip/index.js +0 -3
  145. package/components/Tooltip/position.js +0 -76
  146. package/components/UnwrappedSpinner/index.js +0 -8
  147. package/dist/browser.js +0 -1
  148. package/dist/react/index.js +0 -185
  149. package/dist/react/index.js.map +0 -1
  150. package/jest.config.js +0 -17
  151. package/test/components/ErrorUI.test.js +0 -32
  152. package/test/components/FooterUI.test.js +0 -122
  153. package/test/components/Infotip.test.js +0 -76
  154. package/test/components/Tooltip.test.js +0 -147
  155. package/webpack.config.js +0 -124
  156. package/webpack.config.react.js +0 -104
@@ -2,113 +2,105 @@ import * as React from "react";
2
2
  import "@testing-library/jest-dom";
3
3
  import { describe, expect, test } from "@jest/globals";
4
4
  import Select from "../../components/Select/index";
5
- import { act, Simulate } from "react-dom/test-utils";
6
5
 
7
6
  import { render, fireEvent, screen } from "@testing-library/react";
8
7
 
9
8
  import { MenuItem } from "@mui/material";
10
9
 
11
10
  describe("Select", () => {
11
+ const { getByTestId, findByText, getByRole } = screen;
12
12
  const options = [
13
13
  { key: "key1", value: "value1", testId: "testid1", name: "name1" },
14
14
  { key: "key2", value: "value2", testId: "testid2", name: "name2" },
15
15
  { key: "key3", value: "value2", testId: "testid3", name: "name3" },
16
16
  ];
17
17
  test("Select exists, and simulates input correctly", async () => {
18
- await act(async () => {
19
- const { getByTestId } = render(
20
- <Select
21
- placeHolder={{ name: "placeholder", value: "" }}
22
- required
23
- label="Test"
24
- id="test-select"
25
- inputProps={{ "data-testid": "test-input" }}
26
- data-testid="test-select"
27
- size="small"
28
- options={options.map(({ key, value, testId, name }) => {
29
- return (
30
- <MenuItem
31
- key={key}
32
- value={value}
33
- data-testid={`option-${testId}`}
34
- >
35
- {name}
36
- </MenuItem>
37
- );
38
- })}
39
- />
40
- );
41
- const selectNode = await getByTestId("test-select");
42
- fireEvent.click(selectNode);
43
- const inputNode = await getByTestId("test-input");
44
- fireEvent.select(inputNode, { target: { value: "value1" } });
45
- Simulate.change(inputNode);
46
- expect(inputNode.value).toBe("value1");
47
- });
18
+ render(
19
+ <Select
20
+ placeHolder={{ name: "placeholder", value: "" }}
21
+ required
22
+ label="Test"
23
+ id="test-select"
24
+ inputProps={{ "data-testid": "test-input" }}
25
+ data-testid="test-select"
26
+ size="small"
27
+ options={options.map(({ key, value, testId, name }) => {
28
+ return (
29
+ <MenuItem
30
+ key={key}
31
+ value={value}
32
+ data-testid={`option-${testId}`}
33
+ >
34
+ {name}
35
+ </MenuItem>
36
+ );
37
+ })}
38
+ />,
39
+ );
40
+ const selectNode = await getByTestId("test-select");
41
+ fireEvent.click(selectNode);
42
+ const inputNode = await getByTestId("test-input");
43
+ fireEvent.select(inputNode, { target: { value: "value1" } });
44
+ fireEvent.change(inputNode);
45
+ expect(inputNode.value).toBe("value1");
48
46
  });
49
47
  test("Placeholder value renders", async () => {
50
- await act(async () => {
51
- const { getByTestId } = render(
52
- <Select
53
- placeHolder={{ name: "placeholder", value: "" }}
54
- required
55
- label="Test"
56
- id="test-select"
57
- inputProps={{ "data-testid": "test-input" }}
58
- data-testid="test-select"
59
- size="small"
60
- value=""
61
- options={options.map(({ key, value, testId, name }) => {
62
- return (
63
- <MenuItem
64
- key={key}
65
- value={value}
66
- data-testid={`option-${testId}`}
67
- >
68
- {name}
69
- </MenuItem>
70
- );
71
- })}
72
- />
73
- );
74
- const inputNode = await getByTestId("test-input");
75
- expect(inputNode.value).toBe("");
76
- });
48
+ render(
49
+ <Select
50
+ placeHolder={{ name: "placeholder", value: "" }}
51
+ required
52
+ label="Test"
53
+ id="test-select"
54
+ inputProps={{ "data-testid": "test-input" }}
55
+ data-testid="test-select"
56
+ size="small"
57
+ value=""
58
+ options={options.map(({ key, value, testId, name }) => {
59
+ return (
60
+ <MenuItem
61
+ key={key}
62
+ value={value}
63
+ data-testid={`option-${testId}`}
64
+ >
65
+ {name}
66
+ </MenuItem>
67
+ );
68
+ })}
69
+ />,
70
+ );
71
+ const inputNode = await getByTestId("test-input");
72
+ expect(inputNode.value).toBe("");
77
73
  });
78
74
  test("Select exists, and simulates input correctly", async () => {
79
- await act(async () => {
80
- const { getByTestId } = render(
81
- <Select
82
- label="Test"
83
- value=""
84
- id="test-select"
85
- inputProps={{ "data-testid": "test-input" }}
86
- data-testid="test-select"
87
- size="small"
88
- />
89
- );
90
- const selectNode = await getByTestId("test-select");
91
- fireEvent.click(selectNode);
92
- const inputNode = await getByTestId("test-input");
93
- expect(inputNode.value).toBe("");
94
- });
75
+ render(
76
+ <Select
77
+ label="Test"
78
+ value=""
79
+ id="test-select"
80
+ inputProps={{ "data-testid": "test-input" }}
81
+ data-testid="test-select"
82
+ size="small"
83
+ />,
84
+ );
85
+ const selectNode = await getByTestId("test-select");
86
+ fireEvent.click(selectNode);
87
+ const inputNode = await getByTestId("test-input");
88
+ expect(inputNode.value).toBe("");
95
89
  });
96
90
  test("Helper text exists", async () => {
97
- await act(async () => {
98
- const { findByText } = render(
99
- <Select
100
- helperText="helper text"
101
- label="Test"
102
- value=""
103
- id="test-select"
104
- inputProps={{ "data-testid": "test-input" }}
105
- data-testid="test-select"
106
- size="small"
107
- />
108
- );
109
- const helperText = await findByText("helper text");
110
- expect(helperText).toBeInTheDocument();
111
- });
91
+ render(
92
+ <Select
93
+ helperText="helper text"
94
+ label="Test"
95
+ value=""
96
+ id="test-select"
97
+ inputProps={{ "data-testid": "test-input" }}
98
+ data-testid="test-select"
99
+ size="small"
100
+ />,
101
+ );
102
+ const helperText = await findByText("helper text");
103
+ expect(helperText).toBeInTheDocument();
112
104
  });
113
105
 
114
106
  test("Select renders disabled", () => {
@@ -122,28 +114,26 @@ describe("Select", () => {
122
114
  inputProps={{ "data-testid": "test-input" }}
123
115
  data-testid="test-select"
124
116
  size="small"
125
- />
117
+ />,
126
118
  );
127
- const value = screen.getByRole("textbox");
119
+ const value = getByRole("textbox");
128
120
  expect(value).toHaveTextContent("-");
129
121
  expect(value).toHaveAttribute("readOnly");
130
122
  });
131
123
  test("Select renders error", async () => {
132
- await act(async () => {
133
- const { findByText } = render(
134
- <Select
135
- error
136
- helperText="helper text"
137
- label="Test"
138
- value=""
139
- id="test-select"
140
- inputProps={{ "data-testid": "test-input" }}
141
- data-testid="test-select"
142
- size="small"
143
- />
144
- );
145
- const helperText = await findByText("helper text");
146
- expect(helperText).toBeInTheDocument();
147
- });
124
+ render(
125
+ <Select
126
+ error
127
+ helperText="helper text"
128
+ label="Test"
129
+ value=""
130
+ id="test-select"
131
+ inputProps={{ "data-testid": "test-input" }}
132
+ data-testid="test-select"
133
+ size="small"
134
+ />,
135
+ );
136
+ const helperText = await findByText("helper text");
137
+ expect(helperText).toBeInTheDocument();
148
138
  });
149
139
  });
@@ -1,12 +1,12 @@
1
1
  import "@testing-library/jest-dom";
2
2
  import { describe, expect, test } from "@jest/globals";
3
- import { act } from "react-dom/test-utils";
4
- import { render, waitFor } from "@testing-library/react";
3
+ import { render, waitFor, screen } from "@testing-library/react";
5
4
  import Tab from "../../components/Tabs/Tab";
6
5
  import Tabs from "../../components/Tabs/index";
7
6
  import React from "react";
8
7
 
9
8
  describe("Tabs", () => {
9
+ const { findByTestId } = screen;
10
10
  const Navigations = () => {
11
11
  return (
12
12
  <div>
@@ -265,29 +265,27 @@ describe("Tabs", () => {
265
265
  };
266
266
 
267
267
  test("All Tab components render. ", async () => {
268
- await act(async () => {
269
- const { findByTestId } = await render(<Navigations />);
270
- const standardA = await findByTestId("standard-a");
271
- const standardB = await findByTestId("standard-b");
272
- const standardC = await findByTestId("standard-c");
273
- const verticalC = await findByTestId("v-c");
274
- const standardD = await findByTestId("standard-d");
275
- const largeA = await findByTestId("large-a");
276
- const largeB = await findByTestId("large-b");
277
- const largeC = await findByTestId("large-c");
278
- const largeD = await findByTestId("large-d");
268
+ render(<Navigations />);
269
+ const standardA = await findByTestId("standard-a");
270
+ const standardB = await findByTestId("standard-b");
271
+ const standardC = await findByTestId("standard-c");
272
+ const verticalC = await findByTestId("v-c");
273
+ const standardD = await findByTestId("standard-d");
274
+ const largeA = await findByTestId("large-a");
275
+ const largeB = await findByTestId("large-b");
276
+ const largeC = await findByTestId("large-c");
277
+ const largeD = await findByTestId("large-d");
279
278
 
280
- await waitFor(() => {
281
- expect(standardA).toBeInTheDocument();
282
- expect(standardB).toBeInTheDocument();
283
- expect(standardC).toBeInTheDocument();
284
- expect(verticalC).toBeInTheDocument();
285
- expect(standardD).toBeInTheDocument();
286
- expect(largeA).toBeInTheDocument();
287
- expect(largeB).toBeInTheDocument();
288
- expect(largeC).toBeInTheDocument();
289
- expect(largeD).toBeInTheDocument();
290
- });
279
+ await waitFor(() => {
280
+ expect(standardA).toBeInTheDocument();
281
+ expect(standardB).toBeInTheDocument();
282
+ expect(standardC).toBeInTheDocument();
283
+ expect(verticalC).toBeInTheDocument();
284
+ expect(standardD).toBeInTheDocument();
285
+ expect(largeA).toBeInTheDocument();
286
+ expect(largeB).toBeInTheDocument();
287
+ expect(largeC).toBeInTheDocument();
288
+ expect(largeD).toBeInTheDocument();
291
289
  });
292
290
  });
293
291
  });
@@ -1,51 +1,45 @@
1
- import * as React from "react";
1
+ import React from "react";
2
2
  import "@testing-library/jest-dom";
3
3
  import { describe, expect, test } from "@jest/globals";
4
4
  import TextArea from "../../components/TextArea/index";
5
- import { act, Simulate } from "react-dom/test-utils";
6
- import { render, screen } from "@testing-library/react";
5
+ import { render, screen, waitFor, fireEvent } from "@testing-library/react";
7
6
  import userEvent from "@testing-library/user-event";
8
7
 
9
-
10
8
  describe("TextArea", () => {
11
9
  test("TextArea exists, and simulates input correctly", async () => {
12
- await act(async () => {
13
- const {findByTestId, getByTestId} = render(
14
- <TextArea
15
- placeholder="test Name"
16
- required
17
- label="test Name"
18
- id="testName"
19
- data-testid="test-name-text-field"
20
- disabled={false}
21
- />
22
- );
23
- expect(
24
- await findByTestId("test-name-text-field")
25
- ).toBeInTheDocument();
26
- const textNode = await getByTestId("test-name-text-field");
27
- expect(textNode).toBeInTheDocument();
28
- userEvent.type(textNode, "newVal");
29
- Simulate.change(textNode);
10
+ const { findByTestId, getByTestId } = render(
11
+ <TextArea
12
+ placeholder="test Name"
13
+ required
14
+ label="test Name"
15
+ id="testName"
16
+ data-testid="test-name-text-field"
17
+ disabled={false}
18
+ />,
19
+ );
20
+ expect(await findByTestId("test-name-text-field")).toBeInTheDocument();
21
+ const textNode = await getByTestId("test-name-text-field");
22
+ expect(textNode).toBeInTheDocument();
23
+ userEvent.type(textNode, "newVal");
24
+ fireEvent.change(textNode);
25
+ await waitFor(() => {
30
26
  expect(textNode.value).toBe("newVal");
31
27
  });
32
28
  });
33
29
  test("TextArea renders with helper text", async () => {
34
- await act(async () => {
35
- const {findByText} = render(
36
- <TextArea
37
- error={false}
38
- placeholder="test Name"
39
- helperText="helper text"
40
- label="test Name"
41
- id="testName"
42
- inputProps={{"data-testid": "test-name-input"}}
43
- data-testid="test-name-text-field"
44
- />
45
- );
46
- const helperText = await findByText("helper text");
47
- expect(helperText).toBeInTheDocument();
48
- });
30
+ const { findByText } = render(
31
+ <TextArea
32
+ error={false}
33
+ placeholder="test Name"
34
+ helperText="helper text"
35
+ label="test Name"
36
+ id="testName"
37
+ inputProps={{ "data-testid": "test-name-input" }}
38
+ data-testid="test-name-text-field"
39
+ />,
40
+ );
41
+ const helperText = await findByText("helper text");
42
+ expect(helperText).toBeInTheDocument();
49
43
  });
50
44
  test("renders TextArea for disabled mode", async () => {
51
45
  render(
@@ -55,72 +49,64 @@ describe("TextArea", () => {
55
49
  helperText="helper text"
56
50
  label="test Name"
57
51
  id="testName"
58
- inputProps={{"data-testid": "test-name-input"}}
52
+ inputProps={{ "data-testid": "test-name-input" }}
59
53
  data-testid="test-name-text-field"
60
54
  value="test value"
61
- />
55
+ />,
62
56
  );
63
57
  const textArea = await screen.findByRole("textbox");
64
58
  expect(textArea).toHaveTextContent("test value");
65
59
  expect(textArea).toHaveAttribute("readOnly");
66
60
  });
67
61
  test("HelperText renders errored", async () => {
68
- await act(async () => {
69
- const {findByText} = render(
70
- <TextArea
71
- error
72
- placeholder="test Name"
73
- helperText="helper text"
74
- label="test Name"
75
- id="testName"
76
- inputProps={{"data-testid": "test-name-input"}}
77
- data-testid="test-name-text-field"
78
- />
79
- );
80
- const helperText = await findByText("helper text");
81
- expect(helperText).toBeInTheDocument();
82
- });
62
+ const { findByText } = render(
63
+ <TextArea
64
+ error
65
+ placeholder="test Name"
66
+ helperText="helper text"
67
+ label="test Name"
68
+ id="testName"
69
+ inputProps={{ "data-testid": "test-name-input" }}
70
+ data-testid="test-name-text-field"
71
+ />,
72
+ );
73
+ const helperText = await findByText("helper text");
74
+ expect(helperText).toBeInTheDocument();
83
75
  });
84
76
  test("TextArea renders with default propTypes left out", async () => {
85
- await act(async () => {
86
- const {findByText} = render(
87
- <TextArea
88
- // error purposely omitted
89
- // disabled purposely omitted
90
- placeholder="test Name"
91
- helperText="helper text"
92
- label="test Name"
93
- id="testName"
94
- inputProps={{"data-testid": "test-name-input"}}
95
- data-testid="test-name-text-field"
96
- />
97
- );
98
- const helperText = await findByText("helper text");
99
- expect(helperText).toBeInTheDocument();
100
- });
77
+ const { findByText } = render(
78
+ <TextArea
79
+ // error purposely omitted
80
+ // disabled purposely omitted
81
+ placeholder="test Name"
82
+ helperText="helper text"
83
+ label="test Name"
84
+ id="testName"
85
+ inputProps={{ "data-testid": "test-name-input" }}
86
+ data-testid="test-name-text-field"
87
+ />,
88
+ );
89
+ const helperText = await findByText("helper text");
90
+ expect(helperText).toBeInTheDocument();
101
91
  });
102
92
  test("TextArea shows maxLength", async () => {
103
- await act(async () => {
104
- const {findByTestId, getByTestId, findByText} = render(
105
- <TextArea
106
- placeholder="test Name"
107
- required
108
- label="test Name"
109
- id="testName"
110
- data-testid="test-name-text-field"
111
- disabled={false}
112
- maxLength={10}
113
- />
114
- );
115
- expect(
116
- await findByTestId("test-name-text-field")
117
- ).toBeInTheDocument();
118
- const textNode = await getByTestId("test-name-text-field");
119
- expect(textNode).toBeInTheDocument();
120
- userEvent.type(textNode, "newVal");
121
- Simulate.change(textNode);
122
- const maxLength = await findByText("/10 Characters");
123
- expect(maxLength).toBeInTheDocument();
124
- });
93
+ const { findByTestId, getByTestId, findByText } = render(
94
+ <TextArea
95
+ placeholder="test Name"
96
+ required
97
+ label="test Name"
98
+ id="testName"
99
+ data-testid="test-name-text-field"
100
+ disabled={false}
101
+ maxLength={10}
102
+ />,
103
+ );
104
+ expect(await findByTestId("test-name-text-field")).toBeInTheDocument();
105
+ const textNode = await getByTestId("test-name-text-field");
106
+ expect(textNode).toBeInTheDocument();
107
+ userEvent.type(textNode, "newVal");
108
+ fireEvent.change(textNode);
109
+ const maxLength = await findByText("/10 Characters");
110
+ expect(maxLength).toBeInTheDocument();
125
111
  });
126
112
  });