d5-testing-library 2.0.0-alpha.14 → 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-ZBAIOZXV.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-ZBAIOZXV.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-ZBAIOZXV.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-QQZ3HKUX.mjs")).default;
3323
+ SubFormFactoryClass = (await import("./ListForm-X73EY2FM.mjs")).default;
3324
3324
  break;
3325
3325
  case "3" /* TREE */:
3326
- SubFormFactoryClass = (await import("./TreeView-JTV7B5N6.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-NBNO3NFM.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();
@@ -4789,19 +4802,18 @@ var TagBox = class extends AbstractDXEditorWithInput {
4789
4802
  return this.dropdownList.listItem(text);
4790
4803
  }
4791
4804
  async setTagBoxInputValue(values) {
4792
- const lastElement = values[values.length - 1];
4793
- const input = this.getInputLocator();
4794
- await input.click();
4795
4805
  for (const value of values) {
4796
- await this.selectOption(input, value, lastElement);
4806
+ const input = this.getInputLocator();
4807
+ await input.click();
4808
+ await this.selectOption(input, value);
4809
+ await this.confirmSelection();
4797
4810
  }
4798
- await this.confirmSelection();
4799
4811
  }
4800
4812
  async waitOptionSelection(value) {
4801
4813
  const option = this.page.locator(`.dx-overlay-wrapper .dx-list-item[aria-selected="true"] >> text=${value}`);
4802
4814
  await option.waitFor({ state: "visible", timeout: 5e3 });
4803
4815
  }
4804
- async selectOption(input, value, lastElement) {
4816
+ async selectOption(input, value) {
4805
4817
  try {
4806
4818
  await dropDownOptionClick(value, this.page, false);
4807
4819
  } catch {
@@ -4809,9 +4821,6 @@ var TagBox = class extends AbstractDXEditorWithInput {
4809
4821
  await dropDownOptionClick(value, this.page, true);
4810
4822
  }
4811
4823
  await this.waitOptionSelection(value);
4812
- if (value !== lastElement) {
4813
- await input.pressSequentially("");
4814
- }
4815
4824
  }
4816
4825
  async confirmSelection() {
4817
4826
  const btnOk = this.page.locator(BTN_OK_SELECTOR);
@@ -5845,6 +5854,31 @@ var Table = class extends AbstractElementWithParent {
5845
5854
  await this.selectRowByIndex(index, true);
5846
5855
  }
5847
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
+ }
5848
5882
  getRowElements() {
5849
5883
  const rowsSelector = `${this.getFullCssSelector()} ${this.tableContentCssSelector} .dx-row.dx-data-row`;
5850
5884
  return this.page.locator(rowsSelector);
@@ -808,19 +808,18 @@ var init_TagBox = __esm({
808
808
  return this.dropdownList.listItem(text);
809
809
  }
810
810
  async setTagBoxInputValue(values) {
811
- const lastElement = values[values.length - 1];
812
- const input = this.getInputLocator();
813
- await input.click();
814
811
  for (const value of values) {
815
- await this.selectOption(input, value, lastElement);
812
+ const input = this.getInputLocator();
813
+ await input.click();
814
+ await this.selectOption(input, value);
815
+ await this.confirmSelection();
816
816
  }
817
- await this.confirmSelection();
818
817
  }
819
818
  async waitOptionSelection(value) {
820
819
  const option = this.page.locator(`.dx-overlay-wrapper .dx-list-item[aria-selected="true"] >> text=${value}`);
821
820
  await option.waitFor({ state: "visible", timeout: 5e3 });
822
821
  }
823
- async selectOption(input, value, lastElement) {
822
+ async selectOption(input, value) {
824
823
  try {
825
824
  await dropDownOptionClick(value, this.page, false);
826
825
  } catch {
@@ -828,9 +827,6 @@ var init_TagBox = __esm({
828
827
  await dropDownOptionClick(value, this.page, true);
829
828
  }
830
829
  await this.waitOptionSelection(value);
831
- if (value !== lastElement) {
832
- await input.pressSequentially("");
833
- }
834
830
  }
835
831
  async confirmSelection() {
836
832
  const btnOk = this.page.locator(BTN_OK_SELECTOR);
@@ -2368,17 +2364,30 @@ var init_Row = __esm({
2368
2364
  getCellByTitle(title) {
2369
2365
  return this._getCell({ title });
2370
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
+ }
2371
2384
  async select(preserve = false) {
2372
2385
  const rowEl = this.getLocator();
2373
2386
  const classes = await this.getClasses();
2374
2387
  const isSelected = classes.includes(DX_SELECTION_CLASS);
2375
2388
  const clickedElement = rowEl.locator(FIRST_CLICKED_CELL_SELECTOR);
2376
- if (isSelected && !preserve) {
2377
- await this.page.keyboard.up("Control");
2378
- }
2379
2389
  if (preserve && !isSelected) {
2380
- await this.page.keyboard.down("Control");
2381
- await clickedElement.click();
2390
+ await clickedElement.click({ modifiers: ["ControlOrMeta"] });
2382
2391
  return;
2383
2392
  }
2384
2393
  await clickedElement.click();
@@ -2944,6 +2953,31 @@ var init_Table = __esm({
2944
2953
  await this.selectRowByIndex(index, true);
2945
2954
  }
2946
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
+ }
2947
2981
  getRowElements() {
2948
2982
  const rowsSelector = `${this.getFullCssSelector()} ${this.tableContentCssSelector} .dx-row.dx-data-row`;
2949
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-ZBAIOZXV.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-ZBAIOZXV.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.14",
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",