@atomic-testing/component-driver-mui-v9 0.88.0 → 0.90.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/dist/index.cjs +16 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -11
- package/dist/index.d.mts +10 -11
- package/dist/index.mjs +17 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/components/DialogDriver.ts +2 -2
- package/src/components/DrawerDriver.ts +2 -2
- package/src/components/MenuDriver.ts +2 -2
- package/src/components/OverlayDriver.ts +2 -2
- package/src/components/RatingDriver.ts +9 -17
- package/src/errors/MenuItemNotFoundError.ts +4 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomic-testing/component-driver-mui-v9",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.90.0",
|
|
4
4
|
"description": "Component driver for Material-UI v9",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"@emotion/react": "^11.14.0",
|
|
29
29
|
"@emotion/styled": "^11.14.1",
|
|
30
30
|
"@mui/material": "^9.0.0",
|
|
31
|
-
"@atomic-testing/core": "0.
|
|
32
|
-
"@atomic-testing/dom-core": "0.
|
|
33
|
-
"@atomic-testing/react-18": "0.
|
|
34
|
-
"@atomic-testing/component-driver-html": "0.
|
|
31
|
+
"@atomic-testing/core": "0.90.0",
|
|
32
|
+
"@atomic-testing/dom-core": "0.90.0",
|
|
33
|
+
"@atomic-testing/react-18": "0.90.0",
|
|
34
|
+
"@atomic-testing/component-driver-html": "0.90.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/react": ">=18.0.0",
|
|
@@ -35,11 +35,11 @@ export class DialogDriver<ContentT extends ScenePart> extends ContainerDriver<Co
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
override overriddenParentLocator(): Optional<PartLocator> {
|
|
38
|
+
static override overriddenParentLocator(): Optional<PartLocator> {
|
|
39
39
|
return dialogRootLocator;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
override overrideLocatorRelativePosition(): Optional<LocatorRelativePosition> {
|
|
42
|
+
static override overrideLocatorRelativePosition(): Optional<LocatorRelativePosition> {
|
|
43
43
|
return 'Same';
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -52,11 +52,11 @@ export class DrawerDriver<ContentT extends ScenePart> extends OverlayDriver<Cont
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
override overriddenParentLocator(): Optional<PartLocator> {
|
|
55
|
+
static override overriddenParentLocator(): Optional<PartLocator> {
|
|
56
56
|
return drawerRootLocator;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
override overrideLocatorRelativePosition(): Optional<LocatorRelativePosition> {
|
|
59
|
+
static override overrideLocatorRelativePosition(): Optional<LocatorRelativePosition> {
|
|
60
60
|
return 'Same';
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -32,11 +32,11 @@ export class MenuDriver extends ComponentDriver<typeof parts> {
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
override overriddenParentLocator(): Optional<PartLocator> {
|
|
35
|
+
static override overriddenParentLocator(): Optional<PartLocator> {
|
|
36
36
|
return menuRootLocator;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
override overrideLocatorRelativePosition(): Optional<LocatorRelativePosition> {
|
|
39
|
+
static override overrideLocatorRelativePosition(): Optional<LocatorRelativePosition> {
|
|
40
40
|
return 'Same';
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -11,8 +11,8 @@ const defaultTransitionDuration = 250;
|
|
|
11
11
|
* `closeByBackdrop`.
|
|
12
12
|
*
|
|
13
13
|
* Subclasses supply {@link getSurfaceLocator} (the element whose visibility means
|
|
14
|
-
* "open") and, when the overlay is portal-rendered, override
|
|
15
|
-
* `overriddenParentLocator()`/`overrideLocatorRelativePosition()` to re-root.
|
|
14
|
+
* "open") and, when the overlay is portal-rendered, override the static
|
|
15
|
+
* `overriddenParentLocator()`/`overrideLocatorRelativePosition()` portal hooks to re-root.
|
|
16
16
|
*
|
|
17
17
|
* `closeByEscape` is intentionally absent: keyboard dismissal needs a key-press
|
|
18
18
|
* primitive the `Interactor` interface does not yet expose, which would have to be
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { HTMLRadioButtonGroupDriver } from '@atomic-testing/component-driver-html';
|
|
2
2
|
import {
|
|
3
3
|
byCssClass,
|
|
4
|
-
byCssSelector,
|
|
5
4
|
byInputType,
|
|
6
5
|
byValue,
|
|
7
6
|
ComponentDriver,
|
|
@@ -92,24 +91,17 @@ export class RatingDriver extends ComponentDriver<typeof parts> implements IInpu
|
|
|
92
91
|
return true;
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
if (valueToClick == null) {
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const targetLocator = locatorUtil.append(this.parts.choices.locator, byValue(valueToClick.toString(), 'Same'));
|
|
94
|
+
// Activate the visually-hidden `<input type="radio">` whose `value` attribute
|
|
95
|
+
// matches the target — the empty-string radio (MUI's "no rating") for a clear.
|
|
96
|
+
// `activate` is coordinate-free, so it reaches inputs a positional click cannot:
|
|
97
|
+
// the half-star label for fractional values is zero-width and unclickable in a
|
|
98
|
+
// real browser (#86), and the clear radio has no `<label>` at all (#68). This
|
|
99
|
+
// unifies integer, fractional, and clear on one portable path.
|
|
100
|
+
const targetValue = value == null ? '' : value.toString();
|
|
101
|
+
const targetLocator = locatorUtil.append(this.parts.choices.locator, byValue(targetValue, 'Same'));
|
|
108
102
|
const targetExists = await this.interactor.exists(targetLocator);
|
|
109
103
|
if (targetExists) {
|
|
110
|
-
|
|
111
|
-
const labelLocator = locatorUtil.append(this.locator, byCssSelector(`label[for="${id}"]`));
|
|
112
|
-
await this.interactor.click(labelLocator);
|
|
104
|
+
await this.interactor.activate(targetLocator);
|
|
113
105
|
}
|
|
114
106
|
// TODO: throw error if the value does not exist
|
|
115
107
|
return targetExists;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import { ComponentDriver,
|
|
1
|
+
import { ComponentDriver, ItemNotFoundError } from '@atomic-testing/core';
|
|
2
2
|
|
|
3
3
|
export const MenuItemNotFoundErrorId = 'MenuItemNotFoundError';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
return `Cannot find menu item with label: ${label}`;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export class MenuItemNotFoundError extends ErrorBase {
|
|
5
|
+
export class MenuItemNotFoundError extends ItemNotFoundError {
|
|
10
6
|
constructor(
|
|
11
7
|
public readonly label: string,
|
|
12
|
-
|
|
8
|
+
driver: ComponentDriver<any>
|
|
13
9
|
) {
|
|
14
|
-
super(
|
|
10
|
+
super(label, driver, `Cannot find menu item with label: ${label}`);
|
|
15
11
|
this.name = MenuItemNotFoundErrorId;
|
|
16
12
|
}
|
|
17
13
|
}
|