style(admin): unify dialog layouts and dense readonly presentation
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
vi.mock('@/shared/components/AppDialog.vue', () => ({ default: { props: ['modelValue'], template: '<section v-if="modelValue"><slot /></section>' } }))
|
||||
import ElementPlus from 'element-plus'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { defineComponent } from 'vue'
|
||||
@@ -15,7 +16,7 @@ function data(status = 'COMPLETE'): DailyResponse {
|
||||
}
|
||||
describe('SKU daily trend axes', () => {
|
||||
it('shows both axes, intermediate dates, zero and maximum ticks for a 30-day window', () => {
|
||||
const w = mount(SkuTrend, { props: { data: data() } })
|
||||
const w = mount(SkuTrend, { props: { data: data() }, global: { plugins: [ElementPlus] } })
|
||||
const chart = w.findComponent({ name: 'VChart' })
|
||||
const option = chart.props('option')
|
||||
expect(option.xAxis).toMatchObject({ type: 'category', name: '日期(北京时间)' })
|
||||
@@ -24,11 +25,11 @@ describe('SKU daily trend axes', () => {
|
||||
expect(option.series[1].data).toEqual(Array(30).fill(1))
|
||||
expect(option.tooltip.trigger).toBe('axis')
|
||||
expect(chart.props('initOptions')).toEqual({ renderer: 'canvas' })
|
||||
expect(w.find('svg').exists()).toBe(false)
|
||||
expect(w.get('.sku-trend').find('svg').exists()).toBe(false)
|
||||
w.unmount()
|
||||
})
|
||||
it('retains axes and date markers for an unknown window without drawing zero points', () => {
|
||||
const w = mount(SkuTrend, { props: { data: data('UNKNOWN') } })
|
||||
const w = mount(SkuTrend, { props: { data: data('UNKNOWN') }, global: { plugins: [ElementPlus] } })
|
||||
expect(w.text()).toContain('未知日期不作为零销量')
|
||||
const option = w.findComponent({ name: 'VChart' }).props('option')
|
||||
expect(option.series[0].data.every((point: { value: number | null }) => point.value === null)).toBe(true)
|
||||
|
||||
Reference in New Issue
Block a user