Skip to content

Conversation

@gaouimounir
Copy link
Contributor

Feat #698

The Slash Table component has no test, so his coverage is at 0%
The component should be covered.

https://sonarcloud.io/component_measures?metric=coverage&selected=AxaFrance_design-system%3Aslash%2Freact%2Fsrc%2FTable&id=AxaFrance_design-system

Close #698

@pplancq pplancq added agent-slash Component for the agent theme test labels Aug 13, 2025
Copy link
Contributor

@pplancq pplancq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il faudrait que les tests et exemple soit en anglais

</Table>,
);

const table = container.querySelector("table");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getByRole('table') normalement c'est bon

describe("Composants de la table", () => {
it("devrait rendre un tableau avec la classe correcte", () => {
const { container } = render(
<Table data-testid="table">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pourquoi mettre un data-testid s'il n'est pas utiliser dans le test

});

it("devrait accepter et appliquer une classe custom", () => {
const { container } = render(<Table className="custom-class">{}</Table>);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const { container } = render(<Table className="custom-class">{}</Table>);
const { container } = render(<Table className="custom-class"/>);

Comment on lines +41 to +42
expect(table?.className).toContain("af-table");
expect(table?.className).toContain("mod");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
expect(table?.className).toContain("af-table");
expect(table?.className).toContain("mod");
expect(table).toHaveClass("af-table af-table--mod");

</Table.THead>,
);

const thead = container.querySelector("thead");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

il me semble que getByRole('rowgroup') devrait fonctionner.

<Table.Td data-test-id="td-test" aria-label="label" />,
);

const td = container.querySelector("td");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

il me semble que getByRole('cell') devrait fonctionner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-slash Component for the agent theme test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Test] Add test for Table component

2 participants