@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomic-testing/component-driver-mui-v9",
3
- "version": "0.87.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.87.0",
32
- "@atomic-testing/react-18": "0.87.0",
33
- "@atomic-testing/dom-core": "0.87.0",
34
- "@atomic-testing/core": "0.87.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
- // Clearing (value == null) reuses MUI's "click the selected star again to
96
- // reset" behaviour by re-clicking the current value's label. This resets the
97
- // rating in real browsers but not in jsdom, where MUI's clear path depends on
98
- // pointer coordinates that jsdom does not provide; the empty radio (`value=""`)
99
- // that jsdom could click has no `<label>` and is not reliably clickable in
100
- // browsers. A fully portable clear needs a coordinate-free click primitive on
101
- // the Interactor. TODO(#68): revisit once that primitive exists.
102
- const valueToClick = value ?? currentValue;
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
- const id = await this.interactor.getAttribute(targetLocator, 'id');
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;