fix(docs): restore button, toggle and nav demos to the pinned cn baseline
- button-group: restore all 9 cn demos incl. merge dropdown menu copy, custom-styles merge dropdown, sizes variant=secondary, orientation icon groups, full-width second group and the disabled child override - toggle-button / toggle-button-group: restore cn copy, structure, button counts, theme custom-styles classes and aria-labels - accordion-custom-styles: restore the 3-item collectibles scenario with the original 3dicons images, surface variant, selectors and hover motion - disclosure-group-controlled: restore HeroUI Native / Expo copy and image semantics (Expo brand icon adapted to Tabler IconBrandReactNative) - button-basic / button-loading-state: converge to baseline (console report, no added status paragraph) keeping the duplicate-trigger guard - restore per-demo root gap/alignment/wrap classes instead of demo-row - icon semantics per task card: search glyph kept on 搜索 buttons, rotate-back glyph restored (IconRefresh), person-search glyph restored (IconUserSearch); accordion item icons sized to the baseline 16px
This commit is contained in:
@@ -3,6 +3,7 @@ import { mount } from "@vue/test-utils";
|
||||
import { h } from "vue";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { Button } from "../packages/vue/src";
|
||||
import Basic from "../apps/docs/demos/button-basic.vue";
|
||||
import LoadingState from "../apps/docs/demos/button-loading-state.vue";
|
||||
import Ripple from "../apps/docs/demos/button-ripple-effect.vue";
|
||||
const expected = [
|
||||
@@ -34,6 +35,19 @@ describe("Button examples", () => {
|
||||
readFileSync(`apps/docs/demos/button-${name}.vue`, "utf8"),
|
||||
).toContain("<template>");
|
||||
});
|
||||
it("keeps the baseline label on press and reports the action instead", async () => {
|
||||
const log = vi.spyOn(console, "log").mockImplementation(() => {});
|
||||
const w = mount(Basic, { attachTo: document.body });
|
||||
const button = w.get("button");
|
||||
expect(button.text()).toBe("点我");
|
||||
await button.trigger("click");
|
||||
await button.trigger("click");
|
||||
expect(button.text()).toBe("点我");
|
||||
expect(log).toHaveBeenCalledWith("按钮已按下");
|
||||
expect(log).toHaveBeenCalledTimes(2);
|
||||
log.mockRestore();
|
||||
w.unmount();
|
||||
});
|
||||
it("allows upload, suppresses duplicate activation, restores the button and allows another upload", async () => {
|
||||
vi.useFakeTimers();
|
||||
const w = mount(LoadingState, { attachTo: document.body });
|
||||
@@ -51,7 +65,8 @@ describe("Button examples", () => {
|
||||
await vi.advanceTimersByTimeAsync(1000);
|
||||
expect(button.text()).toBe("上传文件");
|
||||
expect(button.attributes("aria-disabled")).toBeUndefined();
|
||||
expect(w.get("[role=status]").text()).toContain("上传完成");
|
||||
expect(w.find("[role=status]").exists()).toBe(false);
|
||||
expect(w.findAll("p")).toHaveLength(0);
|
||||
await button.trigger("click");
|
||||
expect(button.text()).toBe("上传中…");
|
||||
w.unmount();
|
||||
|
||||
Reference in New Issue
Block a user