@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
|
@@ -53,7 +53,7 @@ export declare const getAllQuick: <T extends HTMLElement>(filter: IQueryQuick, c
|
|
|
53
53
|
*/
|
|
54
54
|
export declare const getQuick: (filter: IQueryQuick, container?: HTMLElement) => HTMLElement;
|
|
55
55
|
/**
|
|
56
|
-
* Find by filter. Waits up to
|
|
56
|
+
* Find by filter. Waits up to 5 seconds to find filter.
|
|
57
57
|
*
|
|
58
58
|
* @param filter Filter
|
|
59
59
|
* @param container Optional container to look in
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* allow external userEvent to be used
|
|
3
|
+
* @param customisedUserEvent
|
|
4
|
+
*/
|
|
5
|
+
export declare const setUpUserEvent: (customisedUserEvent: any) => void;
|
|
1
6
|
export declare const countRows: (within?: HTMLElement) => Promise<number>;
|
|
2
7
|
export declare const findRow: (rowId: number | string, within?: HTMLElement) => Promise<HTMLDivElement>;
|
|
3
8
|
export declare const queryRow: (rowId: number | string, within?: HTMLElement) => Promise<HTMLDivElement | null>;
|
package/dist/step-ag-grid.cjs.js
CHANGED
|
@@ -28392,14 +28392,14 @@ const getQuick = (filter, container) => {
|
|
|
28392
28392
|
return el;
|
|
28393
28393
|
};
|
|
28394
28394
|
/**
|
|
28395
|
-
* Find by filter. Waits up to
|
|
28395
|
+
* Find by filter. Waits up to 5 seconds to find filter.
|
|
28396
28396
|
*
|
|
28397
28397
|
* @param filter Filter
|
|
28398
28398
|
* @param container Optional container to look in
|
|
28399
28399
|
* @return HTMLElement. Throws exception if not found.
|
|
28400
28400
|
*/
|
|
28401
28401
|
const findQuick = async (filter, container) => {
|
|
28402
|
-
const endTime = Date.now() +
|
|
28402
|
+
const endTime = Date.now() + 5000;
|
|
28403
28403
|
while (Date.now() < endTime) {
|
|
28404
28404
|
const el = queryQuick(filter, container);
|
|
28405
28405
|
if (el)
|
|
@@ -28409,46 +28409,42 @@ const findQuick = async (filter, container) => {
|
|
|
28409
28409
|
throw Error(`findQuick not found, selector: ${quickSelector(filter).selector}`);
|
|
28410
28410
|
};
|
|
28411
28411
|
|
|
28412
|
+
let user = userEvent;
|
|
28413
|
+
/**
|
|
28414
|
+
* allow external userEvent to be used
|
|
28415
|
+
* @param customisedUserEvent
|
|
28416
|
+
*/
|
|
28417
|
+
const setUpUserEvent = (customisedUserEvent) => {
|
|
28418
|
+
user = customisedUserEvent;
|
|
28419
|
+
};
|
|
28412
28420
|
const countRows = async (within) => {
|
|
28413
28421
|
return getAllQuick({ tagName: `div[row-id]:not(:empty)` }, within).length;
|
|
28414
28422
|
};
|
|
28415
28423
|
const findRow = async (rowId, within) => {
|
|
28416
|
-
|
|
28417
|
-
let row;
|
|
28418
|
-
await act(async () => {
|
|
28419
|
-
row = await findQuick({ tagName: `div[row-id='${rowId}']:not(:empty)` }, within);
|
|
28420
|
-
});
|
|
28421
|
-
return row;
|
|
28424
|
+
return await findQuick({ tagName: `div[row-id='${rowId}']:not(:empty)` }, within);
|
|
28422
28425
|
};
|
|
28423
28426
|
const queryRow = async (rowId, within) => {
|
|
28424
28427
|
return queryQuick({ tagName: `div[row-id='${rowId}']:not(:empty)` }, within);
|
|
28425
28428
|
};
|
|
28426
28429
|
const _selectRow = async (select, rowId, within) => {
|
|
28427
|
-
await
|
|
28428
|
-
|
|
28429
|
-
|
|
28430
|
-
|
|
28431
|
-
|
|
28432
|
-
|
|
28433
|
-
await
|
|
28434
|
-
|
|
28435
|
-
|
|
28436
|
-
|
|
28437
|
-
|
|
28438
|
-
|
|
28439
|
-
}
|
|
28440
|
-
});
|
|
28430
|
+
const row = await findRow(rowId, within);
|
|
28431
|
+
const isSelected = row.className.includes("ag-row-selected");
|
|
28432
|
+
if (select === "toggle" || (select === "select" && !isSelected) || (select === "deselect" && isSelected)) {
|
|
28433
|
+
const cell = await findCell(rowId, "selection", within);
|
|
28434
|
+
await user.click(cell);
|
|
28435
|
+
await waitForWrapper$1(async () => {
|
|
28436
|
+
const row = await findRow(rowId, within);
|
|
28437
|
+
const nowSelected = row.className.includes("ag-row-selected");
|
|
28438
|
+
if (nowSelected === isSelected)
|
|
28439
|
+
throw `Row ${rowId} won't select`;
|
|
28440
|
+
});
|
|
28441
|
+
}
|
|
28441
28442
|
};
|
|
28442
28443
|
const selectRow = async (rowId, within) => _selectRow("select", rowId, within);
|
|
28443
28444
|
const deselectRow = async (rowId, within) => _selectRow("deselect", rowId, within);
|
|
28444
28445
|
const findCell = async (rowId, colId, within) => {
|
|
28445
|
-
|
|
28446
|
-
|
|
28447
|
-
await act(async () => {
|
|
28448
|
-
const row = await findRow(rowId, within);
|
|
28449
|
-
cell = await findQuick({ tagName: `[col-id='${colId}']` }, row);
|
|
28450
|
-
});
|
|
28451
|
-
return cell;
|
|
28446
|
+
const row = await findRow(rowId, within);
|
|
28447
|
+
return await findQuick({ tagName: `[col-id='${colId}']` }, row);
|
|
28452
28448
|
};
|
|
28453
28449
|
const findCellContains = async (rowId, colId, text, within) => {
|
|
28454
28450
|
return await waitForWrapper$1(async () => {
|
|
@@ -28457,16 +28453,12 @@ const findCellContains = async (rowId, colId, text, within) => {
|
|
|
28457
28453
|
}, { timeout: 10000 });
|
|
28458
28454
|
};
|
|
28459
28455
|
const selectCell = async (rowId, colId, within) => {
|
|
28460
|
-
await
|
|
28461
|
-
|
|
28462
|
-
await userEvent.click(cell);
|
|
28463
|
-
});
|
|
28456
|
+
const cell = await findCell(rowId, colId, within);
|
|
28457
|
+
await user.click(cell);
|
|
28464
28458
|
};
|
|
28465
28459
|
const editCell = async (rowId, colId, within) => {
|
|
28466
|
-
await
|
|
28467
|
-
|
|
28468
|
-
await userEvent.dblClick(cell);
|
|
28469
|
-
});
|
|
28460
|
+
const cell = await findCell(rowId, colId, within);
|
|
28461
|
+
await user.dblClick(cell);
|
|
28470
28462
|
await waitForWrapper$1(findOpenPopover);
|
|
28471
28463
|
};
|
|
28472
28464
|
const isCellReadOnly = async (rowId, colId, within) => {
|
|
@@ -28497,10 +28489,8 @@ const validateMenuOptions = async (rowId, colId, expectedMenuOptions) => {
|
|
|
28497
28489
|
return lodashEs.isEqual(actualOptions, expectedMenuOptions);
|
|
28498
28490
|
};
|
|
28499
28491
|
const clickMenuOption = async (menuOptionText) => {
|
|
28500
|
-
await
|
|
28501
|
-
|
|
28502
|
-
await userEvent.click(menuOption);
|
|
28503
|
-
});
|
|
28492
|
+
const menuOption = await findMenuOption(menuOptionText);
|
|
28493
|
+
await user.click(menuOption);
|
|
28504
28494
|
};
|
|
28505
28495
|
const openAndClickMenuOption = async (rowId, colId, menuOptionText, within) => {
|
|
28506
28496
|
await editCell(rowId, colId, within);
|
|
@@ -28525,21 +28515,21 @@ const findMultiSelectOption = async (value) => {
|
|
|
28525
28515
|
};
|
|
28526
28516
|
const clickMultiSelectOption = async (value) => {
|
|
28527
28517
|
const menuItem = await findMultiSelectOption(value);
|
|
28528
|
-
menuItem.parentElement && (await
|
|
28518
|
+
menuItem.parentElement && (await user.click(menuItem.parentElement));
|
|
28529
28519
|
};
|
|
28530
|
-
const typeInput = async (value, filter) =>
|
|
28520
|
+
const typeInput = async (value, filter) => {
|
|
28531
28521
|
const openMenu = await findOpenPopover();
|
|
28532
28522
|
const input = await findQuick(filter, openMenu);
|
|
28533
|
-
await
|
|
28523
|
+
await user.clear(input);
|
|
28534
28524
|
//'typing' an empty string will cause a console error, and it's also unnecessary after the previous clear call
|
|
28535
28525
|
if (value.length > 0) {
|
|
28536
|
-
await
|
|
28526
|
+
await user.type(input, value);
|
|
28537
28527
|
}
|
|
28538
|
-
}
|
|
28528
|
+
};
|
|
28539
28529
|
const typeOnlyInput = async (value) => typeInput(value, { child: { tagName: "input[type='text'], textarea" } });
|
|
28540
28530
|
const typeInputByLabel = async (value, labelText) => {
|
|
28541
|
-
const labels = getAllQuick({ child: { tagName: "label" } }).filter((l) => l.textContent
|
|
28542
|
-
if (labels.length
|
|
28531
|
+
const labels = getAllQuick({ child: { tagName: "label" } }).filter((l) => l.textContent === labelText);
|
|
28532
|
+
if (labels.length === 0) {
|
|
28543
28533
|
throw Error(`Label not found for text: ${labelText}`);
|
|
28544
28534
|
}
|
|
28545
28535
|
if (labels.length > 1) {
|
|
@@ -28557,10 +28547,8 @@ const closeMenu = () => userEvent.click(document.body);
|
|
|
28557
28547
|
const closePopover = () => userEvent.click(document.body);
|
|
28558
28548
|
const findActionButton = (text, container) => findQuick({ tagName: "button", child: { classes: ".ActionButton-minimalAreaDisplay", text: text } }, container);
|
|
28559
28549
|
const clickActionButton = async (text, container) => {
|
|
28560
|
-
await
|
|
28561
|
-
|
|
28562
|
-
await userEvent.click(button);
|
|
28563
|
-
});
|
|
28550
|
+
const button = await findActionButton(text, container);
|
|
28551
|
+
await user.click(button);
|
|
28564
28552
|
};
|
|
28565
28553
|
|
|
28566
28554
|
exports.ActionButton = ActionButton;
|
|
@@ -28671,6 +28659,7 @@ exports.queryRow = queryRow;
|
|
|
28671
28659
|
exports.sanitiseFileName = sanitiseFileName;
|
|
28672
28660
|
exports.selectCell = selectCell;
|
|
28673
28661
|
exports.selectRow = selectRow;
|
|
28662
|
+
exports.setUpUserEvent = setUpUserEvent;
|
|
28674
28663
|
exports.stringByteLengthIsInvalid = stringByteLengthIsInvalid;
|
|
28675
28664
|
exports.suppressCellKeyboardEvents = suppressCellKeyboardEvents;
|
|
28676
28665
|
exports.typeInputByLabel = typeInputByLabel;
|