diff --git a/web-ui/src/components/edit_skills/EditSkillsCard.jsx b/web-ui/src/components/edit_skills/EditSkillsCard.jsx index 414e7e8892..78d4bb883d 100644 --- a/web-ui/src/components/edit_skills/EditSkillsCard.jsx +++ b/web-ui/src/components/edit_skills/EditSkillsCard.jsx @@ -142,20 +142,20 @@ const EditSkillsCard = ({ skill }) => { if (second) { const secondProfile = selectProfileMap(state)[second]; return rest.length ? ( -
+
Submitted By: {chip(firstProfile)} {chip(secondProfile)} {rest && ` and ${rest.length} others`}.
) : ( -
+
Submitted By: {chip(firstProfile)} {chip(secondProfile)}
); } else return firstProfile ? ( -
Submitted by: {chip(firstProfile)}
+
Submitted by: {chip(firstProfile)}
) : ( -
Submitted by: Unknown
+
Submitted by: Unknown
); }; diff --git a/web-ui/src/components/edit_skills/EditSkillsCard.test.jsx b/web-ui/src/components/edit_skills/EditSkillsCard.test.jsx index 5b73dd8a8c..62e73c6a19 100644 --- a/web-ui/src/components/edit_skills/EditSkillsCard.test.jsx +++ b/web-ui/src/components/edit_skills/EditSkillsCard.test.jsx @@ -70,13 +70,13 @@ afterAll(() => server.close()); describe("EditSkillsCard", () => { it("renders correctly with skill", async () => { - act(() => snapshot( - + await waitForSnapshot("skill-submitted-by", + ( - - )); + ) + ); }); it("renders correctly", () => { diff --git a/web-ui/src/components/edit_skills/__snapshots__/EditSkillsCard.test.jsx.snap b/web-ui/src/components/edit_skills/__snapshots__/EditSkillsCard.test.jsx.snap index 50b21ffa56..07b0630f60 100644 --- a/web-ui/src/components/edit_skills/__snapshots__/EditSkillsCard.test.jsx.snap +++ b/web-ui/src/components/edit_skills/__snapshots__/EditSkillsCard.test.jsx.snap @@ -96,4 +96,81 @@ exports[`EditSkillsCard > renders correctly 1`] = `
`; -exports[`EditSkillsCard > renders correctly with skill 1`] = `
`; +exports[`EditSkillsCard > renders correctly with skill 1`] = ` +
+
+
+
+ + Le test skill + + + le description + +
+
+
+
+
+ Submitted by: +
+
+ +
+ + Current User + +
+
+
+
+
+ + +
+
+
+`; diff --git a/web-ui/src/setupTests.js b/web-ui/src/setupTests.js index 6c453f0a52..041e4fa2a1 100644 --- a/web-ui/src/setupTests.js +++ b/web-ui/src/setupTests.js @@ -3,6 +3,7 @@ import React from "react"; import createFetchMock from 'vitest-fetch-mock';; import requestAnimationFrame from "raf/polyfill"; import { render } from "@testing-library/react"; +import {screen} from '@testing-library/dom'; import '@testing-library/jest-dom'; const mockModule = await vi.importActual("react-dom"); @@ -30,6 +31,11 @@ global.snapshot = (component, options) => expect(render(component, options).container).toMatchSnapshot(); global.rootSnapshot = (component, options) => expect(render(component, options).baseElement).toMatchSnapshot(); +global.waitForSnapshot = async (testId, component, options) => { + const rendered = render(component, options); + await screen.findByTestId(testId); + expect(rendered.container).toMatchSnapshot(); +} global.window = global.window || {}; global.window.requestAnimationFrame = global.requestAnimationFrame = requestAnimationFrame;