Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/src/button/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export const Chromatic = () => (
<Title title="Only icon (image)" theme="light" level={4} />
<DxcButton
mode="text"
icon="https://developer.apple.com/design/human-interface-guidelines/foundations/app-icons/images/icon-and-image-large-icon-settings_2x.png"
icon="https://www.freepnglogos.com/uploads/facebook-logo-design-1.png"
/>
</ExampleContainer>
<BackgroundColorProvider color="#333333">
Expand Down
10 changes: 9 additions & 1 deletion lib/src/button/Button.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { render, fireEvent } from "@testing-library/react";
import { render, fireEvent, getByRole } from "@testing-library/react";
import DxcButton from "./Button.tsx";

describe("Button component tests", () => {
Expand All @@ -16,4 +16,12 @@ describe("Button component tests", () => {
fireEvent.click(button);
expect(onClick).toHaveBeenCalled();
});

test("Renders with correct accessibility attributes", () => {
const { getByRole } = render(<DxcButton label="Home" title="Go home" />);

const button = getByRole("button");
expect(button.getAttribute("aria-label")).toBe("Go home");
expect(button.getAttribute("title")).toBe("Go home");
});
});
Loading