Skip to content

Conversation

afc163
Copy link
Member

@afc163 afc163 commented Dec 30, 2021

@vercel
Copy link

vercel bot commented Dec 30, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/react-component/select/DV222PDD2ojY8XHvLtdRidxpkCdD
✅ Preview: https://select-git-fix-dropdownmatchselectwidth-35c767-react-component.vercel.app

const selectContext = React.useMemo(
() => ({
const selectContext = React.useMemo(() => {
const realVirtual = virtual !== false && dropdownMatchSelectWidth !== false;
Copy link
Member Author

@afc163 afc163 Dec 30, 2021

Choose a reason for hiding this comment

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

@afc163 afc163 force-pushed the fix-dropdownMatchSelectWidth-and-virtual branch from 47ede42 to 0f16085 Compare December 30, 2021 10:06
expect(wrapper.find('.rc-select-dropdown').last().props().style.minWidth).toBe(1000);

// dropdownMatchSelectWidth is false means close virtual scroll
expect(wrapper.find('.rc-select-item')).toHaveLength(options.length);
Copy link
Member Author

Choose a reason for hiding this comment

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

这句断言在 jsdom 里测不出来,即使开启虚拟滚动 length 也始终是全量。

@codecov
Copy link

codecov bot commented Dec 30, 2021

Codecov Report

Merging #699 (0f16085) into master (53e09f9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #699   +/-   ##
=======================================
  Coverage   99.50%   99.50%           
=======================================
  Files          25       25           
  Lines        1011     1012    +1     
  Branches      320      321    +1     
=======================================
+ Hits         1006     1007    +1     
  Misses          4        4           
  Partials        1        1           
Impacted Files Coverage Δ
src/Select.tsx 100.00% <100.00%> (ø)

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 53e09f9...0f16085. Read the comment docs.

@afc163 afc163 merged commit c278095 into master Dec 30, 2021
@afc163 afc163 deleted the fix-dropdownMatchSelectWidth-and-virtual branch December 30, 2021 10:13

// dropdownMatchSelectWidth is false means close virtual scroll
expect(wrapper.find('.rc-select-item')).toHaveLength(options.length);
expect((wrapper.find(VirtualList).props() as any).virtual).toBe(false);
Copy link
Member Author

Choose a reason for hiding this comment

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

还是要检查传给 VirtualList 的属性。

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.

Select dropdownMatchSelectWidth={false} cannot disable virtual prop after 4.18.x
1 participant