@gravitee/graphene-core 3.44.0 → 3.44.1-feat-found-397-data-table-test-ids.6a3fe53
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/USAGE_GUIDE.md +30 -5
- package/dist/base/Table/Table.harness.d.ts +14 -3
- package/dist/base/Table/Table.harness.d.ts.map +1 -1
- package/dist/composed/DataTable/ColumnOption.d.ts +2 -1
- package/dist/composed/DataTable/ColumnOption.d.ts.map +1 -1
- package/dist/composed/DataTable/DataTable.d.ts +9 -1
- package/dist/composed/DataTable/DataTable.d.ts.map +1 -1
- package/dist/composed/DataTable/DataTable.harness.d.ts +5 -3
- package/dist/composed/DataTable/DataTable.harness.d.ts.map +1 -1
- package/dist/composed/DataTable/DataTableColumnHeader.d.ts +7 -1
- package/dist/composed/DataTable/DataTableColumnHeader.d.ts.map +1 -1
- package/dist/composed/DataTable/DataTableTestIdContext.d.ts +7 -0
- package/dist/composed/DataTable/DataTableTestIdContext.d.ts.map +1 -0
- package/dist/composed/DataTable/DataTableViewOptions.d.ts +6 -1
- package/dist/composed/DataTable/DataTableViewOptions.d.ts.map +1 -1
- package/dist/composed/DataTable/DataTableViewOptionsSearch.d.ts +3 -1
- package/dist/composed/DataTable/DataTableViewOptionsSearch.d.ts.map +1 -1
- package/dist/composed/DataTable/cells.d.ts +15 -9
- package/dist/composed/DataTable/cells.d.ts.map +1 -1
- package/dist/composed/DataTablePagination/DataTablePagination.d.ts +6 -1
- package/dist/composed/DataTablePagination/DataTablePagination.d.ts.map +1 -1
- package/dist/composed/JsonSchemaForm/SchemaField.d.ts.map +1 -1
- package/dist/composed/JsonSchemaForm/fields/const/ConstField.d.ts +8 -0
- package/dist/composed/JsonSchemaForm/fields/const/ConstField.d.ts.map +1 -0
- package/dist/index.js +932 -869
- package/dist/testing/index.js +29 -24
- package/package.json +2 -1
package/dist/testing/index.js
CHANGED
|
@@ -215,7 +215,10 @@ function y(e) {
|
|
|
215
215
|
function b(e) {
|
|
216
216
|
return Array.from(e.tBodies).flatMap((e) => Array.from(e.children).filter((e) => e.tagName === "TR"));
|
|
217
217
|
}
|
|
218
|
-
function x(e
|
|
218
|
+
function x(e) {
|
|
219
|
+
return typeof e == "object" && !(e instanceof RegExp);
|
|
220
|
+
}
|
|
221
|
+
function S(e, t) {
|
|
219
222
|
let n = () => Array.from(e.children).filter((e) => e.tagName === "TD"), r = (e) => {
|
|
220
223
|
let r = t(), i = r.findIndex((t) => _(t, e));
|
|
221
224
|
if (i === -1) throw Error(`tableHarness: header matching ${String(e)} not found in [${v(r)}]`);
|
|
@@ -225,16 +228,18 @@ function x(e, t) {
|
|
|
225
228
|
};
|
|
226
229
|
return {
|
|
227
230
|
getElement: () => e,
|
|
231
|
+
getTestId: () => e.getAttribute("data-testid"),
|
|
228
232
|
getCells: () => n().map((e) => (e.textContent ?? "").trim()),
|
|
229
233
|
getCellText: (e) => (r(e).textContent ?? "").trim(),
|
|
230
234
|
getCellElement: r
|
|
231
235
|
};
|
|
232
236
|
}
|
|
233
|
-
function
|
|
237
|
+
function C(e = {}) {
|
|
234
238
|
let t = e.within ? i(e.within) : r, { name: n, selector: a } = e, o = () => a === void 0 ? n === void 0 ? t.getByRole("table") : t.getByRole("table", { name: n }) : c(n === void 0 ? t.getAllByRole("table") : t.getAllByRole("table", { name: n }), e, "table"), s = () => y(o()), l = () => s().map((e) => (e.textContent ?? "").trim()), u = () => b(o()), d = (e) => u().find((t) => {
|
|
239
|
+
if (x(e)) return t.getAttribute("data-testid") === e.testId;
|
|
235
240
|
let n = (t.textContent ?? "").trim();
|
|
236
241
|
return typeof e == "string" ? n.includes(e) : e.test(n);
|
|
237
|
-
})
|
|
242
|
+
}), f = (e) => x(e) ? `with data-testid="${e.testId}"` : `matching ${String(e)}`;
|
|
238
243
|
return {
|
|
239
244
|
getElement: o,
|
|
240
245
|
getHeaders: l,
|
|
@@ -243,33 +248,33 @@ function S(e = {}) {
|
|
|
243
248
|
if (typeof e == "number") {
|
|
244
249
|
let t = u(), n = t[e];
|
|
245
250
|
if (!n) throw Error(`tableHarness: no row at index ${e} (count=${t.length})`);
|
|
246
|
-
return
|
|
251
|
+
return S(n, s);
|
|
247
252
|
}
|
|
248
253
|
let t = d(e);
|
|
249
|
-
if (!t) throw Error(`tableHarness: no row
|
|
250
|
-
return
|
|
254
|
+
if (!t) throw Error(`tableHarness: no row ${f(e)}`);
|
|
255
|
+
return S(t, s);
|
|
251
256
|
},
|
|
252
257
|
queryRow: (e) => {
|
|
253
258
|
let t = d(e);
|
|
254
|
-
return t ?
|
|
259
|
+
return t ? S(t, s) : null;
|
|
255
260
|
},
|
|
256
|
-
getRows: () => u().map((e) =>
|
|
261
|
+
getRows: () => u().map((e) => S(e, s))
|
|
257
262
|
};
|
|
258
263
|
}
|
|
259
264
|
//#endregion
|
|
260
265
|
//#region src/base/Textarea/Textarea.harness.tsx
|
|
261
|
-
function
|
|
266
|
+
function w(e) {
|
|
262
267
|
return e instanceof HTMLTextAreaElement;
|
|
263
268
|
}
|
|
264
|
-
function
|
|
269
|
+
function T(e = {}) {
|
|
265
270
|
let t = e.within ? i(e.within) : r, { name: n, selector: o } = e, s = () => {
|
|
266
271
|
if (o === void 0) {
|
|
267
272
|
let e = n === void 0 ? t.getByRole("textbox") : t.getByRole("textbox", { name: n });
|
|
268
|
-
if (!
|
|
273
|
+
if (!w(e)) throw Error(`textareaHarness: matched element is <${e.tagName.toLowerCase()}>, not <textarea>`);
|
|
269
274
|
return e;
|
|
270
275
|
}
|
|
271
276
|
let r = e.within ?? document.body;
|
|
272
|
-
return c(n === void 0 ? Array.from(r.querySelectorAll("textarea")) : t.getAllByRole("textbox", { name: n }).filter(
|
|
277
|
+
return c(n === void 0 ? Array.from(r.querySelectorAll("textarea")) : t.getAllByRole("textbox", { name: n }).filter(w), e, "textarea");
|
|
273
278
|
}, l = a.setup();
|
|
274
279
|
return {
|
|
275
280
|
type: (e) => l.type(s(), e),
|
|
@@ -286,13 +291,13 @@ function w(e = {}) {
|
|
|
286
291
|
}
|
|
287
292
|
//#endregion
|
|
288
293
|
//#region src/composed/DataTable/DataTable.harness.tsx
|
|
289
|
-
function
|
|
294
|
+
function E(e, t) {
|
|
290
295
|
let n = y(e), r = n.find((e) => _(e, t));
|
|
291
296
|
if (!r) throw Error(`dataTableHarness: header matching ${String(t)} not found in [${v(n)}]`);
|
|
292
297
|
return r;
|
|
293
298
|
}
|
|
294
|
-
function
|
|
295
|
-
let t =
|
|
299
|
+
function D(e = {}) {
|
|
300
|
+
let t = C(e), n = a.setup(), r = (e) => ({
|
|
296
301
|
...e,
|
|
297
302
|
isSelected: () => e.getElement().getAttribute("data-state") === "selected",
|
|
298
303
|
select: async () => {
|
|
@@ -319,11 +324,11 @@ function E(e = {}) {
|
|
|
319
324
|
},
|
|
320
325
|
getRows: () => t.getRows().map(r),
|
|
321
326
|
sortBy: async (e) => {
|
|
322
|
-
let r =
|
|
327
|
+
let r = E(t.getElement(), e), i = r.querySelector("button");
|
|
323
328
|
await n.click(i ?? r);
|
|
324
329
|
},
|
|
325
330
|
getSortDirection: (e) => {
|
|
326
|
-
let n =
|
|
331
|
+
let n = E(t.getElement(), e).getAttribute("aria-sort");
|
|
327
332
|
return n === "ascending" || n === "descending" || n === "none" ? n : null;
|
|
328
333
|
},
|
|
329
334
|
selectAll: async () => {
|
|
@@ -346,8 +351,8 @@ function E(e = {}) {
|
|
|
346
351
|
}
|
|
347
352
|
//#endregion
|
|
348
353
|
//#region src/composed/PageHeader/PageHeader.harness.tsx
|
|
349
|
-
var
|
|
350
|
-
function
|
|
354
|
+
var O = (e) => (e ?? "").replace(/\s+/g, " ").trim(), k = (e) => O(e.querySelector("[data-slot=\"page-header-title\"]")?.textContent ?? null);
|
|
355
|
+
function A(e = {}) {
|
|
351
356
|
let t = e.within ? i(e.within) : r, { name: n, selector: a } = e, o = () => {
|
|
352
357
|
let r = (n === void 0 ? t.getAllByRole("heading", { level: 1 }) : t.getAllByRole("heading", {
|
|
353
358
|
level: 1,
|
|
@@ -362,10 +367,10 @@ function k(e = {}) {
|
|
|
362
367
|
};
|
|
363
368
|
return {
|
|
364
369
|
getElement: o,
|
|
365
|
-
getTitle: () =>
|
|
370
|
+
getTitle: () => k(o()),
|
|
366
371
|
getDescription: () => {
|
|
367
372
|
let e = l("page-header-description");
|
|
368
|
-
return e === null ? null :
|
|
373
|
+
return e === null ? null : O(e.textContent);
|
|
369
374
|
},
|
|
370
375
|
hasActions: () => u("page-header-actions") !== null,
|
|
371
376
|
getActions: () => {
|
|
@@ -378,7 +383,7 @@ function k(e = {}) {
|
|
|
378
383
|
}
|
|
379
384
|
//#endregion
|
|
380
385
|
//#region src/composed/PasswordInput/PasswordInput.harness.tsx
|
|
381
|
-
function
|
|
386
|
+
function j(e = {}) {
|
|
382
387
|
let t = d(e), n = a.setup(), r = () => t.getElement().closest("[data-slot=\"input-group\"]")?.querySelector("[data-slot=\"password-toggle\"]") ?? null, i = () => {
|
|
383
388
|
let e = r();
|
|
384
389
|
if (e === null) throw Error("passwordInputHarness: no reveal toggle found (rendered with hideToggle?)");
|
|
@@ -401,7 +406,7 @@ function A(e = {}) {
|
|
|
401
406
|
}
|
|
402
407
|
//#endregion
|
|
403
408
|
//#region src/composed/SearchField/SearchField.harness.tsx
|
|
404
|
-
function
|
|
409
|
+
function M(e = {}) {
|
|
405
410
|
let t = e.within ? i(e.within) : r, { name: n, selector: o } = e, l = () => {
|
|
406
411
|
let r = (n === void 0 ? t.getAllByRole("searchbox") : t.getAllByRole("searchbox", { name: n })).filter((e) => e instanceof HTMLInputElement && e.closest("[data-search-field]") !== null);
|
|
407
412
|
if (o !== void 0) return c(r, e, "searchField");
|
|
@@ -426,4 +431,4 @@ function j(e = {}) {
|
|
|
426
431
|
};
|
|
427
432
|
}
|
|
428
433
|
//#endregion
|
|
429
|
-
export { l as buttonHarness, u as checkboxHarness,
|
|
434
|
+
export { l as buttonHarness, u as checkboxHarness, D as dataTableHarness, d as inputHarness, A as pageHeaderHarness, j as passwordInputHarness, p as radioGroupHarness, m as radioHarness, o as renderWithGraphene, M as searchFieldHarness, h as selectHarness, g as switchHarness, C as tableHarness, T as textareaHarness };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravitee/graphene-core",
|
|
3
|
-
"version": "3.44.
|
|
3
|
+
"version": "3.44.1-feat-found-397-data-table-test-ids.6a3fe53",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Gravitee's Graphene design system: accessible React components, design tokens, icons, and shared ESLint/TypeScript configs. Built on shadcn/ui and Tailwind.",
|
|
6
6
|
"keywords": [
|
|
@@ -103,6 +103,7 @@
|
|
|
103
103
|
},
|
|
104
104
|
"peerDependencies": {
|
|
105
105
|
"@fontsource/dm-sans": ">=5.0.0",
|
|
106
|
+
"@gravitee/graphene-core": "3.44.1-feat-found-397-data-table-test-ids.6a3fe53",
|
|
106
107
|
"@monaco-editor/react": "^4.7.0",
|
|
107
108
|
"@tanstack/react-table": "^8.0.0",
|
|
108
109
|
"@testing-library/dom": ">=10.0.0",
|