Cascader: fix display errors (#16665)

This commit is contained in:
zhangHongEn
2019-08-14 16:20:17 +08:00
committed by luckyCao
parent 75f0eb81ab
commit 0bff072fa7
2 changed files with 58 additions and 14 deletions

View File

@@ -88,6 +88,23 @@ const options2 = [{
}]
}];
const options3 = [
{
value: 'shanghai',
label: '上海',
children: [
{
value: 'baoshan',
label: '宝山'
}
]
},
{
value: 'beijing',
label: '北京'
}
];
const getMenus = el => el.querySelectorAll('.el-cascader-menu');
const getOptions = (el, menuIndex) => getMenus(el)[menuIndex].querySelectorAll('.el-cascader-node');
const getValidOptions = (el, menuIndex) => getMenus(el)[menuIndex].querySelectorAll('.el-cascader-node[tabindex="-1"]');
@@ -532,5 +549,33 @@ describe('CascaderPanel', () => {
await waitImmediate();
expect(vm.value.length).to.equal(3);
});
it('click leaf hidden children', async() => {
vm = createVue({
template: `
<el-cascader-panel
ref="panel"
v-model="value"
:options="options"></el-cascader-panel>
`,
data() {
return {
value: [],
options: options3
};
}
}, true);
const el = vm.$el;
const elOptions = getOptions(el, 0);
const firstOption = elOptions[0];
const twoOption = elOptions[1];
firstOption.click();
await waitImmediate();
expect(getMenus(el).length).to.equal(2);
twoOption.click();
await waitImmediate();
expect(getMenus(el).length).to.equal(1);
});
});