Apply repository-wide ESLint auto-fix formatting pass
Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
@@ -3,13 +3,13 @@
|
||||
// Authors:
|
||||
// imacat.yang@dsp.im (imacat), 2026/03/05
|
||||
|
||||
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { setActivePinia, createPinia } from 'pinia';
|
||||
import ModalHeader from '@/views/AccountManagement/ModalHeader.vue';
|
||||
import { useModalStore } from '@/stores/modal';
|
||||
import { describe, it, expect, beforeEach, vi } from "vitest";
|
||||
import { mount } from "@vue/test-utils";
|
||||
import { setActivePinia, createPinia } from "pinia";
|
||||
import ModalHeader from "@/views/AccountManagement/ModalHeader.vue";
|
||||
import { useModalStore } from "@/stores/modal";
|
||||
|
||||
describe('ModalHeader', () => {
|
||||
describe("ModalHeader", () => {
|
||||
let pinia;
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -17,35 +17,35 @@ describe('ModalHeader', () => {
|
||||
setActivePinia(pinia);
|
||||
});
|
||||
|
||||
const mountModalHeader = (headerText = 'Test Header') => {
|
||||
const mountModalHeader = (headerText = "Test Header") => {
|
||||
return mount(ModalHeader, {
|
||||
props: { headerText },
|
||||
global: { plugins: [pinia] },
|
||||
});
|
||||
};
|
||||
|
||||
it('renders header text from prop', () => {
|
||||
const wrapper = mountModalHeader('Account Info');
|
||||
expect(wrapper.find('h1').text()).toBe('Account Info');
|
||||
it("renders header text from prop", () => {
|
||||
const wrapper = mountModalHeader("Account Info");
|
||||
expect(wrapper.find("h1").text()).toBe("Account Info");
|
||||
});
|
||||
|
||||
it('renders close button (X icon)', () => {
|
||||
it("renders close button (X icon)", () => {
|
||||
const wrapper = mountModalHeader();
|
||||
const img = wrapper.find('img[alt="X"]');
|
||||
expect(img.exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('calls closeModal when X is clicked', async () => {
|
||||
it("calls closeModal when X is clicked", async () => {
|
||||
const wrapper = mountModalHeader();
|
||||
const store = useModalStore();
|
||||
store.isModalOpen = true;
|
||||
store.whichModal = 'SOME_MODAL';
|
||||
store.whichModal = "SOME_MODAL";
|
||||
|
||||
const img = wrapper.find('img[alt="X"]');
|
||||
await img.trigger('click');
|
||||
await img.trigger("click");
|
||||
|
||||
// closeModal only sets isModalOpen to false; whichModal is not reset
|
||||
expect(store.isModalOpen).toBe(false);
|
||||
expect(store.whichModal).toBe('SOME_MODAL');
|
||||
expect(store.whichModal).toBe("SOME_MODAL");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user