fix(warehouses): select region time zones instead of UTC offsets

This commit is contained in:
2026-10-10 11:02:51 +08:00
parent 320c2e4471
commit 33e7e1e41b
2 changed files with 60 additions and 57 deletions
@@ -76,7 +76,7 @@ const domesticWarehouse: PlatformWarehouseSummaryResource = {
warehouseName: '义乌收货仓',
warehouseType: 'DOMESTIC',
countryCode: 'CN',
timezone: 'UTC+8',
timezone: 'Asia/Shanghai',
contactName: '仓库客服',
contactPhone: '0579-12345678',
contactEmail: 'warehouse@example.com',
@@ -111,7 +111,7 @@ const fbaWarehouse: PlatformWarehouseSummaryResource = {
warehouseName: 'AKR1',
warehouseType: 'FBA',
countryCode: 'US',
timezone: 'UTC-5',
timezone: 'America/New_York',
contactName: null,
contactPhone: null,
contactEmail: null,
@@ -234,14 +234,14 @@ describe('WarehousesView', () => {
expect(wrapper.find('.data-table').text()).not.toContain('浙江省义乌市北苑街道 1 号库')
expect(wrapper.text()).toContain('国内收货仓')
expect(wrapper.text()).toContain('中国 CN')
expect(wrapper.find('.data-table').text()).not.toContain('UTC+8')
expect(wrapper.find('.data-table').text()).not.toContain('Asia/Shanghai')
expect(wrapper.text()).toContain('共 1 个公共仓库')
expect(wrapper.find('.data-table').exists()).toBe(true)
const editButton = wrapper.findAll('.table-actions button').find((button) => button.text().trim() === '编辑')
await editButton?.trigger('click')
await flushPromises()
expect((wrapper.find('textarea[placeholder*="街道"]').element as HTMLTextAreaElement).value).toBe('真实物流园 1 号库')
expect(document.body.textContent).toContain('UTC+8')
expect(document.body.textContent).toContain('Asia/Shanghai')
})
it('submits filters and pagination to the API instead of filtering rows locally', async () => {
@@ -356,12 +356,12 @@ describe('WarehousesView', () => {
city: 'Long Beach',
postalCode: '90802',
addressLine1: '2400 E Spring St',
timezone: 'UTC-8',
timezone: 'America/Los_Angeles',
})
expect(createPlatformWarehouse).not.toHaveBeenCalled()
})
it('hides domestic country, timezone and type inputs while submitting fixed CN and UTC+8 defaults', async () => {
it('hides domestic country, timezone and type inputs while submitting fixed CN and Asia/Shanghai defaults', async () => {
const wrapper = await mountView()
wrapper.findComponent({ name: 'ElDropdown' }).vm.$emit('command', 'DOMESTIC')
@@ -387,7 +387,7 @@ describe('WarehousesView', () => {
warehouseName: '义乌新仓',
warehouseType: 'DOMESTIC',
countryCode: 'CN',
timezone: 'UTC+8',
timezone: 'Asia/Shanghai',
address: expect.objectContaining({ countryCode: 'CN', city: '义乌市' }),
})
})
@@ -409,7 +409,7 @@ describe('WarehousesView', () => {
const timezoneSelect = wrapper.findAllComponents({ name: 'ElSelect' })
.find((select) => select.props('placeholder') === '请选择时区')
expect(timezoneSelect).toBeDefined()
expect(wrapper.findAllComponents({ name: 'ElOption' }).some((option) => option.props('value') === 'UTC-8')).toBe(true)
expect(wrapper.findAllComponents({ name: 'ElOption' }).some((option) => option.props('value') === 'America/Los_Angeles')).toBe(true)
setField('input[placeholder="请输入仓库名称"]', '洛杉矶海外仓')
stateSelect!.vm.$emit('update:modelValue', 'CA')
@@ -427,7 +427,7 @@ describe('WarehousesView', () => {
warehouseName: '洛杉矶海外仓',
warehouseType: 'OVERSEAS',
countryCode: 'US',
timezone: 'UTC-8',
timezone: 'America/Los_Angeles',
address: expect.objectContaining({ stateProvince: 'CA' }),
})
})
@@ -470,7 +470,7 @@ describe('WarehousesView', () => {
warehouseName: '洛杉矶合作仓',
warehouseType: 'OVERSEAS_PARTNER',
countryCode: 'US',
timezone: 'UTC-8',
timezone: 'America/Los_Angeles',
address: expect.objectContaining({ stateProvince: 'CA', city: 'Los Angeles' }),
}))
})
@@ -508,7 +508,7 @@ describe('WarehousesView', () => {
const dialogText = document.querySelector('.warehouse-editor-dialog')?.textContent || ''
expect(dialogText).toContain('编辑FBA 地址')
expect(dialogText).not.toContain('例如 US')
expect(dialogText).not.toContain('例如 UTC-8')
expect(dialogText).not.toContain('例如 America/Los_Angeles')
const countrySelect = wrapper.findAllComponents({ name: 'ElSelect' })
.find((select) => select.props('placeholder') === '请选择国家或地区')
@@ -518,7 +518,7 @@ describe('WarehousesView', () => {
.find((select) => select.props('placeholder') === '请选择时区')
expect(countrySelect?.props('modelValue')).toBe('US')
expect(stateSelect?.props('modelValue')).toBe('OH')
expect(timezoneSelect?.props('modelValue')).toBe('UTC-5')
expect(timezoneSelect?.props('modelValue')).toBe('America/New_York')
expect(countrySelect).toBeDefined()
expect((wrapper.find('input[placeholder="例如 154 或 CADF"]').element as HTMLInputElement).value).toBe('154')
@@ -533,7 +533,7 @@ describe('WarehousesView', () => {
warehouseType: 'FBA',
internalCode: '154',
countryCode: 'US',
timezone: 'UTC-5',
timezone: 'America/New_York',
address: expect.objectContaining({ stateProvince: 'OH' }),
})
})