@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
@@ -0,0 +1 @@
1
+ { "type": "module" }
@@ -0,0 +1,59 @@
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
+ ecmaVersion: "latest",
32
+ },
33
+
34
+ globals: {
35
+ ...globals.node,
36
+ ...globals.browser,
37
+ ...globals.jquery,
38
+ ...globals.mocha,
39
+ },
40
+ },
41
+
42
+ rules: {
43
+ "no-unused-vars": ["error", {
44
+ args: "none",
45
+ }],
46
+
47
+ "linebreak-style": ["error", "unix"],
48
+ "no-console": 0,
49
+ "no-prototype-builtins": [0],
50
+ "react/prop-types": "off"
51
+
52
+ },
53
+
54
+ settings: {
55
+ react: {
56
+ version: "detect",
57
+ },
58
+ },
59
+ }, 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(options) {
8
- return new ErrorPage(options);
4
+ errorPage() {
5
+ return <div data-testId="error-page">
6
+ Something has gone terribly wrong.
7
+ </div>;
9
8
  },
10
-
11
- footer(options) {
12
- return new Footer(options);
9
+ footer() {
10
+ return <div data-testId="unused"></div>;
13
11
  },
14
12
  };
15
13
 
@@ -0,0 +1,10 @@
1
+ export default {
2
+ testEnvironment: "jsdom",
3
+ transform: {
4
+ "^.+\\.jsx?$": "babel-jest",
5
+ },
6
+ moduleNameMapper: {
7
+ "\\.(css|scss)$": "identity-obj-proxy",
8
+ },
9
+ setupFilesAfterEnv: ["@testing-library/jest-dom"],
10
+ };
package/lib/Chevron.jsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
- import PropTypes from "prop-types";
3
2
 
4
- export const Chevron = (props) => {
3
+ export const Chevron = ({ className = "accordion-icon", ...props }) => {
4
+
5
5
  return (
6
6
  <svg
7
7
  width="10px"
@@ -22,11 +22,3 @@ export const Chevron = (props) => {
22
22
  </svg>
23
23
  );
24
24
  };
25
-
26
- Chevron.propTypes = {
27
- className: PropTypes.string,
28
- };
29
-
30
- Chevron.defaultProps = {
31
- className: "accordion-icon",
32
- };
package/package.json CHANGED
@@ -1,18 +1,23 @@
1
1
  {
2
2
  "name": "@madie/madie-design-system",
3
- "version": "1.2.62",
3
+ "version": "2.0.1",
4
4
  "description": "Shared style guide across the Madie program.",
5
- "main": "dist/index.js",
6
5
  "homepage": "https://github.com/MeasureAuthoringTool/madie-design-system",
6
+ "main": "./components/index.js",
7
+ "exports": {
8
+ "import": "./dist/react/index.mjs",
9
+ "require": "./components/index.js",
10
+ "default": "./components/index.js"
11
+ },
7
12
  "scripts": {
8
13
  "prepublishOnly": "npm run build",
9
14
  "build": "npm run clean && webpack-cli --progress --color --env production && npm run build-react",
10
15
  "dev": "npm run clean && webpack-cli --progress --color --watch --env production=false",
11
16
  "clean": "rimraf build && rimraf dist",
12
- "build-react": "webpack --progress --config webpack.config.react.js",
13
- "build-react-watch": "webpack --progress --watch --config webpack.config.react.js",
17
+ "build-react": "webpack --progress --config webpack.config.react.mjs && echo '{ \"type\": \"module\" }' > dist/react/package.json",
18
+ "build-react-watch": "webpack --progress --watch --config webpack.config.react.mjs",
14
19
  "start": "npm run build",
15
- "test": "jest",
20
+ "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
16
21
  "watch-tests": "cross-env BABEL_ENV=test jest --watch",
17
22
  "coverage": "cross-env BABEL_ENV=test jest --coverage",
18
23
  "precommit": "npm run format && npm run lint && npm run format-styles",
@@ -25,68 +30,41 @@
25
30
  "storybook": "storybook dev -p 6007",
26
31
  "build-storybook": "storybook build",
27
32
  "predeploy": "npm run build-storybook",
28
- "deploy": "gh-pages -d storybook-static"
33
+ "deploy": "gh-pages -d storybook-static",
34
+ "check-es": "es-check es2020 './dist/react/index.mjs' --module"
29
35
  },
30
36
  "devDependencies": {
31
- "@babel/cli": "^7.25.6",
32
- "@babel/core": "^7.25.2",
33
- "@babel/preset-env": "^7.25.4",
34
- "@babel/preset-react": "^7.24.7",
35
- "@babel/register": "^7.24.6",
36
- "@storybook/addon-a11y": "^8.3.0",
37
- "@storybook/addon-actions": "^8.3.0",
38
- "@storybook/addon-backgrounds": "^8.3.0",
39
- "@storybook/addon-docs": "^8.3.0",
40
- "@storybook/addon-knobs": "^8.0.1",
41
- "@storybook/addon-links": "^8.3.0",
42
- "@storybook/addon-postcss": "^2.0.0",
43
- "@storybook/addon-storysource": "^8.3.0",
44
- "@storybook/addon-viewport": "^8.3.0",
45
- "@storybook/addon-webpack5-compiler-babel": "^3.0.3",
46
- "@storybook/addons": "^7.6.17",
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",
37
+ "@babel/eslint-parser": "^7.27.5",
38
+ "@storybook/addon-a11y": "^9.0.9",
39
+ "@storybook/addon-backgrounds": "^9.0.8",
40
+ "@storybook/addon-controls": "^9.0.8",
41
+ "@storybook/addon-docs": "^9.0.10",
42
+ "@storybook/addon-links": "^9.0.9",
43
+ "@storybook/addon-viewport": "^9.0.8",
44
+ "@storybook/addon-webpack5-compiler-babel": "^3.0.6",
45
+ "@storybook/react-webpack5": "^9.0.10",
46
+ "@testing-library/jest-dom": "^6.6.3",
47
+ "@testing-library/react": "^16.3.0",
48
+ "@testing-library/user-event": "^14.6.1",
49
+ "babel-loader": "^10.0.0",
50
+ "cross-env": "^7.0.3",
51
+ "d3-selection": "^1.4.2",
52
+ "d3-shape": "^1.3.7",
60
53
  "enzyme": "^3.11.0",
61
- "enzyme-to-json": "^3.6.2",
62
- "eslint": "^7.32.0",
63
- "eslint-config-prettier": "^6.15.0",
64
- "eslint-plugin-babel": "^5.3.1",
65
- "eslint-plugin-prettier": "^3.4.1",
66
- "eslint-plugin-react": "^7.28.0",
67
- "feather-icons-react": "^0.4.3",
68
- "file-loader": "^6.2.0",
69
- "gh-pages": "^6.0.0",
70
- "html-webpack-plugin": "^5.5.0",
71
- "jest": "^29.7.0",
72
- "jest-environment-jsdom": "^29.7.0",
73
- "mini-css-extract-plugin": "^0.11.3",
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"
54
+ "es-check": "^9.1.4",
55
+ "eslint": "^9.30.1",
56
+ "eslint-plugin-react": "^7.33.2",
57
+ "globals": "^16.2.0",
58
+ "jest": "^30.0.0",
59
+ "jest-environment-jsdom": "^30.0.0",
60
+ "mini-css-extract-plugin": "^2.9.2",
61
+ "prettier": "^3.5.3",
62
+ "rimraf": "^5.0.5",
63
+ "sass": "^1.89.2",
64
+ "sass-loader": "^16.0.5",
65
+ "stylelint": "^15.10.3",
66
+ "webpack": "^5.99.9",
67
+ "webpack-cli": "^6.0.1"
90
68
  },
91
69
  "repository": {
92
70
  "type": "git",
@@ -106,16 +84,18 @@
106
84
  "url": "https://github.com/MeasureAuthoringTool/madie-design-system/issues"
107
85
  },
108
86
  "dependencies": {
109
- "@cmsgov/design-system": "^5.0.2",
110
- "@emotion/react": "^11.8.2",
111
- "@emotion/styled": "^11.8.1",
112
- "@mui/icons-material": "^6.1.0",
113
- "@mui/material": "^6.1.0",
114
- "@mui/styles": "^6.1.0",
115
- "@mui/system": "^6.1.0",
116
- "@mui/x-date-pickers": "^7.17.0",
117
- "@reach/portal": "^0.16.2",
118
- "@reach/tooltip": "^0.16.2",
87
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
88
+ "@babel/plugin-transform-class-properties": "^7.27.1",
89
+ "@babel/plugin-transform-modules-umd": "^7.27.1",
90
+ "@babel/preset-env": "^7.27.2",
91
+ "@babel/preset-react": "^7.27.1",
92
+ "@cmsgov/design-system": "^12.4.0",
93
+ "@emotion/react": "^11.11.1",
94
+ "@emotion/styled": "^11.11.0",
95
+ "@mui/icons-material": "^7.1.1",
96
+ "@mui/material": "^7.2.0",
97
+ "@mui/system": "^7.1.1",
98
+ "@mui/x-date-pickers": "7.29.4",
119
99
  "@tiptap/extension-color": "^2.11.7",
120
100
  "@tiptap/extension-highlight": "^2.11.7",
121
101
  "@tiptap/extension-table": "^2.11.7",
@@ -128,15 +108,14 @@
128
108
  "@tiptap/starter-kit": "^2.11.7",
129
109
  "axios": "^1.7.4",
130
110
  "cookie": "^0.7.2",
131
- "cross-env": "^7.0.3",
132
- "d3-selection": "^1.4.2",
133
- "d3-shape": "^1.3.7",
134
111
  "dayjs": "^1.11.7",
135
112
  "dompurify": "^3.2.6",
113
+ "feather-icons-react": "^0.9.0",
136
114
  "jwt-decode": "^3.1.2",
137
115
  "lodash": "^4.17.21",
138
116
  "preact": "^10.6.4",
139
- "prop-types": "^15.8.1",
117
+ "react": "19.1.0",
118
+ "react-dom": "19.1.0",
140
119
  "react-draggable": "^4.4.6",
141
120
  "react-modal": "^3.14.4",
142
121
  "retry": "^0.13.1",
@@ -144,12 +123,8 @@
144
123
  "what-input": "^5.2.10",
145
124
  "xss": "^1.0.10"
146
125
  },
147
- "peerDependencies": {
148
- "classnames": "^2.3.1"
149
- },
150
126
  "overrides": {
151
127
  "trim": ">=0.0.3",
152
- "webpack": "^5.70.0",
153
128
  "trim-newlines": "^3.0.1",
154
129
  "glob-parent": "^6.0.1",
155
130
  "semver": "^7.5.3",
package/styles/_main.scss CHANGED
@@ -1,11 +1,12 @@
1
1
  @charset "utf-8";
2
2
 
3
- // TODO: Remove @cmsgov/design-system dependancies from shared package
3
+ // CMS DS v12 uses `/src/styles/index` for SCSS sources not `dist/scss`
4
+ // @import "~@cmsgov/design-system/src/styles/index"; // way that npm module says to do it
5
+ @import '@cmsgov/design-system/dist/css/index.css'; // precompiled css instead to make it work since there's some extra webpack stuff going on.
6
+
4
7
  $font-path: "~@cmsgov/design-system/dist/fonts";
5
8
  $image-path: "~@cmsgov/design-system/dist/images";
6
9
 
7
- @import "@cmsgov/design-system/dist/scss/index";
8
-
9
10
  @import "paths";
10
11
 
11
12
  @import "third-party/legacy-bootstrap";
@@ -13,7 +13,7 @@ describe("Accordion", () => {
13
13
  leftItem="leftItem"
14
14
  >
15
15
  Content
16
- </Accordion>
16
+ </Accordion>,
17
17
  );
18
18
  expect(getByTestId("accordion")).toBeTruthy();
19
19
  const button = getByRole("button");
@@ -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("autocomplete", "Option1", expect.any(String), expect.any(Object));
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 size="big" onClick={onClick} data-testId="button-test-id" />
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,27 +50,17 @@ 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
  });
53
57
 
54
58
  it("Default props are as expected", async () => {
55
- const onClick = Button.defaultProps.onClick();
56
- expect(onClick).toBe(null);
57
- const children = Button.defaultProps.children;
58
- expect(children).toBe(false);
59
- const className = Button.defaultProps.className;
60
- expect(className).toBe("");
61
- const href = Button.defaultProps.href;
62
- expect(href).toBe("");
63
- const loading = Button.defaultProps.loading;
64
- expect(loading).toBe(false);
65
- const size = Button.defaultProps.size;
66
- expect(size).toBe(null);
67
- const type = Button.defaultProps.type;
68
- expect(type).toBe("button");
69
- const variant = Button.defaultProps.variant;
70
- expect(variant).toBe(null);
59
+ render(<Button>Click me</Button>);
60
+ const button = screen.getByRole("button", { name: /click me/i });
61
+ expect(button).toHaveAttribute("type", "button");
62
+ expect(button).not.toBeDisabled();
63
+ expect(button).toHaveTextContent("Click me");
64
+ expect(button.className).toContain("");
71
65
  });
72
66
  });
@@ -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
- await act(async () => {
12
- const { findByText, getByDisplayValue } = render(
13
- <DateField
14
- label="Status Date"
15
- value={dayjs("2022-04-17")}
16
- handleDateChange={() => console.log("Status Date")}
17
- disabled={false}
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
- const labelText = await findByText("Status Date");
22
- expect(labelText).toBeInTheDocument();
23
- expect(await findByText("Status Date")).toBeInTheDocument();
24
- expect(getByDisplayValue("04/17/2022")).toBeInTheDocument();
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
- await act(async () => {
30
- const { findByText, container } = render(
31
- <DateField
32
- label="Status Date"
33
- handleDateChange={() => console.log("Status Date")}
34
- disabled={false}
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
- const labelText = await findByText("Status Date");
39
- expect(labelText).toBeInTheDocument();
40
- expect(await findByText("Status Date")).toBeInTheDocument();
35
+ const labelText = await findByText("Status Date");
36
+ expect(labelText).toBeInTheDocument();
37
+ expect(await findByText("Status Date")).toBeInTheDocument();
41
38
 
42
- const dateDisplay = container.querySelector('[value="04/17/2022"]');
43
- expect(dateDisplay).toBeNull();
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 { act } from "react-dom/test-utils";
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
- await act(async () => {
12
- const { findByText, findByTestId, getByDisplayValue } = render(
13
- <DateTimeField
14
- label="Active Date/Time"
15
- id="active-date-time"
16
- dateTimeValue={dayjs("2022-04-17T15:30Z")}
17
- handleDateTimeChange={() => {
18
- return;
19
- }}
20
- disabled={false}
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
- const labelText = await findByText("Active Date/Time");
25
- expect(labelText).toBeInTheDocument();
26
- expect(
27
- await findByTestId("active-date-time-input")
28
- ).toBeInTheDocument();
29
- expect(
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);
@@ -44,7 +44,7 @@ describe("Instant", () => {
44
44
  dateTimeValue={dayjs("2022-04-17")}
45
45
  dateFieldSx={{}}
46
46
  />
47
- </div>
47
+ </div>,
48
48
  );
49
49
  const labelText = await findByText("Status Date");
50
50
  expect(labelText).toBeInTheDocument();