优化
This commit is contained in:
@@ -8,7 +8,7 @@ import SmartLoadingDialog from './SmartLoadingDialog.vue'
|
||||
describe('SmartLoadingDialog', () => {
|
||||
afterEach(() => { document.body.innerHTML = '' })
|
||||
|
||||
it('expands to the viewport and can return to the normal dialog size', async () => {
|
||||
it('opens fullscreen by default, can return to normal size, and reopens fullscreen', async () => {
|
||||
const wrapper = mount(SmartLoadingDialog, {
|
||||
attachTo: document.body,
|
||||
props: { modelValue: true },
|
||||
@@ -21,14 +21,19 @@ describe('SmartLoadingDialog', () => {
|
||||
|
||||
expect(wrapper.find('.smart-loading-dialog__warehouses').exists()).toBe(false)
|
||||
expect(document.querySelector('.smart-loading-dialog .el-dialog__body')?.classList.contains('el-dialog__body')).toBe(true)
|
||||
const expand = wrapper.get('button[aria-label="展开全屏"]')
|
||||
await expand.trigger('click')
|
||||
expect(document.querySelector('.smart-loading-dialog.is-fullscreen')).not.toBeNull()
|
||||
expect(wrapper.find('button[aria-label="退出全屏"]').exists()).toBe(true)
|
||||
|
||||
await wrapper.get('button[aria-label="退出全屏"]').trigger('click')
|
||||
expect(document.querySelector('.smart-loading-dialog.is-fullscreen')).toBeNull()
|
||||
expect(wrapper.find('button[aria-label="展开全屏"]').exists()).toBe(true)
|
||||
|
||||
await wrapper.setProps({ modelValue: false })
|
||||
await flushPromises()
|
||||
await wrapper.setProps({ modelValue: true })
|
||||
await flushPromises()
|
||||
expect(document.querySelector('.smart-loading-dialog.is-fullscreen')).not.toBeNull()
|
||||
expect(wrapper.find('button[aria-label="退出全屏"]').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('keeps the outer dialog fixed so only workbench data panes scroll', () => {
|
||||
|
||||
@@ -5,12 +5,10 @@ import AppDialog from '@/shared/components/AppDialog.vue'
|
||||
import GlobalSmartLoadingView from '../pages/GlobalSmartLoadingView.vue'
|
||||
|
||||
const open = defineModel<boolean>({ default: false })
|
||||
const fullscreen = ref(false)
|
||||
const fullscreen = ref(true)
|
||||
|
||||
watch(open, (value) => {
|
||||
if (!value) {
|
||||
fullscreen.value = false
|
||||
}
|
||||
if (value) fullscreen.value = true
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user