fix(ui): honor select search limits for large regional lists

This commit is contained in:
Clintchiz committed 2026-08-26 17:46:13 +05:30
1 parent b1b84eb41c
commit 9e0907ffb2
5 files changed
+84 -4

No files matched your search

+20
View File
@@ -1890,6 +1890,26 @@ test("input number increments, decrements, applies steps, and respects limits",
expect(decrement().disabled).toBe(true);
});
test("advanced select limits rendered options but searches the full dataset and retains saved values", async () => {
const source = readFileSync(uiComponentPath("AdvancedSelect"), "utf8");
const dom = mountHtml(
await renderComponent(source, {
name: "region",
value: "99",
searchResultLimit: 4,
options: Array.from({ length: 100 }, (_, i) => ({ value: String(i), label: "Region " + i })),
}),
);
expect(dom.querySelector(".wrn-next__select-value")?.textContent).toContain("Region 99");
expect(dom.querySelectorAll(".wrn-next__select-option")).toHaveLength(4);
(dom.querySelector(".wrn-next__select-trigger") as HTMLButtonElement).click();
const search = dom.querySelector('input[type="search"]') as HTMLInputElement;
search.value = "Region 99";
search.dispatchEvent(new (dom.window as any).Event("input", { bubbles: true }));
expect(dom.querySelectorAll(".wrn-next__select-option")).toHaveLength(1);
expect(dom.querySelector(".wrn-next__select-option")?.textContent).toContain("Region 99");
});
test("advanced select opens, filters, and selects without reactive handler errors", async () => {
const source = readFileSync(uiComponentPath("AdvancedSelect"), "utf8");
const html = await renderComponent(source, {