Files
MeshChatX/tests/frontend/MaterialDesignIcon.test.js
Sudo-Ivan 21450c69eb Add AppPropagationSync tests and enhance ConfirmDialog tests
- Introduced a new test suite for App propagation sync metrics, validating toast notifications for sync status.
- Enhanced ConfirmDialog tests to verify heading display and button attributes.
- Added additional tests for FormLabel, FormSubLabel, LanguageSelector, and other components to improve test coverage and ensure proper functionality.
2026-02-14 19:18:37 -06:00

41 lines
1.4 KiB
JavaScript

import { mount } from "@vue/test-utils";
import { describe, it, expect } from "vitest";
import MaterialDesignIcon from "../../meshchatx/src/frontend/components/MaterialDesignIcon.vue";
describe("MaterialDesignIcon.vue", () => {
it("converts icon-name to mdiIconName", () => {
const wrapper = mount(MaterialDesignIcon, {
props: { iconName: "account-circle" },
});
expect(wrapper.vm.mdiIconName).toBe("mdiAccountCircle");
});
it("renders svg with correct aria-label", () => {
const wrapper = mount(MaterialDesignIcon, {
props: { iconName: "home" },
});
expect(wrapper.find("svg").attributes("aria-label")).toBe("home");
});
it("falls back to question mark for unknown icons", () => {
const wrapper = mount(MaterialDesignIcon, {
props: { iconName: "non-existent-icon" },
});
expect(wrapper.vm.iconPath).not.toBe("");
});
it("renders an svg element for valid icon", () => {
const wrapper = mount(MaterialDesignIcon, {
props: { iconName: "home" },
});
expect(wrapper.find("svg").exists()).toBe(true);
});
it("accepts iconName prop", () => {
const wrapper = mount(MaterialDesignIcon, {
props: { iconName: "cog" },
});
expect(wrapper.props("iconName")).toBe("cog");
});
});