@linzjs/step-ag-grid 15.1.0 → 15.1.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/dist/src/utils/testQuick.d.ts +1 -1
- package/dist/src/utils/testUtil.d.ts +5 -0
- package/dist/step-ag-grid.cjs.js +41 -52
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +41 -53
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/testQuick.ts +2 -2
- package/src/utils/testUtil.ts +46 -58
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -28371,14 +28371,14 @@ const getQuick = (filter, container) => {
|
|
|
28371
28371
|
return el;
|
|
28372
28372
|
};
|
|
28373
28373
|
/**
|
|
28374
|
-
* Find by filter. Waits up to
|
|
28374
|
+
* Find by filter. Waits up to 5 seconds to find filter.
|
|
28375
28375
|
*
|
|
28376
28376
|
* @param filter Filter
|
|
28377
28377
|
* @param container Optional container to look in
|
|
28378
28378
|
* @return HTMLElement. Throws exception if not found.
|
|
28379
28379
|
*/
|
|
28380
28380
|
const findQuick = async (filter, container) => {
|
|
28381
|
-
const endTime = Date.now() +
|
|
28381
|
+
const endTime = Date.now() + 5000;
|
|
28382
28382
|
while (Date.now() < endTime) {
|
|
28383
28383
|
const el = queryQuick(filter, container);
|
|
28384
28384
|
if (el)
|
|
@@ -28388,46 +28388,42 @@ const findQuick = async (filter, container) => {
|
|
|
28388
28388
|
throw Error(`findQuick not found, selector: ${quickSelector(filter).selector}`);
|
|
28389
28389
|
};
|
|
28390
28390
|
|
|
28391
|
+
let user = userEvent;
|
|
28392
|
+
/**
|
|
28393
|
+
* allow external userEvent to be used
|
|
28394
|
+
* @param customisedUserEvent
|
|
28395
|
+
*/
|
|
28396
|
+
const setUpUserEvent = (customisedUserEvent) => {
|
|
28397
|
+
user = customisedUserEvent;
|
|
28398
|
+
};
|
|
28391
28399
|
const countRows = async (within) => {
|
|
28392
28400
|
return getAllQuick({ tagName: `div[row-id]:not(:empty)` }, within).length;
|
|
28393
28401
|
};
|
|
28394
28402
|
const findRow = async (rowId, within) => {
|
|
28395
|
-
|
|
28396
|
-
let row;
|
|
28397
|
-
await act(async () => {
|
|
28398
|
-
row = await findQuick({ tagName: `div[row-id='${rowId}']:not(:empty)` }, within);
|
|
28399
|
-
});
|
|
28400
|
-
return row;
|
|
28403
|
+
return await findQuick({ tagName: `div[row-id='${rowId}']:not(:empty)` }, within);
|
|
28401
28404
|
};
|
|
28402
28405
|
const queryRow = async (rowId, within) => {
|
|
28403
28406
|
return queryQuick({ tagName: `div[row-id='${rowId}']:not(:empty)` }, within);
|
|
28404
28407
|
};
|
|
28405
28408
|
const _selectRow = async (select, rowId, within) => {
|
|
28406
|
-
await
|
|
28407
|
-
|
|
28408
|
-
|
|
28409
|
-
|
|
28410
|
-
|
|
28411
|
-
|
|
28412
|
-
await
|
|
28413
|
-
|
|
28414
|
-
|
|
28415
|
-
|
|
28416
|
-
|
|
28417
|
-
|
|
28418
|
-
}
|
|
28419
|
-
});
|
|
28409
|
+
const row = await findRow(rowId, within);
|
|
28410
|
+
const isSelected = row.className.includes("ag-row-selected");
|
|
28411
|
+
if (select === "toggle" || (select === "select" && !isSelected) || (select === "deselect" && isSelected)) {
|
|
28412
|
+
const cell = await findCell(rowId, "selection", within);
|
|
28413
|
+
await user.click(cell);
|
|
28414
|
+
await waitForWrapper$1(async () => {
|
|
28415
|
+
const row = await findRow(rowId, within);
|
|
28416
|
+
const nowSelected = row.className.includes("ag-row-selected");
|
|
28417
|
+
if (nowSelected === isSelected)
|
|
28418
|
+
throw `Row ${rowId} won't select`;
|
|
28419
|
+
});
|
|
28420
|
+
}
|
|
28420
28421
|
};
|
|
28421
28422
|
const selectRow = async (rowId, within) => _selectRow("select", rowId, within);
|
|
28422
28423
|
const deselectRow = async (rowId, within) => _selectRow("deselect", rowId, within);
|
|
28423
28424
|
const findCell = async (rowId, colId, within) => {
|
|
28424
|
-
|
|
28425
|
-
|
|
28426
|
-
await act(async () => {
|
|
28427
|
-
const row = await findRow(rowId, within);
|
|
28428
|
-
cell = await findQuick({ tagName: `[col-id='${colId}']` }, row);
|
|
28429
|
-
});
|
|
28430
|
-
return cell;
|
|
28425
|
+
const row = await findRow(rowId, within);
|
|
28426
|
+
return await findQuick({ tagName: `[col-id='${colId}']` }, row);
|
|
28431
28427
|
};
|
|
28432
28428
|
const findCellContains = async (rowId, colId, text, within) => {
|
|
28433
28429
|
return await waitForWrapper$1(async () => {
|
|
@@ -28436,16 +28432,12 @@ const findCellContains = async (rowId, colId, text, within) => {
|
|
|
28436
28432
|
}, { timeout: 10000 });
|
|
28437
28433
|
};
|
|
28438
28434
|
const selectCell = async (rowId, colId, within) => {
|
|
28439
|
-
await
|
|
28440
|
-
|
|
28441
|
-
await userEvent.click(cell);
|
|
28442
|
-
});
|
|
28435
|
+
const cell = await findCell(rowId, colId, within);
|
|
28436
|
+
await user.click(cell);
|
|
28443
28437
|
};
|
|
28444
28438
|
const editCell = async (rowId, colId, within) => {
|
|
28445
|
-
await
|
|
28446
|
-
|
|
28447
|
-
await userEvent.dblClick(cell);
|
|
28448
|
-
});
|
|
28439
|
+
const cell = await findCell(rowId, colId, within);
|
|
28440
|
+
await user.dblClick(cell);
|
|
28449
28441
|
await waitForWrapper$1(findOpenPopover);
|
|
28450
28442
|
};
|
|
28451
28443
|
const isCellReadOnly = async (rowId, colId, within) => {
|
|
@@ -28476,10 +28468,8 @@ const validateMenuOptions = async (rowId, colId, expectedMenuOptions) => {
|
|
|
28476
28468
|
return isEqual(actualOptions, expectedMenuOptions);
|
|
28477
28469
|
};
|
|
28478
28470
|
const clickMenuOption = async (menuOptionText) => {
|
|
28479
|
-
await
|
|
28480
|
-
|
|
28481
|
-
await userEvent.click(menuOption);
|
|
28482
|
-
});
|
|
28471
|
+
const menuOption = await findMenuOption(menuOptionText);
|
|
28472
|
+
await user.click(menuOption);
|
|
28483
28473
|
};
|
|
28484
28474
|
const openAndClickMenuOption = async (rowId, colId, menuOptionText, within) => {
|
|
28485
28475
|
await editCell(rowId, colId, within);
|
|
@@ -28504,21 +28494,21 @@ const findMultiSelectOption = async (value) => {
|
|
|
28504
28494
|
};
|
|
28505
28495
|
const clickMultiSelectOption = async (value) => {
|
|
28506
28496
|
const menuItem = await findMultiSelectOption(value);
|
|
28507
|
-
menuItem.parentElement && (await
|
|
28497
|
+
menuItem.parentElement && (await user.click(menuItem.parentElement));
|
|
28508
28498
|
};
|
|
28509
|
-
const typeInput = async (value, filter) =>
|
|
28499
|
+
const typeInput = async (value, filter) => {
|
|
28510
28500
|
const openMenu = await findOpenPopover();
|
|
28511
28501
|
const input = await findQuick(filter, openMenu);
|
|
28512
|
-
await
|
|
28502
|
+
await user.clear(input);
|
|
28513
28503
|
//'typing' an empty string will cause a console error, and it's also unnecessary after the previous clear call
|
|
28514
28504
|
if (value.length > 0) {
|
|
28515
|
-
await
|
|
28505
|
+
await user.type(input, value);
|
|
28516
28506
|
}
|
|
28517
|
-
}
|
|
28507
|
+
};
|
|
28518
28508
|
const typeOnlyInput = async (value) => typeInput(value, { child: { tagName: "input[type='text'], textarea" } });
|
|
28519
28509
|
const typeInputByLabel = async (value, labelText) => {
|
|
28520
|
-
const labels = getAllQuick({ child: { tagName: "label" } }).filter((l) => l.textContent
|
|
28521
|
-
if (labels.length
|
|
28510
|
+
const labels = getAllQuick({ child: { tagName: "label" } }).filter((l) => l.textContent === labelText);
|
|
28511
|
+
if (labels.length === 0) {
|
|
28522
28512
|
throw Error(`Label not found for text: ${labelText}`);
|
|
28523
28513
|
}
|
|
28524
28514
|
if (labels.length > 1) {
|
|
@@ -28536,11 +28526,9 @@ const closeMenu = () => userEvent.click(document.body);
|
|
|
28536
28526
|
const closePopover = () => userEvent.click(document.body);
|
|
28537
28527
|
const findActionButton = (text, container) => findQuick({ tagName: "button", child: { classes: ".ActionButton-minimalAreaDisplay", text: text } }, container);
|
|
28538
28528
|
const clickActionButton = async (text, container) => {
|
|
28539
|
-
await
|
|
28540
|
-
|
|
28541
|
-
await userEvent.click(button);
|
|
28542
|
-
});
|
|
28529
|
+
const button = await findActionButton(text, container);
|
|
28530
|
+
await user.click(button);
|
|
28543
28531
|
};
|
|
28544
28532
|
|
|
28545
|
-
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, FormError, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellFiller, GridCellFillerColId, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFilterButtons, GridFilterColumnsToggle, GridFilterDownloadCsvButton, GridFilterHeaderIconButton, GridFilterQuick, GridFilters, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormMultiSelectGrid, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridNoRowsOverlay, GridPopoutEditMultiSelect, GridPopoutEditMultiSelectGrid, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditBearingCorrectionEditorParams, GridPopoverEditBearingEditorParams, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, GridWrapper, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, closePopover, convertDDToDMS, countRows, deselectRow, downloadCsvUseValueFormattersProcessCellCallback, editCell, findActionButton, findCell, findCellContains, findMenuOption, findMultiSelectOption, findOpenPopover, findParentWithClass, findRow, fnOrVar, generateFilterGetter, getMultiSelectOptions, hasParentClass, isCellReadOnly, isFloat, isGridCellFiller, isNotEmpty, openAndClickMenuOption, openAndFindMenuOption, queryMenuOption, queryRow, sanitiseFileName, selectCell, selectRow, stringByteLengthIsInvalid, suppressCellKeyboardEvents, typeInputByLabel, typeInputByPlaceholder, typeOnlyInput, typeOtherInput, typeOtherTextArea, useDeferredPromise, useGenerateOrDefaultId, useGridContext, useGridContextMenu, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, validateMenuOptions, wait$1 as wait };
|
|
28533
|
+
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, FormError, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellFiller, GridCellFillerColId, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFilterButtons, GridFilterColumnsToggle, GridFilterDownloadCsvButton, GridFilterHeaderIconButton, GridFilterQuick, GridFilters, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormMultiSelectGrid, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridNoRowsOverlay, GridPopoutEditMultiSelect, GridPopoutEditMultiSelectGrid, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditBearingCorrectionEditorParams, GridPopoverEditBearingEditorParams, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, GridWrapper, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, closePopover, convertDDToDMS, countRows, deselectRow, downloadCsvUseValueFormattersProcessCellCallback, editCell, findActionButton, findCell, findCellContains, findMenuOption, findMultiSelectOption, findOpenPopover, findParentWithClass, findRow, fnOrVar, generateFilterGetter, getMultiSelectOptions, hasParentClass, isCellReadOnly, isFloat, isGridCellFiller, isNotEmpty, openAndClickMenuOption, openAndFindMenuOption, queryMenuOption, queryRow, sanitiseFileName, selectCell, selectRow, setUpUserEvent, stringByteLengthIsInvalid, suppressCellKeyboardEvents, typeInputByLabel, typeInputByPlaceholder, typeOnlyInput, typeOtherInput, typeOtherTextArea, useDeferredPromise, useGenerateOrDefaultId, useGridContext, useGridContextMenu, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, validateMenuOptions, wait$1 as wait };
|
|
28546
28534
|
//# sourceMappingURL=step-ag-grid.esm.js.map
|