@mui/internal-test-utils 2.0.15 → 2.0.18-canary.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.
Files changed (197) hide show
  1. package/CHANGELOG.md +11 -3
  2. package/LICENSE +1 -1
  3. package/README.md +52 -6
  4. package/chaiPlugin.d.ts +3 -0
  5. package/chaiPlugin.js +300 -0
  6. package/{src/chai.types.ts → chaiTypes.d.ts} +7 -40
  7. package/chaiTypes.js +5 -0
  8. package/{build/components.d.ts → components.d.ts} +18 -19
  9. package/components.js +65 -0
  10. package/configure.d.ts +9 -0
  11. package/configure.js +16 -0
  12. package/createDescribe.d.ts +14 -0
  13. package/createDescribe.js +33 -0
  14. package/createRenderer.d.ts +216 -0
  15. package/createRenderer.js +447 -0
  16. package/describeConformance.d.ts +196 -0
  17. package/describeConformance.js +1043 -0
  18. package/env.d.ts +9 -0
  19. package/env.js +21 -0
  20. package/esm/chaiPlugin.d.ts +3 -0
  21. package/esm/chaiPlugin.js +293 -0
  22. package/esm/chaiTypes.d.ts +74 -0
  23. package/esm/chaiTypes.js +3 -0
  24. package/esm/components.d.ts +35 -0
  25. package/esm/components.js +57 -0
  26. package/esm/configure.d.ts +9 -0
  27. package/esm/configure.js +9 -0
  28. package/esm/createDescribe.d.ts +14 -0
  29. package/esm/createDescribe.js +27 -0
  30. package/esm/createRenderer.d.ts +216 -0
  31. package/esm/createRenderer.js +396 -0
  32. package/esm/describeConformance.d.ts +196 -0
  33. package/esm/describeConformance.js +1029 -0
  34. package/esm/env.d.ts +9 -0
  35. package/esm/env.js +13 -0
  36. package/esm/flushMicrotasks.d.ts +1 -0
  37. package/esm/flushMicrotasks.js +4 -0
  38. package/{build → esm}/focusVisible.d.ts +1 -2
  39. package/{src/focusVisible.ts → esm/focusVisible.js} +10 -9
  40. package/esm/index.d.ts +10 -0
  41. package/esm/index.js +18 -0
  42. package/esm/initMatchers.d.ts +5 -0
  43. package/esm/initMatchers.js +9 -0
  44. package/esm/initPlaywrightMatchers.d.ts +24 -0
  45. package/esm/initPlaywrightMatchers.js +40 -0
  46. package/esm/package.json +1 -0
  47. package/esm/setupVitest.d.ts +8 -0
  48. package/esm/setupVitest.js +94 -0
  49. package/flushMicrotasks.d.ts +1 -0
  50. package/flushMicrotasks.js +10 -0
  51. package/focusVisible.d.ts +7 -0
  52. package/focusVisible.js +44 -0
  53. package/index.d.ts +10 -0
  54. package/index.js +125 -0
  55. package/initMatchers.d.ts +5 -0
  56. package/initMatchers.js +29 -0
  57. package/initPlaywrightMatchers.d.ts +24 -0
  58. package/initPlaywrightMatchers.js +42 -0
  59. package/package.json +106 -52
  60. package/setupVitest.d.ts +8 -0
  61. package/setupVitest.js +104 -0
  62. package/build/.tsbuildinfo +0 -1
  63. package/build/KarmaReporterReactProfiler.d.ts +0 -51
  64. package/build/KarmaReporterReactProfiler.d.ts.map +0 -1
  65. package/build/KarmaReporterReactProfiler.js +0 -66
  66. package/build/KarmaReporterReactProfiler.js.map +0 -1
  67. package/build/chai.types.d.ts +0 -75
  68. package/build/chai.types.d.ts.map +0 -1
  69. package/build/chai.types.js +0 -3
  70. package/build/chai.types.js.map +0 -1
  71. package/build/chaiPlugin.d.ts +0 -5
  72. package/build/chaiPlugin.d.ts.map +0 -1
  73. package/build/chaiPlugin.js +0 -416
  74. package/build/chaiPlugin.js.map +0 -1
  75. package/build/components.d.ts.map +0 -1
  76. package/build/components.js +0 -88
  77. package/build/components.js.map +0 -1
  78. package/build/createDOM.d.ts +0 -3
  79. package/build/createDOM.d.ts.map +0 -1
  80. package/build/createDOM.js +0 -60
  81. package/build/createDOM.js.map +0 -1
  82. package/build/createDescribe.d.ts +0 -8
  83. package/build/createDescribe.d.ts.map +0 -1
  84. package/build/createDescribe.js +0 -22
  85. package/build/createDescribe.js.map +0 -1
  86. package/build/createRenderer.d.ts +0 -215
  87. package/build/createRenderer.d.ts.map +0 -1
  88. package/build/createRenderer.js +0 -564
  89. package/build/createRenderer.js.map +0 -1
  90. package/build/createRenderer.test.d.ts +0 -2
  91. package/build/createRenderer.test.d.ts.map +0 -1
  92. package/build/createRenderer.test.js +0 -58
  93. package/build/createRenderer.test.js.map +0 -1
  94. package/build/describeConformance.d.ts +0 -201
  95. package/build/describeConformance.d.ts.map +0 -1
  96. package/build/describeConformance.js +0 -859
  97. package/build/describeConformance.js.map +0 -1
  98. package/build/describeSkipIf.d.ts +0 -4
  99. package/build/describeSkipIf.d.ts.map +0 -1
  100. package/build/describeSkipIf.js +0 -10
  101. package/build/describeSkipIf.js.map +0 -1
  102. package/build/fireDiscreteEvent.d.ts +0 -7
  103. package/build/fireDiscreteEvent.d.ts.map +0 -1
  104. package/build/fireDiscreteEvent.js +0 -77
  105. package/build/fireDiscreteEvent.js.map +0 -1
  106. package/build/flushMicrotasks.d.ts +0 -2
  107. package/build/flushMicrotasks.d.ts.map +0 -1
  108. package/build/flushMicrotasks.js +0 -8
  109. package/build/flushMicrotasks.js.map +0 -1
  110. package/build/focusVisible.d.ts.map +0 -1
  111. package/build/focusVisible.js +0 -38
  112. package/build/focusVisible.js.map +0 -1
  113. package/build/index.d.ts +0 -18
  114. package/build/index.d.ts.map +0 -1
  115. package/build/index.js +0 -68
  116. package/build/index.js.map +0 -1
  117. package/build/init.d.ts +0 -2
  118. package/build/init.d.ts.map +0 -1
  119. package/build/init.js +0 -46
  120. package/build/init.js.map +0 -1
  121. package/build/initMatchers.d.ts +0 -2
  122. package/build/initMatchers.d.ts.map +0 -1
  123. package/build/initMatchers.js +0 -45
  124. package/build/initMatchers.js.map +0 -1
  125. package/build/initMatchers.test.d.ts +0 -2
  126. package/build/initMatchers.test.d.ts.map +0 -1
  127. package/build/initMatchers.test.js +0 -101
  128. package/build/initMatchers.test.js.map +0 -1
  129. package/build/initPlaywrightMatchers.d.ts +0 -25
  130. package/build/initPlaywrightMatchers.d.ts.map +0 -1
  131. package/build/initPlaywrightMatchers.js +0 -73
  132. package/build/initPlaywrightMatchers.js.map +0 -1
  133. package/build/mochaHooks.d.ts +0 -24
  134. package/build/mochaHooks.d.ts.map +0 -1
  135. package/build/mochaHooks.js +0 -165
  136. package/build/mochaHooks.js.map +0 -1
  137. package/build/mochaHooks.test.d.ts +0 -2
  138. package/build/mochaHooks.test.d.ts.map +0 -1
  139. package/build/mochaHooks.test.js +0 -128
  140. package/build/mochaHooks.test.js.map +0 -1
  141. package/build/reactMajor.d.ts +0 -3
  142. package/build/reactMajor.d.ts.map +0 -1
  143. package/build/reactMajor.js +0 -38
  144. package/build/reactMajor.js.map +0 -1
  145. package/build/setup.d.ts +0 -2
  146. package/build/setup.d.ts.map +0 -1
  147. package/build/setup.js +0 -10
  148. package/build/setup.js.map +0 -1
  149. package/build/setupBabel.d.ts +0 -2
  150. package/build/setupBabel.d.ts.map +0 -1
  151. package/build/setupBabel.js +0 -5
  152. package/build/setupBabel.js.map +0 -1
  153. package/build/setupBabelPlaywright.d.ts +0 -2
  154. package/build/setupBabelPlaywright.d.ts.map +0 -1
  155. package/build/setupBabelPlaywright.js +0 -14
  156. package/build/setupBabelPlaywright.js.map +0 -1
  157. package/build/setupJSDOM.d.ts +0 -7
  158. package/build/setupJSDOM.d.ts.map +0 -1
  159. package/build/setupJSDOM.js +0 -17
  160. package/build/setupJSDOM.js.map +0 -1
  161. package/build/setupKarma.d.ts +0 -2
  162. package/build/setupKarma.d.ts.map +0 -1
  163. package/build/setupKarma.js +0 -56
  164. package/build/setupKarma.js.map +0 -1
  165. package/build/setupVitest.d.ts +0 -2
  166. package/build/setupVitest.d.ts.map +0 -1
  167. package/build/setupVitest.js +0 -131
  168. package/build/setupVitest.js.map +0 -1
  169. package/src/KarmaReporterReactProfiler.js +0 -82
  170. package/src/chai-augmentation.d.ts +0 -8
  171. package/src/chaiPlugin.ts +0 -515
  172. package/src/components.tsx +0 -61
  173. package/src/createDOM.d.ts +0 -9
  174. package/src/createDOM.js +0 -67
  175. package/src/createDescribe.ts +0 -31
  176. package/src/createRenderer.test.js +0 -31
  177. package/src/createRenderer.tsx +0 -808
  178. package/src/describeConformance.tsx +0 -1257
  179. package/src/describeSkipIf.tsx +0 -11
  180. package/src/fireDiscreteEvent.ts +0 -76
  181. package/src/flushMicrotasks.ts +0 -5
  182. package/src/index.ts +0 -25
  183. package/src/init.js +0 -11
  184. package/src/initMatchers.test.js +0 -124
  185. package/src/initMatchers.ts +0 -7
  186. package/src/initPlaywrightMatchers.ts +0 -101
  187. package/src/mochaHooks.js +0 -200
  188. package/src/mochaHooks.test.js +0 -116
  189. package/src/reactMajor.ts +0 -3
  190. package/src/setup.js +0 -10
  191. package/src/setupBabel.js +0 -3
  192. package/src/setupBabelPlaywright.js +0 -13
  193. package/src/setupJSDOM.js +0 -20
  194. package/src/setupKarma.js +0 -65
  195. package/src/setupVitest.ts +0 -117
  196. package/tsconfig.build.json +0 -16
  197. package/tsconfig.json +0 -17
@@ -0,0 +1,1043 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ exports.describeRef = describeRef;
10
+ exports.randomStringValue = randomStringValue;
11
+ exports.testClassName = testClassName;
12
+ exports.testComponentProp = testComponentProp;
13
+ exports.testPropsSpread = testPropsSpread;
14
+ exports.testRootClass = testRootClass;
15
+ var _chai = require("chai");
16
+ var React = _interopRequireWildcard(require("react"));
17
+ var _vitest = require("vitest");
18
+ var _createDescribe = _interopRequireDefault(require("./createDescribe"));
19
+ var _env = require("./env");
20
+ var _jsxRuntime = require("react/jsx-runtime");
21
+ function capitalize(string) {
22
+ return string.charAt(0).toUpperCase() + string.slice(1);
23
+ }
24
+ /**
25
+ * Glossary
26
+ * - root component:
27
+ * - renders the outermost host component
28
+ * - has the `root` class if the component has one
29
+ * - excess props are spread to this component
30
+ * - has the type of `inheritComponent`
31
+ */
32
+
33
+ function randomStringValue() {
34
+ return `s${Math.random().toString(36).slice(2)}`;
35
+ }
36
+ function throwMissingPropError(field) {
37
+ throw new Error(`missing "${field}" in options
38
+
39
+ > describeConformance(element, () => options)
40
+ `);
41
+ }
42
+
43
+ /**
44
+ * MUI components have a `className` prop. The `className` is applied to
45
+ * the root component.
46
+ */
47
+ function testClassName(element, getOptions) {
48
+ (0, _vitest.it)('applies the className to the root component', async () => {
49
+ const {
50
+ render
51
+ } = getOptions();
52
+ if (!render) {
53
+ throwMissingPropError('render');
54
+ }
55
+ const className = randomStringValue();
56
+ const testId = randomStringValue();
57
+ const {
58
+ getByTestId
59
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
60
+ className,
61
+ 'data-testid': testId
62
+ }));
63
+ (0, _chai.expect)(getByTestId(testId)).to.have.class(className);
64
+ });
65
+ }
66
+
67
+ /**
68
+ * MUI components have a `component` prop that allows rendering a different
69
+ * Component from @inheritComponent
70
+ */
71
+ function testComponentProp(element, getOptions) {
72
+ (0, _vitest.describe)('prop: component', () => {
73
+ (0, _vitest.it)('can render another root component with the `component` prop', async () => {
74
+ const {
75
+ render,
76
+ testComponentPropWith: component = 'em'
77
+ } = getOptions();
78
+ if (!render) {
79
+ throwMissingPropError('render');
80
+ }
81
+ const testId = randomStringValue();
82
+ if (typeof component === 'string') {
83
+ const {
84
+ getByTestId
85
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
86
+ component,
87
+ 'data-testid': testId
88
+ }));
89
+ (0, _chai.expect)(getByTestId(testId)).not.to.equal(null);
90
+ (0, _chai.expect)(getByTestId(testId).nodeName.toLowerCase()).to.eq(component);
91
+ } else {
92
+ const componentWithTestId = props => /*#__PURE__*/React.createElement(component, {
93
+ ...props,
94
+ 'data-testid': testId
95
+ });
96
+ const {
97
+ getByTestId
98
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
99
+ component: componentWithTestId
100
+ }));
101
+ (0, _chai.expect)(getByTestId(testId)).not.to.equal(null);
102
+ }
103
+ });
104
+ });
105
+ }
106
+
107
+ /**
108
+ * MUI components spread additional props to its root.
109
+ */
110
+ function testPropsSpread(element, getOptions) {
111
+ (0, _vitest.it)(`spreads props to the root component`, async () => {
112
+ // type def in ConformanceOptions
113
+ const {
114
+ render
115
+ } = getOptions();
116
+ if (!render) {
117
+ throwMissingPropError('render');
118
+ }
119
+ const testProp = 'data-test-props-spread';
120
+ const value = randomStringValue();
121
+ const testId = randomStringValue();
122
+ const {
123
+ getByTestId
124
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
125
+ [testProp]: value,
126
+ 'data-testid': testId
127
+ }));
128
+ (0, _chai.expect)(getByTestId(testId)).to.have.attribute(testProp, value);
129
+ });
130
+ }
131
+
132
+ /**
133
+ * Tests that the `ref` of a component will return the correct instance
134
+ *
135
+ * This is determined by a given constructor i.e. a React.Component or HTMLElement for
136
+ * components that forward their ref and attach it to a host component.
137
+ */
138
+ function describeRef(element, getOptions) {
139
+ (0, _vitest.describe)('ref', () => {
140
+ (0, _vitest.it)(`attaches the ref`, async () => {
141
+ // type def in ConformanceOptions
142
+ const {
143
+ render,
144
+ refInstanceof
145
+ } = getOptions();
146
+ if (!render) {
147
+ throwMissingPropError('render');
148
+ }
149
+ const ref = /*#__PURE__*/React.createRef();
150
+ await render(/*#__PURE__*/React.cloneElement(element, {
151
+ ref
152
+ }));
153
+ (0, _chai.expect)(ref.current).to.be.instanceof(refInstanceof);
154
+ });
155
+ });
156
+ }
157
+
158
+ /**
159
+ * Tests that the root component has the root class
160
+ */
161
+ function testRootClass(element, getOptions) {
162
+ (0, _vitest.it)('applies the root class to the root component if it has this class', async () => {
163
+ const {
164
+ classes,
165
+ render,
166
+ skip
167
+ } = getOptions();
168
+ if (classes.root == null) {
169
+ return;
170
+ }
171
+ const className = randomStringValue();
172
+ const classesRootClassname = randomStringValue();
173
+ const {
174
+ container
175
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
176
+ className,
177
+ classes: {
178
+ ...classes,
179
+ root: `${classes.root} ${classesRootClassname}`
180
+ }
181
+ }));
182
+
183
+ // we established that the root component renders the outermost host previously. We immediately
184
+ // jump to the host component because some components pass the `root` class
185
+ // to the `classes` prop of the root component.
186
+ // https://github.com/mui/material-ui/blob/f9896bcd129a1209153106296b3d2487547ba205/packages/material-ui/src/OutlinedInput/OutlinedInput.js#L101
187
+ (0, _chai.expect)(container.firstChild).to.have.class(className);
188
+ (0, _chai.expect)(container.firstChild).to.have.class(classes.root);
189
+ (0, _chai.expect)(document.querySelectorAll(`.${classes.root}`).length).to.equal(1);
190
+
191
+ // classes test only for @mui/material
192
+ if (!skip || !skip.includes('classesRoot')) {
193
+ // Test that classes prop works
194
+ (0, _chai.expect)(container.firstChild).to.have.class(classesRootClassname);
195
+
196
+ // Test that `classes` does not spread to DOM
197
+ (0, _chai.expect)(document.querySelectorAll('[classes]').length).to.equal(0);
198
+ }
199
+ });
200
+ }
201
+ function forEachSlot(slots, callback) {
202
+ if (!slots) {
203
+ return;
204
+ }
205
+ const slotNames = Object.keys(slots);
206
+ slotNames.forEach(slotName => {
207
+ const slot = slots[slotName];
208
+ callback(slotName, slot);
209
+ });
210
+ }
211
+ function testSlotsProp(element, getOptions) {
212
+ const {
213
+ render,
214
+ slots,
215
+ testLegacyComponentsProp
216
+ } = getOptions();
217
+ const CustomComponent = /*#__PURE__*/React.forwardRef(({
218
+ className,
219
+ children
220
+ }, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
221
+ className: className,
222
+ ref: ref,
223
+ "data-testid": "custom",
224
+ children: children
225
+ }));
226
+ if (process.env.NODE_ENV !== "production") CustomComponent.displayName = "CustomComponent";
227
+ forEachSlot(slots, (slotName, slotOptions) => {
228
+ (0, _vitest.it)(`allows overriding the ${slotName} slot with a component using the slots.${slotName} prop`, async () => {
229
+ if (!render) {
230
+ throwMissingPropError('render');
231
+ }
232
+ const slotComponent = slotOptions.testWithComponent ?? CustomComponent;
233
+ const components = {
234
+ [slotName]: slotComponent
235
+ };
236
+ const {
237
+ queryByTestId
238
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
239
+ slots: components
240
+ }));
241
+ const renderedElement = queryByTestId('custom');
242
+ (0, _chai.expect)(renderedElement).not.to.equal(null);
243
+ if (slotOptions.expectedClassName) {
244
+ (0, _chai.expect)(renderedElement).to.have.class(slotOptions.expectedClassName);
245
+ }
246
+ });
247
+ if (slotOptions.testWithElement !== null) {
248
+ (0, _vitest.it)(`allows overriding the ${slotName} slot with an element using the slots.${slotName} prop`, async () => {
249
+ if (!render) {
250
+ throwMissingPropError('render');
251
+ }
252
+ const slotElement = slotOptions.testWithElement ?? 'i';
253
+ const components = {
254
+ [slotName]: slotElement
255
+ };
256
+ const slotProps = {
257
+ [slotName]: {
258
+ 'data-testid': 'customized'
259
+ }
260
+ };
261
+ const {
262
+ queryByTestId
263
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
264
+ slots: components,
265
+ slotProps
266
+ }));
267
+ const renderedElement = queryByTestId('customized');
268
+ (0, _chai.expect)(renderedElement).not.to.equal(null);
269
+ if (typeof slotElement === 'string') {
270
+ (0, _chai.expect)(renderedElement.nodeName.toLowerCase()).to.equal(slotElement);
271
+ }
272
+ if (slotOptions.expectedClassName) {
273
+ (0, _chai.expect)(renderedElement).to.have.class(slotOptions.expectedClassName);
274
+ }
275
+ });
276
+ }
277
+
278
+ // For testing Material UI components v5, and v6. Likely to be removed in a future major release.
279
+ if (testLegacyComponentsProp === true || Array.isArray(testLegacyComponentsProp) && testLegacyComponentsProp.includes(slotName)) {
280
+ (0, _vitest.it)(`allows overriding the ${slotName} slot with a component using the components.${capitalize(slotName)} prop`, async () => {
281
+ if (!render) {
282
+ throwMissingPropError('render');
283
+ }
284
+ const slotComponent = slotOptions.testWithComponent ?? CustomComponent;
285
+ const components = {
286
+ [capitalize(slotName)]: slotComponent
287
+ };
288
+ const {
289
+ queryByTestId
290
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
291
+ components
292
+ }));
293
+ const renderedElement = queryByTestId('custom');
294
+ (0, _chai.expect)(renderedElement).not.to.equal(null);
295
+ if (slotOptions.expectedClassName) {
296
+ (0, _chai.expect)(renderedElement).to.have.class(slotOptions.expectedClassName);
297
+ }
298
+ });
299
+ (0, _vitest.it)(`prioritizes the 'slots.${slotName}' over components.${capitalize(slotName)} if both are defined`, async () => {
300
+ if (!render) {
301
+ throwMissingPropError('render');
302
+ }
303
+ const ComponentForComponentsProp = /*#__PURE__*/React.forwardRef(({
304
+ children
305
+ }, ref) => {
306
+ const SlotComponent = slotOptions.testWithComponent ?? 'div';
307
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(SlotComponent, {
308
+ ref: ref,
309
+ "data-testid": "from-components",
310
+ children: children
311
+ });
312
+ });
313
+ if (process.env.NODE_ENV !== "production") ComponentForComponentsProp.displayName = "ComponentForComponentsProp";
314
+ const ComponentForSlotsProp = /*#__PURE__*/React.forwardRef(({
315
+ children
316
+ }, ref) => {
317
+ const SlotComponent = slotOptions.testWithComponent ?? 'div';
318
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(SlotComponent, {
319
+ ref: ref,
320
+ "data-testid": "from-slots",
321
+ children: children
322
+ });
323
+ });
324
+ if (process.env.NODE_ENV !== "production") ComponentForSlotsProp.displayName = "ComponentForSlotsProp";
325
+ const components = {
326
+ [capitalize(slotName)]: ComponentForComponentsProp
327
+ };
328
+ const slotOverrides = {
329
+ [slotName]: ComponentForSlotsProp
330
+ };
331
+ const {
332
+ queryByTestId
333
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
334
+ components,
335
+ slots: slotOverrides
336
+ }));
337
+ (0, _chai.expect)(queryByTestId('from-slots')).not.to.equal(null);
338
+ (0, _chai.expect)(queryByTestId('from-components')).to.equal(null);
339
+ });
340
+ if (slotOptions.testWithElement !== null) {
341
+ (0, _vitest.it)(`allows overriding the ${slotName} slot with an element using the components.${capitalize(slotName)} prop`, async () => {
342
+ if (!render) {
343
+ throwMissingPropError('render');
344
+ }
345
+ const slotElement = slotOptions.testWithElement ?? 'i';
346
+ const components = {
347
+ [capitalize(slotName)]: slotElement
348
+ };
349
+ const componentsProps = {
350
+ [slotName]: {
351
+ 'data-testid': 'customized'
352
+ }
353
+ };
354
+ const {
355
+ queryByTestId
356
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
357
+ components,
358
+ componentsProps
359
+ }));
360
+ const renderedElement = queryByTestId('customized');
361
+ (0, _chai.expect)(renderedElement).not.to.equal(null);
362
+ if (typeof slotElement === 'string') {
363
+ (0, _chai.expect)(renderedElement.nodeName.toLowerCase()).to.equal(slotElement);
364
+ }
365
+ if (slotOptions.expectedClassName) {
366
+ (0, _chai.expect)(renderedElement).to.have.class(slotOptions.expectedClassName);
367
+ }
368
+ });
369
+ }
370
+ }
371
+ });
372
+ }
373
+ function testSlotPropsProp(element, getOptions) {
374
+ const {
375
+ render,
376
+ slots,
377
+ testLegacyComponentsProp
378
+ } = getOptions();
379
+ if (!render) {
380
+ throwMissingPropError('render');
381
+ }
382
+ forEachSlot(slots, (slotName, slotOptions) => {
383
+ (0, _vitest.it)(`sets custom properties on the ${slotName} slot's element with the slotProps.${slotName} prop`, async () => {
384
+ const slotProps = {
385
+ [slotName]: {
386
+ 'data-testid': 'custom'
387
+ }
388
+ };
389
+ const {
390
+ queryByTestId
391
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
392
+ slotProps
393
+ }));
394
+ const slotComponent = queryByTestId('custom');
395
+ (0, _chai.expect)(slotComponent).not.to.equal(null);
396
+ if (slotOptions.expectedClassName) {
397
+ (0, _chai.expect)(slotComponent).to.have.class(slotOptions.expectedClassName);
398
+ }
399
+ });
400
+ if (slotOptions.expectedClassName) {
401
+ (0, _vitest.it)(`merges the class names provided in slotsProps.${slotName} with the built-in ones`, async () => {
402
+ const slotProps = {
403
+ [slotName]: {
404
+ 'data-testid': 'custom',
405
+ className: randomStringValue()
406
+ }
407
+ };
408
+ const {
409
+ getByTestId
410
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
411
+ slotProps
412
+ }));
413
+ (0, _chai.expect)(getByTestId('custom')).to.have.class(slotOptions.expectedClassName);
414
+ (0, _chai.expect)(getByTestId('custom')).to.have.class(slotProps[slotName].className);
415
+ });
416
+ }
417
+ if (testLegacyComponentsProp === true || Array.isArray(testLegacyComponentsProp) && testLegacyComponentsProp.includes(slotName)) {
418
+ (0, _vitest.it)(`sets custom properties on the ${slotName} slot's element with the componentsProps.${slotName} prop`, async () => {
419
+ const componentsProps = {
420
+ [slotName]: {
421
+ 'data-testid': 'custom'
422
+ }
423
+ };
424
+ const {
425
+ queryByTestId
426
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
427
+ componentsProps
428
+ }));
429
+ const slotComponent = queryByTestId('custom');
430
+ (0, _chai.expect)(slotComponent).not.to.equal(null);
431
+ if (slotOptions.expectedClassName) {
432
+ (0, _chai.expect)(slotComponent).to.have.class(slotOptions.expectedClassName);
433
+ }
434
+ });
435
+ (0, _vitest.it)(`prioritizes the 'slotProps.${slotName}' over componentsProps.${slotName} if both are defined`, async () => {
436
+ const componentsProps = {
437
+ [slotName]: {
438
+ 'data-testid': 'custom',
439
+ 'data-from-components-props': 'true'
440
+ }
441
+ };
442
+ const slotProps = {
443
+ [slotName]: {
444
+ 'data-testid': 'custom',
445
+ 'data-from-slot-props': 'true'
446
+ }
447
+ };
448
+ const {
449
+ queryByTestId
450
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
451
+ componentsProps,
452
+ slotProps
453
+ }));
454
+ const slotComponent = queryByTestId('custom');
455
+ (0, _chai.expect)(slotComponent).to.have.attribute('data-from-slot-props', 'true');
456
+ (0, _chai.expect)(slotComponent).not.to.have.attribute('data-from-components-props');
457
+ });
458
+ }
459
+ });
460
+ }
461
+ function testSlotPropsCallback(element, getOptions) {
462
+ const {
463
+ render,
464
+ slots
465
+ } = getOptions();
466
+ if (!render) {
467
+ throwMissingPropError('render');
468
+ }
469
+ forEachSlot(slots, slotName => {
470
+ (0, _vitest.it)(`sets custom properties on the ${slotName} slot's element with the slotProps.${slotName} callback`, async () => {
471
+ const slotProps = {
472
+ [slotName]: () => ({
473
+ 'data-testid': 'custom'
474
+ })
475
+ };
476
+ const {
477
+ queryByTestId
478
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
479
+ slotProps,
480
+ className: 'custom'
481
+ }));
482
+ const slotComponent = queryByTestId('custom');
483
+ (0, _chai.expect)(slotComponent).not.to.equal(null);
484
+ });
485
+ });
486
+ }
487
+ function testSlotPropsCallbackWithPropsAsOwnerState(element, getOptions) {
488
+ const {
489
+ render,
490
+ slots
491
+ } = getOptions();
492
+ if (!render) {
493
+ throwMissingPropError('render');
494
+ }
495
+ forEachSlot(slots, slotName => {
496
+ (0, _vitest.it)(`sets custom properties on the ${slotName} slot's element with the slotProps.${slotName} callback using the ownerState`, async () => {
497
+ const slotProps = {
498
+ [slotName]: ownerState => ({
499
+ 'data-testid': ownerState.className
500
+ })
501
+ };
502
+ const {
503
+ queryByTestId
504
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
505
+ slotProps,
506
+ className: 'custom'
507
+ }));
508
+ const slotComponent = queryByTestId('custom', {
509
+ exact: false
510
+ });
511
+ (0, _chai.expect)(slotComponent).not.to.equal(null);
512
+ });
513
+ });
514
+ }
515
+
516
+ /**
517
+ * MUI components have a `components` prop that allows rendering a different
518
+ * Components from @inheritComponent
519
+ */
520
+ function testComponentsProp(element, getOptions) {
521
+ (0, _vitest.describe)('prop components:', () => {
522
+ (0, _vitest.it)('can render another root component with the `components` prop', async () => {
523
+ const {
524
+ render,
525
+ testComponentsRootPropWith: component = 'em'
526
+ } = getOptions();
527
+ if (!render) {
528
+ throwMissingPropError('render');
529
+ }
530
+ const testId = randomStringValue();
531
+ const {
532
+ getByTestId
533
+ } = await render(/*#__PURE__*/React.cloneElement(element, {
534
+ components: {
535
+ Root: component
536
+ },
537
+ 'data-testid': testId
538
+ }));
539
+ (0, _chai.expect)(getByTestId(testId)).not.to.equal(null);
540
+ (0, _chai.expect)(getByTestId(testId).nodeName.toLowerCase()).to.eq(component);
541
+ });
542
+ });
543
+ }
544
+
545
+ /**
546
+ * MUI theme has a components section that allows specifying default props.
547
+ * Components from @inheritComponent
548
+ */
549
+ function testThemeDefaultProps(element, getOptions) {
550
+ (0, _vitest.describe)('theme default components:', () => {
551
+ (0, _vitest.it)("respect theme's defaultProps", async () => {
552
+ const testProp = 'data-id';
553
+ const {
554
+ muiName,
555
+ render,
556
+ ThemeProvider,
557
+ createTheme
558
+ } = getOptions();
559
+ if (!muiName) {
560
+ throwMissingPropError('muiName');
561
+ }
562
+ if (!render) {
563
+ throwMissingPropError('render');
564
+ }
565
+ if (!ThemeProvider) {
566
+ throwMissingPropError('ThemeProvider');
567
+ }
568
+ if (!createTheme) {
569
+ throwMissingPropError('createTheme');
570
+ }
571
+ const theme = createTheme({
572
+ components: {
573
+ [muiName]: {
574
+ defaultProps: {
575
+ [testProp]: 'testProp'
576
+ }
577
+ }
578
+ }
579
+ });
580
+ const {
581
+ container
582
+ } = await render(/*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeProvider, {
583
+ theme: theme,
584
+ children: element
585
+ }));
586
+ (0, _chai.expect)(container.firstChild).to.have.attribute(testProp, 'testProp');
587
+ });
588
+ });
589
+ (0, _vitest.describe)('default props provider:', () => {
590
+ const {
591
+ muiName,
592
+ render,
593
+ DefaultPropsProvider
594
+ } = getOptions();
595
+ _vitest.it.skipIf(!DefaultPropsProvider)('respect custom default props', async function test() {
596
+ const testProp = 'data-id';
597
+ if (!muiName) {
598
+ throwMissingPropError('muiName');
599
+ }
600
+ if (!render) {
601
+ throwMissingPropError('render');
602
+ }
603
+ const {
604
+ container
605
+ } = await render(
606
+ /*#__PURE__*/
607
+ // @ts-expect-error we skip it above.
608
+ (0, _jsxRuntime.jsx)(DefaultPropsProvider, {
609
+ value: {
610
+ [muiName]: {
611
+ defaultProps: {
612
+ [testProp]: 'testProp'
613
+ }
614
+ }
615
+ },
616
+ children: element
617
+ }));
618
+ (0, _chai.expect)(container.firstChild).to.have.attribute(testProp, 'testProp');
619
+ });
620
+ });
621
+ }
622
+
623
+ /**
624
+ * MUI theme has a components section that allows specifying style overrides.
625
+ * Components from @inheritComponent
626
+ */
627
+ function testThemeStyleOverrides(element, getOptions) {
628
+ (0, _vitest.describe)('theme style overrides:', () => {
629
+ _vitest.it.skipIf((0, _env.isJsdom)())("respect theme's styleOverrides custom state", async function test() {
630
+ const {
631
+ muiName,
632
+ testStateOverrides,
633
+ render,
634
+ ThemeProvider,
635
+ createTheme
636
+ } = getOptions();
637
+ if (!testStateOverrides) {
638
+ return;
639
+ }
640
+ if (!muiName) {
641
+ throwMissingPropError('muiName');
642
+ }
643
+ if (!render) {
644
+ throwMissingPropError('render');
645
+ }
646
+ if (!ThemeProvider) {
647
+ throwMissingPropError('ThemeProvider');
648
+ }
649
+ if (!createTheme) {
650
+ throwMissingPropError('createTheme');
651
+ }
652
+ const testStyle = {
653
+ marginTop: '13px'
654
+ };
655
+ const theme = createTheme({
656
+ components: {
657
+ [muiName]: {
658
+ styleOverrides: {
659
+ [testStateOverrides.styleKey]: testStyle
660
+ }
661
+ }
662
+ }
663
+ });
664
+ if (!testStateOverrides.prop) {
665
+ return;
666
+ }
667
+ const {
668
+ container
669
+ } = await render(/*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeProvider, {
670
+ theme: theme,
671
+ children: /*#__PURE__*/React.cloneElement(element, {
672
+ [testStateOverrides.prop]: testStateOverrides.value
673
+ })
674
+ }));
675
+ (0, _chai.expect)(container.firstChild).to.toHaveComputedStyle(testStyle);
676
+ });
677
+ _vitest.it.skipIf((0, _env.isJsdom)())("respect theme's styleOverrides slots", async function test() {
678
+ const {
679
+ muiName,
680
+ testDeepOverrides,
681
+ testRootOverrides = {
682
+ slotName: 'root'
683
+ },
684
+ render,
685
+ ThemeProvider,
686
+ createTheme
687
+ } = getOptions();
688
+ if (!ThemeProvider) {
689
+ throwMissingPropError('ThemeProvider');
690
+ }
691
+ if (!createTheme) {
692
+ throwMissingPropError('createTheme');
693
+ }
694
+ const testStyle = {
695
+ mixBlendMode: 'darken'
696
+ };
697
+ function resolveDeepOverrides(callback) {
698
+ if (!testDeepOverrides) {
699
+ return {};
700
+ }
701
+ const styles = {};
702
+ if (Array.isArray(testDeepOverrides)) {
703
+ testDeepOverrides.forEach(slot => {
704
+ callback(styles, slot);
705
+ });
706
+ } else {
707
+ callback(styles, testDeepOverrides);
708
+ }
709
+ return styles;
710
+ }
711
+ const theme = createTheme({
712
+ components: {
713
+ [muiName]: {
714
+ styleOverrides: {
715
+ [testRootOverrides.slotName]: {
716
+ ...testStyle,
717
+ ...resolveDeepOverrides((styles, slot) => {
718
+ styles[`& .${slot.slotClassName}`] = {
719
+ fontVariantCaps: 'all-petite-caps'
720
+ };
721
+ })
722
+ },
723
+ ...resolveDeepOverrides((styles, slot) => {
724
+ styles[slot.slotName] = {
725
+ mixBlendMode: 'darken'
726
+ };
727
+ })
728
+ }
729
+ }
730
+ }
731
+ });
732
+ const {
733
+ container,
734
+ setProps
735
+ } = await render(/*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeProvider, {
736
+ theme: theme,
737
+ children: element
738
+ }));
739
+ if (testRootOverrides.slotClassName) {
740
+ (0, _chai.expect)(document.querySelector(`.${testRootOverrides.slotClassName}`)).to.toHaveComputedStyle(testStyle);
741
+ } else {
742
+ (0, _chai.expect)(container.firstChild).to.toHaveComputedStyle(testStyle);
743
+ }
744
+ if (testDeepOverrides) {
745
+ (Array.isArray(testDeepOverrides) ? testDeepOverrides : [testDeepOverrides]).forEach(slot => {
746
+ (0, _chai.expect)(document.querySelector(`.${slot.slotClassName}`)).to.toHaveComputedStyle({
747
+ fontVariantCaps: 'all-petite-caps',
748
+ mixBlendMode: 'darken'
749
+ });
750
+ });
751
+ const themeWithoutRootOverrides = createTheme({
752
+ components: {
753
+ [muiName]: {
754
+ styleOverrides: {
755
+ ...resolveDeepOverrides((styles, slot) => {
756
+ styles[slot.slotName] = testStyle;
757
+ })
758
+ }
759
+ }
760
+ }
761
+ });
762
+ setProps({
763
+ theme: themeWithoutRootOverrides
764
+ });
765
+ (Array.isArray(testDeepOverrides) ? testDeepOverrides : [testDeepOverrides]).forEach(slot => {
766
+ (0, _chai.expect)(document.querySelector(`.${slot.slotClassName}`)).to.toHaveComputedStyle(testStyle);
767
+ });
768
+ }
769
+ });
770
+ _vitest.it.skipIf((0, _env.isJsdom)())('overrideStyles does not replace each other in slots', async function test() {
771
+ const {
772
+ muiName,
773
+ classes,
774
+ testStateOverrides,
775
+ render,
776
+ ThemeProvider,
777
+ createTheme
778
+ } = getOptions();
779
+ if (!ThemeProvider) {
780
+ throwMissingPropError('ThemeProvider');
781
+ }
782
+ if (!createTheme) {
783
+ throwMissingPropError('createTheme');
784
+ }
785
+ const classKeys = Object.keys(classes);
786
+
787
+ // only test the component that has `root` and other classKey
788
+ if (!testStateOverrides || !classKeys.includes('root') || classKeys.length === 1) {
789
+ return;
790
+ }
791
+
792
+ // `styleKey` in some tests is `foo` or `bar`, so need to check if it is a valid classKey.
793
+ const isStyleKeyExists = classKeys.includes(testStateOverrides.styleKey);
794
+ if (!isStyleKeyExists) {
795
+ return;
796
+ }
797
+ const theme = createTheme({
798
+ components: {
799
+ [muiName]: {
800
+ styleOverrides: {
801
+ root: {
802
+ [`&.${classes.root}`]: {
803
+ filter: 'blur(1px)',
804
+ mixBlendMode: 'darken'
805
+ }
806
+ },
807
+ ...(testStateOverrides && {
808
+ [testStateOverrides.styleKey]: {
809
+ [`&.${classes.root}`]: {
810
+ mixBlendMode: 'color'
811
+ }
812
+ }
813
+ })
814
+ }
815
+ }
816
+ }
817
+ });
818
+ if (!testStateOverrides.prop) {
819
+ return;
820
+ }
821
+ await render(/*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeProvider, {
822
+ theme: theme,
823
+ children: /*#__PURE__*/React.cloneElement(element, {
824
+ [testStateOverrides.prop]: testStateOverrides.value
825
+ })
826
+ }));
827
+ (0, _chai.expect)(document.querySelector(`.${classes.root}`)).toHaveComputedStyle({
828
+ filter: 'blur(1px)',
829
+ // still valid in root
830
+ mixBlendMode: 'color' // overridden by `styleKey`
831
+ });
832
+ });
833
+ });
834
+ }
835
+
836
+ /**
837
+ * MUI theme has a components section that allows specifying custom variants.
838
+ * Components from @inheritComponent
839
+ */
840
+ function testThemeVariants(element, getOptions) {
841
+ (0, _vitest.describe)('theme variants:', () => {
842
+ _vitest.it.skipIf((0, _env.isJsdom)())("respect theme's variants", async function test() {
843
+ const {
844
+ muiName,
845
+ testVariantProps,
846
+ render,
847
+ ThemeProvider,
848
+ createTheme
849
+ } = getOptions();
850
+ if (!testVariantProps) {
851
+ throw new Error('missing testVariantProps');
852
+ }
853
+ if (!muiName) {
854
+ throwMissingPropError('muiName');
855
+ }
856
+ if (!render) {
857
+ throwMissingPropError('render');
858
+ }
859
+ if (!ThemeProvider) {
860
+ throwMissingPropError('ThemeProvider');
861
+ }
862
+ if (!createTheme) {
863
+ throwMissingPropError('createTheme');
864
+ }
865
+ const testStyle = {
866
+ mixBlendMode: 'darken'
867
+ };
868
+ const theme = createTheme({
869
+ components: {
870
+ [muiName]: {
871
+ variants: [{
872
+ props: testVariantProps,
873
+ style: testStyle
874
+ }]
875
+ }
876
+ }
877
+ });
878
+ const {
879
+ getByTestId
880
+ } = await render(/*#__PURE__*/(0, _jsxRuntime.jsxs)(ThemeProvider, {
881
+ theme: theme,
882
+ children: [/*#__PURE__*/React.cloneElement(element, {
883
+ ...testVariantProps,
884
+ 'data-testid': 'with-props'
885
+ }), /*#__PURE__*/React.cloneElement(element, {
886
+ 'data-testid': 'without-props'
887
+ })]
888
+ }));
889
+ (0, _chai.expect)(getByTestId('with-props')).to.toHaveComputedStyle(testStyle);
890
+ (0, _chai.expect)(getByTestId('without-props')).not.to.toHaveComputedStyle(testStyle);
891
+ });
892
+ _vitest.it.skipIf((0, _env.isJsdom)())('supports custom variant', async function test() {
893
+ const {
894
+ muiName,
895
+ testCustomVariant,
896
+ render,
897
+ ThemeProvider,
898
+ createTheme
899
+ } = getOptions();
900
+ if (!ThemeProvider) {
901
+ throwMissingPropError('ThemeProvider');
902
+ }
903
+ if (!createTheme) {
904
+ throwMissingPropError('createTheme');
905
+ }
906
+ if (!testCustomVariant) {
907
+ return;
908
+ }
909
+ const theme = createTheme({
910
+ components: {
911
+ [muiName]: {
912
+ styleOverrides: {
913
+ root: ({
914
+ ownerState
915
+ }) => ({
916
+ ...(ownerState.variant === 'unknown' && {
917
+ mixBlendMode: 'darken'
918
+ })
919
+ })
920
+ }
921
+ }
922
+ }
923
+ });
924
+ const {
925
+ getByTestId
926
+ } = await render(/*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeProvider, {
927
+ theme: theme,
928
+ children: /*#__PURE__*/React.cloneElement(element, {
929
+ variant: 'unknown',
930
+ 'data-testid': 'custom-variant'
931
+ })
932
+ }));
933
+ (0, _chai.expect)(getByTestId('custom-variant')).toHaveComputedStyle({
934
+ mixBlendMode: 'darken'
935
+ });
936
+ });
937
+ });
938
+ }
939
+
940
+ /**
941
+ * MUI theme supports custom palettes.
942
+ * The components that iterate over the palette via `variants` should be able to render with or without applying the custom palette styles.
943
+ */
944
+ function testThemeCustomPalette(element, getOptions) {
945
+ (0, _vitest.describe)('theme extended palette:', () => {
946
+ const {
947
+ render,
948
+ ThemeProvider,
949
+ createTheme
950
+ } = getOptions();
951
+ _vitest.it.skipIf(!(0, _env.isJsdom)() || !render || !ThemeProvider || !createTheme)('should render without errors', function test() {
952
+ var _ThemeProvider;
953
+ if (!render || !ThemeProvider || !createTheme) {
954
+ throw new Error('missing render, ThemeProvider or createTheme, should have been handled by skipIf');
955
+ }
956
+ const theme = createTheme({
957
+ palette: {
958
+ custom: {
959
+ main: '#ff5252'
960
+ },
961
+ unknown: null,
962
+ custom2: {
963
+ main: {
964
+ blue: {
965
+ dark: '#FFCC00'
966
+ }
967
+ }
968
+ }
969
+ }
970
+ });
971
+ (0, _chai.expect)(() => render(_ThemeProvider || (_ThemeProvider = /*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeProvider, {
972
+ theme: theme,
973
+ children: element
974
+ })))).not.to.throw();
975
+ });
976
+ });
977
+ }
978
+ const fullSuite = {
979
+ componentProp: testComponentProp,
980
+ componentsProp: testComponentsProp,
981
+ mergeClassName: testClassName,
982
+ propsSpread: testPropsSpread,
983
+ refForwarding: describeRef,
984
+ rootClass: testRootClass,
985
+ slotPropsProp: testSlotPropsProp,
986
+ slotPropsCallback: testSlotPropsCallback,
987
+ slotPropsCallbackWithPropsAsOwnerState: testSlotPropsCallbackWithPropsAsOwnerState,
988
+ slotsProp: testSlotsProp,
989
+ themeDefaultProps: testThemeDefaultProps,
990
+ themeStyleOverrides: testThemeStyleOverrides,
991
+ themeVariants: testThemeVariants,
992
+ themeCustomPalette: testThemeCustomPalette
993
+ };
994
+
995
+ /**
996
+ * Tests various aspects of a component that should be equal across MUI
997
+ * components.
998
+ */
999
+ function describeConformance(minimalElement, getOptions) {
1000
+ let originalMatchmedia;
1001
+ const storage = {};
1002
+ (0, _vitest.beforeEach)(() => {
1003
+ originalMatchmedia = window.matchMedia;
1004
+ // Create mocks of localStorage getItem and setItem functions
1005
+ Object.defineProperty(globalThis, 'localStorage', {
1006
+ value: {
1007
+ getItem: key => storage[key],
1008
+ setItem: (key, value) => {
1009
+ storage[key] = value;
1010
+ }
1011
+ },
1012
+ configurable: true
1013
+ });
1014
+ window.matchMedia = () => ({
1015
+ // Keep mocking legacy methods because @mui/material v5 still uses them
1016
+ addListener: () => {},
1017
+ addEventListener: () => {},
1018
+ removeListener: () => {},
1019
+ removeEventListener: () => {}
1020
+ });
1021
+ });
1022
+ (0, _vitest.afterEach)(() => {
1023
+ window.matchMedia = originalMatchmedia;
1024
+ });
1025
+ const {
1026
+ after: runAfterHook = () => {},
1027
+ only = Object.keys(fullSuite),
1028
+ slots,
1029
+ skip = []
1030
+ } = getOptions();
1031
+ let filteredTests = Object.keys(fullSuite).filter(testKey => only.includes(testKey) && !skip.includes(testKey));
1032
+ const slotBasedTests = ['slotsProp', 'slotPropsProp', 'slotPropsCallback', 'slotPropsCallbackWithPropsAsOwnerState'];
1033
+ if (!slots) {
1034
+ // if `slots` are not defined, do not run tests that depend on them
1035
+ filteredTests = filteredTests.filter(testKey => !slotBasedTests.includes(testKey));
1036
+ }
1037
+ (0, _vitest.afterAll)(runAfterHook);
1038
+ filteredTests.forEach(testKey => {
1039
+ const test = fullSuite[testKey];
1040
+ test(minimalElement, getOptions);
1041
+ });
1042
+ }
1043
+ var _default = exports.default = (0, _createDescribe.default)('MUI component API', describeConformance);