@madie/madie-design-system 1.2.25 → 1.2.26
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.
- package/components/MadieAlert/index.jsx +70 -2
- package/coverage/clover.xml +38 -12
- package/coverage/coverage-final.json +1 -1
- package/coverage/lcov-report/index.html +17 -17
- package/coverage/lcov-report/react/components/Accordion/index.html +1 -1
- package/coverage/lcov-report/react/components/Accordion/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Button/index.html +1 -1
- package/coverage/lcov-report/react/components/Button/index.js.html +1 -1
- package/coverage/lcov-report/react/components/DateField/DateField.jsx.html +1 -1
- package/coverage/lcov-report/react/components/DateField/index.html +1 -1
- package/coverage/lcov-report/react/components/DateTimeField/DateTimeField.jsx.html +1 -1
- package/coverage/lcov-report/react/components/DateTimeField/index.html +1 -1
- package/coverage/lcov-report/react/components/Error/Collapsible.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Error/ErrorUI.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Error/error.js.html +1 -1
- package/coverage/lcov-report/react/components/Error/index.html +1 -1
- package/coverage/lcov-report/react/components/Footer/FooterUI.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Footer/LegacyFooterUI.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Footer/footer.js.html +1 -1
- package/coverage/lcov-report/react/components/Footer/index.html +1 -1
- package/coverage/lcov-report/react/components/Infotip/Infotip.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Infotip/InfotipIcon.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Infotip/index.html +1 -1
- package/coverage/lcov-report/react/components/Infotip/index.js.html +1 -1
- package/coverage/lcov-report/react/components/InputLabel/index.html +1 -1
- package/coverage/lcov-report/react/components/InputLabel/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/MadieAlert/index.html +15 -15
- package/coverage/lcov-report/react/components/MadieAlert/index.jsx.html +219 -15
- package/coverage/lcov-report/react/components/MadieDeleteDialog/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieDeleteDialog/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/MadieDialog/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieDialog/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/MadieDiscardDialog/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieDiscardDialog/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/MadieSpinner/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieSpinner/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/MadieTooltip/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieTooltip/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/MadieTooltipIcon/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieTooltipIcon/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Pagination/index.html +1 -1
- package/coverage/lcov-report/react/components/Pagination/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Popover/index.html +1 -1
- package/coverage/lcov-report/react/components/Popover/index.js.html +1 -1
- package/coverage/lcov-report/react/components/ReadOnlyTextField/index.html +1 -1
- package/coverage/lcov-report/react/components/ReadOnlyTextField/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Select/index.html +1 -1
- package/coverage/lcov-report/react/components/Select/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Tabs/Tab.js.html +1 -1
- package/coverage/lcov-report/react/components/Tabs/index.html +1 -1
- package/coverage/lcov-report/react/components/Tabs/index.js.html +1 -1
- package/coverage/lcov-report/react/components/TextArea/index.html +1 -1
- package/coverage/lcov-report/react/components/TextArea/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/TextField/index.html +1 -1
- package/coverage/lcov-report/react/components/TextField/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Toast/index.html +1 -1
- package/coverage/lcov-report/react/components/Toast/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Tooltip/Tooltip.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Tooltip/index.html +1 -1
- package/coverage/lcov-report/react/components/Tooltip/index.js.html +1 -1
- package/coverage/lcov-report/react/components/Tooltip/position.js.html +1 -1
- package/coverage/lcov-report/react/index.html +1 -1
- package/coverage/lcov-report/react/index.js.html +1 -1
- package/coverage/lcov-report/react/lib/Chevron.jsx.html +1 -1
- package/coverage/lcov-report/react/lib/SvgComponents.jsx.html +1 -1
- package/coverage/lcov-report/react/lib/index.html +1 -1
- package/coverage/lcov.info +87 -24
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +7 -7
- package/dist/react/index.js.map +1 -1
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/test/components/MadieAlert.test.js +117 -1
package/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@madie/madie-design-system",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.26",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@madie/madie-design-system",
|
|
9
|
-
"version": "1.2.
|
|
9
|
+
"version": "1.2.26",
|
|
10
10
|
"license": "CC0-1.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@cmsgov/design-system": "^5.0.2",
|
package/package.json
CHANGED
|
@@ -2,7 +2,6 @@ import "@testing-library/jest-dom";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { render, fireEvent, waitFor, screen } from "@testing-library/react";
|
|
4
4
|
import MadieAlert from "../../components/MadieAlert";
|
|
5
|
-
import "@testing-library/jest-dom";
|
|
6
5
|
|
|
7
6
|
describe("Madie Alert", () => {
|
|
8
7
|
it("It renders as expected with basic props and triggers on Close on click", async () => {
|
|
@@ -31,6 +30,123 @@ describe("Madie Alert", () => {
|
|
|
31
30
|
});
|
|
32
31
|
});
|
|
33
32
|
|
|
33
|
+
it("renders with copy button and copies text correctly", async () => {
|
|
34
|
+
const expectedReturn =
|
|
35
|
+
`Following issues were found within the CQL(3) Errors:
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
Row: 7, Col:0: VSAC: 0:66 | Request failed with status code 404 for oid = 1.16.840.1.113762.1.4.1206.28 location = 7:0-7:66
|
|
40
|
+
Row: 5, Col:0: VSAC: 0:89 | Request failed with status code 404 for oid = 1.16.840.1.113762.1.4.1222.1334 location = 5:0-5:89
|
|
41
|
+
Row: 6, Col:0: VSAC: 0:87 | Request failed with status code 404 for oid = 1.16.840.1.113762.1.4.1106.114 location = 6:0-6:87`
|
|
42
|
+
const onClose = jest.fn();
|
|
43
|
+
const mockedWriteText = jest.fn();
|
|
44
|
+
navigator.clipboard = {
|
|
45
|
+
writeText: mockedWriteText,
|
|
46
|
+
};
|
|
47
|
+
const { getByTestId } = render(
|
|
48
|
+
<MadieAlert
|
|
49
|
+
type="warning"
|
|
50
|
+
visible
|
|
51
|
+
canClose={false}
|
|
52
|
+
copyButton={true}
|
|
53
|
+
content={
|
|
54
|
+
<div aria-live="polite" role="alert"><h3 aria-live="polite" role="alert" data-testid="generic-error-text-header">Following issues were found within the CQL</h3><h6>(3) Errors:</h6><ul data-testid="generic-errors-text-list"><li>Row: 7, Col:0: VSAC: 0:66 | Request failed with status code 404 for oid = 1.16.840.1.113762.1.4.1206.28 location = 7:0-7:66</li><li>Row: 5, Col:0: VSAC: 0:89 | Request failed with status code 404 for oid = 1.16.840.1.113762.1.4.1222.1334 location = 5:0-5:89</li><li>Row: 6, Col:0: VSAC: 0:87 | Request failed with status code 404 for oid = 1.16.840.1.113762.1.4.1106.114 location = 6:0-6:87</li></ul></div>
|
|
55
|
+
}
|
|
56
|
+
alertProps={{
|
|
57
|
+
"data-testid": "alert-dialog",
|
|
58
|
+
}}
|
|
59
|
+
closeButtonProps={{
|
|
60
|
+
onClick: onClose,
|
|
61
|
+
"data-testid": "close-button",
|
|
62
|
+
}}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
expect(getByTestId("alert-dialog")).toBeInTheDocument();
|
|
66
|
+
expect(getByTestId("ContentCopyIcon")).toBeInTheDocument();
|
|
67
|
+
const copyButton = getByTestId("ContentCopyIcon");
|
|
68
|
+
fireEvent.click(copyButton);
|
|
69
|
+
|
|
70
|
+
await waitFor(() => {
|
|
71
|
+
expect(mockedWriteText).toHaveBeenCalledTimes(1);
|
|
72
|
+
expect(mockedWriteText).toHaveBeenCalledWith(expectedReturn);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
it("renders with copy button and copies text correctly with a non-array in children", async () => {
|
|
76
|
+
const expectedReturn =
|
|
77
|
+
`Following test case(s) were imported successfully, but the measure populations do not match the populations in the import file. The Test Case has been imported, but no expected values have been set.
|
|
78
|
+
|
|
79
|
+
9ccff643-5ec1-4875-910e-4f602c174455
|
|
80
|
+
21b8a225-7cd5-4b4b-bc08-b25100e6346c`
|
|
81
|
+
const onClose = jest.fn();
|
|
82
|
+
const mockedWriteText = jest.fn();
|
|
83
|
+
navigator.clipboard = {
|
|
84
|
+
writeText: mockedWriteText,
|
|
85
|
+
};
|
|
86
|
+
const { getByTestId } = render(
|
|
87
|
+
<MadieAlert
|
|
88
|
+
type="warning"
|
|
89
|
+
visible
|
|
90
|
+
canClose={false}
|
|
91
|
+
copyButton={true}
|
|
92
|
+
content={
|
|
93
|
+
<div aria-live="polite" role="alert"><div><div class="StatusHandler___StyledDiv2-sc-1tujbo9-2 gtcQQP">Following test case(s) were imported successfully, but the measure populations do not match the populations in the import file. The Test Case has been imported, but no expected values have been set.</div><ul><li data-testid="success-imports-with-warnings">9ccff643-5ec1-4875-910e-4f602c174455 </li><li data-testid="success-imports-with-warnings">21b8a225-7cd5-4b4b-bc08-b25100e6346c </li></ul></div></div>
|
|
94
|
+
}
|
|
95
|
+
alertProps={{
|
|
96
|
+
"data-testid": "alert-dialog",
|
|
97
|
+
}}
|
|
98
|
+
closeButtonProps={{
|
|
99
|
+
onClick: onClose,
|
|
100
|
+
"data-testid": "close-button",
|
|
101
|
+
}}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
expect(getByTestId("alert-dialog")).toBeInTheDocument();
|
|
105
|
+
expect(getByTestId("ContentCopyIcon")).toBeInTheDocument();
|
|
106
|
+
const copyButton = getByTestId("ContentCopyIcon");
|
|
107
|
+
fireEvent.click(copyButton);
|
|
108
|
+
|
|
109
|
+
await waitFor(() => {
|
|
110
|
+
expect(mockedWriteText).toHaveBeenCalledTimes(1);
|
|
111
|
+
expect(mockedWriteText).toHaveBeenCalledWith(expectedReturn);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it("renders with copy button and copies simple text", async () => {
|
|
116
|
+
const expectedReturn = `hello`
|
|
117
|
+
const onClose = jest.fn();
|
|
118
|
+
const mockedWriteText = jest.fn();
|
|
119
|
+
navigator.clipboard = {
|
|
120
|
+
writeText: mockedWriteText,
|
|
121
|
+
};
|
|
122
|
+
const { getByTestId } = render(
|
|
123
|
+
<MadieAlert
|
|
124
|
+
type="warning"
|
|
125
|
+
visible
|
|
126
|
+
canClose={false}
|
|
127
|
+
copyButton={true}
|
|
128
|
+
content="hello"
|
|
129
|
+
alertProps={{
|
|
130
|
+
"data-testid": "alert-dialog",
|
|
131
|
+
}}
|
|
132
|
+
closeButtonProps={{
|
|
133
|
+
onClick: onClose,
|
|
134
|
+
"data-testid": "close-button",
|
|
135
|
+
}}
|
|
136
|
+
/>
|
|
137
|
+
);
|
|
138
|
+
expect(getByTestId("alert-dialog")).toBeInTheDocument();
|
|
139
|
+
expect(getByTestId("ContentCopyIcon")).toBeInTheDocument();
|
|
140
|
+
const copyButton = getByTestId("ContentCopyIcon");
|
|
141
|
+
fireEvent.click(copyButton);
|
|
142
|
+
|
|
143
|
+
await waitFor(() => {
|
|
144
|
+
expect(mockedWriteText).toHaveBeenCalledTimes(1);
|
|
145
|
+
expect(mockedWriteText).toHaveBeenCalledWith(expectedReturn);
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
|
|
34
150
|
it("It does not render when inivislbe", async () => {
|
|
35
151
|
render(
|
|
36
152
|
<MadieAlert
|