d5-testing-library 2.0.0-alpha.15 → 2.0.0-alpha.16

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FormEdit
3
- } from "./chunk-XN4OIA4L.mjs";
3
+ } from "./chunk-LNXRNPAK.mjs";
4
4
  export {
5
5
  FormEdit as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ListForm
3
- } from "./chunk-XN4OIA4L.mjs";
3
+ } from "./chunk-LNXRNPAK.mjs";
4
4
  export {
5
5
  ListForm as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TreeView
3
- } from "./chunk-XN4OIA4L.mjs";
3
+ } from "./chunk-LNXRNPAK.mjs";
4
4
  export {
5
5
  TreeView as default
6
6
  };
@@ -3320,15 +3320,15 @@ async function classDependencyInjector(formType) {
3320
3320
  let SubFormFactoryClass;
3321
3321
  switch (formType) {
3322
3322
  case "1" /* LIST */:
3323
- SubFormFactoryClass = (await import("./ListForm-DB2J5ED6.mjs")).default;
3323
+ SubFormFactoryClass = (await import("./ListForm-X73EY2FM.mjs")).default;
3324
3324
  break;
3325
3325
  case "3" /* TREE */:
3326
- SubFormFactoryClass = (await import("./TreeView-VOVTTSRC.mjs")).default;
3326
+ SubFormFactoryClass = (await import("./TreeView-ANMIB5JD.mjs")).default;
3327
3327
  break;
3328
3328
  case "2" /* EDIT */:
3329
3329
  case "99" /* FREE_FORM */:
3330
3330
  case "4" /* REPORT */:
3331
- SubFormFactoryClass = (await import("./FormEdit-V5FY7PL5.mjs")).default;
3331
+ SubFormFactoryClass = (await import("./FormEdit-ONBAJE2O.mjs")).default;
3332
3332
  break;
3333
3333
  default:
3334
3334
  throw new Error(`Unsupported form type ${formType}`);
@@ -3573,17 +3573,30 @@ var Row = class extends AbstractElementWithParent {
3573
3573
  getCellByTitle(title) {
3574
3574
  return this._getCell({ title });
3575
3575
  }
3576
+ async deselect() {
3577
+ const row = this.getLocator();
3578
+ const classes = await this.getClasses();
3579
+ if (!classes.includes(DX_SELECTION_CLASS)) {
3580
+ return;
3581
+ }
3582
+ const cell = row.locator(FIRST_CLICKED_CELL_SELECTOR);
3583
+ await cell.click({ modifiers: ["ControlOrMeta"] });
3584
+ await wait(
3585
+ async () => {
3586
+ const classes2 = await this.getClasses();
3587
+ return !classes2.includes(DX_SELECTION_CLASS);
3588
+ },
3589
+ this.page,
3590
+ "Cannot deselect row"
3591
+ );
3592
+ }
3576
3593
  async select(preserve = false) {
3577
3594
  const rowEl = this.getLocator();
3578
3595
  const classes = await this.getClasses();
3579
3596
  const isSelected = classes.includes(DX_SELECTION_CLASS);
3580
3597
  const clickedElement = rowEl.locator(FIRST_CLICKED_CELL_SELECTOR);
3581
- if (isSelected && !preserve) {
3582
- await this.page.keyboard.up("Control");
3583
- }
3584
3598
  if (preserve && !isSelected) {
3585
- await this.page.keyboard.down("Control");
3586
- await clickedElement.click();
3599
+ await clickedElement.click({ modifiers: ["ControlOrMeta"] });
3587
3600
  return;
3588
3601
  }
3589
3602
  await clickedElement.click();
@@ -5841,6 +5854,31 @@ var Table = class extends AbstractElementWithParent {
5841
5854
  await this.selectRowByIndex(index, true);
5842
5855
  }
5843
5856
  }
5857
+ /**
5858
+ * Зняти виділення з рядка по індексу.
5859
+ * @param index починається з 0
5860
+ */
5861
+ deselectRowByIndex(index) {
5862
+ return this.getRowByIndex(index).deselect();
5863
+ }
5864
+ /**
5865
+ * Зняти виділення з масиву рядків по індексу.
5866
+ * @param indexes починається з 0
5867
+ */
5868
+ async deselectRowsByIndexes(indexes) {
5869
+ for (const index of indexes) {
5870
+ await this.deselectRowByIndex(index);
5871
+ }
5872
+ }
5873
+ /**
5874
+ * Зняти виділення з усіх виділених рядків.
5875
+ */
5876
+ async clearSelection() {
5877
+ const selectedRows = await this.getSelectedRows();
5878
+ for (const row of selectedRows) {
5879
+ await row.deselect();
5880
+ }
5881
+ }
5844
5882
  getRowElements() {
5845
5883
  const rowsSelector = `${this.getFullCssSelector()} ${this.tableContentCssSelector} .dx-row.dx-data-row`;
5846
5884
  return this.page.locator(rowsSelector);
@@ -2364,17 +2364,30 @@ var init_Row = __esm({
2364
2364
  getCellByTitle(title) {
2365
2365
  return this._getCell({ title });
2366
2366
  }
2367
+ async deselect() {
2368
+ const row = this.getLocator();
2369
+ const classes = await this.getClasses();
2370
+ if (!classes.includes(DX_SELECTION_CLASS)) {
2371
+ return;
2372
+ }
2373
+ const cell = row.locator(FIRST_CLICKED_CELL_SELECTOR);
2374
+ await cell.click({ modifiers: ["ControlOrMeta"] });
2375
+ await wait(
2376
+ async () => {
2377
+ const classes2 = await this.getClasses();
2378
+ return !classes2.includes(DX_SELECTION_CLASS);
2379
+ },
2380
+ this.page,
2381
+ "Cannot deselect row"
2382
+ );
2383
+ }
2367
2384
  async select(preserve = false) {
2368
2385
  const rowEl = this.getLocator();
2369
2386
  const classes = await this.getClasses();
2370
2387
  const isSelected = classes.includes(DX_SELECTION_CLASS);
2371
2388
  const clickedElement = rowEl.locator(FIRST_CLICKED_CELL_SELECTOR);
2372
- if (isSelected && !preserve) {
2373
- await this.page.keyboard.up("Control");
2374
- }
2375
2389
  if (preserve && !isSelected) {
2376
- await this.page.keyboard.down("Control");
2377
- await clickedElement.click();
2390
+ await clickedElement.click({ modifiers: ["ControlOrMeta"] });
2378
2391
  return;
2379
2392
  }
2380
2393
  await clickedElement.click();
@@ -2940,6 +2953,31 @@ var init_Table = __esm({
2940
2953
  await this.selectRowByIndex(index, true);
2941
2954
  }
2942
2955
  }
2956
+ /**
2957
+ * Зняти виділення з рядка по індексу.
2958
+ * @param index починається з 0
2959
+ */
2960
+ deselectRowByIndex(index) {
2961
+ return this.getRowByIndex(index).deselect();
2962
+ }
2963
+ /**
2964
+ * Зняти виділення з масиву рядків по індексу.
2965
+ * @param indexes починається з 0
2966
+ */
2967
+ async deselectRowsByIndexes(indexes) {
2968
+ for (const index of indexes) {
2969
+ await this.deselectRowByIndex(index);
2970
+ }
2971
+ }
2972
+ /**
2973
+ * Зняти виділення з усіх виділених рядків.
2974
+ */
2975
+ async clearSelection() {
2976
+ const selectedRows = await this.getSelectedRows();
2977
+ for (const row of selectedRows) {
2978
+ await row.deselect();
2979
+ }
2980
+ }
2943
2981
  getRowElements() {
2944
2982
  const rowsSelector = `${this.getFullCssSelector()} ${this.tableContentCssSelector} .dx-row.dx-data-row`;
2945
2983
  return this.page.locator(rowsSelector);
@@ -633,6 +633,7 @@ declare class Row extends AbstractElementWithParent {
633
633
  getCellByIndex(index: number): Cell;
634
634
  getCell(name: string): Cell;
635
635
  getCellByTitle(title: string): Cell;
636
+ deselect(): Promise<void>;
636
637
  select(preserve?: boolean): Promise<void>;
637
638
  isSelected(): Promise<boolean>;
638
639
  getIndex(): number;
@@ -704,6 +705,20 @@ declare class Table extends AbstractElementWithParent {
704
705
  * @param indexes починається з 0
705
706
  */
706
707
  selectRowsByIndexes(indexes: number[]): Promise<void>;
708
+ /**
709
+ * Зняти виділення з рядка по індексу.
710
+ * @param index починається з 0
711
+ */
712
+ deselectRowByIndex(index: number): Promise<void>;
713
+ /**
714
+ * Зняти виділення з масиву рядків по індексу.
715
+ * @param indexes починається з 0
716
+ */
717
+ deselectRowsByIndexes(indexes: number[]): Promise<void>;
718
+ /**
719
+ * Зняти виділення з усіх виділених рядків.
720
+ */
721
+ clearSelection(): Promise<void>;
707
722
  protected getRowElements(): Locator;
708
723
  getRows(): Promise<Row[]>;
709
724
  getColumns(): Promise<Column[]>;
@@ -633,6 +633,7 @@ declare class Row extends AbstractElementWithParent {
633
633
  getCellByIndex(index: number): Cell;
634
634
  getCell(name: string): Cell;
635
635
  getCellByTitle(title: string): Cell;
636
+ deselect(): Promise<void>;
636
637
  select(preserve?: boolean): Promise<void>;
637
638
  isSelected(): Promise<boolean>;
638
639
  getIndex(): number;
@@ -704,6 +705,20 @@ declare class Table extends AbstractElementWithParent {
704
705
  * @param indexes починається з 0
705
706
  */
706
707
  selectRowsByIndexes(indexes: number[]): Promise<void>;
708
+ /**
709
+ * Зняти виділення з рядка по індексу.
710
+ * @param index починається з 0
711
+ */
712
+ deselectRowByIndex(index: number): Promise<void>;
713
+ /**
714
+ * Зняти виділення з масиву рядків по індексу.
715
+ * @param indexes починається з 0
716
+ */
717
+ deselectRowsByIndexes(indexes: number[]): Promise<void>;
718
+ /**
719
+ * Зняти виділення з усіх виділених рядків.
720
+ */
721
+ clearSelection(): Promise<void>;
707
722
  protected getRowElements(): Locator;
708
723
  getRows(): Promise<Row[]>;
709
724
  getColumns(): Promise<Column[]>;
@@ -25,7 +25,7 @@ import {
25
25
  readonlyLocator,
26
26
  wait,
27
27
  waitElementIsVisible_default
28
- } from "./chunk-XN4OIA4L.mjs";
28
+ } from "./chunk-LNXRNPAK.mjs";
29
29
  export {
30
30
  AbstractPage,
31
31
  ApiRequest,
@@ -25,7 +25,7 @@ import {
25
25
  readonlyLocator,
26
26
  wait,
27
27
  waitElementIsVisible_default
28
- } from "./chunk-XN4OIA4L.mjs";
28
+ } from "./chunk-LNXRNPAK.mjs";
29
29
  export {
30
30
  AbstractPage,
31
31
  ApiRequest,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "d5-testing-library",
3
- "version": "2.0.0-alpha.15",
3
+ "version": "2.0.0-alpha.16",
4
4
  "description": "e2e testing D5 projects",
5
5
  "main": "dist/cjs/d5-testing-library.cjs",
6
6
  "module": "dist/d5-testing-library.legacy-esm.js",