@atomic-testing/component-driver-mui-v9 0.87.0 → 0.89.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 +4 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +4 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/components/RatingDriver.ts +9 -17
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.89.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/component-driver-html": "0.
|
|
32
|
-
"@atomic-testing/
|
|
33
|
-
"@atomic-testing/
|
|
34
|
-
"@atomic-testing/core": "0.
|
|
31
|
+
"@atomic-testing/component-driver-html": "0.89.0",
|
|
32
|
+
"@atomic-testing/core": "0.89.0",
|
|
33
|
+
"@atomic-testing/react-18": "0.89.0",
|
|
34
|
+
"@atomic-testing/dom-core": "0.89.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/react": ">=18.0.0",
|
|
@@ -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;
|