mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
fix: NestedSelect级联下拉开启onlyChildren&onlyleaf后,导致下拉最后一项默认选中问题 (#9215)
* fix: 测试:「组件」级联下拉开启onlyleaf后,存在属性互斥的情况,组件表现不符合预期(onlyChildren&onlyleaf) * fix: 测试:「组件」级联下拉开启onlyleaf后,存在属性互斥的情况 ,组件表现不符合预期(onlyChildren&onlyleaf) * fix: 测试:「组件」级联下拉开启onlyleaf后,存在属性互斥的情况 ,组件表现不符合预期(onlyChildren&onlyleaf)
This commit is contained in:
parent
ed2940ac4e
commit
2955833fd6
@ -218,3 +218,33 @@ describe.only('Renderer:NestedSelect with onlyLeaf', () => {
|
||||
expect(queryByText(optionWithChild)).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
test('test onlyChildren&onlyleaf', async () => {
|
||||
const {container} = await setupNestedSelect({
|
||||
"onlyLeaf": true,
|
||||
"multiple": true,
|
||||
"options": [
|
||||
{"label":"选项A","value":"A"},
|
||||
{"label":"选项B","value":"B",
|
||||
"children":[
|
||||
{"label":"选项b1","value":"b1"},
|
||||
{"label":"选项b2","value":"b2"}
|
||||
]
|
||||
},
|
||||
{"label":"选项C-children为null","value":"C","children":[]},
|
||||
{"label":"选项d","value":"d",
|
||||
"children":[
|
||||
{"label":"选项D1-CHILDREN为null","value":"D1","children":[]}
|
||||
]}
|
||||
]
|
||||
});
|
||||
|
||||
const trigger = container.querySelector('.cxd-ResultBox');
|
||||
expect(trigger).toBeInTheDocument();
|
||||
|
||||
fireEvent.click(trigger!);
|
||||
await wait(200);
|
||||
|
||||
const hasActive = container.querySelector('.is-active');
|
||||
expect(hasActive).toBeNull();
|
||||
});
|
||||
|
@ -689,6 +689,7 @@ export default class NestedSelectControl extends React.Component<
|
||||
if (
|
||||
!selfChecked &&
|
||||
onlyChildren &&
|
||||
multiple &&
|
||||
this.isParentNode(option) &&
|
||||
this.allChecked(option.children!)
|
||||
) {
|
||||
|
Loading…
Reference in New Issue
Block a user