@terpjs/react-core 0.27.0 → 0.28.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 +31 -7
- package/package.json +4 -3
- package/src/Field.test.tsx +95 -1
- package/src/Field.tsx +70 -1
- package/src/LoginView.test.tsx +33 -0
- package/src/LoginView.tsx +36 -23
- package/src/Meter.test.tsx +304 -0
- package/src/Meter.tsx +159 -0
- package/src/QuietActions.test.tsx +118 -0
- package/src/QuietActions.tsx +75 -0
- package/src/UserMenu.test.tsx +23 -0
- package/src/UserMenu.tsx +9 -1
- package/src/admin/AuditLogAdmin.tsx +1 -1
- package/src/admin/admin.test.tsx +57 -5
- package/src/admin/module.tsx +9 -6
- package/src/bootstrap.test.tsx +1 -1
- package/src/bootstrap.tsx +2 -1
- package/src/dataview/DataView.test.tsx +70 -0
- package/src/dataview/README.md +5 -3
- package/src/dataview/index.ts +1 -1
- package/src/dataview/internal.tsx +76 -19
- package/src/dataview/types.ts +9 -35
- package/src/errorMessages.test.tsx +21 -0
- package/src/errorMessages.tsx +33 -19
- package/src/index.ts +7 -3
- package/src/locale.test.tsx +35 -0
- package/src/locale.tsx +62 -4
- package/src/markers.test.ts +33 -11
- package/src/ssr.test.tsx +18 -0
- package/src/styles.test.ts +265 -14
- package/src/styles.ts +424 -49
- package/src/testing.test.tsx +162 -0
- package/src/testing.ts +84 -0
- package/src/tokens.guard.test.ts +11 -6
- package/src/ui/controlMessages.tsx +27 -14
- package/src/uiText.literals.test.ts +19 -6
- package/src/uiText.test.tsx +54 -2
- package/src/uiText.tsx +166 -6
- package/vitest.setup.ts +7 -20
package/vitest.setup.ts
CHANGED
|
@@ -5,6 +5,8 @@ import "@testing-library/jest-dom/vitest";
|
|
|
5
5
|
|
|
6
6
|
import { configure } from "@testing-library/dom";
|
|
7
7
|
|
|
8
|
+
import { installDialogPolyfill } from "@terpjs/react-core/testing";
|
|
9
|
+
|
|
8
10
|
// `findBy*` and `waitFor` default to a 1000ms budget, and the component tests spend it on
|
|
9
11
|
// a path that is not a render: a mocked fetch resolving, then the state it sets, then the
|
|
10
12
|
// re-render that finally puts the text on screen. One second does not reliably cover that,
|
|
@@ -93,23 +95,8 @@ if (typeof window !== "undefined") {
|
|
|
93
95
|
window.scrollTo = (() => {}) as typeof window.scrollTo;
|
|
94
96
|
}
|
|
95
97
|
|
|
96
|
-
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
showModal?: () => void;
|
|
102
|
-
close?: () => void;
|
|
103
|
-
};
|
|
104
|
-
if (typeof proto.showModal !== "function") {
|
|
105
|
-
proto.showModal = function showModal(this: HTMLDialogElement) {
|
|
106
|
-
this.setAttribute("open", "");
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
if (typeof proto.close !== "function") {
|
|
110
|
-
proto.close = function close(this: HTMLDialogElement) {
|
|
111
|
-
this.removeAttribute("open");
|
|
112
|
-
this.dispatchEvent(new Event("close"));
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
}
|
|
98
|
+
// jsdom has no `showModal()` / `close()`, and ConfirmDialog calls both. The polyfill is the
|
|
99
|
+
// one every generated app's setup file installs, imported through the same published subpath
|
|
100
|
+
// rather than by relative path, so this suite also proves the export an app resolves exists.
|
|
101
|
+
// A no-op in the node-environment files, which have no HTMLDialogElement.
|
|
102
|
+
installDialogPolyfill();
|