Skip to content

Commit

Permalink
Merge pull request #30073 from storybookjs/valentin/remove-test-count…
Browse files Browse the repository at this point in the history
…-from-status

Addon A11y: Add conditional rendering for a11y violation number in Testing Module
  • Loading branch information
valentinpalkovic authored Dec 16, 2024
2 parents 6717ac8 + d09ea61 commit faaf253
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions code/addons/test/src/components/TestProviderRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ export const TestProviderRender: FC<
state.config || { a11y: false, coverage: false }
);

const isStoryEntry = entryId?.includes('--') ?? false;

const a11yResults = useMemo(() => {
if (!isA11yAddon) {
return [];
Expand Down Expand Up @@ -156,7 +158,7 @@ export const TestProviderRender: FC<
(result) => result?.status === 'failed' || result?.status === 'warning'
).length;

const storyId = entryId?.includes('--') ? entryId : undefined;
const storyId = isStoryEntry ? entryId : undefined;
const results = (state.details?.testResults || [])
.flatMap((test) => {
if (!entryId) {
Expand Down Expand Up @@ -340,7 +342,7 @@ export const TestProviderRender: FC<
: null
}
icon={<TestStatusIcon status={a11yStatus} aria-label={`status: ${a11yStatus}`} />}
right={a11yNotPassedAmount || null}
right={isStoryEntry ? null : a11yNotPassedAmount || null}
/>
)}
</Extras>
Expand Down

0 comments on commit faaf253

Please sign in to comment.