@mui/internal-test-utils 2.0.16 → 2.0.18-canary.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.
- package/CHANGELOG.md +11 -3
- package/LICENSE +1 -1
- package/README.md +52 -6
- package/chaiPlugin.d.ts +0 -1
- package/chaiPlugin.js +47 -34
- package/components.js +2 -1
- package/configure.d.ts +9 -0
- package/configure.js +16 -0
- package/createDescribe.d.ts +10 -3
- package/createDescribe.js +11 -4
- package/createRenderer.d.ts +109 -107
- package/createRenderer.js +71 -52
- package/describeConformance.d.ts +1 -5
- package/describeConformance.js +13 -8
- package/env.d.ts +9 -1
- package/env.js +13 -3
- package/esm/chaiPlugin.d.ts +0 -1
- package/esm/chaiPlugin.js +46 -34
- package/esm/components.js +2 -1
- package/esm/configure.d.ts +9 -0
- package/esm/configure.js +9 -0
- package/esm/createDescribe.d.ts +10 -3
- package/esm/createDescribe.js +10 -2
- package/esm/createRenderer.d.ts +109 -107
- package/esm/createRenderer.js +53 -47
- package/esm/describeConformance.d.ts +1 -5
- package/esm/describeConformance.js +13 -8
- package/esm/env.d.ts +9 -1
- package/esm/env.js +11 -3
- package/esm/flushMicrotasks.d.ts +1 -1
- package/esm/flushMicrotasks.js +1 -1
- package/esm/index.d.ts +4 -12
- package/esm/index.js +6 -15
- package/esm/initMatchers.d.ts +5 -1
- package/esm/initMatchers.js +5 -2
- package/esm/setupVitest.d.ts +8 -1
- package/esm/setupVitest.js +87 -21
- package/flushMicrotasks.d.ts +1 -1
- package/flushMicrotasks.js +1 -1
- package/index.d.ts +4 -12
- package/index.js +13 -27
- package/initMatchers.d.ts +5 -1
- package/initMatchers.js +21 -2
- package/package.json +31 -20
- package/setupVitest.d.ts +8 -1
- package/setupVitest.js +93 -21
- package/createDOM.d.ts +0 -2
- package/createDOM.js +0 -49
- package/createRenderer.test.d.ts +0 -1
- package/esm/createDOM.d.ts +0 -2
- package/esm/createDOM.js +0 -47
- package/esm/createRenderer.test.d.ts +0 -1
- package/esm/fireDiscreteEvent.d.ts +0 -6
- package/esm/fireDiscreteEvent.js +0 -68
- package/esm/init.d.ts +0 -1
- package/esm/init.js +0 -13
- package/esm/initMatchers.test.d.ts +0 -1
- package/esm/reactMajor.d.ts +0 -2
- package/esm/reactMajor.js +0 -2
- package/esm/setup.d.ts +0 -1
- package/esm/setup.js +0 -8
- package/esm/setupVitestBrowser.d.ts +0 -1
- package/esm/setupVitestBrowser.js +0 -30
- package/fireDiscreteEvent.d.ts +0 -6
- package/fireDiscreteEvent.js +0 -79
- package/init.d.ts +0 -1
- package/init.js +0 -15
- package/initMatchers.test.d.ts +0 -1
- package/reactMajor.d.ts +0 -2
- package/reactMajor.js +0 -9
- package/setup.d.ts +0 -1
- package/setup.js +0 -10
- package/setupVitestBrowser.d.ts +0 -1
- package/setupVitestBrowser.js +0 -34
- /package/{chai.types.d.ts → chaiTypes.d.ts} +0 -0
- /package/{chai.types.js → chaiTypes.js} +0 -0
- /package/esm/{chai.types.d.ts → chaiTypes.d.ts} +0 -0
- /package/esm/{chai.types.js → chaiTypes.js} +0 -0
package/esm/createRenderer.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { queries, RenderResult, fireEvent as rtlFireEvent, Screen, RenderOptions as TestingLibraryRenderOptions } from '@testing-library/react/pure';
|
|
1
|
+
import { queries, RenderResult, fireEvent as rtlFireEvent, Screen, RenderOptions as TestingLibraryRenderOptions } from '@testing-library/react/pure.js';
|
|
2
2
|
import { userEvent } from '@testing-library/user-event';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useFakeTimers } from 'sinon';
|
|
5
|
+
import { flushMicrotasks } from "./flushMicrotasks.js";
|
|
5
6
|
declare function queryAllDescriptionsOf(baseElement: HTMLElement, element: Element): HTMLElement[];
|
|
6
7
|
declare const customQueries: {
|
|
7
|
-
queryDescriptionOf: import("@testing-library/
|
|
8
|
+
queryDescriptionOf: import("@testing-library/dom").QueryBy<[Element]>;
|
|
8
9
|
queryAllDescriptionsOf: typeof queryAllDescriptionsOf;
|
|
9
|
-
getDescriptionOf: import("@testing-library/
|
|
10
|
-
getAllDescriptionsOf: import("@testing-library/
|
|
11
|
-
findDescriptionOf: import("@testing-library/
|
|
12
|
-
findAllDescriptionsOf: import("@testing-library/
|
|
10
|
+
getDescriptionOf: import("@testing-library/dom").GetBy<[Element]>;
|
|
11
|
+
getAllDescriptionsOf: import("@testing-library/dom").GetAllBy<[Element]>;
|
|
12
|
+
findDescriptionOf: import("@testing-library/dom").FindBy<[Element]>;
|
|
13
|
+
findAllDescriptionsOf: import("@testing-library/dom").FindAllBy<[Element]>;
|
|
13
14
|
};
|
|
14
15
|
interface RenderConfiguration extends Pick<TestingLibraryRenderOptions, 'reactStrictMode'> {
|
|
15
16
|
/**
|
|
@@ -91,6 +92,7 @@ export interface CreateRendererOptions extends Pick<RenderOptions, 'strict' | 's
|
|
|
91
92
|
clock?: 'fake' | 'real';
|
|
92
93
|
clockConfig?: ClockConfig;
|
|
93
94
|
clockOptions?: Parameters<typeof createClock>[2];
|
|
95
|
+
emotion?: boolean;
|
|
94
96
|
}
|
|
95
97
|
export declare function createRenderer(globalOptions?: CreateRendererOptions): Renderer;
|
|
96
98
|
declare const fireEvent: typeof rtlFireEvent;
|
|
@@ -100,115 +102,115 @@ export declare function fireTouchChangedEvent(target: Element, type: 'touchstart
|
|
|
100
102
|
declare function act<T>(callback: () => T | Promise<T>): Promise<T>;
|
|
101
103
|
declare function act(callback: () => void): void;
|
|
102
104
|
declare const bodyBoundQueries: {
|
|
103
|
-
getByLabelText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
104
|
-
getAllByLabelText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
105
|
-
queryByLabelText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
106
|
-
queryAllByLabelText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
107
|
-
findByLabelText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
108
|
-
findAllByLabelText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
109
|
-
getByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
110
|
-
getAllByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
111
|
-
queryByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
112
|
-
queryAllByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
113
|
-
findByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
114
|
-
findAllByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
115
|
-
getByText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
116
|
-
getAllByText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
117
|
-
queryByText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
118
|
-
queryAllByText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
119
|
-
findByText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
120
|
-
findAllByText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
121
|
-
getByAltText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
122
|
-
getAllByAltText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
123
|
-
queryByAltText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
124
|
-
queryAllByAltText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
125
|
-
findByAltText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
126
|
-
findAllByAltText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
127
|
-
getByTitle<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
128
|
-
getAllByTitle<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
129
|
-
queryByTitle<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
130
|
-
queryAllByTitle<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
131
|
-
findByTitle<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
132
|
-
findAllByTitle<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
133
|
-
getByDisplayValue<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
134
|
-
getAllByDisplayValue<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
135
|
-
queryByDisplayValue<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
136
|
-
queryAllByDisplayValue<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
137
|
-
findByDisplayValue<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
138
|
-
findAllByDisplayValue<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
139
|
-
getByRole<T extends HTMLElement = HTMLElement>(role: import("@testing-library/
|
|
140
|
-
getAllByRole<T extends HTMLElement = HTMLElement>(role: import("@testing-library/
|
|
141
|
-
queryByRole<T extends HTMLElement = HTMLElement>(role: import("@testing-library/
|
|
142
|
-
queryAllByRole<T extends HTMLElement = HTMLElement>(role: import("@testing-library/
|
|
143
|
-
findByRole<T extends HTMLElement = HTMLElement>(role: import("@testing-library/
|
|
144
|
-
findAllByRole<T extends HTMLElement = HTMLElement>(role: import("@testing-library/
|
|
145
|
-
getByTestId<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
146
|
-
getAllByTestId<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
147
|
-
queryByTestId<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
148
|
-
queryAllByTestId<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
149
|
-
findByTestId<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
150
|
-
findAllByTestId<T extends HTMLElement = HTMLElement>(id: import("@testing-library/
|
|
105
|
+
getByLabelText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): ReturnType<queries.GetByText<T>>;
|
|
106
|
+
getAllByLabelText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): ReturnType<queries.AllByText<T>>;
|
|
107
|
+
queryByLabelText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): ReturnType<queries.QueryByText<T>>;
|
|
108
|
+
queryAllByLabelText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): ReturnType<queries.AllByText<T>>;
|
|
109
|
+
findByLabelText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): ReturnType<queries.FindByText<T>>;
|
|
110
|
+
findAllByLabelText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): ReturnType<queries.FindAllByText<T>>;
|
|
111
|
+
getByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.GetByBoundAttribute<T>>;
|
|
112
|
+
getAllByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.AllByBoundAttribute<T>>;
|
|
113
|
+
queryByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.QueryByBoundAttribute<T>>;
|
|
114
|
+
queryAllByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.AllByBoundAttribute<T>>;
|
|
115
|
+
findByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): ReturnType<queries.FindByBoundAttribute<T>>;
|
|
116
|
+
findAllByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): ReturnType<queries.FindAllByBoundAttribute<T>>;
|
|
117
|
+
getByText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): ReturnType<queries.GetByText<T>>;
|
|
118
|
+
getAllByText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): ReturnType<queries.AllByText<T>>;
|
|
119
|
+
queryByText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): ReturnType<queries.QueryByText<T>>;
|
|
120
|
+
queryAllByText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined): ReturnType<queries.AllByText<T>>;
|
|
121
|
+
findByText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): ReturnType<queries.FindByText<T>>;
|
|
122
|
+
findAllByText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): ReturnType<queries.FindAllByText<T>>;
|
|
123
|
+
getByAltText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.GetByBoundAttribute<T>>;
|
|
124
|
+
getAllByAltText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.AllByBoundAttribute<T>>;
|
|
125
|
+
queryByAltText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.QueryByBoundAttribute<T>>;
|
|
126
|
+
queryAllByAltText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.AllByBoundAttribute<T>>;
|
|
127
|
+
findByAltText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): ReturnType<queries.FindByBoundAttribute<T>>;
|
|
128
|
+
findAllByAltText<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): ReturnType<queries.FindAllByBoundAttribute<T>>;
|
|
129
|
+
getByTitle<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.GetByBoundAttribute<T>>;
|
|
130
|
+
getAllByTitle<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.AllByBoundAttribute<T>>;
|
|
131
|
+
queryByTitle<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.QueryByBoundAttribute<T>>;
|
|
132
|
+
queryAllByTitle<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.AllByBoundAttribute<T>>;
|
|
133
|
+
findByTitle<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): ReturnType<queries.FindByBoundAttribute<T>>;
|
|
134
|
+
findAllByTitle<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): ReturnType<queries.FindAllByBoundAttribute<T>>;
|
|
135
|
+
getByDisplayValue<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.GetByBoundAttribute<T>>;
|
|
136
|
+
getAllByDisplayValue<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.AllByBoundAttribute<T>>;
|
|
137
|
+
queryByDisplayValue<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.QueryByBoundAttribute<T>>;
|
|
138
|
+
queryAllByDisplayValue<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.AllByBoundAttribute<T>>;
|
|
139
|
+
findByDisplayValue<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): ReturnType<queries.FindByBoundAttribute<T>>;
|
|
140
|
+
findAllByDisplayValue<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): ReturnType<queries.FindAllByBoundAttribute<T>>;
|
|
141
|
+
getByRole<T extends HTMLElement = HTMLElement>(role: import("@testing-library/dom").ByRoleMatcher, options?: queries.ByRoleOptions | undefined): ReturnType<queries.GetByRole<T>>;
|
|
142
|
+
getAllByRole<T extends HTMLElement = HTMLElement>(role: import("@testing-library/dom").ByRoleMatcher, options?: queries.ByRoleOptions | undefined): ReturnType<queries.AllByRole<T>>;
|
|
143
|
+
queryByRole<T extends HTMLElement = HTMLElement>(role: import("@testing-library/dom").ByRoleMatcher, options?: queries.ByRoleOptions | undefined): ReturnType<queries.QueryByRole<T>>;
|
|
144
|
+
queryAllByRole<T extends HTMLElement = HTMLElement>(role: import("@testing-library/dom").ByRoleMatcher, options?: queries.ByRoleOptions | undefined): ReturnType<queries.AllByRole<T>>;
|
|
145
|
+
findByRole<T extends HTMLElement = HTMLElement>(role: import("@testing-library/dom").ByRoleMatcher, options?: queries.ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): ReturnType<queries.FindByRole<T>>;
|
|
146
|
+
findAllByRole<T extends HTMLElement = HTMLElement>(role: import("@testing-library/dom").ByRoleMatcher, options?: queries.ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): ReturnType<queries.FindAllByRole<T>>;
|
|
147
|
+
getByTestId<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.GetByBoundAttribute<T>>;
|
|
148
|
+
getAllByTestId<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.AllByBoundAttribute<T>>;
|
|
149
|
+
queryByTestId<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.QueryByBoundAttribute<T>>;
|
|
150
|
+
queryAllByTestId<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined): ReturnType<queries.AllByBoundAttribute<T>>;
|
|
151
|
+
findByTestId<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): ReturnType<queries.FindByBoundAttribute<T>>;
|
|
152
|
+
findAllByTestId<T extends HTMLElement = HTMLElement>(id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined): ReturnType<queries.FindAllByBoundAttribute<T>>;
|
|
151
153
|
} & {
|
|
152
154
|
queryDescriptionOf: (args_0: Element) => HTMLElement | null;
|
|
153
155
|
queryAllDescriptionsOf: (element: Element) => HTMLElement[];
|
|
154
156
|
getDescriptionOf: (args_0: Element) => HTMLElement;
|
|
155
157
|
getAllDescriptionsOf: (args_0: Element) => HTMLElement[];
|
|
156
|
-
findDescriptionOf: (args_0: Element, args_1?: undefined, args_2?: import("@testing-library/
|
|
157
|
-
findAllDescriptionsOf: (args_0: Element, args_1?: undefined, args_2?: import("@testing-library/
|
|
158
|
-
getByLabelText: (id: import("@testing-library/
|
|
159
|
-
getAllByLabelText: (id: import("@testing-library/
|
|
160
|
-
queryByLabelText: (id: import("@testing-library/
|
|
161
|
-
queryAllByLabelText: (id: import("@testing-library/
|
|
162
|
-
findByLabelText: (id: import("@testing-library/
|
|
163
|
-
findAllByLabelText: (id: import("@testing-library/
|
|
164
|
-
getByPlaceholderText: (id: import("@testing-library/
|
|
165
|
-
getAllByPlaceholderText: (id: import("@testing-library/
|
|
166
|
-
queryByPlaceholderText: (id: import("@testing-library/
|
|
167
|
-
queryAllByPlaceholderText: (id: import("@testing-library/
|
|
168
|
-
findByPlaceholderText: (id: import("@testing-library/
|
|
169
|
-
findAllByPlaceholderText: (id: import("@testing-library/
|
|
170
|
-
getByText: (id: import("@testing-library/
|
|
171
|
-
getAllByText: (id: import("@testing-library/
|
|
172
|
-
queryByText: (id: import("@testing-library/
|
|
173
|
-
queryAllByText: (id: import("@testing-library/
|
|
174
|
-
findByText: (id: import("@testing-library/
|
|
175
|
-
findAllByText: (id: import("@testing-library/
|
|
176
|
-
getByAltText: (id: import("@testing-library/
|
|
177
|
-
getAllByAltText: (id: import("@testing-library/
|
|
178
|
-
queryByAltText: (id: import("@testing-library/
|
|
179
|
-
queryAllByAltText: (id: import("@testing-library/
|
|
180
|
-
findByAltText: (id: import("@testing-library/
|
|
181
|
-
findAllByAltText: (id: import("@testing-library/
|
|
182
|
-
getByTitle: (id: import("@testing-library/
|
|
183
|
-
getAllByTitle: (id: import("@testing-library/
|
|
184
|
-
queryByTitle: (id: import("@testing-library/
|
|
185
|
-
queryAllByTitle: (id: import("@testing-library/
|
|
186
|
-
findByTitle: (id: import("@testing-library/
|
|
187
|
-
findAllByTitle: (id: import("@testing-library/
|
|
188
|
-
getByDisplayValue: (id: import("@testing-library/
|
|
189
|
-
getAllByDisplayValue: (id: import("@testing-library/
|
|
190
|
-
queryByDisplayValue: (id: import("@testing-library/
|
|
191
|
-
queryAllByDisplayValue: (id: import("@testing-library/
|
|
192
|
-
findByDisplayValue: (id: import("@testing-library/
|
|
193
|
-
findAllByDisplayValue: (id: import("@testing-library/
|
|
194
|
-
getByRole: (role: import("@testing-library/
|
|
195
|
-
getAllByRole: (role: import("@testing-library/
|
|
196
|
-
queryByRole: (role: import("@testing-library/
|
|
197
|
-
queryAllByRole: (role: import("@testing-library/
|
|
198
|
-
findByRole: (role: import("@testing-library/
|
|
199
|
-
findAllByRole: (role: import("@testing-library/
|
|
200
|
-
getByTestId: (id: import("@testing-library/
|
|
201
|
-
getAllByTestId: (id: import("@testing-library/
|
|
202
|
-
queryByTestId: (id: import("@testing-library/
|
|
203
|
-
queryAllByTestId: (id: import("@testing-library/
|
|
204
|
-
findByTestId: (id: import("@testing-library/
|
|
205
|
-
findAllByTestId: (id: import("@testing-library/
|
|
158
|
+
findDescriptionOf: (args_0: Element, args_1?: undefined, args_2?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
159
|
+
findAllDescriptionsOf: (args_0: Element, args_1?: undefined, args_2?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
160
|
+
getByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement;
|
|
161
|
+
getAllByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
162
|
+
queryByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement | null;
|
|
163
|
+
queryAllByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
164
|
+
findByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
165
|
+
findAllByLabelText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
166
|
+
getByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement;
|
|
167
|
+
getAllByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
|
168
|
+
queryByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null;
|
|
169
|
+
queryAllByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
|
170
|
+
findByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
171
|
+
findAllByPlaceholderText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
172
|
+
getByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement;
|
|
173
|
+
getAllByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
174
|
+
queryByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement | null;
|
|
175
|
+
queryAllByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
176
|
+
findByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
177
|
+
findAllByText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
178
|
+
getByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement;
|
|
179
|
+
getAllByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
|
180
|
+
queryByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null;
|
|
181
|
+
queryAllByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
|
182
|
+
findByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
183
|
+
findAllByAltText: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
184
|
+
getByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement;
|
|
185
|
+
getAllByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
|
186
|
+
queryByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null;
|
|
187
|
+
queryAllByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
|
188
|
+
findByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
189
|
+
findAllByTitle: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
190
|
+
getByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement;
|
|
191
|
+
getAllByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
|
192
|
+
queryByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null;
|
|
193
|
+
queryAllByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
|
194
|
+
findByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
195
|
+
findAllByDisplayValue: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
196
|
+
getByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: queries.ByRoleOptions | undefined) => HTMLElement;
|
|
197
|
+
getAllByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: queries.ByRoleOptions | undefined) => HTMLElement[];
|
|
198
|
+
queryByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: queries.ByRoleOptions | undefined) => HTMLElement | null;
|
|
199
|
+
queryAllByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: queries.ByRoleOptions | undefined) => HTMLElement[];
|
|
200
|
+
findByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: queries.ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
201
|
+
findAllByRole: (role: import("@testing-library/dom").ByRoleMatcher, options?: queries.ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
202
|
+
getByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement;
|
|
203
|
+
getAllByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
|
204
|
+
queryByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement | null;
|
|
205
|
+
queryAllByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined) => HTMLElement[];
|
|
206
|
+
findByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
207
|
+
findAllByTestId: (id: import("@testing-library/dom").Matcher, options?: import("@testing-library/dom").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/dom").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
206
208
|
};
|
|
207
|
-
export { renderHook, waitFor, within, createEvent, type RenderHookResult, type EventType } from '@testing-library/react/pure';
|
|
209
|
+
export { configure, render, renderHook, waitFor, within, cleanup, createEvent, type RenderHookResult, type EventType } from '@testing-library/react/pure.js';
|
|
208
210
|
export { act, fireEvent };
|
|
209
211
|
export declare const screen: Screen & typeof bodyBoundQueries;
|
|
210
|
-
export declare
|
|
212
|
+
export declare const flushEffects: typeof flushMicrotasks;
|
|
211
213
|
/**
|
|
212
|
-
* returns true when touch is
|
|
214
|
+
* returns true when touch is supported and can be mocked
|
|
213
215
|
*/
|
|
214
216
|
export declare function supportsTouch(): boolean;
|
package/esm/createRenderer.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { buildQueries, cleanup, prettyDOM, queries, act as rtlAct, fireEvent as rtlFireEvent, screen as rtlScreen, render as testingLibraryRender, within } from '@testing-library/react/pure';
|
|
1
|
+
import { buildQueries, prettyDOM, queries, act as rtlAct, fireEvent as rtlFireEvent, screen as rtlScreen, render as testingLibraryRender, within
|
|
2
|
+
// eslint-disable-next-line import/extensions
|
|
3
|
+
} from '@testing-library/react/pure.js';
|
|
5
4
|
import { userEvent } from '@testing-library/user-event';
|
|
6
5
|
import * as React from 'react';
|
|
7
6
|
import * as ReactDOMServer from 'react-dom/server';
|
|
8
|
-
import { beforeEach, afterEach, beforeAll, vi
|
|
9
|
-
import reactMajor from "./
|
|
7
|
+
import { beforeEach, afterEach, beforeAll, vi } from 'vitest';
|
|
8
|
+
import { reactMajor } from "./env.js";
|
|
9
|
+
import { flushMicrotasks } from "./flushMicrotasks.js";
|
|
10
|
+
import { config as utilsConfig } from "./configure.js";
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
function queryAllDescriptionsOf(baseElement, element) {
|
|
12
13
|
const ariaDescribedBy = element.getAttribute('aria-describedby');
|
|
@@ -106,14 +107,6 @@ function createClock(defaultMode, config, options) {
|
|
|
106
107
|
}
|
|
107
108
|
});
|
|
108
109
|
}
|
|
109
|
-
afterEach(async () => {
|
|
110
|
-
if (vi.isFakeTimers()) {
|
|
111
|
-
await rtlAct(async () => {
|
|
112
|
-
vi.runOnlyPendingTimers();
|
|
113
|
-
});
|
|
114
|
-
vi.useRealTimers();
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
110
|
return {
|
|
118
111
|
withFakeTimers: () => {
|
|
119
112
|
if (vi.isFakeTimers()) {
|
|
@@ -163,7 +156,8 @@ export function createRenderer(globalOptions = {}) {
|
|
|
163
156
|
clockConfig,
|
|
164
157
|
strict: globalStrict = true,
|
|
165
158
|
strictEffects: globalStrictEffects = globalStrict,
|
|
166
|
-
clockOptions
|
|
159
|
+
clockOptions,
|
|
160
|
+
emotion = utilsConfig.emotion
|
|
167
161
|
} = globalOptions;
|
|
168
162
|
// save stack to re-use in test-hooks
|
|
169
163
|
const {
|
|
@@ -189,7 +183,10 @@ export function createRenderer(globalOptions = {}) {
|
|
|
189
183
|
* For legacy reasons `configuredClientRender` might accidentally be called in a beforeAll(Each) hook.
|
|
190
184
|
*/
|
|
191
185
|
let prepared = false;
|
|
192
|
-
|
|
186
|
+
let EmotionCacheProvider = null;
|
|
187
|
+
beforeEach(async ({
|
|
188
|
+
expect
|
|
189
|
+
}) => {
|
|
193
190
|
if (!wasCalledInSuite) {
|
|
194
191
|
const error = new Error('Unable to run `before` hook for `createRenderer`. This usually indicates that `createRenderer` was called in a `before` hook instead of in a `describe()` block.');
|
|
195
192
|
error.stack = createClientRenderStack;
|
|
@@ -199,27 +196,33 @@ export function createRenderer(globalOptions = {}) {
|
|
|
199
196
|
if (!id) {
|
|
200
197
|
throw new Error('Unable to find the currently running test. This is a bug with the client-renderer. Please report this issue to a maintainer.');
|
|
201
198
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
199
|
+
if (emotion) {
|
|
200
|
+
// Avoid loading emotion unless needed, this allows us to make emotion an optional peerDependency
|
|
201
|
+
const [{
|
|
202
|
+
default: createEmotionCache
|
|
203
|
+
}, {
|
|
204
|
+
CacheProvider
|
|
205
|
+
}] = await Promise.all([import('@emotion/cache'), import('@emotion/react')]);
|
|
206
|
+
EmotionCacheProvider = CacheProvider;
|
|
207
|
+
emotionCache = createEmotionCache({
|
|
208
|
+
key: 'emotion-client-render'
|
|
209
|
+
});
|
|
210
|
+
}
|
|
205
211
|
serverContainer = document.createElement('div');
|
|
206
212
|
document.body.appendChild(serverContainer);
|
|
207
213
|
prepared = true;
|
|
208
214
|
});
|
|
209
215
|
afterEach(() => {
|
|
210
|
-
if (
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
216
|
+
if (emotionCache) {
|
|
217
|
+
emotionCache.sheet.tags.forEach(styleTag => {
|
|
218
|
+
styleTag.remove();
|
|
219
|
+
});
|
|
220
|
+
emotionCache = null;
|
|
221
|
+
}
|
|
222
|
+
if (serverContainer) {
|
|
223
|
+
serverContainer.remove();
|
|
224
|
+
serverContainer = null;
|
|
215
225
|
}
|
|
216
|
-
cleanup();
|
|
217
|
-
emotionCache.sheet.tags.forEach(styleTag => {
|
|
218
|
-
styleTag.remove();
|
|
219
|
-
});
|
|
220
|
-
emotionCache = null;
|
|
221
|
-
serverContainer.remove();
|
|
222
|
-
serverContainer = null;
|
|
223
226
|
});
|
|
224
227
|
function createWrapper(options) {
|
|
225
228
|
const {
|
|
@@ -228,12 +231,16 @@ export function createRenderer(globalOptions = {}) {
|
|
|
228
231
|
return function Wrapper({
|
|
229
232
|
children
|
|
230
233
|
}) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
children: /*#__PURE__*/_jsx(InnerWrapper, {
|
|
234
|
-
children: children
|
|
235
|
-
})
|
|
234
|
+
let result = /*#__PURE__*/_jsx(InnerWrapper, {
|
|
235
|
+
children: children
|
|
236
236
|
});
|
|
237
|
+
if (EmotionCacheProvider) {
|
|
238
|
+
result = /*#__PURE__*/_jsx(EmotionCacheProvider, {
|
|
239
|
+
value: emotionCache,
|
|
240
|
+
children: result
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
return result;
|
|
237
244
|
};
|
|
238
245
|
}
|
|
239
246
|
return {
|
|
@@ -267,12 +274,8 @@ export function createRenderer(globalOptions = {}) {
|
|
|
267
274
|
}
|
|
268
275
|
};
|
|
269
276
|
}
|
|
270
|
-
const fireEvent = (target, event, ...args) =>
|
|
271
|
-
|
|
272
|
-
};
|
|
273
|
-
Object.keys(rtlFireEvent).forEach(
|
|
274
|
-
// @ts-expect-error
|
|
275
|
-
eventType => {
|
|
277
|
+
const fireEvent = (target, event, ...args) => rtlFireEvent(target, event, ...args);
|
|
278
|
+
Object.keys(rtlFireEvent).forEach(eventType => {
|
|
276
279
|
fireEvent[eventType] = (...args) => rtlFireEvent[eventType](...args);
|
|
277
280
|
});
|
|
278
281
|
const originalFireEventKeyDown = rtlFireEvent.keyDown;
|
|
@@ -356,18 +359,21 @@ const bodyBoundQueries = within(document.body, {
|
|
|
356
359
|
...queries,
|
|
357
360
|
...customQueries
|
|
358
361
|
});
|
|
359
|
-
export { renderHook, waitFor, within, createEvent
|
|
362
|
+
export { configure, render, renderHook, waitFor, within, cleanup, createEvent
|
|
363
|
+
|
|
364
|
+
// eslint-disable-next-line import/extensions
|
|
365
|
+
} from '@testing-library/react/pure.js';
|
|
360
366
|
export { act, fireEvent };
|
|
361
367
|
export const screen = {
|
|
362
368
|
...rtlScreen,
|
|
363
369
|
...bodyBoundQueries
|
|
364
370
|
};
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
371
|
+
|
|
372
|
+
// @deprecated use flushMicrotasks instead
|
|
373
|
+
export const flushEffects = flushMicrotasks;
|
|
368
374
|
|
|
369
375
|
/**
|
|
370
|
-
* returns true when touch is
|
|
376
|
+
* returns true when touch is supported and can be mocked
|
|
371
377
|
*/
|
|
372
378
|
export function supportsTouch() {
|
|
373
379
|
// only run in supported browsers
|
|
@@ -192,9 +192,5 @@ declare const fullSuite: {
|
|
|
192
192
|
themeVariants: typeof testThemeVariants;
|
|
193
193
|
themeCustomPalette: typeof testThemeCustomPalette;
|
|
194
194
|
};
|
|
195
|
-
declare const _default:
|
|
196
|
-
(minimalElement: React.ReactElement<any, string | React.JSXElementConstructor<any>>, getOptions: () => ConformanceOptions): void;
|
|
197
|
-
skip: (minimalElement: React.ReactElement<any, string | React.JSXElementConstructor<any>>, getOptions: () => ConformanceOptions) => void;
|
|
198
|
-
only: (minimalElement: React.ReactElement<any, string | React.JSXElementConstructor<any>>, getOptions: () => ConformanceOptions) => void;
|
|
199
|
-
};
|
|
195
|
+
declare const _default: import("./createDescribe.js").MUIDescribe<[minimalElement: React.ReactElement<any, string | React.JSXElementConstructor<any>>, getOptions: () => ConformanceOptions]>;
|
|
200
196
|
export default _default;
|
|
@@ -2,6 +2,7 @@ import { expect } from 'chai';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { describe, it, afterAll, afterEach, beforeEach } from 'vitest';
|
|
4
4
|
import createDescribe from "./createDescribe.js";
|
|
5
|
+
import { isJsdom } from "./env.js";
|
|
5
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
7
|
function capitalize(string) {
|
|
7
8
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
@@ -208,6 +209,7 @@ function testSlotsProp(element, getOptions) {
|
|
|
208
209
|
"data-testid": "custom",
|
|
209
210
|
children: children
|
|
210
211
|
}));
|
|
212
|
+
if (process.env.NODE_ENV !== "production") CustomComponent.displayName = "CustomComponent";
|
|
211
213
|
forEachSlot(slots, (slotName, slotOptions) => {
|
|
212
214
|
it(`allows overriding the ${slotName} slot with a component using the slots.${slotName} prop`, async () => {
|
|
213
215
|
if (!render) {
|
|
@@ -294,6 +296,7 @@ function testSlotsProp(element, getOptions) {
|
|
|
294
296
|
children: children
|
|
295
297
|
});
|
|
296
298
|
});
|
|
299
|
+
if (process.env.NODE_ENV !== "production") ComponentForComponentsProp.displayName = "ComponentForComponentsProp";
|
|
297
300
|
const ComponentForSlotsProp = /*#__PURE__*/React.forwardRef(({
|
|
298
301
|
children
|
|
299
302
|
}, ref) => {
|
|
@@ -304,6 +307,7 @@ function testSlotsProp(element, getOptions) {
|
|
|
304
307
|
children: children
|
|
305
308
|
});
|
|
306
309
|
});
|
|
310
|
+
if (process.env.NODE_ENV !== "production") ComponentForSlotsProp.displayName = "ComponentForSlotsProp";
|
|
307
311
|
const components = {
|
|
308
312
|
[capitalize(slotName)]: ComponentForComponentsProp
|
|
309
313
|
};
|
|
@@ -608,7 +612,7 @@ function testThemeDefaultProps(element, getOptions) {
|
|
|
608
612
|
*/
|
|
609
613
|
function testThemeStyleOverrides(element, getOptions) {
|
|
610
614
|
describe('theme style overrides:', () => {
|
|
611
|
-
it.skipIf(
|
|
615
|
+
it.skipIf(isJsdom())("respect theme's styleOverrides custom state", async function test() {
|
|
612
616
|
const {
|
|
613
617
|
muiName,
|
|
614
618
|
testStateOverrides,
|
|
@@ -656,7 +660,7 @@ function testThemeStyleOverrides(element, getOptions) {
|
|
|
656
660
|
}));
|
|
657
661
|
expect(container.firstChild).to.toHaveComputedStyle(testStyle);
|
|
658
662
|
});
|
|
659
|
-
it.skipIf(
|
|
663
|
+
it.skipIf(isJsdom())("respect theme's styleOverrides slots", async function test() {
|
|
660
664
|
const {
|
|
661
665
|
muiName,
|
|
662
666
|
testDeepOverrides,
|
|
@@ -749,7 +753,7 @@ function testThemeStyleOverrides(element, getOptions) {
|
|
|
749
753
|
});
|
|
750
754
|
}
|
|
751
755
|
});
|
|
752
|
-
it.skipIf(
|
|
756
|
+
it.skipIf(isJsdom())('overrideStyles does not replace each other in slots', async function test() {
|
|
753
757
|
const {
|
|
754
758
|
muiName,
|
|
755
759
|
classes,
|
|
@@ -821,7 +825,7 @@ function testThemeStyleOverrides(element, getOptions) {
|
|
|
821
825
|
*/
|
|
822
826
|
function testThemeVariants(element, getOptions) {
|
|
823
827
|
describe('theme variants:', () => {
|
|
824
|
-
it.skipIf(
|
|
828
|
+
it.skipIf(isJsdom())("respect theme's variants", async function test() {
|
|
825
829
|
const {
|
|
826
830
|
muiName,
|
|
827
831
|
testVariantProps,
|
|
@@ -871,7 +875,7 @@ function testThemeVariants(element, getOptions) {
|
|
|
871
875
|
expect(getByTestId('with-props')).to.toHaveComputedStyle(testStyle);
|
|
872
876
|
expect(getByTestId('without-props')).not.to.toHaveComputedStyle(testStyle);
|
|
873
877
|
});
|
|
874
|
-
it.skipIf(
|
|
878
|
+
it.skipIf(isJsdom())('supports custom variant', async function test() {
|
|
875
879
|
const {
|
|
876
880
|
muiName,
|
|
877
881
|
testCustomVariant,
|
|
@@ -930,9 +934,11 @@ function testThemeCustomPalette(element, getOptions) {
|
|
|
930
934
|
ThemeProvider,
|
|
931
935
|
createTheme
|
|
932
936
|
} = getOptions();
|
|
933
|
-
it.skipIf(!
|
|
937
|
+
it.skipIf(!isJsdom() || !render || !ThemeProvider || !createTheme)('should render without errors', function test() {
|
|
934
938
|
var _ThemeProvider;
|
|
935
|
-
|
|
939
|
+
if (!render || !ThemeProvider || !createTheme) {
|
|
940
|
+
throw new Error('missing render, ThemeProvider or createTheme, should have been handled by skipIf');
|
|
941
|
+
}
|
|
936
942
|
const theme = createTheme({
|
|
937
943
|
palette: {
|
|
938
944
|
custom: {
|
|
@@ -948,7 +954,6 @@ function testThemeCustomPalette(element, getOptions) {
|
|
|
948
954
|
}
|
|
949
955
|
}
|
|
950
956
|
});
|
|
951
|
-
// @ts-ignore
|
|
952
957
|
expect(() => render(_ThemeProvider || (_ThemeProvider = /*#__PURE__*/_jsx(ThemeProvider, {
|
|
953
958
|
theme: theme,
|
|
954
959
|
children: element
|
package/esm/env.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
export declare function isJsdom(): boolean;
|
|
1
|
+
export declare function isJsdom(): boolean;
|
|
2
|
+
export declare const reactMajor: number;
|
|
3
|
+
/**
|
|
4
|
+
* Set to true if console logs during [lifecycles that are invoked twice in `React.StrictMode`](https://reactjs.org/docs/strict-mode.html#detecting-unexpected-side-effects) are suppressed.
|
|
5
|
+
* Useful for asserting on `console.warn` or `console.error` via `toErrorDev()`.
|
|
6
|
+
* TODO: Refactor to use reactMajor when fixing the React 17 cron test.
|
|
7
|
+
* https://github.com/mui/material-ui/issues/43153
|
|
8
|
+
*/
|
|
9
|
+
export declare const strictModeDoubleLoggingSuppressed: boolean;
|