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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Transfer header checkbox label unit calculating issue #21136

Merged
merged 1 commit into from Jan 29, 2020

Conversation

morenyang
Copy link
Contributor

@morenyang morenyang commented Jan 29, 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

馃挕 Background and solution

The label for checkbox in the header of Transfer component shows the text like this:

<span>
{(checkedKeys.length > 0 ? `${checkedKeys.length}/` : '') + filteredItems.length}{' '}
{unit}
</span>

total items displaying use variable filteredItems.length, but calculate unit use dataSource.length:

const unit = dataSource.length > 1 ? itemsUnit : itemUnit;

and it may cause a case like 1 items:

expect(headerText(wrapper)).toEqual('1 items');

but expect is 1 item.

馃摑 Changelog

Language Changelog
馃嚭馃嚫 English Fix Transfer header checkbox label unit calculating issue.
馃嚚馃嚦 Chinese

鈽戯笍 Self Check before Merge

  • 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

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

@ant-design-bot
Copy link
Contributor

@ant-design-bot ant-design-bot commented Jan 29, 2020

@afc163 afc163 merged commit 5fcd73c into ant-design:master Jan 29, 2020
14 of 16 checks passed
@codesandbox-ci
Copy link

@codesandbox-ci codesandbox-ci bot commented Jan 29, 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 92d081f:

Sandbox Source
antd reproduction template Configuration

@codecov
Copy link

@codecov codecov bot commented Jan 29, 2020

Codecov Report

Merging #21136 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #21136   +/-   ##
=======================================
  Coverage   97.45%   97.45%           
=======================================
  Files         296      296           
  Lines        6912     6912           
  Branches     1919     1919           
=======================================
  Hits         6736     6736           
  Misses        176      176
Impacted Files Coverage 螖
components/transfer/list.tsx 100% <100%> (酶) 猬嗭笍

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 0b4caf9...92d081f. Read the comment docs.

@morenyang morenyang deleted the transfer-checkbox-label-unit branch Jan 29, 2020
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.

None yet

3 participants