fix: follow-ups of the lot-v018 stack reviews #482
3 changed files with 22 additions and 1 deletions
|
|
@ -51,4 +51,8 @@ describe("LicenseKeyForm", () => {
|
|||
expect(html).toContain('placeholder="t(license.keyPlaceholder)"');
|
||||
expect(html).toMatch(/<button type="submit"[^>]*>t\(license\.activate\)<\/button>/);
|
||||
});
|
||||
|
||||
it("names the cancel button through t (#437)", () => {
|
||||
expect(render(null)).toMatch(/<button type="button"[^>]*>t\(common\.cancel\)<\/button>/);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -147,6 +147,10 @@ describe("TransactionTable — texts that go through t (#437)", () => {
|
|||
const icon = 'aria-label="t(transactions.transferIcon.ariaLabel)"';
|
||||
expect(count(html, icon)).toBe(1);
|
||||
expect(bodyRows(html)[1]).toContain(icon);
|
||||
// Its tooltip, the account and the direction of the link included.
|
||||
expect(bodyRows(html)[1]).toContain(
|
||||
'title="t(transactions.transferIcon.tooltip): CELI (t(balance.transfers.direction.in))"',
|
||||
);
|
||||
});
|
||||
|
||||
it("names every row's notes button through t", () => {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// SplitButton (or to a row's notes button), then renders again to read what
|
||||
// opened.
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import { isValidElement, type ReactElement, type ReactNode } from "react";
|
||||
import { Fragment, isValidElement, type ReactElement, type ReactNode } from "react";
|
||||
|
||||
vi.mock("react", async (orig) => (await import("../../test/hookHarness")).fakeReact(await orig()));
|
||||
vi.mock("react-i18next", async () => (await import("../../test/i18nMock")).i18nMock());
|
||||
|
|
@ -156,4 +156,17 @@ describe("TransactionTable — the notes row (#437)", () => {
|
|||
expect(areas).toHaveLength(1);
|
||||
expect(areas[0].props.placeholder).toBe("t(transactions.notes.placeholder)");
|
||||
});
|
||||
|
||||
it("opens the notes of the row whose button was clicked, under that row", () => {
|
||||
(notesButtons(render("open"))[1].props.onClick as () => void)();
|
||||
// Each row and the rows it opens sit in a Fragment keyed by the row's id
|
||||
// (the unkeyed ones are inside the cells).
|
||||
const byRow = find(render("open"), Fragment)
|
||||
.filter((row) => row.key !== null)
|
||||
.map((row) => [row.key, find(row.props.children, "textarea").length]);
|
||||
expect(byRow).toEqual([
|
||||
["1", 0],
|
||||
["2", 1],
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue