统一预订事项日期选择控件
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { flushPromises, mount } from '@vue/test-utils'
|
||||
import { createPinia, setActivePinia } from 'pinia'
|
||||
import PrimeVue from 'primevue/config'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { createI18n } from 'vue-i18n'
|
||||
import { createMemoryHistory, createRouter } from 'vue-router'
|
||||
@@ -40,6 +41,20 @@ const service = await import('@/services/reservationService')
|
||||
describe('reservation V4 pages', () => {
|
||||
beforeEach(() => {
|
||||
sessionStorage.clear()
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: vi.fn().mockImplementation((query: string) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: vi.fn(),
|
||||
removeListener: vi.fn(),
|
||||
addEventListener: vi.fn(),
|
||||
removeEventListener: vi.fn(),
|
||||
dispatchEvent: vi.fn(),
|
||||
})),
|
||||
})
|
||||
vi.mocked(service.ackReservationV4SourceNotification).mockReset()
|
||||
vi.mocked(service.confirmReservationV4OrderTaskCard).mockReset()
|
||||
vi.mocked(service.fetchReservationV4AccountLookups).mockReset()
|
||||
@@ -780,8 +795,10 @@ describe('reservation V4 pages', () => {
|
||||
expect((breakfast.element as HTMLInputElement).disabled).toBe(true)
|
||||
expect((roomCard.find('input[name="/room_information/final_values/group_block_name"]').element as HTMLInputElement).value)
|
||||
.toBe('GRP-V4-RI-GROUP-001')
|
||||
expect(roomCard.find('input[name="/room_information/final_values/arrival_date"]').attributes('type')).toBe('text')
|
||||
expect((roomCard.find('input[name="/room_information/final_values/arrival_date"]').element as HTMLInputElement).value)
|
||||
.toBe('2026-07-26')
|
||||
expect(roomCard.find('input[name="/room_information/final_values/departure_date"]').attributes('type')).toBe('text')
|
||||
expect((roomCard.find('input[name="/room_information/final_values/departure_date"]').element as HTMLInputElement).value)
|
||||
.toBe('2026-07-29')
|
||||
|
||||
@@ -1405,7 +1422,7 @@ async function mountWithPlugins(component: object, initialPath: string) {
|
||||
|
||||
return mount(component, {
|
||||
global: {
|
||||
plugins: [pinia, i18n, router],
|
||||
plugins: [pinia, i18n, router, PrimeVue],
|
||||
stubs: {
|
||||
RouterLink: {
|
||||
template: '<a><slot /></a>',
|
||||
|
||||
Reference in New Issue
Block a user