diff --git a/components/cascader/__tests__/index.test.js b/components/cascader/__tests__/index.test.js index 86cf209410..8e4aab695e 100644 --- a/components/cascader/__tests__/index.test.js +++ b/components/cascader/__tests__/index.test.js @@ -503,6 +503,7 @@ describe('Cascader', () => { }); expect(wrapper.find('input').prop('placeholder')).toBe(customPlaceholder); }); + it('popup correctly with defaultValue RTL', () => { const wrapper = mount( @@ -523,6 +524,7 @@ describe('Cascader', () => { ), ).toMatchSnapshot(); }); + it('can be selected in RTL direction', () => { const options2 = [ { diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index c2180aee25..8fe32ef987 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -522,10 +522,8 @@ class Cascader extends React.Component { const names: FilledFieldNamesType = getFilledFieldNames(this.props); if (options && options.length > 0) { if (state.inputValue) { - options = this.generateFilteredOptions(prefixCls, renderEmpty); - if (isEqual(options, this.cachedOptions)) { - options = this.cachedOptions; - } + const filteredOptions = this.generateFilteredOptions(prefixCls, renderEmpty); + options = isEqual(filteredOptions, this.cachedOptions) ? this.cachedOptions : filteredOptions; } } else { options = [