mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
fix(components): [splitter] display the mask after panel update (#22954)
* fix(components): [splitter] display the mask when there is no panel * fix: update
This commit is contained in:
@@ -411,4 +411,24 @@ describe('Splitter', () => {
|
||||
expect(panels[0].attributes('style')).toContain('flex-basis: 150px;')
|
||||
expect(panels[1].attributes('style')).toContain('flex-basis: 250px;')
|
||||
})
|
||||
|
||||
it('should not still display the mask after the panel updates', async () => {
|
||||
const show = ref(true)
|
||||
const wrapper = mount(() => (
|
||||
<ElSplitter onResizeStart={() => (show.value = false)}>
|
||||
<ElSplitterPanel v-if={show.value}>Left Panel</ElSplitterPanel>
|
||||
<ElSplitterPanel>Right Panel</ElSplitterPanel>
|
||||
</ElSplitter>
|
||||
))
|
||||
await nextTick()
|
||||
|
||||
expect(wrapper.find('.el-splitter__mask').exists()).toBeFalsy()
|
||||
|
||||
const splitBar = wrapper.find('.el-splitter-bar__dragger')
|
||||
const mousedown = new MouseEvent('mousedown', { bubbles: true })
|
||||
Object.defineProperty(mousedown, 'pageX', { value: 200 })
|
||||
splitBar.element.dispatchEvent(mousedown)
|
||||
await nextTick()
|
||||
expect(wrapper.find('.el-splitter__mask').exists()).toBeFalsy()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -37,6 +37,7 @@ const {
|
||||
} = useOrderedChildren<PanelItemState>(getCurrentInstance()!, 'ElSplitterPanel')
|
||||
|
||||
watch(panels, () => {
|
||||
movingIndex.value = null
|
||||
panels.value.forEach((instance: PanelItemState, index: number) => {
|
||||
instance.setIndex(index)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user