mirror of
https://github.com/unraid/api.git
synced 2026-02-06 16:08:52 -06:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - New Features - Introduced Docker management UI components: Overview, Logs, Console, Preview, and Edit. - Added responsive Card/Detail layouts with grouping, bulk actions, and tabs. - New UnraidToaster component and global toaster configuration. - Component auto-mounting improved with async loading and multi-selector support. - UI/UX - Overhauled theme system (light/dark tokens, primary/orange accents) and added theme variants. - Header OS version now includes integrated changelog modal. - Registration displays warning states; multiple visual polish updates. - API - CPU load now includes percentGuest and percentSteal metrics. - Chores - Migrated web app to Vite; updated artifacts and manifests. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mdatelle <mike@datelle.net> Co-authored-by: Michael Datelle <mdatelle@icloud.com>
62 lines
1.4 KiB
TypeScript
62 lines
1.4 KiB
TypeScript
/**
|
|
* Modal store test coverage
|
|
*/
|
|
|
|
import { ref } from 'vue';
|
|
import { createPinia, setActivePinia } from 'pinia';
|
|
|
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
|
|
import { useModalStore } from '~/store/modal';
|
|
|
|
vi.mock('@vueuse/core', () => ({
|
|
useToggle: (initial: boolean) => {
|
|
const state = ref(initial);
|
|
const toggle = () => {
|
|
state.value = !state.value;
|
|
};
|
|
return [state, toggle];
|
|
},
|
|
}));
|
|
|
|
describe('Modal Store', () => {
|
|
let store: ReturnType<typeof useModalStore>;
|
|
|
|
beforeEach(() => {
|
|
setActivePinia(createPinia());
|
|
store = useModalStore();
|
|
vi.clearAllMocks();
|
|
});
|
|
|
|
describe('State and Initialization', () => {
|
|
it('should initialize with modal visible', () => {
|
|
expect(store.modalVisible).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe('Actions', () => {
|
|
it('should hide modal', () => {
|
|
store.modalHide();
|
|
expect(store.modalVisible).toBe(false);
|
|
});
|
|
|
|
it('should show modal', () => {
|
|
store.modalHide();
|
|
expect(store.modalVisible).toBe(false);
|
|
|
|
store.modalShow();
|
|
expect(store.modalVisible).toBe(true);
|
|
});
|
|
|
|
it('should toggle modal visibility', () => {
|
|
expect(store.modalVisible).toBe(true);
|
|
|
|
store.modalToggle();
|
|
expect(store.modalVisible).toBe(false);
|
|
|
|
store.modalToggle();
|
|
expect(store.modalVisible).toBe(true);
|
|
});
|
|
});
|
|
});
|