Skip to content

Commit

Permalink
Merge pull request #29375 from storybookjs/test-provider-name
Browse files Browse the repository at this point in the history
Core: Improve aria labels using test provider `name` property
  • Loading branch information
valentinpalkovic authored Oct 17, 2024
2 parents e9523db + 71a4b08 commit 2ecb957
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions code/addons/test/src/manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ addons.register(ADDON_ID, (api) => {
runnable: true,
watchable: true,

name: 'Component tests',
title: ({ crashed }) => (crashed ? "Component tests didn't complete" : 'Component tests'),
description: ({ failed, running, watching, progress, crashed, details }) => {
const [isModalOpen, setIsModalOpen] = useState(false);
Expand Down
6 changes: 3 additions & 3 deletions code/core/src/manager/components/sidebar/TestingModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export const TestingModule = ({
<Actions>
{state.watchable && (
<Button
aria-label="Toggle watch mode"
aria-label={`${state.watching ? 'Disable' : 'Enable'} watch mode for ${state.name}`}
variant="ghost"
padding="small"
active={state.watching}
Expand All @@ -255,7 +255,7 @@ export const TestingModule = ({
<>
{state.running && state.cancellable ? (
<Button
aria-label={`Cancel tests`}
aria-label={`Stop ${state.name}`}
variant="ghost"
padding="small"
onClick={() => onCancelTests(state.id)}
Expand All @@ -265,7 +265,7 @@ export const TestingModule = ({
</Button>
) : (
<Button
aria-label={`Run ${state.title}`}
aria-label={`Start ${state.name}`}
variant="ghost"
padding="small"
onClick={() => onRunTests(state.id)}
Expand Down
1 change: 1 addition & 0 deletions code/core/src/types/modules/addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ export interface Addon_TestProviderType<
type: Addon_TypesEnum.experimental_TEST_PROVIDER;
/** The unique id of the test provider. */
id: string;
name: string;
title: (state: Addon_TestProviderState<Details>) => ReactNode;
description: (state: Addon_TestProviderState<Details>) => ReactNode;
mapStatusUpdate?: (state: Addon_TestProviderState<Details>) => API_StatusUpdate;
Expand Down

0 comments on commit 2ecb957

Please sign in to comment.