@react-spectrum/test-utils 1.0.0-beta.3 → 1.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -0
- package/dist/import.mjs +3 -3
- package/dist/main.js +4 -4
- package/dist/module.js +3 -3
- package/dist/{testSetup.main.js → private/testSetup.cjs} +8 -6
- package/dist/private/testSetup.cjs.map +1 -0
- package/dist/{testSetup.mjs → private/testSetup.js} +7 -5
- package/dist/private/testSetup.js.map +1 -0
- package/dist/types/src/index.d.ts +2 -0
- package/dist/{types.d.ts → types/src/testSetup.d.ts} +8 -7
- package/package.json +27 -23
- package/src/testSetup.ts +9 -3
- package/dist/testSetup.main.js.map +0 -1
- package/dist/testSetup.module.js +0 -23
- package/dist/testSetup.module.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,3 +1,74 @@
|
|
|
1
1
|
# @react-spectrum/test-utils
|
|
2
2
|
|
|
3
3
|
This package is part of [react-spectrum](https://github.com/adobe/react-spectrum). See the repo for more details.
|
|
4
|
+
|
|
5
|
+
See the [React Spectrum testing docs](https://react-spectrum.adobe.com/testing#react-spectrum-test-utils) for usage.
|
|
6
|
+
|
|
7
|
+
`@react-spectrum/test-utils` re-exports the same test utils available in `@react-aria/test-utils`, including the ARIA pattern testers. These testers are a set of testing utilities that aim to make writing unit tests easier for consumers of React Spectrum.
|
|
8
|
+
|
|
9
|
+
In addition to the re-exports, this package provides `simulateMobile` and `simulateDesktop` helpers for switching between mobile and desktop component variants in your tests (Jest only).
|
|
10
|
+
|
|
11
|
+
> **Requirements:** This library uses [@testing-library/dom@10](https://www.npmjs.com/package/@testing-library/dom) and [@testing-library/user-event@14](https://www.npmjs.com/package/@testing-library/user-event). You need to be on React 18+ for these utilities to work.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
npm install @react-spectrum/test-utils --dev
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Setup
|
|
20
|
+
|
|
21
|
+
Initialize a `User` object at the top of your test file, and use it to create an ARIA pattern tester in your test cases. The tester has methods that you can call within your test to query for specific subcomponents or simulate common interactions.
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
// YourTest.test.ts
|
|
25
|
+
import {screen} from '@testing-library/react';
|
|
26
|
+
import {User} from '@react-spectrum/test-utils';
|
|
27
|
+
|
|
28
|
+
// Provide whatever method of advancing timers you use in your test, this example assumes Jest with fake timers.
|
|
29
|
+
// 'interactionType' specifies what mode of interaction should be simulated by the tester
|
|
30
|
+
// 'advanceTimer' is used by the tester to advance the timers in the tests for specific interactions (e.g. long press)
|
|
31
|
+
let testUtilUser = new User({interactionType: 'mouse', advanceTimer: jest.advanceTimersByTime});
|
|
32
|
+
// ...
|
|
33
|
+
|
|
34
|
+
it('my test case', async function () {
|
|
35
|
+
// Render your test component/app
|
|
36
|
+
render();
|
|
37
|
+
// Initialize the table tester via providing the 'Table' pattern name and the root element of said table
|
|
38
|
+
let table = testUtilUser.createTester('Table', {root: screen.getByTestId('test_table')});
|
|
39
|
+
|
|
40
|
+
// ...
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## User API
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
class User {
|
|
48
|
+
constructor(opts?: {
|
|
49
|
+
interactionType?: 'mouse' | 'keyboard' | 'touch',
|
|
50
|
+
advanceTimer?: (time?: number) => void | Promise<unknown>
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
createTester(patternName, opts): PatternTester;
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- `interactionType` — default modality used by testers created from this `User`. Individual testers can override this via `setInteractionType` or per-method options.
|
|
58
|
+
- `advanceTimer` — used by testers to advance timers for interactions like long press. Pass `jest.advanceTimersByTime` (or your test framework's equivalent) when using fake timers.
|
|
59
|
+
- `createTester(patternName, opts)` — returns a tester for the given ARIA pattern. `opts.root` is the root element of the component under test.
|
|
60
|
+
|
|
61
|
+
## Patterns
|
|
62
|
+
|
|
63
|
+
Below is a list of the ARIA patterns supported by `createTester`. See the accompanying component testing docs pages on the [React Spectrum docs site](https://react-spectrum.adobe.com/testing#react-spectrum-test-utils) for sample usage of each tester in a test suite.
|
|
64
|
+
|
|
65
|
+
- [CheckboxGroup](https://react-spectrum.adobe.com/CheckboxGroup/testing)
|
|
66
|
+
- [ComboBox](https://react-spectrum.adobe.com/ComboBox/testing)
|
|
67
|
+
- [Dialog](https://react-spectrum.adobe.com/Dialog/testing)
|
|
68
|
+
- [ListView](https://react-spectrum.adobe.com/ListView/testing)
|
|
69
|
+
- [Menu](https://react-spectrum.adobe.com/Menu/testing)
|
|
70
|
+
- [Picker](https://react-spectrum.adobe.com/Picker/testing)
|
|
71
|
+
- [RadioGroup](https://react-spectrum.adobe.com/RadioGroup/testing)
|
|
72
|
+
- [TableView](https://react-spectrum.adobe.com/TableView/testing)
|
|
73
|
+
- [Tabs](https://react-spectrum.adobe.com/Tabs/testing)
|
|
74
|
+
- [TreeView](https://react-spectrum.adobe.com/TreeView/testing)
|
package/dist/import.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {simulateMobile as $
|
|
2
|
-
import * as $
|
|
1
|
+
import {simulateMobile as $7050032d7d4fd4c3$export$54df5c253b80fcbe, simulateDesktop as $7050032d7d4fd4c3$export$ff7d7f7ce6432302} from "./private/testSetup.js";
|
|
2
|
+
import * as $4eaVR$reactariatestutils from "@react-aria/test-utils";
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
5
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -16,5 +16,5 @@ import * as $bJdOA$reactariatestutils from "@react-aria/test-utils";
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
export {$
|
|
19
|
+
export {$7050032d7d4fd4c3$export$54df5c253b80fcbe as simulateMobile, $7050032d7d4fd4c3$export$ff7d7f7ce6432302 as simulateDesktop};
|
|
20
20
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
1
|
+
var $e67bb2a716bef3a9$exports = require("./private/testSetup.cjs");
|
|
2
|
+
var $4Wi86$reactariatestutils = require("@react-aria/test-utils");
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
function $parcel$exportWildcard(dest, source) {
|
|
@@ -31,8 +31,8 @@ function $parcel$exportWildcard(dest, source) {
|
|
|
31
31
|
*/ /// <reference types="css-module-types" />
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
$parcel$exportWildcard(module.exports, $
|
|
35
|
-
$parcel$exportWildcard(module.exports, $
|
|
34
|
+
$parcel$exportWildcard(module.exports, $4Wi86$reactariatestutils);
|
|
35
|
+
$parcel$exportWildcard(module.exports, $e67bb2a716bef3a9$exports);
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
//# sourceMappingURL=main.js.map
|
package/dist/module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {simulateMobile as $
|
|
2
|
-
import * as $
|
|
1
|
+
import {simulateMobile as $7050032d7d4fd4c3$export$54df5c253b80fcbe, simulateDesktop as $7050032d7d4fd4c3$export$ff7d7f7ce6432302} from "./private/testSetup.js";
|
|
2
|
+
import * as $4eaVR$reactariatestutils from "@react-aria/test-utils";
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
5
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -16,5 +16,5 @@ import * as $bJdOA$reactariatestutils from "@react-aria/test-utils";
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
export {$
|
|
19
|
+
export {$7050032d7d4fd4c3$export$54df5c253b80fcbe as simulateMobile, $7050032d7d4fd4c3$export$ff7d7f7ce6432302 as simulateDesktop};
|
|
20
20
|
//# sourceMappingURL=module.js.map
|
|
@@ -3,8 +3,8 @@ function $parcel$export(e, n, v, s) {
|
|
|
3
3
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
$parcel$export(module.exports, "simulateMobile", ()
|
|
7
|
-
$parcel$export(module.exports, "simulateDesktop", ()
|
|
6
|
+
$parcel$export(module.exports, "simulateMobile", function () { return $e67bb2a716bef3a9$export$54df5c253b80fcbe; });
|
|
7
|
+
$parcel$export(module.exports, "simulateDesktop", function () { return $e67bb2a716bef3a9$export$ff7d7f7ce6432302; });
|
|
8
8
|
/*
|
|
9
9
|
* Copyright 2023 Adobe. All rights reserved.
|
|
10
10
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -17,13 +17,15 @@ $parcel$export(module.exports, "simulateDesktop", () => $4a49f14ca150c145$export
|
|
|
17
17
|
* governing permissions and limitations under the License.
|
|
18
18
|
*/ /**
|
|
19
19
|
* Mocks screen width to simulate mobile experience, useful for testing Tray rendering.
|
|
20
|
-
*
|
|
21
|
-
|
|
20
|
+
*
|
|
21
|
+
* @param width Optional width to apply. Automatically clamped to the maximum value allowed for
|
|
22
|
+
* mobile rendering.
|
|
23
|
+
*/ function $e67bb2a716bef3a9$export$54df5c253b80fcbe(width = 700) {
|
|
22
24
|
jest.spyOn(window.screen, 'width', 'get').mockImplementation(()=>Math.min(Math.max(width, 0), 700));
|
|
23
25
|
}
|
|
24
|
-
function $
|
|
26
|
+
function $e67bb2a716bef3a9$export$ff7d7f7ce6432302(width = 701) {
|
|
25
27
|
jest.spyOn(window.screen, 'width', 'get').mockImplementation(()=>Math.max(width, 701));
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
|
|
29
|
-
//# sourceMappingURL=testSetup.
|
|
31
|
+
//# sourceMappingURL=testSetup.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC,GAED;;;;;CAKC,GACM,SAAS,0CAAe,QAAgB,GAAG;IAChD,KACG,KAAK,CAAC,OAAO,MAAM,EAAE,SAAS,OAC9B,kBAAkB,CAAC,IAAM,KAAK,GAAG,CAAC,KAAK,GAAG,CAAC,OAAO,IAAI;AAC3D;AAQO,SAAS,0CAAgB,QAAgB,GAAG;IACjD,KAAK,KAAK,CAAC,OAAO,MAAM,EAAE,SAAS,OAAO,kBAAkB,CAAC,IAAM,KAAK,GAAG,CAAC,OAAO;AACrF","sources":["packages/@react-spectrum/test-utils/src/testSetup.ts"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/**\n * Mocks screen width to simulate mobile experience, useful for testing Tray rendering.\n *\n * @param width Optional width to apply. Automatically clamped to the maximum value allowed for\n * mobile rendering.\n */\nexport function simulateMobile(width: number = 700): void {\n jest\n .spyOn(window.screen, 'width', 'get')\n .mockImplementation(() => Math.min(Math.max(width, 0), 700));\n}\n\n/**\n * Mocks screen width to simulate standard desktop experience.\n *\n * @param width Optional width to apply. Automatically clamped to the minimum value allowed for\n * desktop rendering.\n */\nexport function simulateDesktop(width: number = 701): void {\n jest.spyOn(window.screen, 'width', 'get').mockImplementation(() => Math.max(width, 701));\n}\n"],"names":[],"version":3,"file":"testSetup.cjs.map"}
|
|
@@ -10,14 +10,16 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/ /**
|
|
12
12
|
* Mocks screen width to simulate mobile experience, useful for testing Tray rendering.
|
|
13
|
-
*
|
|
14
|
-
|
|
13
|
+
*
|
|
14
|
+
* @param width Optional width to apply. Automatically clamped to the maximum value allowed for
|
|
15
|
+
* mobile rendering.
|
|
16
|
+
*/ function $7050032d7d4fd4c3$export$54df5c253b80fcbe(width = 700) {
|
|
15
17
|
jest.spyOn(window.screen, 'width', 'get').mockImplementation(()=>Math.min(Math.max(width, 0), 700));
|
|
16
18
|
}
|
|
17
|
-
function $
|
|
19
|
+
function $7050032d7d4fd4c3$export$ff7d7f7ce6432302(width = 701) {
|
|
18
20
|
jest.spyOn(window.screen, 'width', 'get').mockImplementation(()=>Math.max(width, 701));
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
|
|
22
|
-
export {$
|
|
23
|
-
//# sourceMappingURL=testSetup.
|
|
24
|
+
export {$7050032d7d4fd4c3$export$54df5c253b80fcbe as simulateMobile, $7050032d7d4fd4c3$export$ff7d7f7ce6432302 as simulateDesktop};
|
|
25
|
+
//# sourceMappingURL=testSetup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA;;;;;;;;;;CAUC,GAED;;;;;CAKC,GACM,SAAS,0CAAe,QAAgB,GAAG;IAChD,KACG,KAAK,CAAC,OAAO,MAAM,EAAE,SAAS,OAC9B,kBAAkB,CAAC,IAAM,KAAK,GAAG,CAAC,KAAK,GAAG,CAAC,OAAO,IAAI;AAC3D;AAQO,SAAS,0CAAgB,QAAgB,GAAG;IACjD,KAAK,KAAK,CAAC,OAAO,MAAM,EAAE,SAAS,OAAO,kBAAkB,CAAC,IAAM,KAAK,GAAG,CAAC,OAAO;AACrF","sources":["packages/@react-spectrum/test-utils/src/testSetup.ts"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/**\n * Mocks screen width to simulate mobile experience, useful for testing Tray rendering.\n *\n * @param width Optional width to apply. Automatically clamped to the maximum value allowed for\n * mobile rendering.\n */\nexport function simulateMobile(width: number = 700): void {\n jest\n .spyOn(window.screen, 'width', 'get')\n .mockImplementation(() => Math.min(Math.max(width, 0), 700));\n}\n\n/**\n * Mocks screen width to simulate standard desktop experience.\n *\n * @param width Optional width to apply. Automatically clamped to the minimum value allowed for\n * desktop rendering.\n */\nexport function simulateDesktop(width: number = 701): void {\n jest.spyOn(window.screen, 'width', 'get').mockImplementation(() => Math.max(width, 701));\n}\n"],"names":[],"version":3,"file":"testSetup.js.map"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Mocks screen width to simulate mobile experience, useful for testing Tray rendering.
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* @param width Optional width to apply. Automatically clamped to the maximum value allowed for
|
|
5
|
+
* mobile rendering.
|
|
4
6
|
*/
|
|
5
|
-
export function simulateMobile(width?: number): void;
|
|
7
|
+
export declare function simulateMobile(width?: number): void;
|
|
6
8
|
/**
|
|
7
9
|
* Mocks screen width to simulate standard desktop experience.
|
|
8
|
-
*
|
|
10
|
+
*
|
|
11
|
+
* @param width Optional width to apply. Automatically clamped to the minimum value allowed for
|
|
12
|
+
* desktop rendering.
|
|
9
13
|
*/
|
|
10
|
-
export function simulateDesktop(width?: number): void;
|
|
11
|
-
export * from '@react-aria/test-utils';
|
|
12
|
-
|
|
13
|
-
//# sourceMappingURL=types.d.ts.map
|
|
14
|
+
export declare function simulateDesktop(width?: number): void;
|
package/package.json
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/test-utils",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-rc.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"source": "./src/index.ts",
|
|
10
|
-
"types": [
|
|
11
|
-
"./dist/types.d.ts",
|
|
12
|
-
"./src/index.ts"
|
|
13
|
-
],
|
|
14
|
-
"import": "./dist/import.mjs",
|
|
15
|
-
"require": "./dist/main.js"
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/adobe/react-spectrum"
|
|
16
9
|
},
|
|
17
|
-
"types": "dist/types.d.ts",
|
|
18
10
|
"source": "src/index.ts",
|
|
19
11
|
"files": [
|
|
20
12
|
"dist",
|
|
@@ -23,26 +15,38 @@
|
|
|
23
15
|
"sideEffects": [
|
|
24
16
|
"*.css"
|
|
25
17
|
],
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
"main": "dist/main.js",
|
|
19
|
+
"module": "dist/module.js",
|
|
20
|
+
"types": "./dist/types/src/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
"source": "./src/index.ts",
|
|
23
|
+
"types": "./dist/types/src/index.d.ts",
|
|
24
|
+
"import": "./dist/import.mjs",
|
|
25
|
+
"require": "./dist/main.js"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@react-aria/test-utils": "1.0.0-
|
|
31
|
+
"@react-aria/test-utils": "1.0.0-rc.0",
|
|
32
32
|
"@swc/helpers": "^0.5.0"
|
|
33
33
|
},
|
|
34
|
-
"
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@testing-library/dom": "^10.1.0",
|
|
35
36
|
"@testing-library/react": "^16.0.0",
|
|
36
37
|
"@testing-library/user-event": "^14.0.0",
|
|
37
|
-
"jest": "^29.5.0",
|
|
38
38
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
39
39
|
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
|
40
40
|
},
|
|
41
|
-
"
|
|
42
|
-
"
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@testing-library/dom": "^10.0.0",
|
|
43
|
+
"@testing-library/user-event": "^14.0.0",
|
|
44
|
+
"jest": "^29.5.0",
|
|
45
|
+
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
46
|
+
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
|
43
47
|
},
|
|
44
|
-
"
|
|
45
|
-
"
|
|
48
|
+
"targets": {
|
|
49
|
+
"types": false
|
|
46
50
|
},
|
|
47
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "3577a20859b9585a000010c720f6ee39c1c588cc"
|
|
48
52
|
}
|
package/src/testSetup.ts
CHANGED
|
@@ -12,15 +12,21 @@
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Mocks screen width to simulate mobile experience, useful for testing Tray rendering.
|
|
15
|
-
*
|
|
15
|
+
*
|
|
16
|
+
* @param width Optional width to apply. Automatically clamped to the maximum value allowed for
|
|
17
|
+
* mobile rendering.
|
|
16
18
|
*/
|
|
17
19
|
export function simulateMobile(width: number = 700): void {
|
|
18
|
-
jest
|
|
20
|
+
jest
|
|
21
|
+
.spyOn(window.screen, 'width', 'get')
|
|
22
|
+
.mockImplementation(() => Math.min(Math.max(width, 0), 700));
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
/**
|
|
22
26
|
* Mocks screen width to simulate standard desktop experience.
|
|
23
|
-
*
|
|
27
|
+
*
|
|
28
|
+
* @param width Optional width to apply. Automatically clamped to the minimum value allowed for
|
|
29
|
+
* desktop rendering.
|
|
24
30
|
*/
|
|
25
31
|
export function simulateDesktop(width: number = 701): void {
|
|
26
32
|
jest.spyOn(window.screen, 'width', 'get').mockImplementation(() => Math.max(width, 701));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC,GAED;;;CAGC,GACM,SAAS,0CAAe,QAAgB,GAAG;IAChD,KAAK,KAAK,CAAC,OAAO,MAAM,EAAE,SAAS,OAAO,kBAAkB,CAAC,IAAM,KAAK,GAAG,CAAC,KAAK,GAAG,CAAC,OAAO,IAAI;AAClG;AAMO,SAAS,0CAAgB,QAAgB,GAAG;IACjD,KAAK,KAAK,CAAC,OAAO,MAAM,EAAE,SAAS,OAAO,kBAAkB,CAAC,IAAM,KAAK,GAAG,CAAC,OAAO;AACrF","sources":["packages/@react-spectrum/test-utils/src/testSetup.ts"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/**\n * Mocks screen width to simulate mobile experience, useful for testing Tray rendering.\n * @param width Optional width to apply. Automatically clamped to the maximum value allowed for mobile rendering.\n */\nexport function simulateMobile(width: number = 700): void {\n jest.spyOn(window.screen, 'width', 'get').mockImplementation(() => Math.min(Math.max(width, 0), 700));\n}\n\n/**\n * Mocks screen width to simulate standard desktop experience.\n * @param width Optional width to apply. Automatically clamped to the minimum value allowed for desktop rendering.\n */\nexport function simulateDesktop(width: number = 701): void {\n jest.spyOn(window.screen, 'width', 'get').mockImplementation(() => Math.max(width, 701));\n}\n"],"names":[],"version":3,"file":"testSetup.main.js.map"}
|
package/dist/testSetup.module.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2023 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/ /**
|
|
12
|
-
* Mocks screen width to simulate mobile experience, useful for testing Tray rendering.
|
|
13
|
-
* @param width Optional width to apply. Automatically clamped to the maximum value allowed for mobile rendering.
|
|
14
|
-
*/ function $64c3935c8d6a7115$export$54df5c253b80fcbe(width = 700) {
|
|
15
|
-
jest.spyOn(window.screen, 'width', 'get').mockImplementation(()=>Math.min(Math.max(width, 0), 700));
|
|
16
|
-
}
|
|
17
|
-
function $64c3935c8d6a7115$export$ff7d7f7ce6432302(width = 701) {
|
|
18
|
-
jest.spyOn(window.screen, 'width', 'get').mockImplementation(()=>Math.max(width, 701));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export {$64c3935c8d6a7115$export$54df5c253b80fcbe as simulateMobile, $64c3935c8d6a7115$export$ff7d7f7ce6432302 as simulateDesktop};
|
|
23
|
-
//# sourceMappingURL=testSetup.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAAA;;;;;;;;;;CAUC,GAED;;;CAGC,GACM,SAAS,0CAAe,QAAgB,GAAG;IAChD,KAAK,KAAK,CAAC,OAAO,MAAM,EAAE,SAAS,OAAO,kBAAkB,CAAC,IAAM,KAAK,GAAG,CAAC,KAAK,GAAG,CAAC,OAAO,IAAI;AAClG;AAMO,SAAS,0CAAgB,QAAgB,GAAG;IACjD,KAAK,KAAK,CAAC,OAAO,MAAM,EAAE,SAAS,OAAO,kBAAkB,CAAC,IAAM,KAAK,GAAG,CAAC,OAAO;AACrF","sources":["packages/@react-spectrum/test-utils/src/testSetup.ts"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/**\n * Mocks screen width to simulate mobile experience, useful for testing Tray rendering.\n * @param width Optional width to apply. Automatically clamped to the maximum value allowed for mobile rendering.\n */\nexport function simulateMobile(width: number = 700): void {\n jest.spyOn(window.screen, 'width', 'get').mockImplementation(() => Math.min(Math.max(width, 0), 700));\n}\n\n/**\n * Mocks screen width to simulate standard desktop experience.\n * @param width Optional width to apply. Automatically clamped to the minimum value allowed for desktop rendering.\n */\nexport function simulateDesktop(width: number = 701): void {\n jest.spyOn(window.screen, 'width', 'get').mockImplementation(() => Math.max(width, 701));\n}\n"],"names":[],"version":3,"file":"testSetup.module.js.map"}
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAYA;;;GAGG;AACH,+BAA+B,KAAK,GAAE,MAAY,GAAG,IAAI,CAExD;AAED;;;GAGG;AACH,gCAAgC,KAAK,GAAE,MAAY,GAAG,IAAI,CAEzD;ACZD,cAAc,wBAAwB,CAAC","sources":["packages/@react-spectrum/test-utils/src/packages/@react-spectrum/test-utils/src/testSetup.ts","packages/@react-spectrum/test-utils/src/packages/@react-spectrum/test-utils/src/index.ts","packages/@react-spectrum/test-utils/src/index.ts"],"sourcesContent":[null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport * from '@react-aria/test-utils';\nexport * from './testSetup';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|