Skip to content

Commit

Permalink
chore: address next round of comments and minor changes spotted
Browse files Browse the repository at this point in the history
  • Loading branch information
tomdavies73 committed Jan 10, 2024
1 parent dfa7725 commit a3029cb
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 12 deletions.
4 changes: 0 additions & 4 deletions playwright/components/step-flow/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Page } from "playwright-core";
import {
STEP_FLOW_COMPONENT,
STEP_FLOW_PROGRESS_INDICATOR,
STEP_FLOW_CATEGORY_TEXT,
STEP_FLOW_TITLE_TEXT_WRAPPER,
Expand All @@ -12,9 +11,6 @@ import {
} from "./locators";

// component preview locators
export const stepFlowComponent = (page: Page) =>
page.locator(STEP_FLOW_COMPONENT);

export const stepFlowProgressIndicator = (page: Page) =>
page.locator(STEP_FLOW_PROGRESS_INDICATOR);

Expand Down
1 change: 0 additions & 1 deletion playwright/components/step-flow/locators.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export const STEP_FLOW_COMPONENT = '[data-component="step-flow"]';
export const STEP_FLOW_PROGRESS_INDICATOR =
'[data-element="progress-indicator"]';
export const STEP_FLOW_CATEGORY_TEXT = '[data-element="category-text"]';
Expand Down
6 changes: 4 additions & 2 deletions src/components/step-flow/step-flow.pw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { CHARACTERS } from "../../../playwright/support/constants";

const testData = [CHARACTERS.DIACRITICS, CHARACTERS.SPECIALCHARACTERS];

test.describe("Prop checks for Portrait component", () => {
test.describe("Prop checks for StepFlow component", () => {
testData.forEach((stringVals) => {
test(`should render with the category prop, when the prop's value is ${stringVals}`, async ({
mount,
Expand Down Expand Up @@ -207,6 +207,7 @@ test.describe("Event checks for StepFlow component", () => {
/>
);
await stepFlowDismissIcon(page).click();

expect(callbackCount).toBe(1);
});
});
Expand All @@ -220,6 +221,7 @@ test.describe("Ref checks for StepFlow component", () => {

await expect(stepFlowTitleTextWrapper(page)).not.toBeFocused();
await button(page).nth(1).click();

await expect(stepFlowTitleTextWrapper(page)).toBeFocused();
});
});
Expand All @@ -234,7 +236,7 @@ test.describe("Accessibility tests for StepFlow component", () => {
await checkAccessibility(page);
});

test("should pass accessibility checks when component is rendered with a ref", async ({
test("should pass accessibility checks when component is rendered with a ref and buttons", async ({
mount,
page,
}) => {
Expand Down
1 change: 0 additions & 1 deletion src/components/step-flow/step-flow.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,6 @@ describe("Step Flow component", () => {
const user = userEvent.setup();
const { container } = render(<MockComponent />);
const button = screen.getByRole("button");
button.focus();

await user.click(button);

Expand Down
4 changes: 2 additions & 2 deletions src/components/step-flow/step-flow.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import StepFlow from "carbon-react/lib/components/step-flow";

## Examples

A `ref` is **strongly** recommended to be used, to ensure focus is programmatically moved to a a title div when
a user advances through each step. This ensures screen reader users are made aware of all information throughout the user journey.
To ensure focus is programmatically moved to the `title` of a given `StepFlow` when a user advances through each step,
pass a `ref` is **strongly** recommended. This ensures screen reader users are made aware of all information throughout the user journey
An example of how this can be achieved is provided in the **Example implementation** story.

### Default
Expand Down
2 changes: 1 addition & 1 deletion src/components/typography/typography.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export interface TypographyProps extends SpaceProps, TagProps {
/** Set whether it will be visually hidden
* NOTE: This is for screen readers only and will make a lot of the other props redundant */
screenReaderOnly?: boolean;
/** @private @ignore Identifier used for testing purposes, applied to the root element of the component. */
/** @private @ignore */
"aria-hidden"?: "true" | "false";
}

Expand Down
4 changes: 3 additions & 1 deletion src/locales/pl-pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ const plPL: Locale = {
stepLabel: (currentStep, totalSteps) =>
`Krok ${currentStep} z ${totalSteps}`,
screenReaderOnlyTitle: (title, currentStep, totalSteps, category) =>
`${category}. ${title}. Krok ${currentStep} of ${totalSteps}.`,
`${
category ? `${category}.` : ""
}. ${title}. Krok ${currentStep} of ${totalSteps}.`,
closeIconAriaLabel: () => "Zamknij",
},
switch: {
Expand Down

0 comments on commit a3029cb

Please sign in to comment.