mirror of
https://git.quad4.io/RNS-Things/MeshChatX.git
synced 2026-03-31 03:55:43 +00:00
Some checks failed
Build Test / Build and Test (push) Failing after 6m1s
CI / lint (push) Failing after 1m27s
CI / build-frontend (push) Failing after 1m30s
CI / test-backend (push) Successful in 1m17s
CI / test-lang (push) Failing after 1m15s
Build and Publish Docker Image / build (push) Failing after 4m28s
Build and Publish Docker Image / build-dev (push) Failing after 5m38s
Security Scans / scan (push) Successful in 2m12s
Tests / test (push) Failing after 1m17s
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
import { mount } from "@vue/test-utils";
|
|
import { describe, it, expect } from "vitest";
|
|
import IconButton from "../../meshchatx/src/frontend/components/IconButton.vue";
|
|
|
|
function mountIconButton(slots = {}) {
|
|
return mount(IconButton, {
|
|
slots: { default: slots.default ?? '<span class="icon">X</span>' },
|
|
});
|
|
}
|
|
|
|
describe("IconButton UI", () => {
|
|
it("renders button with slot content", () => {
|
|
const wrapper = mountIconButton({ default: '<span class="icon">+</span>' });
|
|
expect(wrapper.find("button").exists()).toBe(true);
|
|
expect(wrapper.find(".icon").exists()).toBe(true);
|
|
expect(wrapper.text()).toContain("+");
|
|
});
|
|
|
|
it("emits click when clicked", async () => {
|
|
const wrapper = mountIconButton();
|
|
await wrapper.find("button").trigger("click");
|
|
expect(wrapper.emitted("click")).toHaveLength(1);
|
|
});
|
|
|
|
it("has expected button classes", () => {
|
|
const wrapper = mountIconButton();
|
|
const btn = wrapper.find("button");
|
|
expect(btn.classes()).toContain("rounded-full");
|
|
expect(btn.attributes("type")).toBe("button");
|
|
});
|
|
});
|