Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
test(client): reopen the template pill before reading its tick
matt wilkieee53289dbc7b
diff --git a/apps/client/src/widgets/collections/board/index.spec.tsx b/apps/client/src/widgets/collections/board/index.spec.tsxindex 0c6a14798a..d69da7e9bc 100644--- a/apps/client/src/widgets/collections/board/index.spec.tsx+++ b/apps/client/src/widgets/collections/board/index.spec.tsx@@ -2263,7 +2263,15 @@ describe("Board column rename", () => {// Stored on the board, so the next editor opens on it as well.expect(saved.at(-1)?.template).toBe("type:canvas:application/json");- expect([ ...(menu?.querySelectorAll(".dropdown-item") ?? []) ]++ // Picking closes the menu, as any dropdown item click does; open it again to read the tick.+ await act(async () => {+ pill.dispatchEvent(new MouseEvent("pointerdown", { bubbles: true }));+ $(pill.closest(".dropdown") as HTMLElement).trigger("show.bs.dropdown");+ await flush();+ });+ const reopened = [ ...document.querySelectorAll<HTMLElement>(".card-template-pill") ].at(-1);+ expect([ ...(reopened?.querySelectorAll(".dropdown-item") ?? []) ].map(item => !!item.querySelector(".card-template-current"))).toEqual([ false, false, true, false, false ]);