@linzjs/step-ag-grid 7.17.1 → 7.19.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
@@ -2,7 +2,7 @@
2
2
  "name": "@linzjs/step-ag-grid",
3
3
  "repository": "github:linz/step-ag-grid.git",
4
4
  "license": "MIT",
5
- "version": "7.17.1",
5
+ "version": "7.19.0",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -73,7 +73,7 @@ export const editCell = async (rowId: number | string, colId: string, within?: H
73
73
  const cell = await findCell(rowId, colId, within);
74
74
  userEvent.dblClick(cell);
75
75
  });
76
- await waitFor(findOpenMenu);
76
+ await waitFor(findOpenPopover);
77
77
  };
78
78
 
79
79
  export const isCellReadOnly = async (rowId: number | string, colId: string, within?: HTMLElement): Promise<boolean> => {
@@ -81,10 +81,10 @@ export const isCellReadOnly = async (rowId: number | string, colId: string, with
81
81
  return cell.className.includes("GridCell-readonly");
82
82
  };
83
83
 
84
- const findOpenMenu = async (): Promise<HTMLElement> => findQuick({ classes: ".szh-menu--state-open" });
84
+ export const findOpenPopover = async (): Promise<HTMLElement> => findQuick({ classes: ".szh-menu--state-open" });
85
85
 
86
86
  export const queryMenuOption = async (menuOptionText: string | RegExp): Promise<HTMLElement | null> => {
87
- const openMenu = await findOpenMenu();
87
+ const openMenu = await findOpenPopover();
88
88
  const els = await within(openMenu).findAllByRole("menuitem");
89
89
  const matcher = getMatcher(menuOptionText);
90
90
  const result = els.find(matcher);
@@ -110,7 +110,7 @@ export const validateMenuOptions = async (
110
110
  expectedMenuOptions: Array<string>,
111
111
  ): Promise<boolean> => {
112
112
  await editCell(rowId, colId);
113
- const openMenu = await findOpenMenu();
113
+ const openMenu = await findOpenPopover();
114
114
  const actualOptions = (await within(openMenu).findAllByRole("menuitem")).map((menuItem) => menuItem.textContent);
115
115
  return isEqual(actualOptions, expectedMenuOptions);
116
116
  };
@@ -132,8 +132,18 @@ export const openAndClickMenuOption = async (
132
132
  await clickMenuOption(menuOptionText);
133
133
  };
134
134
 
135
+ export const openAndFindMenuOption = async (
136
+ rowId: number | string,
137
+ colId: string,
138
+ menuOptionText: string | RegExp,
139
+ within?: HTMLElement,
140
+ ): Promise<HTMLElement> => {
141
+ await editCell(rowId, colId, within);
142
+ return await findMenuOption(menuOptionText);
143
+ };
144
+
135
145
  export const getMultiSelectOptions = async () => {
136
- const openMenu = await findOpenMenu();
146
+ const openMenu = await findOpenPopover();
137
147
  return getAllQuick<HTMLInputElement>({ role: "menuitem", child: { tagName: "input,textarea" } }, openMenu).map(
138
148
  (input) => {
139
149
  return {
@@ -145,7 +155,7 @@ export const getMultiSelectOptions = async () => {
145
155
  };
146
156
 
147
157
  export const findMultiSelectOption = async (value: string): Promise<HTMLElement> => {
148
- const openMenu = await findOpenMenu();
158
+ const openMenu = await findOpenPopover();
149
159
  return getQuick({ role: "menuitem", child: { tagName: `input[value='${value}']` } }, openMenu);
150
160
  };
151
161
 
@@ -154,18 +164,16 @@ export const clickMultiSelectOption = async (value: string): Promise<void> => {
154
164
  menuItem.parentElement && userEvent.click(menuItem.parentElement);
155
165
  };
156
166
 
157
- const typeInput = async (value: string, filter: IQueryQuick): Promise<void> => {
158
- await act(async () => {
159
- const openMenu = await findOpenMenu();
167
+ const typeInput = async (value: string, filter: IQueryQuick): Promise<void> =>
168
+ act(async () => {
169
+ const openMenu = await findOpenPopover();
160
170
  const input = await findQuick(filter, openMenu);
161
171
  userEvent.clear(input);
162
172
  userEvent.type(input, value);
163
173
  });
164
- };
165
174
 
166
- export const typeOnlyInput = async (value: string): Promise<void> => {
167
- await typeInput(value, { child: { tagName: "input[type='text'], textarea" } });
168
- };
175
+ export const typeOnlyInput = async (value: string): Promise<void> =>
176
+ typeInput(value, { child: { tagName: "input[type='text'], textarea" } });
169
177
 
170
178
  export const typeInputByLabel = async (value: string, labelText: string): Promise<void> => {
171
179
  const labels = getAllQuick({ child: { tagName: "label" } }).filter((l) => l.textContent == labelText);
@@ -179,28 +187,24 @@ export const typeInputByLabel = async (value: string, labelText: string): Promis
179
187
  await typeInput(value, { child: { tagName: `input[id='${inputId}'], textarea[id='${inputId}']` } });
180
188
  };
181
189
 
182
- export const typeInputByPlaceholder = async (value: string, placeholder: string): Promise<void> => {
183
- await typeInput(value, {
190
+ export const typeInputByPlaceholder = async (value: string, placeholder: string): Promise<void> =>
191
+ typeInput(value, {
184
192
  child: { tagName: `input[placeholder='${placeholder}'], textarea[placeholder='${placeholder}']` },
185
193
  });
186
- };
187
194
 
188
- export const typeOtherInput = async (value: string): Promise<void> => {
189
- await typeInput(value, { classes: ".subComponent", child: { tagName: "input[type='text']" } });
190
- };
195
+ export const typeOtherInput = async (value: string): Promise<void> =>
196
+ typeInput(value, { classes: ".subComponent", child: { tagName: "input[type='text']" } });
191
197
 
192
- export const typeOtherTextArea = async (value: string): Promise<void> => {
193
- await typeInput(value, { classes: ".subComponent", child: { tagName: "textarea" } });
194
- };
198
+ export const typeOtherTextArea = async (value: string): Promise<void> =>
199
+ typeInput(value, { classes: ".subComponent", child: { tagName: "textarea" } });
195
200
 
196
- export const closeMenu = (): void => {
197
- userEvent.click(document.body);
198
- };
201
+ export const closeMenu = (): void => userEvent.click(document.body);
202
+ export const closePopover = (): void => userEvent.click(document.body);
199
203
 
200
- export const findActionButton = (text: string, container: HTMLElement): Promise<HTMLElement> =>
204
+ export const findActionButton = (text: string, container?: HTMLElement): Promise<HTMLElement> =>
201
205
  findQuick({ tagName: "button", child: { classes: ".ActionButton-minimalAreaDisplay", text: text } }, container);
202
206
 
203
- export const clickActionButton = async (text: string, container: HTMLElement): Promise<void> => {
207
+ export const clickActionButton = async (text: string, container?: HTMLElement): Promise<void> => {
204
208
  await act(async () => {
205
209
  const button = await findActionButton(text, container);
206
210
  userEvent.click(button);