fix(docs): restore official visual hierarchy and component previews
This commit is contained in:
@@ -44,6 +44,7 @@ vi.mock("vitepress", async () => {
|
||||
import Layout from "../apps/docs/.vitepress/theme/Layout.vue";
|
||||
import DocSearch from "../apps/docs/.vitepress/theme/DocSearch.vue";
|
||||
import Demo from "../apps/docs/.vitepress/theme/Demo.vue";
|
||||
import DocsComponents from "../apps/docs/.vitepress/theme/DocsComponents.vue";
|
||||
const wrappers: ReturnType<typeof mount>[] = [];
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
@@ -99,6 +100,18 @@ async function search(text: string) {
|
||||
input().dispatchEvent(new Event("input", { bubbles: true }));
|
||||
await flushPromises();
|
||||
}
|
||||
|
||||
it("keeps component navigation usable when a themed thumbnail fails", async () => {
|
||||
const w = fixture(DocsComponents as never, {
|
||||
props: { category: "buttons" },
|
||||
});
|
||||
const image = w.get("img.component-thumbnail-light");
|
||||
expect(image.attributes("src")).toContain("light-button.png");
|
||||
await image.trigger("error");
|
||||
expect(w.get(".component-thumbnail-fallback").text()).toContain("Button");
|
||||
expect(w.get('a[href="/components/button"]').text()).toBe("Button 按钮");
|
||||
expect(w.findAll("img.component-thumbnail-dark")).toHaveLength(5);
|
||||
});
|
||||
describe("documentation structure", () => {
|
||||
it("makes every existing component page reachable exactly once in navigation and its category overview", () => {
|
||||
const pages = readdirSync("apps/docs/components")
|
||||
|
||||
Reference in New Issue
Block a user