@linzjs/step-ag-grid 7.16.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 +4 -0
- package/dist/src/utils/testUtil.d.ts +3 -1
- package/dist/step-ag-grid.esm.js +33 -27
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/testUtil.ts +24 -11
package/package.json
CHANGED
package/src/utils/testUtil.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { act, waitFor, within } from "@testing-library/react";
|
|
2
2
|
import userEvent from "@testing-library/user-event";
|
|
3
|
-
import { findQuick, getAllQuick, getMatcher, getQuick, queryQuick } from "./testQuick";
|
|
3
|
+
import { findQuick, getAllQuick, getMatcher, getQuick, IQueryQuick, queryQuick } from "./testQuick";
|
|
4
4
|
import { isEqual } from "lodash-es";
|
|
5
5
|
|
|
6
6
|
export const countRows = async (within?: HTMLElement): Promise<number> => {
|
|
@@ -149,25 +149,38 @@ export const clickMultiSelectOption = async (value: string): Promise<void> => {
|
|
|
149
149
|
menuItem.parentElement && userEvent.click(menuItem.parentElement);
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
const typeInput = async (value: string, filter: IQueryQuick): Promise<void> => {
|
|
153
153
|
const openMenu = await findOpenMenu();
|
|
154
|
-
const input = await findQuick(
|
|
154
|
+
const input = await findQuick(filter, openMenu);
|
|
155
155
|
userEvent.clear(input);
|
|
156
156
|
userEvent.type(input, value);
|
|
157
157
|
};
|
|
158
158
|
|
|
159
|
+
export const typeOnlyInput = async (value: string): Promise<void> => {
|
|
160
|
+
typeInput(value, { child: { tagName: "input[type='text']" } });
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export const typeInputByLabel = async (value: string, labelText: string): Promise<void> => {
|
|
164
|
+
const labels = getAllQuick({ child: { tagName: "label" } }).filter((l) => l.textContent == labelText);
|
|
165
|
+
if (labels.length == 0) {
|
|
166
|
+
throw Error(`Label not found for text: ${labelText}`);
|
|
167
|
+
}
|
|
168
|
+
if (labels.length > 1) {
|
|
169
|
+
throw Error(`Multiple labels found for text: ${labelText}`);
|
|
170
|
+
}
|
|
171
|
+
typeInput(value, { child: { tagName: `input[id='${labels[0].getAttribute("for")}']` } });
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export const typeInputByPlaceholder = async (value: string, placeholder: string): Promise<void> => {
|
|
175
|
+
typeInput(value, { child: { tagName: `input[placeholder='${placeholder}']` } });
|
|
176
|
+
};
|
|
177
|
+
|
|
159
178
|
export const typeOtherInput = async (value: string): Promise<void> => {
|
|
160
|
-
|
|
161
|
-
const otherInput = await findQuick({ classes: ".subComponent", child: { tagName: "input[type='text']" } }, openMenu);
|
|
162
|
-
userEvent.clear(otherInput);
|
|
163
|
-
userEvent.type(otherInput, value);
|
|
179
|
+
typeInput(value, { classes: ".subComponent", child: { tagName: "input[type='text']" } });
|
|
164
180
|
};
|
|
165
181
|
|
|
166
182
|
export const typeOtherTextArea = async (value: string): Promise<void> => {
|
|
167
|
-
|
|
168
|
-
const otherTextArea = await findQuick({ classes: ".subComponent", child: { tagName: "textarea" } }, openMenu);
|
|
169
|
-
userEvent.clear(otherTextArea);
|
|
170
|
-
userEvent.type(otherTextArea, value);
|
|
183
|
+
typeInput(value, { classes: ".subComponent", child: { tagName: "textarea" } });
|
|
171
184
|
};
|
|
172
185
|
|
|
173
186
|
export const closeMenu = (): void => {
|