Skip to content

Commit

Permalink
fixup! Normalize empty space in bot run test status list
Browse files Browse the repository at this point in the history
  • Loading branch information
jugglinmike committed Feb 21, 2024
1 parent 88f9666 commit 8fc0a42
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions client/components/BotRunTestStatusList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@ const BotRunTestStatusUnorderedList = styled.ul`
`;

/**
* Generate a string describing some number of "Tests" where the word "Test" is
* pluralized appropriately (and without interstitial space characters which
* produces unnatural speech in some screen readers [1]).
* Generate a string describing the status of some number of "Tests" where the
* word "Test" is pluralized appropriately and qualified with the provided
* status. As a single primitive string value, the output of this utility
* function can be rendered into the document without interstitial space
* characters which produces unnatural speech in some screen readers:
*
* [1]: https://github.com/w3c/aria-at-app/issues/872
* https://github.com/w3c/aria-at-app/issues/872
*
* @param {number} count the integer number of tests being described
* @param {string} status the status of the tests being described
*
* @returns {string} the pluralized text
*/
const testCountString = (count) => `${count} Test${count === 1 ? '' : 's'}`;
const testCountString = (count, status) =>
`${count} Test${count === 1 ? '' : 's'} ${status}`;

const BotRunTestStatusList = ({ testPlanReportId, runnableTestsLength }) => {
const {
Expand Down Expand Up @@ -129,15 +133,15 @@ const BotRunTestStatusList = ({ testPlanReportId, runnableTestsLength }) => {
<BotRunTestStatusUnorderedList className="text-secondary fs-6">
<li className="m-2">
<ReportStatusDot className="tests-complete" />
{testCountString(numTestsCompleted)} Completed
{testCountString(numTestsCompleted, 'Completed')}
</li>
<li className="m-2">
<ReportStatusDot className="tests-queued" />
{testCountString(numTestsQueued)} Queued
{testCountString(numTestsQueued, 'Queued')}
</li>
<li className="m-2">
<ReportStatusDot className="tests-cancelled" />
{testCountString(numTestsCancelled)} Cancelled
{testCountString(numTestsCancelled, 'Cancelled')}
</li>
</BotRunTestStatusUnorderedList>
);
Expand Down

0 comments on commit 8fc0a42

Please sign in to comment.