Table: add test for selectOnIndeterminate (#10210)

pull/10221/head
杨奕 2018-03-16 21:42:11 +08:00 committed by GitHub
parent e36d57ac1d
commit 84bb3397cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 49 additions and 4 deletions

View File

@ -308,7 +308,7 @@ Vertical NavMenu could be collapsed.
| unique-opened | whether only one sub-menu can be active | boolean | — | false |
| menu-trigger | how sub-menus are triggered, only works when `mode` is 'horizontal' | string | — | hover |
| router | whether `vue-router` mode is activated. If true, index will be used as 'path' to activate the route action | boolean | — | false |
| collapse-transition | whether the menu collapse transition is active | boolean | — | true |
| collapse-transition | whether to enable the collapse transition | boolean | — | true |
### Menu Methods
| Event Name | Description | Parameters |

View File

@ -1975,7 +1975,7 @@ You can customize row index in `type=index` columns.
| sum-text | displayed text for the first column of summary row | String | — | Sum |
| summary-method | custom summary method | Function({ columns, data }) | — | — |
| span-method | method that returns rowspan and colspan | Function({ row, column, rowIndex, columnIndex }) | — | — |
| select-on-indeterminate | Controls the behavior of master checkbox in multi-select tables when only some rows are selected (but not all). If true, all rows will be selected, else deselected. | Boolean | — | false |
| select-on-indeterminate | controls the behavior of master checkbox in multi-select tables when only some rows are selected (but not all). If true, all rows will be selected, else deselected. | Boolean | — | true |
### Table Events
| Event Name | Description | Parameters |

View File

@ -310,6 +310,7 @@ NavMenu vertical puede ser colapsado.
| unique-opened | si solo un submenu puede ser activo | boolean | — | false |
| menu-trigger | como dispara eventos sub-menus, solo funciona cuando `mode` es 'horizontal' | string | — | hover |
| router | si el modo `vue-router` está activado. Si es verdader, índice será usado como 'path' para activar la ruta | boolean | — | false |
| collapse-transition | whether to enable the collapse transition | boolean | — | true |
### Métodos Menu
| Nombre de evento | Descripción | Parámetros |

View File

@ -1978,7 +1978,7 @@ Puede personalizar el índice de la fila con la propiedad `type=index` de las co
| sum-text | texto a mostrar para la primer columna de la fila de resumen | String | — | Sum |
| summary-method | método personalizado para resumen | Function({ columns, data }) | — | — |
| span-method | método que devuelve _rowspan_ y _colspan_ | Function({ row, column, rowIndex, columnIndex }) | — | — |
| select-on-indeterminate | Controls the behavior of master checkbox in multi-select tables when only some rows are selected (but not all). If true, all rows will be selected, else deselected. | Boolean | — | false |
| select-on-indeterminate | controls the behavior of master checkbox in multi-select tables when only some rows are selected (but not all). If true, all rows will be selected, else deselected. | Boolean | — | true |
### Eventos de la tabla
| Nombre del evento | Descripción | Parámetros |

View File

@ -2035,7 +2035,7 @@
| sum-text | 合计行第一列的文本 | String | — | 合计 |
| summary-method | 自定义的合计计算方法 | Function({ columns, data }) | — | — |
| span-method | 合并行或列的计算方法 | Function({ row, column, rowIndex, columnIndex }) | — | — |
| select-on-indeterminate | Controls the behavior of master checkbox in multi-select tables when only some rows are selected (but not all). If true, all rows will be selected, else deselected. | Boolean | — | false |
| select-on-indeterminate | 在多选表格中,当仅有部分行被选中时,点击表头的多选框时的行为。若为 true则选中所有行若为 false则取消选择所有行 | Boolean | — | true |
### Table Events
| 事件名 | 说明 | 参数 |

View File

@ -234,6 +234,47 @@ describe('Table', () => {
}, DELAY);
}, DELAY);
});
it('select-on-indeterminate', done => {
const vm = createVue({
template: `
<el-table :data="testData" @selection-change="change" :select-on-indeterminate="false" ref="table">
<el-table-column type="selection" />
<el-table-column prop="name" label="name" />
<el-table-column prop="release" label="release" />
<el-table-column prop="director" label="director" />
<el-table-column prop="runtime" label="runtime" />
</el-table>
`,
created() {
this.testData = getTestData();
},
mounted() {
this.$refs.table.toggleRowSelection(this.testData[0]);
},
data() {
return { selected: [] };
},
methods: {
change(val) {
this.selected = val;
}
}
}, true);
setTimeout(_ => {
vm.$el.querySelector('.el-checkbox').click();
setTimeout(_ => {
expect(vm.selected).to.length(0);
destroyVM(vm);
done();
}, DELAY);
}, DELAY);
});
});
describe('filter', () => {

3
types/table.d.ts vendored
View File

@ -79,6 +79,9 @@ export declare class ElTable extends ElementUIComponent {
/** Custom summary method */
summaryMethod: (param: SummaryMethodParams) => any[]
/** Controls the behavior of master checkbox in multi-select tables when only some rows are selected */
selectOnIndeterminate: boolean
/** Clear selection. Might be useful when `reserve-selection` is on */
clearSelection (): void