@linzjs/step-ag-grid 7.15.0 → 7.16.1

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/README.md CHANGED
@@ -147,6 +147,7 @@ The following testing calls can be imported from step-ag-grid:
147
147
  - selectCell
148
148
  - editCell
149
149
  - findOpenMenu
150
+ - validateMenuOptions
150
151
  - queryMenuOption
151
152
  - findMenuOption
152
153
  - clickMenuOption
@@ -154,6 +155,9 @@ The following testing calls can be imported from step-ag-grid:
154
155
  - getMultiSelectOptions
155
156
  - findMultiSelectOption
156
157
  - clickMultiSelectOption
158
+ - typeOnlyInput
159
+ - typeInputByLabel
160
+ - typeInputByPlaceholder
157
161
  - typeOtherInput
158
162
  - typeOtherTextArea
159
163
  - closeMenu
@@ -9,6 +9,7 @@ export declare const selectCell: (rowId: string | number, colId: string, within?
9
9
  export declare const editCell: (rowId: number | string, colId: string, within?: HTMLElement) => Promise<void>;
10
10
  export declare const queryMenuOption: (menuOptionText: string | RegExp) => Promise<HTMLElement | null>;
11
11
  export declare const findMenuOption: (menuOptionText: string | RegExp) => Promise<HTMLElement>;
12
+ export declare const validateMenuOptions: (rowId: number | string, colId: string, expectedMenuOptions: Array<string>) => Promise<boolean>;
12
13
  export declare const clickMenuOption: (menuOptionText: string | RegExp) => Promise<void>;
13
14
  export declare const openAndClickMenuOption: (rowId: number | string, colId: string, menuOptionText: string | RegExp, within?: HTMLElement) => Promise<void>;
14
15
  export declare const getMultiSelectOptions: () => Promise<{
@@ -17,7 +18,9 @@ export declare const getMultiSelectOptions: () => Promise<{
17
18
  }[]>;
18
19
  export declare const findMultiSelectOption: (value: string) => Promise<HTMLElement>;
19
20
  export declare const clickMultiSelectOption: (value: string) => Promise<void>;
20
- export declare const typeInput: (value: string) => Promise<void>;
21
+ export declare const typeOnlyInput: (value: string) => Promise<void>;
22
+ export declare const typeInputByLabel: (value: string, labelText: string) => Promise<void>;
23
+ export declare const typeInputByPlaceholder: (value: string, placeholder: string) => Promise<void>;
21
24
  export declare const typeOtherInput: (value: string) => Promise<void>;
22
25
  export declare const typeOtherTextArea: (value: string) => Promise<void>;
23
26
  export declare const closeMenu: () => void;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { useMemo, useLayoutEffect, useEffect, createContext, memo, forwardRef, useRef, useContext, useState, useCallback, useReducer, cloneElement, useImperativeHandle, Fragment } from 'react';
3
3
  import ReactDOM, { unstable_batchedUpdates, flushSync, createPortal } from 'react-dom';
4
- import { findIndex, debounce, negate, isEmpty, difference, delay, sortBy, defer as defer$1, last, castArray, remove, flatten, xorBy, partition, pick, groupBy, fromPairs, toPairs, omit } from 'lodash-es';
4
+ import { findIndex, debounce, negate, isEmpty, difference, delay, sortBy, defer as defer$1, last, castArray, remove, flatten, xorBy, partition, pick, groupBy, fromPairs, toPairs, omit, isEqual } from 'lodash-es';
5
5
  import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
6
6
  import { AgGridReact } from 'ag-grid-react';
7
7
  import { LuiMiniSpinner, LuiIcon, LuiCheckboxInput, LuiButton } from '@linzjs/lui';
@@ -24663,6 +24663,23 @@ var findMenuOption = function (menuOptionText) { return __awaiter(void 0, void 0
24663
24663
  }
24664
24664
  });
24665
24665
  }); };
24666
+ var validateMenuOptions = function (rowId, colId, expectedMenuOptions) { return __awaiter(void 0, void 0, void 0, function () {
24667
+ var openMenu, actualOptions;
24668
+ return __generator(this, function (_a) {
24669
+ switch (_a.label) {
24670
+ case 0: return [4 /*yield*/, editCell(rowId, colId)];
24671
+ case 1:
24672
+ _a.sent();
24673
+ return [4 /*yield*/, findOpenMenu()];
24674
+ case 2:
24675
+ openMenu = _a.sent();
24676
+ return [4 /*yield*/, getQueriesForElement(openMenu).findAllByRole("menuitem")];
24677
+ case 3:
24678
+ actualOptions = (_a.sent()).map(function (menuItem) { return menuItem.textContent; });
24679
+ return [2 /*return*/, isEqual(actualOptions, expectedMenuOptions)];
24680
+ }
24681
+ });
24682
+ }); };
24666
24683
  var clickMenuOption = function (menuOptionText) { return __awaiter(void 0, void 0, void 0, function () {
24667
24684
  var menuOption;
24668
24685
  return __generator(this, function (_a) {
@@ -24735,14 +24752,14 @@ var clickMultiSelectOption = function (value) { return __awaiter(void 0, void 0,
24735
24752
  }
24736
24753
  });
24737
24754
  }); };
24738
- var typeInput = function (value) { return __awaiter(void 0, void 0, void 0, function () {
24755
+ var typeInput = function (value, filter) { return __awaiter(void 0, void 0, void 0, function () {
24739
24756
  var openMenu, input;
24740
24757
  return __generator(this, function (_a) {
24741
24758
  switch (_a.label) {
24742
24759
  case 0: return [4 /*yield*/, findOpenMenu()];
24743
24760
  case 1:
24744
24761
  openMenu = _a.sent();
24745
- return [4 /*yield*/, findQuick({ child: { tagName: "input[type='text']" } }, openMenu)];
24762
+ return [4 /*yield*/, findQuick(filter, openMenu)];
24746
24763
  case 2:
24747
24764
  input = _a.sent();
24748
24765
  userEvent.clear(input);
@@ -24751,36 +24768,42 @@ var typeInput = function (value) { return __awaiter(void 0, void 0, void 0, func
24751
24768
  }
24752
24769
  });
24753
24770
  }); };
24754
- var typeOtherInput = function (value) { return __awaiter(void 0, void 0, void 0, function () {
24755
- var openMenu, otherInput;
24771
+ var typeOnlyInput = function (value) { return __awaiter(void 0, void 0, void 0, function () {
24756
24772
  return __generator(this, function (_a) {
24757
- switch (_a.label) {
24758
- case 0: return [4 /*yield*/, findOpenMenu()];
24759
- case 1:
24760
- openMenu = _a.sent();
24761
- return [4 /*yield*/, findQuick({ classes: ".subComponent", child: { tagName: "input[type='text']" } }, openMenu)];
24762
- case 2:
24763
- otherInput = _a.sent();
24764
- userEvent.clear(otherInput);
24765
- userEvent.type(otherInput, value);
24766
- return [2 /*return*/];
24773
+ typeInput(value, { child: { tagName: "input[type='text']" } });
24774
+ return [2 /*return*/];
24775
+ });
24776
+ }); };
24777
+ var typeInputByLabel = function (value, labelText) { return __awaiter(void 0, void 0, void 0, function () {
24778
+ var labels;
24779
+ return __generator(this, function (_a) {
24780
+ labels = getAllQuick({ child: { tagName: "label" } }).filter(function (l) { return l.textContent == labelText; });
24781
+ if (labels.length == 0) {
24782
+ throw Error("Label not found for text: ".concat(labelText));
24783
+ }
24784
+ if (labels.length > 1) {
24785
+ throw Error("Multiple labels found for text: ".concat(labelText));
24767
24786
  }
24787
+ typeInput(value, { child: { tagName: "input[id='".concat(labels[0].getAttribute("for"), "']") } });
24788
+ return [2 /*return*/];
24789
+ });
24790
+ }); };
24791
+ var typeInputByPlaceholder = function (value, placeholder) { return __awaiter(void 0, void 0, void 0, function () {
24792
+ return __generator(this, function (_a) {
24793
+ typeInput(value, { child: { tagName: "input[placeholder='".concat(placeholder, "']") } });
24794
+ return [2 /*return*/];
24795
+ });
24796
+ }); };
24797
+ var typeOtherInput = function (value) { return __awaiter(void 0, void 0, void 0, function () {
24798
+ return __generator(this, function (_a) {
24799
+ typeInput(value, { classes: ".subComponent", child: { tagName: "input[type='text']" } });
24800
+ return [2 /*return*/];
24768
24801
  });
24769
24802
  }); };
24770
24803
  var typeOtherTextArea = function (value) { return __awaiter(void 0, void 0, void 0, function () {
24771
- var openMenu, otherTextArea;
24772
24804
  return __generator(this, function (_a) {
24773
- switch (_a.label) {
24774
- case 0: return [4 /*yield*/, findOpenMenu()];
24775
- case 1:
24776
- openMenu = _a.sent();
24777
- return [4 /*yield*/, findQuick({ classes: ".subComponent", child: { tagName: "textarea" } }, openMenu)];
24778
- case 2:
24779
- otherTextArea = _a.sent();
24780
- userEvent.clear(otherTextArea);
24781
- userEvent.type(otherTextArea, value);
24782
- return [2 /*return*/];
24783
- }
24805
+ typeInput(value, { classes: ".subComponent", child: { tagName: "textarea" } });
24806
+ return [2 /*return*/];
24784
24807
  });
24785
24808
  }); };
24786
24809
  var closeMenu = function () {
@@ -24811,5 +24834,5 @@ var clickActionButton = function (text, container) { return __awaiter(void 0, vo
24811
24834
  });
24812
24835
  }); };
24813
24836
 
24814
- export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionValueFormatter, bearingNumberParser, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, convertDDToDMS, countRows, deselectRow, editCell, findActionButton, findCell, findCellContains, findMenuOption, findMultiSelectOption, findParentWithClass, findRow, fnOrVar, getMultiSelectOptions, hasParentClass, isFloat, isNotEmpty, openAndClickMenuOption, queryMenuOption, queryRow, selectCell, selectRow, stringByteLengthIsInvalid, suppressCellKeyboardEvents, typeInput, typeOtherInput, typeOtherTextArea, useDeferredPromise, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait$2 as wait };
24837
+ export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionValueFormatter, bearingNumberParser, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, convertDDToDMS, countRows, deselectRow, editCell, findActionButton, findCell, findCellContains, findMenuOption, findMultiSelectOption, findParentWithClass, findRow, fnOrVar, getMultiSelectOptions, hasParentClass, isFloat, isNotEmpty, openAndClickMenuOption, queryMenuOption, queryRow, selectCell, selectRow, stringByteLengthIsInvalid, suppressCellKeyboardEvents, typeInputByLabel, typeInputByPlaceholder, typeOnlyInput, typeOtherInput, typeOtherTextArea, useDeferredPromise, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, validateMenuOptions, wait$2 as wait };
24815
24838
  //# sourceMappingURL=step-ag-grid.esm.js.map