@linzjs/step-ag-grid 28.1.2 → 28.2.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/README.md CHANGED
@@ -278,4 +278,4 @@ This will throw an exception if the row id is not found.
278
278
 
279
279
  ```tsx
280
280
  window.__stepAgGrid.grids[dataTestId].scrollRowIntoViewById("1000")
281
- ```
281
+ ```
@@ -183,7 +183,7 @@ export const findMenuOption = async (menuOptionText: string | RegExp): Promise<H
183
183
  );
184
184
  };
185
185
 
186
- export const validateMenuOptions = async (
186
+ export const editValidateMenuOptions = async (
187
187
  rowId: number | string,
188
188
  colId: string,
189
189
  expectedMenuOptions: Array<string>,
@@ -194,11 +194,32 @@ export const validateMenuOptions = async (
194
194
  return isEqual(actualOptions, expectedMenuOptions);
195
195
  };
196
196
 
197
+ export const validateMenuOptions = async (
198
+ rowId: number | string,
199
+ colId: string,
200
+ expectedMenuOptions: Array<string>,
201
+ ): Promise<boolean> => {
202
+ await selectCell(rowId, colId);
203
+ const openMenu = await findOpenPopover();
204
+ const actualOptions = (await within(openMenu).findAllByRole('menuitem')).map((menuItem) => menuItem.textContent);
205
+ return isEqual(actualOptions, expectedMenuOptions);
206
+ };
207
+
197
208
  export const clickMenuOption = async (menuOptionText: string | RegExp): Promise<void> => {
198
209
  const menuOption = await findMenuOption(menuOptionText);
199
210
  await user.click(menuOption);
200
211
  };
201
212
 
213
+ export const editAndClickMenuOption = async (
214
+ rowId: number | string,
215
+ colId: string,
216
+ menuOptionText: string | RegExp,
217
+ within?: HTMLElement,
218
+ ): Promise<void> => {
219
+ await editCell(rowId, colId, within);
220
+ await clickMenuOption(menuOptionText);
221
+ };
222
+
202
223
  export const openAndClickMenuOption = async (
203
224
  rowId: number | string,
204
225
  colId: string,
@@ -215,7 +236,7 @@ export const openAndFindMenuOption = async (
215
236
  menuOptionText: string | RegExp,
216
237
  within?: HTMLElement,
217
238
  ): Promise<HTMLElement> => {
218
- await editCell(rowId, colId, within);
239
+ await selectCell(rowId, colId, within);
219
240
  return await findMenuOption(menuOptionText);
220
241
  };
221
242
 
@@ -136,8 +136,13 @@ export const findCellContains = async (
136
136
  };
137
137
 
138
138
  export const selectCell = async (rowId: string | number, colId: string, within?: HTMLElement): Promise<void> => {
139
- const cell = await findCell(rowId, colId, within);
140
- await user.click(cell);
139
+ await waitFor(
140
+ async () => {
141
+ const cell = await findCell(rowId, colId, within);
142
+ await user.click(cell);
143
+ },
144
+ { timeout: 10000 },
145
+ );
141
146
  };
142
147
 
143
148
  export const editCell = async (rowId: number | string, colId: string, within?: HTMLElement): Promise<void> => {
@@ -179,7 +184,7 @@ export const findMenuOption = async (menuOptionText: string | RegExp): Promise<H
179
184
  );
180
185
  };
181
186
 
182
- export const validateMenuOptions = async (
187
+ export const editValidateMenuOptions = async (
183
188
  rowId: number | string,
184
189
  colId: string,
185
190
  expectedMenuOptions: Array<string>,
@@ -190,12 +195,23 @@ export const validateMenuOptions = async (
190
195
  return isEqual(actualOptions, expectedMenuOptions);
191
196
  };
192
197
 
198
+ export const validateMenuOptions = async (
199
+ rowId: number | string,
200
+ colId: string,
201
+ expectedMenuOptions: Array<string>,
202
+ ): Promise<boolean> => {
203
+ await selectCell(rowId, colId);
204
+ const openMenu = await findOpenPopover();
205
+ const actualOptions = (await within(openMenu).findAllByRole('menuitem')).map((menuItem) => menuItem.textContent);
206
+ return isEqual(actualOptions, expectedMenuOptions);
207
+ };
208
+
193
209
  export const clickMenuOption = async (menuOptionText: string | RegExp): Promise<void> => {
194
210
  const menuOption = await findMenuOption(menuOptionText);
195
211
  await user.click(menuOption);
196
212
  };
197
213
 
198
- export const openAndClickMenuOption = async (
214
+ export const editAndClickMenuOption = async (
199
215
  rowId: number | string,
200
216
  colId: string,
201
217
  menuOptionText: string | RegExp,
@@ -205,13 +221,23 @@ export const openAndClickMenuOption = async (
205
221
  await clickMenuOption(menuOptionText);
206
222
  };
207
223
 
224
+ export const openAndClickMenuOption = async (
225
+ rowId: number | string,
226
+ colId: string,
227
+ menuOptionText: string | RegExp,
228
+ within?: HTMLElement,
229
+ ): Promise<void> => {
230
+ await selectCell(rowId, colId, within);
231
+ await clickMenuOption(menuOptionText);
232
+ };
233
+
208
234
  export const openAndFindMenuOption = async (
209
235
  rowId: number | string,
210
236
  colId: string,
211
237
  menuOptionText: string | RegExp,
212
238
  within?: HTMLElement,
213
239
  ): Promise<HTMLElement> => {
214
- await editCell(rowId, colId, within);
240
+ await selectCell(rowId, colId, within);
215
241
  return await findMenuOption(menuOptionText);
216
242
  };
217
243
 
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": "28.1.2",
5
+ "version": "28.2.0",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -125,7 +125,7 @@
125
125
  "rollup-plugin-peer-deps-external": "^2.2.4",
126
126
  "rollup-plugin-postcss": "^4.0.2",
127
127
  "rollup-plugin-typescript2": "^0.36.0",
128
- "sass": "^1.89.2",
128
+ "sass": "^1.90.0",
129
129
  "sass-loader": "^16.0.5",
130
130
  "semantic-release": "^24.2.7",
131
131
  "storybook": "^9.1.0",
@@ -183,7 +183,7 @@ export const findMenuOption = async (menuOptionText: string | RegExp): Promise<H
183
183
  );
184
184
  };
185
185
 
186
- export const validateMenuOptions = async (
186
+ export const editValidateMenuOptions = async (
187
187
  rowId: number | string,
188
188
  colId: string,
189
189
  expectedMenuOptions: Array<string>,
@@ -194,11 +194,32 @@ export const validateMenuOptions = async (
194
194
  return isEqual(actualOptions, expectedMenuOptions);
195
195
  };
196
196
 
197
+ export const validateMenuOptions = async (
198
+ rowId: number | string,
199
+ colId: string,
200
+ expectedMenuOptions: Array<string>,
201
+ ): Promise<boolean> => {
202
+ await selectCell(rowId, colId);
203
+ const openMenu = await findOpenPopover();
204
+ const actualOptions = (await within(openMenu).findAllByRole('menuitem')).map((menuItem) => menuItem.textContent);
205
+ return isEqual(actualOptions, expectedMenuOptions);
206
+ };
207
+
197
208
  export const clickMenuOption = async (menuOptionText: string | RegExp): Promise<void> => {
198
209
  const menuOption = await findMenuOption(menuOptionText);
199
210
  await user.click(menuOption);
200
211
  };
201
212
 
213
+ export const editAndClickMenuOption = async (
214
+ rowId: number | string,
215
+ colId: string,
216
+ menuOptionText: string | RegExp,
217
+ within?: HTMLElement,
218
+ ): Promise<void> => {
219
+ await editCell(rowId, colId, within);
220
+ await clickMenuOption(menuOptionText);
221
+ };
222
+
202
223
  export const openAndClickMenuOption = async (
203
224
  rowId: number | string,
204
225
  colId: string,
@@ -215,7 +236,7 @@ export const openAndFindMenuOption = async (
215
236
  menuOptionText: string | RegExp,
216
237
  within?: HTMLElement,
217
238
  ): Promise<HTMLElement> => {
218
- await editCell(rowId, colId, within);
239
+ await selectCell(rowId, colId, within);
219
240
  return await findMenuOption(menuOptionText);
220
241
  };
221
242
 
@@ -136,8 +136,13 @@ export const findCellContains = async (
136
136
  };
137
137
 
138
138
  export const selectCell = async (rowId: string | number, colId: string, within?: HTMLElement): Promise<void> => {
139
- const cell = await findCell(rowId, colId, within);
140
- await user.click(cell);
139
+ await waitFor(
140
+ async () => {
141
+ const cell = await findCell(rowId, colId, within);
142
+ await user.click(cell);
143
+ },
144
+ { timeout: 10000 },
145
+ );
141
146
  };
142
147
 
143
148
  export const editCell = async (rowId: number | string, colId: string, within?: HTMLElement): Promise<void> => {
@@ -179,7 +184,7 @@ export const findMenuOption = async (menuOptionText: string | RegExp): Promise<H
179
184
  );
180
185
  };
181
186
 
182
- export const validateMenuOptions = async (
187
+ export const editValidateMenuOptions = async (
183
188
  rowId: number | string,
184
189
  colId: string,
185
190
  expectedMenuOptions: Array<string>,
@@ -190,12 +195,23 @@ export const validateMenuOptions = async (
190
195
  return isEqual(actualOptions, expectedMenuOptions);
191
196
  };
192
197
 
198
+ export const validateMenuOptions = async (
199
+ rowId: number | string,
200
+ colId: string,
201
+ expectedMenuOptions: Array<string>,
202
+ ): Promise<boolean> => {
203
+ await selectCell(rowId, colId);
204
+ const openMenu = await findOpenPopover();
205
+ const actualOptions = (await within(openMenu).findAllByRole('menuitem')).map((menuItem) => menuItem.textContent);
206
+ return isEqual(actualOptions, expectedMenuOptions);
207
+ };
208
+
193
209
  export const clickMenuOption = async (menuOptionText: string | RegExp): Promise<void> => {
194
210
  const menuOption = await findMenuOption(menuOptionText);
195
211
  await user.click(menuOption);
196
212
  };
197
213
 
198
- export const openAndClickMenuOption = async (
214
+ export const editAndClickMenuOption = async (
199
215
  rowId: number | string,
200
216
  colId: string,
201
217
  menuOptionText: string | RegExp,
@@ -205,13 +221,23 @@ export const openAndClickMenuOption = async (
205
221
  await clickMenuOption(menuOptionText);
206
222
  };
207
223
 
224
+ export const openAndClickMenuOption = async (
225
+ rowId: number | string,
226
+ colId: string,
227
+ menuOptionText: string | RegExp,
228
+ within?: HTMLElement,
229
+ ): Promise<void> => {
230
+ await selectCell(rowId, colId, within);
231
+ await clickMenuOption(menuOptionText);
232
+ };
233
+
208
234
  export const openAndFindMenuOption = async (
209
235
  rowId: number | string,
210
236
  colId: string,
211
237
  menuOptionText: string | RegExp,
212
238
  within?: HTMLElement,
213
239
  ): Promise<HTMLElement> => {
214
- await editCell(rowId, colId, within);
240
+ await selectCell(rowId, colId, within);
215
241
  return await findMenuOption(menuOptionText);
216
242
  };
217
243