mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
test: 主题相关测试显式固定浅色环境避免默认玻璃主题影响断言
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import SiteUserDataDialog from '@/components/dialog/SiteUserDataDialog.vue'
|
import SiteUserDataDialog from '@/components/dialog/SiteUserDataDialog.vue'
|
||||||
import type { SiteUserData } from '@/api/types'
|
import type { SiteUserData } from '@/api/types'
|
||||||
|
import vuetify from '@/plugins/vuetify'
|
||||||
import { fireEvent, screen, waitFor } from '@testing-library/vue'
|
import { fireEvent, screen, waitFor } from '@testing-library/vue'
|
||||||
import { createSite, createSiteUserData } from '@tests/support/factories/site'
|
import { createSite, createSiteUserData } from '@tests/support/factories/site'
|
||||||
import { refreshSiteUserDataHandler, siteUserDataHandler } from '@tests/support/msw/handlers/site'
|
import { refreshSiteUserDataHandler, siteUserDataHandler } from '@tests/support/msw/handlers/site'
|
||||||
@@ -97,6 +98,8 @@ function getRetryButton() {
|
|||||||
describe('SiteUserDataDialog projections', () => {
|
describe('SiteUserDataDialog projections', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
chartInputs.length = 0
|
chartInputs.length = 0
|
||||||
|
// 图表明暗断言基于浅色环境,显式固定主题避免受应用默认主题影响。
|
||||||
|
vuetify.theme.global.name.value = 'light'
|
||||||
vi.spyOn(console, 'error').mockImplementation(() => {})
|
vi.spyOn(console, 'error').mockImplementation(() => {})
|
||||||
vi.spyOn(console, 'log').mockImplementation(() => {})
|
vi.spyOn(console, 'log').mockImplementation(() => {})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -232,6 +232,8 @@ describe('AccountSettingNotification', () => {
|
|||||||
|
|
||||||
it('loads, edits, and saves a template while pausing refresh and following the active theme', async () => {
|
it('loads, edits, and saves a template while pausing refresh and following the active theme', async () => {
|
||||||
const previousTheme = vuetify.theme.global.name.value
|
const previousTheme = vuetify.theme.global.name.value
|
||||||
|
// 从浅色主题起步验证编辑器跟随主题切换,不受应用默认主题影响。
|
||||||
|
vuetify.theme.global.name.value = 'light'
|
||||||
const controller = createDialogController()
|
const controller = createDialogController()
|
||||||
mocks.openSharedDialog.mockReturnValue(controller)
|
mocks.openSharedDialog.mockReturnValue(controller)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user