Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#23019): display defaultValue when no matched options #24058

Merged
merged 1 commit into from
May 12, 2020
Merged

fix(#23019): display defaultValue when no matched options #24058

merged 1 commit into from
May 12, 2020

Conversation

kerm1it
Copy link
Member

@kerm1it kerm1it commented May 11, 2020

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

close #23019

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English display defaultValue instead of empty string when no matched options
🇨🇳 Chinese 当默认值没有匹配任何选项时展示默认值而不是空字符串

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

Copy link

@tests-checker tests-checker bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add tests to make sure this change works as expected?

@kerm1it
Copy link
Member Author

kerm1it commented May 11, 2020

有些代码被代码格式化自动修改。

@ant-design-bot
Copy link
Contributor

ant-design-bot commented May 11, 2020

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 11, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 25831a0:

Sandbox Source
antd reproduction template Configuration

@kerm1it
Copy link
Member Author

kerm1it commented May 11, 2020

@afc163 好像modal那失败了,是调整了什么吗?

@afc163
Copy link
Member

afc163 commented May 11, 2020

rebase master

@codecov
Copy link

codecov bot commented May 11, 2020

Codecov Report

Merging #24058 into master will decrease coverage by 0.01%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24058      +/-   ##
==========================================
- Coverage   98.83%   98.82%   -0.02%     
==========================================
  Files         364      364              
  Lines        7290     7292       +2     
  Branches     2017     1981      -36     
==========================================
+ Hits         7205     7206       +1     
- Misses         85       86       +1     
Impacted Files Coverage Δ
components/cascader/index.tsx 97.22% <80.00%> (-0.45%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 705a6d6...25831a0. Read the comment docs.

@afc163
Copy link
Member

afc163 commented May 11, 2020

image

Could you fix coverage?

@kerm1it
Copy link
Member Author

kerm1it commented May 11, 2020

image

Could you fix coverage?

之前在这个测试用例其实已经覆盖了,但是就是没有执行,然而在本地就会执行。

it('should select item immediately when searching and pressing down arrow key', () => {
    const wrapper = mount(<Cascader options={options} showSearch={{ filter }} />);
    wrapper.find('input').simulate('click');
    wrapper.find('input').simulate('change', { target: { value: 'a' } });
    expect(wrapper.find('.ant-cascader-menu-item').length).toBe(2);
    expect(wrapper.find('.ant-cascader-menu-item-active').length).toBe(0);
    wrapper.find('input').simulate('keyDown', {
      keyCode: KeyCode.DOWN,
    });
    expect(wrapper.find('.ant-cascader-menu-item-active').length).toBe(1);
  });

这是之前的PR#22216

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

建议Cascader级联选择组件默认值不在选项中时可以显示默认值
4 participants