mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-11-16 17:09:09 +00:00
test(dashboard): read the region picker and the Select guard as the native branch renders them
This commit is contained in:
@@ -435,16 +435,18 @@ describe("conn-modals (Phase 1c extraction)", () => {
|
||||
/>
|
||||
);
|
||||
|
||||
// The region picker is the kit (Radix) Select since KEA-7886: a combobox trigger
|
||||
// labelled by the field, showing the selected option's label ("… (Beijing)").
|
||||
// The region picker is the kit NativeSelect since #19620 (OS picker on phones): a real
|
||||
// <select> labelled by the field, with the stored region selected ("… (Beijing)").
|
||||
const regionLabel = Array.from(c.querySelectorAll("label")).find((label) =>
|
||||
label.textContent?.includes("apiRegionLabel")
|
||||
);
|
||||
const regionSelect = regionLabel ? document.getElementById(regionLabel.htmlFor) : null;
|
||||
expect(regionSelect?.getAttribute("role")).toBe("combobox");
|
||||
const regionSelect = regionLabel
|
||||
? (document.getElementById(regionLabel.htmlFor) as HTMLSelectElement | null)
|
||||
: null;
|
||||
expect(regionSelect?.tagName).toBe("SELECT");
|
||||
expect(kitSelectValue(regionSelect!)).toBe("china-beijing");
|
||||
expect(regionSelect?.textContent).toContain("(Beijing)");
|
||||
expect(regionSelect?.textContent).not.toContain("(Singapore)");
|
||||
expect(regionSelect?.selectedOptions[0]?.textContent).toContain("(Beijing)");
|
||||
expect(regionSelect?.selectedOptions[0]?.textContent).not.toContain("(Singapore)");
|
||||
});
|
||||
|
||||
it("EditConnectionModal renders without ReferenceError for oauth connection", () => {
|
||||
|
||||
@@ -34,7 +34,9 @@ test("shared Select: renders children and guards placeholder/options when childr
|
||||
// `!children && placeholder`. The guard itself is unchanged — still gated on `!children`.
|
||||
// KEA-7886: the adapter resolves the fallback first (`resolvedPlaceholder = placeholder ??
|
||||
// t("selectOption")`), so the native-mode guard reads `!children && resolvedPlaceholder`.
|
||||
assert.ok(src.includes("!children && resolvedPlaceholder"), "placeholder guarded by !children");
|
||||
// #19620: the native branch also serves `options` with `native`, so the guard coerces the
|
||||
// resolved placeholder (`!children && !!resolvedPlaceholder && placeholderIsNeeded`).
|
||||
assert.ok(src.includes("!children && !!resolvedPlaceholder"), "placeholder guarded by !children");
|
||||
assert.ok(
|
||||
src.includes("!children &&\n options.map") || src.includes("!children &&"),
|
||||
"options guarded by !children"
|
||||
|
||||
Reference in New Issue
Block a user