mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
fix(components): [table] toggleRowSelection restores previous behavior (#17884)
closed #17870
This commit is contained in:
@@ -800,7 +800,7 @@ describe('Table.vue', () => {
|
||||
},
|
||||
template: `
|
||||
<el-table ref="table" :data="testData" @${prop}="handleEvent">
|
||||
<el-table-column type="selection" />
|
||||
<el-table-column type="selection" :selectable="selectable" />
|
||||
<el-table-column prop="name" />
|
||||
<el-table-column prop="release" />
|
||||
<el-table-column prop="director" />
|
||||
@@ -813,6 +813,9 @@ describe('Table.vue', () => {
|
||||
this.fireCount++
|
||||
this.selection = selection
|
||||
},
|
||||
selectable(row) {
|
||||
return row.id !== 1
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -844,7 +847,7 @@ describe('Table.vue', () => {
|
||||
const vm = wrapper.vm
|
||||
vm.$refs.table.toggleAllSelection()
|
||||
await doubleWait()
|
||||
expect(vm.selection.length).toEqual(5)
|
||||
expect(vm.selection.length).toEqual(4)
|
||||
|
||||
vm.$refs.table.toggleAllSelection()
|
||||
await doubleWait()
|
||||
|
||||
@@ -197,13 +197,7 @@ function useWatcher<T>() {
|
||||
children: instance?.store?.states?.childrenColumnName.value,
|
||||
checkStrictly: instance?.store?.states?.checkStrictly.value,
|
||||
}
|
||||
const changed = toggleRowStatus(
|
||||
selection.value,
|
||||
row,
|
||||
selected,
|
||||
treeProps,
|
||||
selectable.value
|
||||
)
|
||||
const changed = toggleRowStatus(selection.value, row, selected, treeProps)
|
||||
if (changed) {
|
||||
const newSelection = (selection.value || []).slice()
|
||||
// 调用 API 修改选中值,不触发 select 事件
|
||||
|
||||
Reference in New Issue
Block a user