mirror of
https://github.com/unraid/api.git
synced 2026-01-08 09:39:49 -06:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced comprehensive testing utilities for Vue components utilizing the composition API. - Enhanced testing coverage for the `DownloadApiLogs` and `KeyActions` components, ensuring robust functionality and user interaction validation. - Added mock implementations for various libraries and components to facilitate isolated unit testing. - Improved flexibility in the `DummyServerSwitcher` component's input handling. - Added a new test setup file to configure the testing environment for Vue applications. - Added new test files for `AuthComponent` and `KeyActions` with comprehensive test cases. - Introduced a new mock implementation for UI components to streamline testing. - Added a new mock implementation for the `useRequest` composable to prevent hanging issues during tests. - Added a new mock implementation for the server store used by the Auth component. - **Bug Fixes** - Improved sanitization process to block inline styles for a safer and more consistent display. - **Documentation** - Added README documentation for Vue Component Testing Utilities, detailing usage and examples. - Updated ESLint configuration to ignore coverage directory files. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mdatelle <mike@datelle.net> Co-authored-by: Eli Bosley <ekbosley@gmail.com>
46 lines
1.4 KiB
Vue
46 lines
1.4 KiB
Vue
<script lang="ts" setup>
|
|
import { storeToRefs } from 'pinia';
|
|
|
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@unraid/ui';
|
|
import { useDummyServerStore } from '~/_data/serverState';
|
|
|
|
import type { ServerSelector } from '~/_data/serverState';
|
|
|
|
// Define the same type locally as in reka-ui
|
|
type AcceptableValue = string | number | Record<string, unknown> | null;
|
|
|
|
const store = useDummyServerStore();
|
|
const { selector, serverState } = storeToRefs(store);
|
|
|
|
const updateSelector = (val: AcceptableValue) => {
|
|
if (typeof val === 'string') {
|
|
selector.value = val as ServerSelector;
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<div class="flex flex-col gap-2 border-solid border-2 p-2 border-r-2">
|
|
<h1 class="text-lg">Server State Selection</h1>
|
|
<details>
|
|
<summary>Initial Server State: {{ selector }}</summary>
|
|
<pre>{{ JSON.stringify(serverState, null, 4) }}</pre>
|
|
</details>
|
|
<Select v-model="selector" @update:model-value="updateSelector">
|
|
<SelectTrigger>
|
|
<SelectValue placeholder="Select an initial state" />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
<SelectItem value="default">Default</SelectItem>
|
|
<SelectItem value="oemActiviation">OEM Activation</SelectItem>
|
|
</SelectContent>
|
|
</Select>
|
|
</div>
|
|
</template>
|
|
|
|
<style lang="postcss">
|
|
/* Import unraid-ui globals first */
|
|
@import '@unraid/ui/styles';
|
|
@import '~/assets/main.css';
|
|
</style>
|