-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Victor Zeinstra
committed
Jul 25, 2023
1 parent
0fbd052
commit 07a15b7
Showing
10 changed files
with
197 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/code-du-travail-frontend/src/Feedback/__tests__/feedback.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { fireEvent, render, screen } from "@testing-library/react"; | ||
import { Feedback } from ".."; | ||
import { ui } from "./ui"; | ||
|
||
describe("Etant donné un composant Feedback", () => { | ||
beforeEach(() => { | ||
render(<Feedback />); | ||
}); | ||
test("Vérification que l'introduction s'affiche", () => { | ||
expect(ui.introduction.title.query()).toBeInTheDocument(); | ||
expect(ui.introduction.button.query()).toBeInTheDocument(); | ||
}); | ||
describe("Etant donné un click sur le bouton 'Fermer'", () => { | ||
beforeEach(() => { | ||
fireEvent.click(ui.closeButton.get()); | ||
}); | ||
test("Vérification que le composant ne s'affiche plus", () => { | ||
expect(ui.introduction.title.query()).not.toBeInTheDocument(); | ||
expect(ui.introduction.button.query()).not.toBeInTheDocument(); | ||
}); | ||
}); | ||
describe("Etant donné un click sur le bouton 'Donner mon avis'", () => { | ||
beforeEach(() => { | ||
fireEvent.click(ui.introduction.button.get()); | ||
}); | ||
test("Vérification que le composant ne s'affiche plus", () => { | ||
expect(ui.questionnaire.title.query()).toBeInTheDocument(); | ||
expect(ui.questionnaire.notGood.query()).toBeInTheDocument(); | ||
expect(ui.questionnaire.average.query()).toBeInTheDocument(); | ||
expect(ui.questionnaire.good.query()).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
15 changes: 15 additions & 0 deletions
15
packages/code-du-travail-frontend/src/Feedback/__tests__/ui.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { byTestId, byText } from "testing-library-selector"; | ||
|
||
export const ui = { | ||
closeButton: byTestId("feedbackCloseButton"), | ||
introduction: { | ||
title: byText("Votre avis sur ce simulateur nous intéresse"), | ||
button: byText("Donner mon avis"), | ||
}, | ||
questionnaire: { | ||
title: byText(/Comment s'est passée cette simulation pour vous/), | ||
notGood: byText("Pas bien"), | ||
average: byText("Moyen"), | ||
good: byText("Très bien"), | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.