mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
fix(components): [table] expanded rows cannot be updated using array methods (#23761)
* fix(components): [table] expanded rows cannot be updated using array methods * test: add case * test: apply coderabbit suggest
This commit is contained in:
@@ -2056,6 +2056,25 @@ describe('Table.vue', () => {
|
||||
childRows.forEach((item) => {
|
||||
expect(item.attributes('style')).toContain('')
|
||||
})
|
||||
|
||||
// #23759
|
||||
wrapper.vm.expandRowKeys.splice(1, 1)
|
||||
await doubleWait()
|
||||
childRows = wrapper.findAll('.el-table__row--level-1')
|
||||
childRows.forEach((item, index) => {
|
||||
if (index < 2) {
|
||||
expect(item.attributes('style')).not.toContain('display: none')
|
||||
} else {
|
||||
expect(item.attributes('style')).toContain('display: none')
|
||||
}
|
||||
})
|
||||
|
||||
wrapper.vm.expandRowKeys.push('1999-3-31')
|
||||
await doubleWait()
|
||||
childRows = wrapper.findAll('.el-table__row--level-1')
|
||||
childRows.forEach((item) => {
|
||||
expect(item.attributes('style')).not.toContain('display: none')
|
||||
})
|
||||
})
|
||||
|
||||
it('expand-row-keys & toggleRowExpansion', async () => {
|
||||
|
||||
@@ -148,7 +148,8 @@ function useTree<T extends DefaultRow>(watcherData: WatcherPropsData<T>) {
|
||||
() => expandRowKeys.value,
|
||||
() => {
|
||||
updateTreeData(true)
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
watch(
|
||||
|
||||
Reference in New Issue
Block a user