test: pin the focus restore, the choice labels and the phone layout to their fix
Three round-1 fixes whose tests passed against the broken version too. The focus restore keeps watching until the element that closed the box is GONE, rather than spending itself on the first render after the change — the distinction Chrome exposed and jsdom did not, because jsdom commits the save in one render where Chrome takes two. Driven now through the general case instead: the user moved the focus elsewhere while the request was out, renders keep coming while that element is still there, and the restore happens only once it disappears. The choice test's i18n mock returned an option's bare value, which is exactly what dropping the `config.choices.*` lookup renders — a Hungarian admin would have seen `on`/`off` instead of `GPU`/`Szoftver` with the gate green. Marked labels now, still short enough not to move the segmented-bar budget the same file measures. The admin config row's stacking had no test at all, only its sibling fix did — and stacking is the only fix for a text or number key, whose fixed-width input is the wide control. Class contract, as SearchBar.dom.test.tsx already does for the narrow-header rules, since jsdom does no layout. Also: the time-zone cleanup deleted TZ, and Node re-reads it on assignment only, so the process kept the last zone the file set. Harmless until someone appends a test below it.
This commit is contained in:
@@ -198,11 +198,13 @@ describe("formatRuntime", () => {
|
||||
// runtime's own locale and time zone are the dev box's, so both languages — and a zone west of UTC —
|
||||
// are pinned explicitly.
|
||||
describe("formatDateTime / formatDate", () => {
|
||||
const savedTz = process.env.TZ;
|
||||
// Node re-reads TZ when it is ASSIGNED and not when it is deleted, so the zone has to be put back
|
||||
// by name — and `process.env.TZ` is unset here, so the name has to come from the resolved zone.
|
||||
// Vitest's per-file process would contain a leak today, but only until someone adds a test below.
|
||||
const savedTz = process.env.TZ ?? Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
afterEach(() => {
|
||||
i18nStub.language = "en";
|
||||
if (savedTz === undefined) delete process.env.TZ;
|
||||
else process.env.TZ = savedTz;
|
||||
process.env.TZ = savedTz;
|
||||
});
|
||||
|
||||
it("formats a timestamp in the UI language, not in the runtime's", () => {
|
||||
|
||||
Reference in New Issue
Block a user