@madie/madie-design-system 1.2.62 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +1 -1
- package/.storybook/.babelrc +2 -1
- package/.storybook/main.js +3 -11
- package/components/AutoComplete/AutoComplete.jsx +1 -1
- package/components/Button/Button.stories.js +0 -2
- package/components/DateField/DateField.jsx +1 -1
- package/components/DateField/DateField.stories.jsx +23 -10
- package/components/DateTimeField/DateTimeField.jsx +6 -2
- package/components/DateTimeField/DateTimeField.stories.jsx +29 -19
- package/components/Instant/Instant.stories.js +14 -6
- package/components/MadieAlert/MadieAlert.stories.js +35 -29
- package/components/MadieAlert/index.jsx +5 -5
- package/components/MadieConfirmDialog/MadieConfirmDialog.stories.js +17 -27
- package/components/MadieDeleteDialog/MadieDeleteDialog.stories.js +9 -18
- package/components/MadieDialog/MadieDialog.stories.js +45 -116
- package/components/MadieDialog/index.jsx +4 -2
- package/components/MadieDiscardDialog/MadieDiscardDialog.stories.js +5 -7
- package/components/MadieSpinner/MadieSpinner.stories.js +1 -3
- package/components/MadieTooltip/MadieTooltip.stories.js +7 -2
- package/components/Modal/Modal.stories.js +18 -89
- package/components/NotificationBanner/NotificationBanner.stories.js +17 -11
- package/components/NotificationBanner/index.js +3 -3
- package/components/NumberInput/NumberInput.stories.js +51 -63
- package/components/Popover/Popover.stories.js +6 -14
- package/components/Popover/index.js +2 -2
- package/components/RadioButton/RadioButton.jsx +4 -2
- package/components/RadioButton/RadioButton.stories.jsx +6 -2
- package/components/ReadOnlyTextField/ReadOnlyTextField.stories.js +4 -3
- package/components/ReadOnlyTextField/index.jsx +1 -1
- package/components/RichTextEditor/RichTextEditor.stories.js +10 -8
- package/components/RichTextEditor/index.jsx +14 -15
- package/components/Search/Search.stories.js +2 -4
- package/components/Select/Select.stories.js +59 -160
- package/components/Select/index.jsx +1 -1
- package/components/Tabs/Tabs.stories.js +78 -210
- package/components/TextArea/TextArea.stories.js +88 -108
- package/components/TextArea/index.jsx +1 -1
- package/components/TextField/TextField.stories.js +101 -124
- package/components/TextField/index.jsx +1 -1
- package/components/TimeField/TimeField.stories.js +18 -8
- package/components/Toast/Toast.stories.js +42 -102
- package/components/TruncateText/TruncateText.stories.js +22 -17
- package/components/hooks/useGetConfig.js +2 -2
- package/components/index.js +0 -24
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +182 -51
- package/dist/react/index.js.LICENSE.txt +27 -24
- package/dist/react/index.js.map +1 -1
- package/eslint.config.js +56 -0
- package/index.js +7 -9
- package/package.json +43 -75
- package/test/components/Accordion.test.js +1 -1
- package/test/components/AutoComplete.test.js +11 -6
- package/test/components/Button.test.js +7 -3
- package/test/components/DateField.test.js +25 -29
- package/test/components/DateTimeField.test.js +21 -25
- package/test/components/Instant.test.js +1 -1
- package/test/components/MadieAlert.test.js +22 -22
- package/test/components/MadieConfirmDialog.test.js +42 -64
- package/test/components/MadieDeleteDialog.test.js +51 -69
- package/test/components/MadieDialog.test.js +13 -13
- package/test/components/MadieDiscardDialog.test.js +28 -45
- package/test/components/MadieSpinner.test.js +12 -17
- package/test/components/Modal.test.js +115 -0
- package/test/components/Pagination.test.js +2 -2
- package/test/components/RadioButton.test.js +7 -7
- package/test/components/ReadOnlyTextField.test.js +4 -2
- package/test/components/RichTextEditor.test.js +90 -6
- package/test/components/Search.test.js +75 -0
- package/test/components/Select.test.js +97 -107
- package/test/components/Tabs.test.js +22 -24
- package/test/components/TextArea.test.js +78 -92
- package/test/components/TextField.test.js +128 -147
- package/test/components/Toast.test.js +67 -78
- package/test/components/TruncateText.test.js +75 -0
- package/test/components/index.test.js +23 -0
- package/webpack.config.js +0 -1
- package/.eslintignore +0 -5
- package/components/Alert/Alert.stories.js +0 -70
- package/components/Alert/index.js +0 -55
- package/components/Breadcrumb/Breadcrumb.md +0 -28
- package/components/Breadcrumb/Breadcrumb.stories.js +0 -76
- package/components/Breadcrumb/index.js +0 -92
- package/components/CalloutBox/CalloutBox.stories.js +0 -94
- package/components/CalloutBox/index.js +0 -109
- package/components/Card/Card.stories.js +0 -163
- package/components/Card/index.js +0 -144
- package/components/Dropdown/Dropdown.stories.js +0 -94
- package/components/Dropdown/index.js +0 -85
- package/components/Error/Collapsible.jsx +0 -93
- package/components/Error/ErrorUI.jsx +0 -31
- package/components/Error/error.js +0 -26
- package/components/FlashNotification/FlashNotificationUI.jsx +0 -91
- package/components/FlashNotification/index.js +0 -30
- package/components/Footer/Footer.stories.js +0 -20
- package/components/Footer/FooterUI.jsx +0 -137
- package/components/Footer/LegacyFooterUI.jsx +0 -204
- package/components/Footer/SocialLinks.jsx +0 -63
- package/components/Footer/Subscribe.jsx +0 -34
- package/components/Footer/footer.js +0 -30
- package/components/Infotip/Infotip.jsx +0 -75
- package/components/Infotip/Infotip.stories.js +0 -52
- package/components/Infotip/InfotipIcon.jsx +0 -41
- package/components/Infotip/index.js +0 -3
- package/components/Link/Link.stories.js +0 -82
- package/components/Link/index.js +0 -61
- package/components/Spinner/index.js +0 -9
- package/components/TextInput/TextInput.stories.js +0 -118
- package/components/TextInput/index.js +0 -137
- package/components/Tooltip/Tooltip.jsx +0 -88
- package/components/Tooltip/Tooltip.stories.js +0 -80
- package/components/Tooltip/index.js +0 -3
- package/components/Tooltip/position.js +0 -76
- package/test/components/ErrorUI.test.js +0 -32
- package/test/components/FooterUI.test.js +0 -122
- package/test/components/Infotip.test.js +0 -76
- package/test/components/Tooltip.test.js +0 -147
package/eslint.config.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const {
|
|
2
|
+
defineConfig,
|
|
3
|
+
globalIgnores,
|
|
4
|
+
} = require("eslint/config");
|
|
5
|
+
|
|
6
|
+
const babelParser = require("@babel/eslint-parser");
|
|
7
|
+
const globals = require("globals");
|
|
8
|
+
const js = require("@eslint/js");
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
FlatCompat,
|
|
12
|
+
} = require("@eslint/eslintrc");
|
|
13
|
+
|
|
14
|
+
const compat = new FlatCompat({
|
|
15
|
+
baseDirectory: __dirname,
|
|
16
|
+
recommendedConfig: js.configs.recommended,
|
|
17
|
+
allConfig: js.configs.all
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
module.exports = defineConfig([{
|
|
21
|
+
extends: compat.extends("eslint:recommended", "plugin:react/recommended"),
|
|
22
|
+
|
|
23
|
+
languageOptions: {
|
|
24
|
+
parser: babelParser,
|
|
25
|
+
sourceType: "module",
|
|
26
|
+
|
|
27
|
+
parserOptions: {
|
|
28
|
+
ecmaFeatures: {
|
|
29
|
+
jsx: true,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
globals: {
|
|
34
|
+
...globals.node,
|
|
35
|
+
...globals.browser,
|
|
36
|
+
...globals.jquery,
|
|
37
|
+
...globals.mocha,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
rules: {
|
|
42
|
+
"no-unused-vars": ["error", {
|
|
43
|
+
args: "none",
|
|
44
|
+
}],
|
|
45
|
+
|
|
46
|
+
"linebreak-style": ["error", "unix"],
|
|
47
|
+
"no-console": 0,
|
|
48
|
+
"no-prototype-builtins": [0],
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
settings: {
|
|
52
|
+
react: {
|
|
53
|
+
version: "detect",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
}, globalIgnores(["**/_*", "**/css", "**/dist", "**/node_modules", "**/test"])]);
|
package/index.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import ErrorPage from "./components/Error/error";
|
|
2
|
-
import Footer from "./components/Footer/footer";
|
|
3
|
-
|
|
4
1
|
import "what-input";
|
|
5
|
-
|
|
2
|
+
import React from 'react'
|
|
6
3
|
const QppStyleComponents = {
|
|
7
|
-
errorPage(
|
|
8
|
-
return
|
|
4
|
+
errorPage() {
|
|
5
|
+
return <div data-testId="error-page">
|
|
6
|
+
Something has gone terribly wrong.
|
|
7
|
+
</div>;
|
|
9
8
|
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return new Footer(options);
|
|
9
|
+
footer() {
|
|
10
|
+
return <div data-testId="unused"></div>;
|
|
13
11
|
},
|
|
14
12
|
};
|
|
15
13
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@madie/madie-design-system",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.00",
|
|
4
4
|
"description": "Shared style guide across the Madie program.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"homepage": "https://github.com/MeasureAuthoringTool/madie-design-system",
|
|
@@ -28,65 +28,36 @@
|
|
|
28
28
|
"deploy": "gh-pages -d storybook-static"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@babel/
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"@storybook/addon-
|
|
37
|
-
"@storybook/addon-
|
|
38
|
-
"@storybook/addon-
|
|
39
|
-
"@storybook/
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"@storybook/react": "^8.3.0",
|
|
48
|
-
"@storybook/react-webpack5": "^8.3.0",
|
|
49
|
-
"@testing-library/jest-dom": "^6.1.4",
|
|
50
|
-
"@testing-library/react": "^12.1.2",
|
|
51
|
-
"@testing-library/user-event": "^13.5.0",
|
|
52
|
-
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.6",
|
|
53
|
-
"autoprefixer": "^10.4.2",
|
|
54
|
-
"babel-eslint": "^10.1.0",
|
|
55
|
-
"babel-jest": "^27.4.6",
|
|
56
|
-
"babel-loader": "^8.2.3",
|
|
57
|
-
"chai": "^4.3.4",
|
|
58
|
-
"copy-webpack-plugin": "^5.1.2",
|
|
59
|
-
"css-loader": "^7.1.2",
|
|
31
|
+
"@babel/eslint-parser": "^7.27.5",
|
|
32
|
+
"@storybook/addon-a11y": "^9.0.9",
|
|
33
|
+
"@storybook/addon-backgrounds": "^9.0.8",
|
|
34
|
+
"@storybook/addon-controls": "^9.0.8",
|
|
35
|
+
"@storybook/addon-docs": "^9.0.10",
|
|
36
|
+
"@storybook/addon-links": "^9.0.9",
|
|
37
|
+
"@storybook/addon-viewport": "^9.0.8",
|
|
38
|
+
"@storybook/addon-webpack5-compiler-babel": "^3.0.6",
|
|
39
|
+
"@storybook/react-webpack5": "^9.0.10",
|
|
40
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
41
|
+
"@testing-library/react": "^16.3.0",
|
|
42
|
+
"@testing-library/user-event": "^14.6.1",
|
|
43
|
+
"babel-loader": "^10.0.0",
|
|
44
|
+
"cross-env": "^7.0.3",
|
|
45
|
+
"d3-selection": "^1.4.2",
|
|
46
|
+
"d3-shape": "^1.3.7",
|
|
60
47
|
"enzyme": "^3.11.0",
|
|
61
|
-
"
|
|
62
|
-
"eslint": "^7.
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"moxios": "^0.4.0",
|
|
75
|
-
"node-fetch": "^2.6.7",
|
|
76
|
-
"prettier": "^2.5.1",
|
|
77
|
-
"raw-loader": "^4.0.2",
|
|
78
|
-
"react": "^17.0.2",
|
|
79
|
-
"react-dom": "^17.0.2",
|
|
80
|
-
"react-test-renderer": "^17.0.2",
|
|
81
|
-
"regenerator-runtime": "^0.13.9",
|
|
82
|
-
"rimraf": "^3.0.2",
|
|
83
|
-
"sass": "^1.48.0",
|
|
84
|
-
"sass-loader": "^10.2.1",
|
|
85
|
-
"sinon": "^12.0.1",
|
|
86
|
-
"style-loader": "^1.3.0",
|
|
87
|
-
"svgo-loader": "^4.0.0",
|
|
88
|
-
"webpack": "^5.70.0",
|
|
89
|
-
"webpack-cli": "^4.9.2"
|
|
48
|
+
"eslint": "^9.29.0",
|
|
49
|
+
"eslint-plugin-react": "^7.33.2",
|
|
50
|
+
"globals": "^16.2.0",
|
|
51
|
+
"jest": "^30.0.0",
|
|
52
|
+
"jest-environment-jsdom": "^30.0.0",
|
|
53
|
+
"mini-css-extract-plugin": "^2.9.2",
|
|
54
|
+
"prettier": "^3.5.3",
|
|
55
|
+
"rimraf": "^5.0.5",
|
|
56
|
+
"sass": "^1.89.2",
|
|
57
|
+
"sass-loader": "^16.0.5",
|
|
58
|
+
"stylelint": "^15.10.3",
|
|
59
|
+
"webpack": "^5.99.9",
|
|
60
|
+
"webpack-cli": "^6.0.1"
|
|
90
61
|
},
|
|
91
62
|
"repository": {
|
|
92
63
|
"type": "git",
|
|
@@ -106,16 +77,17 @@
|
|
|
106
77
|
"url": "https://github.com/MeasureAuthoringTool/madie-design-system/issues"
|
|
107
78
|
},
|
|
108
79
|
"dependencies": {
|
|
80
|
+
"@babel/plugin-transform-class-properties": "^7.27.1",
|
|
81
|
+
"@babel/plugin-transform-modules-umd": "^7.27.1",
|
|
82
|
+
"@babel/preset-env": "^7.27.2",
|
|
83
|
+
"@babel/preset-react": "^7.27.1",
|
|
109
84
|
"@cmsgov/design-system": "^5.0.2",
|
|
110
|
-
"@emotion/react": "^11.
|
|
111
|
-
"@emotion/styled": "^11.
|
|
112
|
-
"@mui/icons-material": "^
|
|
113
|
-
"@mui/material": "
|
|
114
|
-
"@mui/
|
|
115
|
-
"@mui/
|
|
116
|
-
"@mui/x-date-pickers": "^7.17.0",
|
|
117
|
-
"@reach/portal": "^0.16.2",
|
|
118
|
-
"@reach/tooltip": "^0.16.2",
|
|
85
|
+
"@emotion/react": "^11.11.1",
|
|
86
|
+
"@emotion/styled": "^11.11.0",
|
|
87
|
+
"@mui/icons-material": "^7.1.1",
|
|
88
|
+
"@mui/material": "7.1.1",
|
|
89
|
+
"@mui/system": "^7.1.1",
|
|
90
|
+
"@mui/x-date-pickers": "7.29.4",
|
|
119
91
|
"@tiptap/extension-color": "^2.11.7",
|
|
120
92
|
"@tiptap/extension-highlight": "^2.11.7",
|
|
121
93
|
"@tiptap/extension-table": "^2.11.7",
|
|
@@ -128,15 +100,15 @@
|
|
|
128
100
|
"@tiptap/starter-kit": "^2.11.7",
|
|
129
101
|
"axios": "^1.7.4",
|
|
130
102
|
"cookie": "^0.7.2",
|
|
131
|
-
"cross-env": "^7.0.3",
|
|
132
|
-
"d3-selection": "^1.4.2",
|
|
133
|
-
"d3-shape": "^1.3.7",
|
|
134
103
|
"dayjs": "^1.11.7",
|
|
135
104
|
"dompurify": "^3.2.6",
|
|
105
|
+
"feather-icons-react": "^0.9.0",
|
|
136
106
|
"jwt-decode": "^3.1.2",
|
|
137
107
|
"lodash": "^4.17.21",
|
|
138
108
|
"preact": "^10.6.4",
|
|
139
109
|
"prop-types": "^15.8.1",
|
|
110
|
+
"react": "19.1.0",
|
|
111
|
+
"react-dom": "19.1.0",
|
|
140
112
|
"react-draggable": "^4.4.6",
|
|
141
113
|
"react-modal": "^3.14.4",
|
|
142
114
|
"retry": "^0.13.1",
|
|
@@ -144,12 +116,8 @@
|
|
|
144
116
|
"what-input": "^5.2.10",
|
|
145
117
|
"xss": "^1.0.10"
|
|
146
118
|
},
|
|
147
|
-
"peerDependencies": {
|
|
148
|
-
"classnames": "^2.3.1"
|
|
149
|
-
},
|
|
150
119
|
"overrides": {
|
|
151
120
|
"trim": ">=0.0.3",
|
|
152
|
-
"webpack": "^5.70.0",
|
|
153
121
|
"trim-newlines": "^3.0.1",
|
|
154
122
|
"glob-parent": "^6.0.1",
|
|
155
123
|
"semver": "^7.5.3",
|
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import "@testing-library/jest-dom";
|
|
3
3
|
import { describe, expect } from "@jest/globals";
|
|
4
4
|
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
|
5
|
-
import {render, screen } from "@testing-library/react";
|
|
5
|
+
import { render, screen } from "@testing-library/react";
|
|
6
6
|
import userEvent from "@testing-library/user-event";
|
|
7
7
|
|
|
8
8
|
describe("AutoComplete Component", () => {
|
|
@@ -18,7 +18,7 @@ describe("AutoComplete Component", () => {
|
|
|
18
18
|
options={options}
|
|
19
19
|
onChange={mockOnChange}
|
|
20
20
|
placeholder="Search for a value"
|
|
21
|
-
|
|
21
|
+
/>,
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
const input = screen.getByRole("combobox");
|
|
@@ -29,7 +29,12 @@ describe("AutoComplete Component", () => {
|
|
|
29
29
|
expect(option).toBeInTheDocument();
|
|
30
30
|
|
|
31
31
|
await userEvent.click(option);
|
|
32
|
-
expect(mockOnChange).toHaveBeenCalledWith(
|
|
32
|
+
expect(mockOnChange).toHaveBeenCalledWith(
|
|
33
|
+
"autocomplete",
|
|
34
|
+
"Option1",
|
|
35
|
+
expect.any(String),
|
|
36
|
+
expect.any(Object),
|
|
37
|
+
);
|
|
33
38
|
});
|
|
34
39
|
|
|
35
40
|
it("renders AutoComplete in disabled mode", async () => {
|
|
@@ -40,7 +45,7 @@ describe("AutoComplete Component", () => {
|
|
|
40
45
|
label="Auto Complete"
|
|
41
46
|
disabled
|
|
42
47
|
value="Option1"
|
|
43
|
-
|
|
48
|
+
/>,
|
|
44
49
|
);
|
|
45
50
|
|
|
46
51
|
const readOnlyField = screen.getByRole("textbox");
|
|
@@ -55,7 +60,7 @@ describe("AutoComplete Component", () => {
|
|
|
55
60
|
dataTestId="autocomplete-helper"
|
|
56
61
|
label="Auto Complete"
|
|
57
62
|
helperText="Helper text goes here"
|
|
58
|
-
|
|
63
|
+
/>,
|
|
59
64
|
);
|
|
60
65
|
|
|
61
66
|
const helperText = screen.getByText("Helper text goes here");
|
|
@@ -70,7 +75,7 @@ describe("AutoComplete Component", () => {
|
|
|
70
75
|
label="Auto Complete"
|
|
71
76
|
error
|
|
72
77
|
helperText="This field is required"
|
|
73
|
-
|
|
78
|
+
/>,
|
|
74
79
|
);
|
|
75
80
|
|
|
76
81
|
const errorText = screen.getByText("This field is required");
|
|
@@ -10,7 +10,11 @@ describe("Button", () => {
|
|
|
10
10
|
it("Button renders with provided size, onClick triggers", async () => {
|
|
11
11
|
const onClick = jest.fn();
|
|
12
12
|
render(
|
|
13
|
-
<Button
|
|
13
|
+
<Button
|
|
14
|
+
size="big"
|
|
15
|
+
onClick={onClick}
|
|
16
|
+
data-testId="button-test-id"
|
|
17
|
+
/>,
|
|
14
18
|
);
|
|
15
19
|
const button = getByTestId("button-test-id");
|
|
16
20
|
expect(button).toHaveClass("qpp-c-button--big");
|
|
@@ -33,7 +37,7 @@ describe("Button", () => {
|
|
|
33
37
|
onClick={onClick}
|
|
34
38
|
href="https://whatwouldkevindo.com/"
|
|
35
39
|
children="test"
|
|
36
|
-
|
|
40
|
+
/>,
|
|
37
41
|
);
|
|
38
42
|
expect(getByText("test").href).toBe("https://whatwouldkevindo.com/");
|
|
39
43
|
});
|
|
@@ -46,7 +50,7 @@ describe("Button", () => {
|
|
|
46
50
|
className="test"
|
|
47
51
|
data-testId="text-test-id"
|
|
48
52
|
children="test"
|
|
49
|
-
|
|
53
|
+
/>,
|
|
50
54
|
);
|
|
51
55
|
expect(getByText("test")).toBeTruthy();
|
|
52
56
|
});
|
|
@@ -2,46 +2,42 @@ import * as React from "react";
|
|
|
2
2
|
import "@testing-library/jest-dom";
|
|
3
3
|
import { describe, expect } from "@jest/globals";
|
|
4
4
|
import DateField from "../../components/DateField/DateField";
|
|
5
|
-
import { act } from "react-dom/test-utils";
|
|
6
5
|
import { render, screen } from "@testing-library/react";
|
|
7
6
|
import dayjs from "dayjs";
|
|
8
7
|
|
|
9
8
|
describe("DateField", () => {
|
|
9
|
+
const { findByText, getByDisplayValue } = screen;
|
|
10
10
|
it("DateField Exists", async () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
);
|
|
11
|
+
render(
|
|
12
|
+
<DateField
|
|
13
|
+
label="Status Date"
|
|
14
|
+
value={dayjs("2022-04-17")}
|
|
15
|
+
handleDateChange={() => console.log("Status Date")}
|
|
16
|
+
disabled={false}
|
|
17
|
+
/>,
|
|
18
|
+
);
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
20
|
+
const labelText = await findByText("Status Date");
|
|
21
|
+
expect(labelText).toBeInTheDocument();
|
|
22
|
+
expect(await findByText("Status Date")).toBeInTheDocument();
|
|
23
|
+
expect(getByDisplayValue("04/17/2022")).toBeInTheDocument();
|
|
26
24
|
});
|
|
27
25
|
|
|
28
26
|
it("DateField Exists, with empty value", async () => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
);
|
|
27
|
+
const { findByText, container } = render(
|
|
28
|
+
<DateField
|
|
29
|
+
label="Status Date"
|
|
30
|
+
handleDateChange={() => console.log("Status Date")}
|
|
31
|
+
disabled={false}
|
|
32
|
+
/>,
|
|
33
|
+
);
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
const labelText = await findByText("Status Date");
|
|
36
|
+
expect(labelText).toBeInTheDocument();
|
|
37
|
+
expect(await findByText("Status Date")).toBeInTheDocument();
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
39
|
+
const dateDisplay = container.querySelector('[value="04/17/2022"]');
|
|
40
|
+
expect(dateDisplay).toBeNull();
|
|
45
41
|
});
|
|
46
42
|
|
|
47
43
|
it("renders ReadOnlyTextField when disabled is true", () => {
|
|
@@ -2,34 +2,30 @@ import * as React from "react";
|
|
|
2
2
|
import "@testing-library/jest-dom";
|
|
3
3
|
import { describe, expect } from "@jest/globals";
|
|
4
4
|
import DateTimeField from "../../components/DateTimeField/DateTimeField";
|
|
5
|
-
import {
|
|
6
|
-
import { render } from "@testing-library/react";
|
|
5
|
+
import { render, screen } from "@testing-library/react";
|
|
7
6
|
import dayjs from "dayjs";
|
|
8
7
|
|
|
9
8
|
describe("DateTimeField", () => {
|
|
9
|
+
const { findByText, findByTestId, getByDisplayValue } = screen;
|
|
10
10
|
it("DateTimeField Exists", async () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
);
|
|
11
|
+
render(
|
|
12
|
+
<DateTimeField
|
|
13
|
+
label="Active Date/Time"
|
|
14
|
+
id="active-date-time"
|
|
15
|
+
dateTimeValue={dayjs("2022-04-17T15:30Z")}
|
|
16
|
+
handleDateTimeChange={() => {
|
|
17
|
+
return;
|
|
18
|
+
}}
|
|
19
|
+
disabled={false}
|
|
20
|
+
/>,
|
|
21
|
+
);
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
getByDisplayValue("04/17/2022 03:30 PM")
|
|
31
|
-
).toBeInTheDocument();
|
|
32
|
-
});
|
|
23
|
+
const labelText = await findByText("Active Date/Time");
|
|
24
|
+
expect(labelText).toBeInTheDocument();
|
|
25
|
+
expect(
|
|
26
|
+
await findByTestId("active-date-time-input"),
|
|
27
|
+
).toBeInTheDocument();
|
|
28
|
+
expect(getByDisplayValue("04/17/2022 03:30 PM")).toBeInTheDocument();
|
|
33
29
|
});
|
|
34
30
|
|
|
35
31
|
it("renders ReadOnlyTextField when disabled is true", () => {
|
|
@@ -44,7 +40,7 @@ describe("DateTimeField", () => {
|
|
|
44
40
|
handleDateTimeChange={() => {}}
|
|
45
41
|
disabled={true}
|
|
46
42
|
id={id}
|
|
47
|
-
|
|
43
|
+
/>,
|
|
48
44
|
);
|
|
49
45
|
|
|
50
46
|
const readOnlyField = getByLabelText(label);
|
|
@@ -64,7 +60,7 @@ describe("DateTimeField", () => {
|
|
|
64
60
|
handleDateTimeChange={() => {}}
|
|
65
61
|
disabled={true}
|
|
66
62
|
id={id}
|
|
67
|
-
|
|
63
|
+
/>,
|
|
68
64
|
);
|
|
69
65
|
|
|
70
66
|
const readOnlyField = getByLabelText(label);
|