diff --git a/examples/debug.tsx b/examples/debug.tsx index 74261d58..5ac849ee 100644 --- a/examples/debug.tsx +++ b/examples/debug.tsx @@ -10,13 +10,13 @@ const addressOptions = [ children: [], }, { - label: '福建', - value: 'fj', + label: '福建 "', + value: 'fj "', title: '测试标题', children: [ { - label: '福州', - value: 'fuzhou', + label: '福州"', + value: 'fuzhou "', children: [ { label: '马尾', diff --git a/src/OptionList/index.tsx b/src/OptionList/index.tsx index 21def516..cc8f1e35 100644 --- a/src/OptionList/index.tsx +++ b/src/OptionList/index.tsx @@ -148,7 +148,9 @@ const RefOptionList = React.forwardRef((props, ref) => { for (let i = 0; i < activeValueCells.length; i += 1) { const cellPath = activeValueCells.slice(0, i + 1); const cellKeyPath = toPathKey(cellPath); - const ele = containerRef.current?.querySelector(`li[data-path-key="${cellKeyPath}"]`); + const ele = containerRef.current?.querySelector( + `li[data-path-key="${cellKeyPath.replace(/(? { let selectedValue; @@ -806,4 +806,26 @@ describe('Cascader.Basic', () => { wrapper.unmount(); }); }); + + it('should support double quote in label and value', () => { + const wrapper = mount( + , + ); + + wrapper.find(`li[data-path-key]`).simulate('click'); + }); });