fix(docs): restore related showcases and correct CSS customization examples

This commit is contained in:
maoyingjie
2026-10-28 23:06:08 +08:00
parent cfbcb38ec3
commit f9938eea8c
9 changed files with 180 additions and 5 deletions
+23
View File
@@ -408,3 +408,26 @@ it("closes the mobile TOC before navigating and focuses the requested heading",
expect(document.activeElement).toBe(document.getElementById("section"));
expect(document.querySelector(".mobile-toc-content")).toBeNull();
});
it("shows only matching upstream showcase cards and updates without empty placeholders", async () => {
const { default: RelatedShowcases } =
await import("../apps/docs/.vitepress/theme/DocsRelatedShowcases.vue");
const w = mount(RelatedShowcases, { props: { component: "Button" } });
wrappers.push(w);
const link = w.get("a");
expect(link.attributes("href")).toBe(
"https://heroui.com/cn/showcase/apple-iphone-disclosure",
);
expect(link.attributes("aria-label")).toContain("上游 React 案例");
expect(link.attributes("rel")).toContain("noopener");
expect(w.get("video").attributes("poster")).toMatch(/\/1\.jpg$/);
await w.setProps({ component: "tabs" });
expect(w.findAll("a")).toHaveLength(1);
expect(w.get("a").attributes("href")).toBe(
"https://heroui.com/cn/showcase/apple-iphone-camera-zoom",
);
expect(w.get("source").attributes("src")).toMatch(/\/2\.mp4$/);
await w.setProps({ component: "Input" });
expect(w.find(".docs-related-showcases").exists()).toBe(false);
expect(w.find("a").exists()).toBe(false);
});