@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.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { HTMLButtonDriver, HTMLCheckboxDriver, HTMLElementDriver, HTMLRadioButtonGroupDriver, HTMLSelectDriver, HTMLTextInputDriver } from "@atomic-testing/component-driver-html";
2
- import { ComponentDriver, ComponentDriverCtor, ContainerDriver, ErrorBase, IComponentDriverOption, IContainerDriverOption, IFormFieldDriver, IInputDriver, IToggleDriver, Interactor, ListComponentDriver, ListComponentDriverSpecificOption, LocatorRelativePosition, Nullable, Optional, PartLocator, ScenePart } from "@atomic-testing/core";
2
+ import { ComponentDriver, ComponentDriverCtor, ContainerDriver, ErrorBase, IComponentDriverOption, IContainerDriverOption, IFormFieldDriver, IInputDriver, IToggleDriver, Interactor, ItemNotFoundError, ListComponentDriver, ListComponentDriverSpecificOption, LocatorRelativePosition, Nullable, Optional, PartLocator, ScenePart } from "@atomic-testing/core";
3
3
 
4
4
  //#region src/components/AccordionDriver.d.ts
5
5
  declare const parts$13: {
@@ -366,8 +366,8 @@ declare const parts$8: {
366
366
  };
367
367
  declare class DialogDriver<ContentT extends ScenePart> extends ContainerDriver<ContentT, typeof parts$8> {
368
368
  constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IContainerDriverOption>);
369
- overriddenParentLocator(): Optional<PartLocator>;
370
- overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>;
369
+ static overriddenParentLocator(): Optional<PartLocator>;
370
+ static overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>;
371
371
  getTitle(): Promise<string | null>;
372
372
  /**
373
373
  * Dismiss the dialog by clicking outside its content, then wait for it to close.
@@ -413,8 +413,8 @@ declare class DialogDriver<ContentT extends ScenePart> extends ContainerDriver<C
413
413
  * `closeByBackdrop`.
414
414
  *
415
415
  * Subclasses supply {@link getSurfaceLocator} (the element whose visibility means
416
- * "open") and, when the overlay is portal-rendered, override
417
- * `overriddenParentLocator()`/`overrideLocatorRelativePosition()` to re-root.
416
+ * "open") and, when the overlay is portal-rendered, override the static
417
+ * `overriddenParentLocator()`/`overrideLocatorRelativePosition()` portal hooks to re-root.
418
418
  *
419
419
  * `closeByEscape` is intentionally absent: keyboard dismissal needs a key-press
420
420
  * primitive the `Interactor` interface does not yet expose, which would have to be
@@ -473,8 +473,8 @@ type DrawerAnchor = 'left' | 'right' | 'top' | 'bottom';
473
473
  */
474
474
  declare class DrawerDriver<ContentT extends ScenePart> extends OverlayDriver<ContentT, typeof drawerParts> {
475
475
  constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IContainerDriverOption>);
476
- overriddenParentLocator(): Optional<PartLocator>;
477
- overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>;
476
+ static overriddenParentLocator(): Optional<PartLocator>;
477
+ static overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>;
478
478
  protected getSurfaceLocator(): PartLocator;
479
479
  /**
480
480
  * The side the drawer is anchored to, read from the portal root's anchor class, or
@@ -577,8 +577,8 @@ declare const parts$6: {
577
577
  };
578
578
  declare class MenuDriver extends ComponentDriver<typeof parts$6> {
579
579
  constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>);
580
- overriddenParentLocator(): Optional<PartLocator>;
581
- overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>;
580
+ static overriddenParentLocator(): Optional<PartLocator>;
581
+ static overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>;
582
582
  getMenuItemByLabel(label: string): Promise<MenuItemDriver | null>;
583
583
  selectByLabel(label: string): Promise<void>;
584
584
  get driverName(): string;
@@ -1381,9 +1381,8 @@ declare class MenuItemDisabledError extends ErrorBase {
1381
1381
  //#endregion
1382
1382
  //#region src/errors/MenuItemNotFoundError.d.ts
1383
1383
  declare const MenuItemNotFoundErrorId = "MenuItemNotFoundError";
1384
- declare class MenuItemNotFoundError extends ErrorBase {
1384
+ declare class MenuItemNotFoundError extends ItemNotFoundError {
1385
1385
  readonly label: string;
1386
- readonly driver: ComponentDriver<any>;
1387
1386
  constructor(label: string, driver: ComponentDriver<any>);
1388
1387
  }
1389
1388
  //#endregion
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { HTMLButtonDriver, HTMLCheckboxDriver, HTMLElementDriver, HTMLRadioButtonGroupDriver, HTMLSelectDriver, HTMLTextInputDriver } from "@atomic-testing/component-driver-html";
2
- import { ComponentDriver, ComponentDriverCtor, ContainerDriver, ErrorBase, IComponentDriverOption, IContainerDriverOption, IFormFieldDriver, IInputDriver, IToggleDriver, Interactor, ListComponentDriver, ListComponentDriverSpecificOption, LocatorRelativePosition, Nullable, Optional, PartLocator, ScenePart } from "@atomic-testing/core";
2
+ import { ComponentDriver, ComponentDriverCtor, ContainerDriver, ErrorBase, IComponentDriverOption, IContainerDriverOption, IFormFieldDriver, IInputDriver, IToggleDriver, Interactor, ItemNotFoundError, ListComponentDriver, ListComponentDriverSpecificOption, LocatorRelativePosition, Nullable, Optional, PartLocator, ScenePart } from "@atomic-testing/core";
3
3
 
4
4
  //#region src/components/AccordionDriver.d.ts
5
5
  declare const parts$13: {
@@ -366,8 +366,8 @@ declare const parts$8: {
366
366
  };
367
367
  declare class DialogDriver<ContentT extends ScenePart> extends ContainerDriver<ContentT, typeof parts$8> {
368
368
  constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IContainerDriverOption>);
369
- overriddenParentLocator(): Optional<PartLocator>;
370
- overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>;
369
+ static overriddenParentLocator(): Optional<PartLocator>;
370
+ static overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>;
371
371
  getTitle(): Promise<string | null>;
372
372
  /**
373
373
  * Dismiss the dialog by clicking outside its content, then wait for it to close.
@@ -413,8 +413,8 @@ declare class DialogDriver<ContentT extends ScenePart> extends ContainerDriver<C
413
413
  * `closeByBackdrop`.
414
414
  *
415
415
  * Subclasses supply {@link getSurfaceLocator} (the element whose visibility means
416
- * "open") and, when the overlay is portal-rendered, override
417
- * `overriddenParentLocator()`/`overrideLocatorRelativePosition()` to re-root.
416
+ * "open") and, when the overlay is portal-rendered, override the static
417
+ * `overriddenParentLocator()`/`overrideLocatorRelativePosition()` portal hooks to re-root.
418
418
  *
419
419
  * `closeByEscape` is intentionally absent: keyboard dismissal needs a key-press
420
420
  * primitive the `Interactor` interface does not yet expose, which would have to be
@@ -473,8 +473,8 @@ type DrawerAnchor = 'left' | 'right' | 'top' | 'bottom';
473
473
  */
474
474
  declare class DrawerDriver<ContentT extends ScenePart> extends OverlayDriver<ContentT, typeof drawerParts> {
475
475
  constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IContainerDriverOption>);
476
- overriddenParentLocator(): Optional<PartLocator>;
477
- overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>;
476
+ static overriddenParentLocator(): Optional<PartLocator>;
477
+ static overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>;
478
478
  protected getSurfaceLocator(): PartLocator;
479
479
  /**
480
480
  * The side the drawer is anchored to, read from the portal root's anchor class, or
@@ -577,8 +577,8 @@ declare const parts$6: {
577
577
  };
578
578
  declare class MenuDriver extends ComponentDriver<typeof parts$6> {
579
579
  constructor(locator: PartLocator, interactor: Interactor, option?: Partial<IComponentDriverOption>);
580
- overriddenParentLocator(): Optional<PartLocator>;
581
- overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>;
580
+ static overriddenParentLocator(): Optional<PartLocator>;
581
+ static overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>;
582
582
  getMenuItemByLabel(label: string): Promise<MenuItemDriver | null>;
583
583
  selectByLabel(label: string): Promise<void>;
584
584
  get driverName(): string;
@@ -1381,9 +1381,8 @@ declare class MenuItemDisabledError extends ErrorBase {
1381
1381
  //#endregion
1382
1382
  //#region src/errors/MenuItemNotFoundError.d.ts
1383
1383
  declare const MenuItemNotFoundErrorId = "MenuItemNotFoundError";
1384
- declare class MenuItemNotFoundError extends ErrorBase {
1384
+ declare class MenuItemNotFoundError extends ItemNotFoundError {
1385
1385
  readonly label: string;
1386
- readonly driver: ComponentDriver<any>;
1387
1386
  constructor(label: string, driver: ComponentDriver<any>);
1388
1387
  }
1389
1388
  //#endregion
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { HTMLButtonDriver, HTMLCheckboxDriver, HTMLElementDriver, HTMLRadioButtonGroupDriver, HTMLSelectDriver, HTMLTextInputDriver } from "@atomic-testing/component-driver-html";
2
- import { ComponentDriver, ContainerDriver, ErrorBase, ListComponentDriver, byAttribute, byCssClass, byCssSelector, byDataTestId, byInputType, byLinkedElement, byRole, byTagName, byValue, escapeUtil, listHelper, locatorUtil, timingUtil } from "@atomic-testing/core";
2
+ import { ComponentDriver, ContainerDriver, ErrorBase, ItemNotFoundError, ListComponentDriver, byAttribute, byCssClass, byCssSelector, byDataTestId, byInputType, byLinkedElement, byRole, byTagName, byValue, escapeUtil, listHelper, locatorUtil, timingUtil } from "@atomic-testing/core";
3
3
  //#region src/components/AccordionDriver.ts
4
4
  const parts$13 = {
5
5
  /**
@@ -598,10 +598,10 @@ var DialogDriver = class extends ContainerDriver {
598
598
  content: option?.content ?? {}
599
599
  });
600
600
  }
601
- overriddenParentLocator() {
601
+ static overriddenParentLocator() {
602
602
  return dialogRootLocator;
603
603
  }
604
- overrideLocatorRelativePosition() {
604
+ static overrideLocatorRelativePosition() {
605
605
  return "Same";
606
606
  }
607
607
  async getTitle() {
@@ -681,8 +681,8 @@ const defaultTransitionDuration = 250;
681
681
  * `closeByBackdrop`.
682
682
  *
683
683
  * Subclasses supply {@link getSurfaceLocator} (the element whose visibility means
684
- * "open") and, when the overlay is portal-rendered, override
685
- * `overriddenParentLocator()`/`overrideLocatorRelativePosition()` to re-root.
684
+ * "open") and, when the overlay is portal-rendered, override the static
685
+ * `overriddenParentLocator()`/`overrideLocatorRelativePosition()` portal hooks to re-root.
686
686
  *
687
687
  * `closeByEscape` is intentionally absent: keyboard dismissal needs a key-press
688
688
  * primitive the `Interactor` interface does not yet expose, which would have to be
@@ -768,10 +768,10 @@ var DrawerDriver = class extends OverlayDriver {
768
768
  content: option?.content ?? {}
769
769
  });
770
770
  }
771
- overriddenParentLocator() {
771
+ static overriddenParentLocator() {
772
772
  return drawerRootLocator;
773
773
  }
774
- overrideLocatorRelativePosition() {
774
+ static overrideLocatorRelativePosition() {
775
775
  return "Same";
776
776
  }
777
777
  getSurfaceLocator() {
@@ -880,12 +880,12 @@ var InputDriver = class extends ComponentDriver {
880
880
  //#endregion
881
881
  //#region src/errors/MenuItemDisabledError.ts
882
882
  const MenuItemDisabledErrorId = "MenuItemDisabledError";
883
- function getErrorMessage$1(label) {
883
+ function getErrorMessage(label) {
884
884
  return `The menu item with label: ${label} is disabled`;
885
885
  }
886
886
  var MenuItemDisabledError = class extends ErrorBase {
887
887
  constructor(label, driver) {
888
- super(getErrorMessage$1(label), driver);
888
+ super(getErrorMessage(label), driver);
889
889
  this.label = label;
890
890
  this.driver = driver;
891
891
  this.name = MenuItemDisabledErrorId;
@@ -935,14 +935,10 @@ var ListDriver = class extends ListComponentDriver {
935
935
  //#endregion
936
936
  //#region src/errors/MenuItemNotFoundError.ts
937
937
  const MenuItemNotFoundErrorId = "MenuItemNotFoundError";
938
- function getErrorMessage(label) {
939
- return `Cannot find menu item with label: ${label}`;
940
- }
941
- var MenuItemNotFoundError = class extends ErrorBase {
938
+ var MenuItemNotFoundError = class extends ItemNotFoundError {
942
939
  constructor(label, driver) {
943
- super(getErrorMessage(label), driver);
940
+ super(label, driver, `Cannot find menu item with label: ${label}`);
944
941
  this.label = label;
945
- this.driver = driver;
946
942
  this.name = MenuItemNotFoundErrorId;
947
943
  }
948
944
  };
@@ -974,10 +970,10 @@ var MenuDriver = class extends ComponentDriver {
974
970
  parts: parts$6
975
971
  });
976
972
  }
977
- overriddenParentLocator() {
973
+ static overriddenParentLocator() {
978
974
  return menuRootLocator;
979
975
  }
980
- overrideLocatorRelativePosition() {
976
+ static overrideLocatorRelativePosition() {
981
977
  return "Same";
982
978
  }
983
979
  async getMenuItemByLabel(label) {
@@ -1322,17 +1318,11 @@ var RatingDriver = class extends ComponentDriver {
1322
1318
  return this.interactor.hasCssClass(this.locator, disabledClassName);
1323
1319
  }
1324
1320
  async setValue(value) {
1325
- const currentValue = await this.getValue();
1326
- if (value === currentValue) return true;
1327
- const valueToClick = value ?? currentValue;
1328
- if (valueToClick == null) return true;
1329
- const targetLocator = locatorUtil.append(this.parts.choices.locator, byValue(valueToClick.toString(), "Same"));
1321
+ if (value === await this.getValue()) return true;
1322
+ const targetValue = value == null ? "" : value.toString();
1323
+ const targetLocator = locatorUtil.append(this.parts.choices.locator, byValue(targetValue, "Same"));
1330
1324
  const targetExists = await this.interactor.exists(targetLocator);
1331
- if (targetExists) {
1332
- const id = await this.interactor.getAttribute(targetLocator, "id");
1333
- const labelLocator = locatorUtil.append(this.locator, byCssSelector(`label[for="${id}"]`));
1334
- await this.interactor.click(labelLocator);
1335
- }
1325
+ if (targetExists) await this.interactor.activate(targetLocator);
1336
1326
  return targetExists;
1337
1327
  }
1338
1328
  get driverName() {