@mui/internal-test-utils 1.0.0-dev.20240529-082515-213b5e33ab

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 (148) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE +21 -0
  3. package/README.md +9 -0
  4. package/build/.tsbuildinfo +1 -0
  5. package/build/KarmaReporterReactProfiler.d.ts +51 -0
  6. package/build/KarmaReporterReactProfiler.d.ts.map +1 -0
  7. package/build/KarmaReporterReactProfiler.js +68 -0
  8. package/build/KarmaReporterReactProfiler.js.map +1 -0
  9. package/build/components.d.ts +36 -0
  10. package/build/components.d.ts.map +1 -0
  11. package/build/components.js +78 -0
  12. package/build/components.js.map +1 -0
  13. package/build/createDOM.d.ts +3 -0
  14. package/build/createDOM.d.ts.map +1 -0
  15. package/build/createDOM.js +60 -0
  16. package/build/createDOM.js.map +1 -0
  17. package/build/createDescribe.d.ts +8 -0
  18. package/build/createDescribe.d.ts.map +1 -0
  19. package/build/createDescribe.js +22 -0
  20. package/build/createDescribe.js.map +1 -0
  21. package/build/createMount.d.ts +9 -0
  22. package/build/createMount.d.ts.map +1 -0
  23. package/build/createMount.js +120 -0
  24. package/build/createMount.js.map +1 -0
  25. package/build/createRenderer.d.ts +231 -0
  26. package/build/createRenderer.d.ts.map +1 -0
  27. package/build/createRenderer.js +506 -0
  28. package/build/createRenderer.js.map +1 -0
  29. package/build/createRenderer.test.d.ts +2 -0
  30. package/build/createRenderer.test.d.ts.map +1 -0
  31. package/build/createRenderer.test.js +48 -0
  32. package/build/createRenderer.test.js.map +1 -0
  33. package/build/describeConformance.d.ts +152 -0
  34. package/build/describeConformance.d.ts.map +1 -0
  35. package/build/describeConformance.js +815 -0
  36. package/build/describeConformance.js.map +1 -0
  37. package/build/findOutermostIntrinsic.d.ts +14 -0
  38. package/build/findOutermostIntrinsic.d.ts.map +1 -0
  39. package/build/findOutermostIntrinsic.js +22 -0
  40. package/build/findOutermostIntrinsic.js.map +1 -0
  41. package/build/findOutermostIntrinsic.test.d.ts +2 -0
  42. package/build/findOutermostIntrinsic.test.d.ts.map +1 -0
  43. package/build/findOutermostIntrinsic.test.js +70 -0
  44. package/build/findOutermostIntrinsic.test.js.map +1 -0
  45. package/build/fireDiscreteEvent.d.ts +7 -0
  46. package/build/fireDiscreteEvent.d.ts.map +1 -0
  47. package/build/fireDiscreteEvent.js +98 -0
  48. package/build/fireDiscreteEvent.js.map +1 -0
  49. package/build/flushMicrotasks.d.ts +2 -0
  50. package/build/flushMicrotasks.d.ts.map +1 -0
  51. package/build/flushMicrotasks.js +11 -0
  52. package/build/flushMicrotasks.js.map +1 -0
  53. package/build/focusVisible.d.ts +7 -0
  54. package/build/focusVisible.d.ts.map +1 -0
  55. package/build/focusVisible.js +33 -0
  56. package/build/focusVisible.js.map +1 -0
  57. package/build/index.d.ts +18 -0
  58. package/build/index.d.ts.map +1 -0
  59. package/build/index.js +59 -0
  60. package/build/index.js.map +1 -0
  61. package/build/init.d.ts +2 -0
  62. package/build/init.d.ts.map +1 -0
  63. package/build/init.js +42 -0
  64. package/build/init.js.map +1 -0
  65. package/build/initMatchers.d.ts +81 -0
  66. package/build/initMatchers.d.ts.map +1 -0
  67. package/build/initMatchers.js +431 -0
  68. package/build/initMatchers.js.map +1 -0
  69. package/build/initMatchers.test.d.ts +2 -0
  70. package/build/initMatchers.test.d.ts.map +1 -0
  71. package/build/initMatchers.test.js +103 -0
  72. package/build/initMatchers.test.js.map +1 -0
  73. package/build/initPlaywrightMatchers.d.ts +25 -0
  74. package/build/initPlaywrightMatchers.d.ts.map +1 -0
  75. package/build/initPlaywrightMatchers.js +63 -0
  76. package/build/initPlaywrightMatchers.js.map +1 -0
  77. package/build/mochaHooks.d.ts +25 -0
  78. package/build/mochaHooks.d.ts.map +1 -0
  79. package/build/mochaHooks.js +171 -0
  80. package/build/mochaHooks.js.map +1 -0
  81. package/build/mochaHooks.test.d.ts +2 -0
  82. package/build/mochaHooks.test.d.ts.map +1 -0
  83. package/build/mochaHooks.test.js +112 -0
  84. package/build/mochaHooks.test.js.map +1 -0
  85. package/build/setup.d.ts +2 -0
  86. package/build/setup.d.ts.map +1 -0
  87. package/build/setup.js +10 -0
  88. package/build/setup.js.map +1 -0
  89. package/build/setupBabel.d.ts +2 -0
  90. package/build/setupBabel.d.ts.map +1 -0
  91. package/build/setupBabel.js +5 -0
  92. package/build/setupBabel.js.map +1 -0
  93. package/build/setupBabelPlaywright.d.ts +2 -0
  94. package/build/setupBabelPlaywright.d.ts.map +1 -0
  95. package/build/setupBabelPlaywright.js +11 -0
  96. package/build/setupBabelPlaywright.js.map +1 -0
  97. package/build/setupJSDOM.d.ts +7 -0
  98. package/build/setupJSDOM.d.ts.map +1 -0
  99. package/build/setupJSDOM.js +17 -0
  100. package/build/setupJSDOM.js.map +1 -0
  101. package/build/setupKarma.d.ts +2 -0
  102. package/build/setupKarma.d.ts.map +1 -0
  103. package/build/setupKarma.js +56 -0
  104. package/build/setupKarma.js.map +1 -0
  105. package/build/until.d.ts +2 -0
  106. package/build/until.d.ts.map +1 -0
  107. package/build/until.js +26 -0
  108. package/build/until.js.map +1 -0
  109. package/build/until.test.d.ts +2 -0
  110. package/build/until.test.d.ts.map +1 -0
  111. package/build/until.test.js +118 -0
  112. package/build/until.test.js.map +1 -0
  113. package/build/userEvent.d.ts +8 -0
  114. package/build/userEvent.d.ts.map +1 -0
  115. package/build/userEvent.js +61 -0
  116. package/build/userEvent.js.map +1 -0
  117. package/package.json +76 -0
  118. package/src/KarmaReporterReactProfiler.js +81 -0
  119. package/src/components.tsx +61 -0
  120. package/src/createDOM.d.ts +9 -0
  121. package/src/createDOM.js +67 -0
  122. package/src/createDescribe.ts +31 -0
  123. package/src/createMount.tsx +136 -0
  124. package/src/createRenderer.test.js +31 -0
  125. package/src/createRenderer.tsx +737 -0
  126. package/src/describeConformance.tsx +1117 -0
  127. package/src/findOutermostIntrinsic.test.js +68 -0
  128. package/src/findOutermostIntrinsic.ts +19 -0
  129. package/src/fireDiscreteEvent.ts +76 -0
  130. package/src/flushMicrotasks.ts +8 -0
  131. package/src/focusVisible.ts +28 -0
  132. package/src/index.ts +24 -0
  133. package/src/init.js +15 -0
  134. package/src/initMatchers.test.js +126 -0
  135. package/src/initMatchers.ts +658 -0
  136. package/src/initPlaywrightMatchers.ts +96 -0
  137. package/src/mochaHooks.js +209 -0
  138. package/src/mochaHooks.test.js +113 -0
  139. package/src/setup.js +10 -0
  140. package/src/setupBabel.js +3 -0
  141. package/src/setupBabelPlaywright.js +10 -0
  142. package/src/setupJSDOM.js +20 -0
  143. package/src/setupKarma.js +65 -0
  144. package/src/until.js +28 -0
  145. package/src/until.test.js +120 -0
  146. package/src/userEvent.ts +35 -0
  147. package/tsconfig.build.json +17 -0
  148. package/tsconfig.json +12 -0
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const React = __importStar(require("react"));
30
+ const chai_1 = require("chai");
31
+ const prop_types_1 = __importDefault(require("prop-types"));
32
+ const enzyme_1 = require("enzyme");
33
+ const until_1 = __importDefault(require("./until"));
34
+ function Div() {
35
+ return React.createElement("div", null);
36
+ }
37
+ const hoc = (Component) => function Wrapper() {
38
+ return React.createElement(Component, null);
39
+ };
40
+ describe('until', () => {
41
+ it('shallow renders the current wrapper one level deep', () => {
42
+ const EnhancedDiv = hoc(Div);
43
+ const wrapper = until_1.default.call((0, enzyme_1.shallow)(React.createElement(EnhancedDiv, null)), 'Div');
44
+ (0, chai_1.expect)(wrapper.contains(React.createElement("div", null))).to.equal(true);
45
+ });
46
+ it('shallow renders the current wrapper several levels deep', () => {
47
+ const EnhancedDiv = hoc(hoc(hoc(Div)));
48
+ const wrapper = until_1.default.call((0, enzyme_1.shallow)(React.createElement(EnhancedDiv, null)), 'Div');
49
+ (0, chai_1.expect)(wrapper.contains(React.createElement("div", null))).to.equal(true);
50
+ });
51
+ it('stops shallow rendering when the wrapper is empty', () => {
52
+ const nullHoc = () => () => null;
53
+ const EnhancedDiv = nullHoc();
54
+ const wrapper = until_1.default.call((0, enzyme_1.shallow)(React.createElement(EnhancedDiv, null)), 'Div');
55
+ (0, chai_1.expect)(wrapper.html()).to.equal(null);
56
+ });
57
+ it('shallow renders as much as possible when no selector is provided', () => {
58
+ const EnhancedDiv = hoc(hoc(Div));
59
+ const wrapper = until_1.default.call((0, enzyme_1.shallow)(React.createElement(EnhancedDiv, null)));
60
+ (0, chai_1.expect)(wrapper.contains(React.createElement("div", null))).to.equal(true);
61
+ });
62
+ it('shallow renders the current wrapper even if the selector never matches', () => {
63
+ const EnhancedDiv = hoc(Div);
64
+ const wrapper = until_1.default.call((0, enzyme_1.shallow)(React.createElement(EnhancedDiv, null)), 'NotDiv');
65
+ (0, chai_1.expect)(wrapper.contains(React.createElement("div", null))).to.equal(true);
66
+ });
67
+ it('stops shallow rendering when it encounters a HTML element', () => {
68
+ const wrapper = until_1.default.call((0, enzyme_1.shallow)(React.createElement("div", null,
69
+ React.createElement(Div, null))), 'Div');
70
+ (0, chai_1.expect)(wrapper.contains(React.createElement("div", null,
71
+ React.createElement(Div, null)))).to.equal(true);
72
+ });
73
+ it('throws when until called on an empty wrapper', () => {
74
+ (0, chai_1.expect)(() => {
75
+ until_1.default.call((0, enzyme_1.shallow)(React.createElement(Div, null)).find('Foo'), 'div');
76
+ }).to.throw(Error);
77
+ });
78
+ it('shallow renders non-root wrappers', () => {
79
+ function Container() {
80
+ return (React.createElement("div", null,
81
+ React.createElement(Div, null)));
82
+ }
83
+ const wrapper = until_1.default.call((0, enzyme_1.shallow)(React.createElement(Container, null)).find(Div));
84
+ (0, chai_1.expect)(wrapper.contains(React.createElement("div", null))).to.equal(true);
85
+ });
86
+ // eslint-disable-next-line react/prefer-stateless-function
87
+ class Foo extends React.Component {
88
+ render() {
89
+ return React.createElement(Div, null);
90
+ }
91
+ }
92
+ Foo.contextTypes = {
93
+ quux: prop_types_1.default.bool.isRequired,
94
+ };
95
+ it('context propagation passes down context from the root component', () => {
96
+ const EnhancedFoo = hoc(Foo);
97
+ const options = { context: { quux: true } };
98
+ const wrapper = until_1.default.call((0, enzyme_1.shallow)(React.createElement(EnhancedFoo, null), options), 'Foo', options);
99
+ (0, chai_1.expect)(wrapper.context('quux')).to.equal(true);
100
+ (0, chai_1.expect)(wrapper.contains(React.createElement(Div, null))).to.equal(true);
101
+ });
102
+ class Bar extends React.Component {
103
+ getChildContext() {
104
+ return { quux: true };
105
+ }
106
+ render() {
107
+ return React.createElement(Foo, null);
108
+ }
109
+ }
110
+ Bar.childContextTypes = { quux: prop_types_1.default.bool };
111
+ it('context propagation passes down context from an intermediary component', () => {
112
+ const EnhancedBar = hoc(Bar);
113
+ const wrapper = until_1.default.call((0, enzyme_1.shallow)(React.createElement(EnhancedBar, null)), 'Foo');
114
+ (0, chai_1.expect)(wrapper.context('quux')).to.equal(true);
115
+ (0, chai_1.expect)(wrapper.contains(React.createElement(Div, null))).to.equal(true);
116
+ });
117
+ });
118
+ //# sourceMappingURL=until.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"until.test.js","sourceRoot":"","sources":["../src/until.test.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,+BAA8B;AAC9B,4DAAmC;AACnC,mCAAiC;AACjC,oDAA4B;AAE5B,SAAS,GAAG;IACV,OAAO,gCAAO,CAAC;AACjB,CAAC;AACD,MAAM,GAAG,GAAG,CAAC,SAAS,EAAE,EAAE,CACxB,SAAS,OAAO;IACd,OAAO,oBAAC,SAAS,OAAG,CAAC;AACvB,CAAC,CAAC;AAEJ,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC5D,MAAM,WAAW,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7B,MAAM,OAAO,GAAG,eAAK,CAAC,IAAI,CAAC,IAAA,gBAAO,EAAC,oBAAC,WAAW,OAAG,CAAC,EAAE,KAAK,CAAC,CAAC;QAC5D,IAAA,aAAM,EAAC,OAAO,CAAC,QAAQ,CAAC,gCAAO,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACjE,MAAM,WAAW,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,eAAK,CAAC,IAAI,CAAC,IAAA,gBAAO,EAAC,oBAAC,WAAW,OAAG,CAAC,EAAE,KAAK,CAAC,CAAC;QAC5D,IAAA,aAAM,EAAC,OAAO,CAAC,QAAQ,CAAC,gCAAO,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK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AC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { fireEvent } from './createRenderer';
2
+ export declare function touch(target: Element): void;
3
+ export declare const mousePress: (...args: Parameters<(typeof fireEvent)['mouseUp']>) => void;
4
+ export declare function keyPress(target: Element, options: {
5
+ key: string;
6
+ [key: string]: any;
7
+ }): void;
8
+ //# sourceMappingURL=userEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userEvent.d.ts","sourceRoot":"","sources":["../src/userEvent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAO,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,wBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAG3C;AAED,eAAO,MAAM,UAAU,EAAE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,OAAO,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,IAchF,CAAC;AAEF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,IAAI,CAS5F"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.keyPress = exports.mousePress = exports.touch = void 0;
27
+ const React = __importStar(require("react"));
28
+ const fireDiscreteEvent_1 = require("./fireDiscreteEvent");
29
+ const createRenderer_1 = require("./createRenderer");
30
+ function touch(target) {
31
+ createRenderer_1.fireEvent.touchStart(target);
32
+ createRenderer_1.fireEvent.touchEnd(target);
33
+ }
34
+ exports.touch = touch;
35
+ const mousePress = (target, options) => {
36
+ if (React.version.startsWith('18')) {
37
+ createRenderer_1.fireEvent.mouseDown(target, options);
38
+ createRenderer_1.fireEvent.mouseUp(target, options);
39
+ createRenderer_1.fireEvent.click(target, options);
40
+ }
41
+ else {
42
+ (0, fireDiscreteEvent_1.mouseDown)(target, options);
43
+ (0, fireDiscreteEvent_1.mouseUp)(target, options);
44
+ (0, fireDiscreteEvent_1.click)(target, options);
45
+ (0, createRenderer_1.act)(() => { });
46
+ }
47
+ };
48
+ exports.mousePress = mousePress;
49
+ function keyPress(target, options) {
50
+ if (React.version.startsWith('18')) {
51
+ createRenderer_1.fireEvent.keyDown(target, options);
52
+ createRenderer_1.fireEvent.keyUp(target, options);
53
+ }
54
+ else {
55
+ (0, fireDiscreteEvent_1.keyDown)(target, options);
56
+ (0, fireDiscreteEvent_1.keyUp)(target, options);
57
+ (0, createRenderer_1.act)(() => { });
58
+ }
59
+ }
60
+ exports.keyPress = keyPress;
61
+ //# sourceMappingURL=userEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userEvent.js","sourceRoot":"","sources":["../src/userEvent.ts"],"names":[],"mappings":";;;;;;;;;;;;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,EAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAChB,CAAC;AACH,CAAC;AATD,4BASC"}
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@mui/internal-test-utils",
3
+ "version": "1.0.0-dev.20240529-082515-213b5e33ab",
4
+ "author": "MUI Team",
5
+ "description": "Utilities for MUI tests. This is an internal package not meant for general use.",
6
+ "main": "./build/index.js",
7
+ "exports": {
8
+ ".": "./build/index.js",
9
+ "./createDescribe": "./build/createDescribe.js",
10
+ "./createRenderer": "./build/createRenderer.js",
11
+ "./init": "./build/init.js",
12
+ "./initMatchers": {
13
+ "types": "./build/initMatchers.d.ts",
14
+ "default": "./build/initMatchers.js"
15
+ },
16
+ "./initPlaywrightMatchers": {
17
+ "types": "./build/initPlaywrightMatchers.d.ts",
18
+ "default": "./build/initPlaywrightMatchers.js"
19
+ },
20
+ "./KarmaReporterReactProfiler": "./build/KarmaReporterReactProfiler.js",
21
+ "./setupBabel": "./build/setupBabel.js",
22
+ "./setupBabelPlaywright": "./build/setupBabelPlaywright.js",
23
+ "./setupJSDOM": "./build/setupJSDOM.js",
24
+ "./setupKarma": "./build/setupKarma.js"
25
+ },
26
+ "dependencies": {
27
+ "@babel/plugin-transform-modules-commonjs": "^7.24.6",
28
+ "@babel/preset-typescript": "^7.24.6",
29
+ "@babel/register": "^7.24.6",
30
+ "@babel/runtime": "^7.24.6",
31
+ "@emotion/cache": "^11.11.0",
32
+ "@emotion/react": "^11.11.4",
33
+ "@mnajdova/enzyme-adapter-react-18": "^0.2.0",
34
+ "@testing-library/dom": "^10.1.0",
35
+ "@testing-library/react": "^15.0.7",
36
+ "chai": "^4.4.1",
37
+ "chai-dom": "^1.12.0",
38
+ "dom-accessibility-api": "^0.6.3",
39
+ "enzyme": "^3.11.0",
40
+ "format-util": "^1.0.5",
41
+ "fs-extra": "^11.2.0",
42
+ "jsdom": "^24.0.0",
43
+ "lodash": "^4.17.21",
44
+ "mocha": "^10.4.0",
45
+ "playwright": "^1.44.0",
46
+ "prop-types": "^15.8.1",
47
+ "react-test-renderer": "^18.2.0",
48
+ "sinon": "^16.1.3"
49
+ },
50
+ "devDependencies": {
51
+ "@types/chai": "^4.3.16",
52
+ "@types/chai-dom": "^1.11.3",
53
+ "@types/enzyme": "^3.10.18",
54
+ "@types/format-util": "^1.0.4",
55
+ "@types/prop-types": "^15.7.12",
56
+ "@types/react": "^18.2.55",
57
+ "@types/react-dom": "^18.3.0",
58
+ "@types/react-test-renderer": "^18.3.0",
59
+ "@types/sinon": "^17.0.3",
60
+ "typescript": "^5.4.5"
61
+ },
62
+ "peerDependencies": {
63
+ "react": "^18.2.0",
64
+ "react-dom": "^18.2.0"
65
+ },
66
+ "publishConfig": {
67
+ "access": "public"
68
+ },
69
+ "scripts": {
70
+ "prebuild": "rimraf ./build",
71
+ "build": "tsc -b tsconfig.build.json",
72
+ "typescript": "tsc -b tsconfig.json",
73
+ "release:publish": "pnpm publish --tag latest",
74
+ "release:publish:dry-run": "pnpm publish --tag latest --registry=\"http://localhost:4873/\""
75
+ }
76
+ }
@@ -0,0 +1,81 @@
1
+ // File is not transpiled.
2
+ const path = require('path');
3
+ const fse = require('fs-extra');
4
+
5
+ /**
6
+ * @typedef {object} Browser
7
+ * @property {string} id - Seem random
8
+ * @property {string} name - Includes name, version and OS
9
+ */
10
+
11
+ /**
12
+ * Records results from the Profiler injected
13
+ * @param {*} karmaConfig
14
+ */
15
+ function KarmaReporterReactProfiler(karmaConfig) {
16
+ /**
17
+ * Mapping from browser.id to all profiler results it received
18
+ * @type {Map<string, Record<string, unknown[]>}
19
+ */
20
+ const allRenders = new Map();
21
+
22
+ const { outputDir } = karmaConfig.reactProfilerReporter || {};
23
+ if (typeof outputDir !== 'string') {
24
+ throw new TypeError(
25
+ `Expected karma config to contain reactProfilerReporter.outputDir of type 'string' but got type '${typeof outputDir}'.`,
26
+ );
27
+ }
28
+ fse.ensureDirSync(outputDir);
29
+
30
+ /**
31
+ * @param {Browser} browser
32
+ * @param {unknown | { type: 'reactProfilerResults', detail: Record<string, unknown[]>}} info
33
+ */
34
+ function handleBrowserInfo(browser, info) {
35
+ // `info?.type`
36
+ if (info != null && info.type === 'reactProfilerResults') {
37
+ Object.assign(allRenders.get(browser.id), info.detail);
38
+ }
39
+ }
40
+
41
+ /**
42
+ * @param {Browser} browser
43
+ */
44
+ this.onBrowserStart = (browser) => {
45
+ allRenders.set(browser.id, {});
46
+ // Create it on start to signal to users where the files will appear
47
+ fse.ensureDirSync(path.join(outputDir, browser.name));
48
+
49
+ browser.emitter.addListener('browser_info', handleBrowserInfo);
50
+ };
51
+
52
+ /**
53
+ * @param {Browser} browser
54
+ */
55
+ this.onBrowserComplete = (browser) => {
56
+ browser.emitter.removeListener('browser_info', handleBrowserInfo);
57
+
58
+ const browserRenders = allRenders.get(browser.id);
59
+ if (browserRenders === undefined) {
60
+ // Can be undefined if the run for this browser never started.
61
+ // For example, when starting the browser timed out in https://app.circleci.com/pipelines/github/mui/material-ui/32869/workflows/a2f398d9-2eb4-4390-a912-40c1b8d458d8/jobs/211413.
62
+ console.warn(
63
+ `Unable to find browser renders for '${browser.id}'. ` +
64
+ `Only recorded renders for '${Array.from(allRenders.keys()).join("', '")}. ` +
65
+ `Maybe the browser never started?'`,
66
+ );
67
+ return;
68
+ }
69
+
70
+ fse.ensureDirSync(path.join(outputDir, browser.name));
71
+ fse.writeJSONSync(path.join(outputDir, browser.name, `${Date.now()}.json`), browserRenders, {
72
+ spaces: 2,
73
+ });
74
+ };
75
+ }
76
+
77
+ KarmaReporterReactProfiler.$inject = ['config'];
78
+
79
+ module.exports = {
80
+ 'reporter:profiler': ['type', KarmaReporterReactProfiler],
81
+ };
@@ -0,0 +1,61 @@
1
+ import * as React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ /**
5
+ * A basic error boundary that can be used to assert thrown errors in render.
6
+ * @example <ErrorBoundary ref={errorRef}><MyComponent /></ErrorBoundary>;
7
+ * expect(errorRef.current.errors).to.have.length(0);
8
+ */
9
+ export class ErrorBoundary extends React.Component<{ children: React.ReactNode }> {
10
+ static propTypes = {
11
+ children: PropTypes.node.isRequired,
12
+ };
13
+
14
+ state = {
15
+ error: null,
16
+ };
17
+
18
+ /**
19
+ * @public
20
+ */
21
+ errors: unknown[] = [];
22
+
23
+ static getDerivedStateFromError(error: unknown) {
24
+ return { error };
25
+ }
26
+
27
+ componentDidCatch(error: unknown) {
28
+ this.errors.push(error);
29
+ }
30
+
31
+ render() {
32
+ if (this.state.error) {
33
+ return null;
34
+ }
35
+ return this.props.children;
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Allows counting how many times the owner of `RenderCounter` rendered or
41
+ * a component within the RenderCounter tree "commits" an update.
42
+ * @example <RenderCounter ref={getRenderCountRef}>...</RenderCounter>
43
+ * getRenderCountRef.current() === 2
44
+ */
45
+ export const RenderCounter = React.forwardRef<() => number, { children: React.ReactNode }>(
46
+ function RenderCounter({ children }, ref) {
47
+ const getRenderCountRef = React.useRef(0);
48
+ React.useImperativeHandle(ref, () => () => getRenderCountRef.current);
49
+
50
+ return (
51
+ <React.Profiler
52
+ id="render-counter"
53
+ onRender={() => {
54
+ getRenderCountRef.current += 1;
55
+ }}
56
+ >
57
+ {children}
58
+ </React.Profiler>
59
+ );
60
+ },
61
+ );
@@ -0,0 +1,9 @@
1
+ // there's probably a broader solution e.g. levering DOMWindow from 'jsdom'
2
+ // interface Window extends DOMWindow doesn't work because jsdom typings use
3
+ // triple slash directives. Technical dom.lib.d.ts should already have these properties
4
+ interface Window {
5
+ DragEvent: typeof DragEvent;
6
+ Event: typeof Event;
7
+ HTMLButtonElement: HTMLButtonElement;
8
+ HTMLParagraphElement: HTMLParagraphElement;
9
+ }
@@ -0,0 +1,67 @@
1
+ const { JSDOM } = require('jsdom');
2
+
3
+ // We can use jsdom-global at some point if maintaining these lists is a burden.
4
+ const whitelist = [
5
+ // used by React's experimental cache API
6
+ // Always including it to reduce churn when switching between React builds
7
+ 'AbortController',
8
+ // required for fake getComputedStyle
9
+ 'CSSStyleDeclaration',
10
+ 'Element',
11
+ 'Event',
12
+ 'TouchEvent',
13
+ 'Image',
14
+ 'HTMLElement',
15
+ 'HTMLInputElement',
16
+ 'Node',
17
+ 'Performance',
18
+ 'document',
19
+ 'DocumentFragment',
20
+ ];
21
+ const blacklist = ['sessionStorage', 'localStorage'];
22
+
23
+ function createDOM() {
24
+ const dom = new JSDOM('', {
25
+ pretendToBeVisual: true,
26
+ url: 'http://localhost',
27
+ });
28
+ global.window = dom.window;
29
+ // Not yet supported: https://github.com/jsdom/jsdom/issues/2152
30
+ class Touch {
31
+ constructor(instance) {
32
+ this.instance = instance;
33
+ }
34
+
35
+ get identifier() {
36
+ return this.instance.identifier;
37
+ }
38
+
39
+ get pageX() {
40
+ return this.instance.pageX;
41
+ }
42
+
43
+ get pageY() {
44
+ return this.instance.pageY;
45
+ }
46
+
47
+ get clientX() {
48
+ return this.instance.clientX;
49
+ }
50
+
51
+ get clientY() {
52
+ return this.instance.clientY;
53
+ }
54
+ }
55
+ global.window.Touch = Touch;
56
+
57
+ Object.keys(dom.window)
58
+ .filter((key) => !blacklist.includes(key))
59
+ .concat(whitelist)
60
+ .forEach((key) => {
61
+ if (typeof global[key] === 'undefined') {
62
+ global[key] = dom.window[key];
63
+ }
64
+ });
65
+ }
66
+
67
+ module.exports = createDOM;
@@ -0,0 +1,31 @@
1
+ /* eslint-env mocha */
2
+
3
+ type MUIDescribe<P extends any[]> = {
4
+ (...args: P): void;
5
+
6
+ skip: (...args: P) => void;
7
+ only: (...args: P) => void;
8
+ };
9
+ export default <P extends any[]>(
10
+ message: string,
11
+ callback: (...args: P) => void,
12
+ ): MUIDescribe<P> => {
13
+ const muiDescribe = (...args: P) => {
14
+ describe(message, () => {
15
+ callback(...args);
16
+ });
17
+ };
18
+
19
+ muiDescribe.skip = (...args: P) => {
20
+ describe.skip(message, () => {
21
+ callback(...args);
22
+ });
23
+ };
24
+ muiDescribe.only = (...args: P) => {
25
+ describe.only(message, () => {
26
+ callback(...args);
27
+ });
28
+ };
29
+
30
+ return muiDescribe;
31
+ };
@@ -0,0 +1,136 @@
1
+ /* eslint-env mocha */
2
+ import * as React from 'react';
3
+ import * as ReactDOM from 'react-dom';
4
+ import * as ReactDOMTestUtils from 'react-dom/test-utils';
5
+ import { Test, Suite } from 'mocha';
6
+ import { mount as enzymeMount, MountRendererProps } from 'enzyme';
7
+
8
+ interface ModeProps {
9
+ /**
10
+ * this is essentially children. However, we can't use children because then
11
+ * using `wrapper.setProps({ children })` would work differently if this component
12
+ * would be the root.
13
+ */
14
+ __element: React.ReactElement<any>;
15
+ __strict: boolean;
16
+ }
17
+
18
+ /**
19
+ * Can't just mount <React.Fragment>{node}</React.Fragment>
20
+ * because that swallows wrapper.setProps
21
+ *
22
+ * why class component:
23
+ * https://github.com/airbnb/enzyme/issues/2043
24
+ */
25
+ // eslint-disable-next-line react/prefer-stateless-function
26
+ class Mode extends React.Component<ModeProps> {
27
+ render() {
28
+ // Excess props will come from e.g. enzyme setProps
29
+ // eslint-disable-next-line @typescript-eslint/naming-convention
30
+ const { __element, __strict, ...other } = this.props;
31
+ const Component = __strict ? React.StrictMode : React.Fragment;
32
+
33
+ return <Component>{React.cloneElement(__element, other)}</Component>;
34
+ }
35
+ }
36
+
37
+ interface CreateMountOptions extends MountRendererProps {
38
+ mount?: typeof enzymeMount;
39
+ strict?: boolean;
40
+ }
41
+ // Generate an enhanced mount function.
42
+ export default function createMount(options: CreateMountOptions = {}) {
43
+ const { mount = enzymeMount, strict: globalStrict = true, ...globalEnzymeOptions } = options;
44
+
45
+ let container: HTMLElement | null = null;
46
+
47
+ function computeTestName(test: Test | undefined) {
48
+ let current: Test | Suite | undefined = test;
49
+ const titles: string[] = [];
50
+ while (current != null) {
51
+ titles.push(current.title);
52
+ current = current.parent;
53
+ }
54
+
55
+ return titles.filter(Boolean).reverse().join(' -> ');
56
+ }
57
+
58
+ // save stack to re-use in test-hooks
59
+ const { stack: createMountStack } = new Error();
60
+
61
+ /**
62
+ * Flag whether `createMount` was called in a suite i.e. describe() block.
63
+ * For legacy reasons `createMount` might accidentally be called in a before(Each) hook.
64
+ */
65
+ let wasCalledInSuite = false;
66
+ before(() => {
67
+ wasCalledInSuite = true;
68
+ });
69
+
70
+ beforeEach(() => {
71
+ if (!wasCalledInSuite) {
72
+ const error = new Error(
73
+ 'Unable to run `before` hook for `createMount`. This usually indicates that `createMount` was called in a `before` hook instead of in a `describe()` block.',
74
+ );
75
+ error.stack = createMountStack;
76
+ throw error;
77
+ }
78
+ });
79
+
80
+ beforeEach(function beforeEachMountTest() {
81
+ container = document.createElement('div');
82
+ container.setAttribute('data-test', computeTestName(this.currentTest));
83
+ document.body.insertBefore(container, document.body.firstChild);
84
+ });
85
+
86
+ afterEach(() => {
87
+ ReactDOMTestUtils.act(() => {
88
+ // eslint-disable-next-line react/no-deprecated
89
+ ReactDOM.unmountComponentAtNode(container!);
90
+ });
91
+ container!.parentElement!.removeChild(container!);
92
+ container = null;
93
+ });
94
+
95
+ const mountWithContext = function mountWithContext(
96
+ node: React.ReactElement<any>,
97
+ localOptions: Omit<CreateMountOptions, 'mount'> = {},
98
+ ) {
99
+ const { strict = globalStrict, ...localEnzymeOptions } = localOptions;
100
+
101
+ if (container === null) {
102
+ throw new Error(
103
+ `Tried to mount without setup. Mounting inside before() is not allowed. Try mounting in beforeEach or better: in each test`,
104
+ );
105
+ }
106
+ ReactDOMTestUtils.act(() => {
107
+ // eslint-disable-next-line react/no-deprecated
108
+ ReactDOM.unmountComponentAtNode(container!);
109
+ });
110
+
111
+ // some tests require that no other components are in the tree
112
+ // for example when doing .instance(), .state() etc.
113
+ const wrapper = mount(
114
+ strict == null ? node : <Mode __element={node} __strict={Boolean(strict)} />,
115
+ {
116
+ attachTo: container,
117
+ ...globalEnzymeOptions,
118
+ ...localEnzymeOptions,
119
+ },
120
+ );
121
+ const originalUnmount = wrapper.unmount;
122
+
123
+ wrapper.unmount = () => {
124
+ // flush effect cleanup functions
125
+ ReactDOMTestUtils.act(() => {
126
+ originalUnmount.call(wrapper);
127
+ });
128
+
129
+ return wrapper;
130
+ };
131
+
132
+ return wrapper;
133
+ };
134
+
135
+ return mountWithContext;
136
+ }