Skip to content

Commit 17afbf5

Browse files
clemlatzdianeCdrPixer-lim
committed
feat(mon-pix): display only first 3 trainings
in sent results modal Co-authored-by: Diane Cordier <diane.cordier@pix.fr> Co-authored-by: Eric Lim <eric.lim@pix.fr>
1 parent 6a5c594 commit 17afbf5

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

mon-pix/app/components/routes/campaigns/assessment/evaluation-results.gjs

+5-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export default class EvaluationResults extends Component {
2929
return !isAutonomousCourse && !this.args.model.campaign.isForAbsoluteNovice;
3030
}
3131

32+
get trainingsForModal() {
33+
return this.args.model.trainings.slice(0, 2);
34+
}
35+
3236
@action
3337
showTrainings() {
3438
const tabElement = document.querySelector('[role="tablist"]');
@@ -83,7 +87,7 @@ export default class EvaluationResults extends Component {
8387
/>
8488
{{#if this.isModalSentResultEnabled}}
8589
<EvaluationSentResultsModal
86-
@trainings={{@model.trainings}}
90+
@trainings={{this.trainingsForModal}}
8791
@showModal={{this.showEvaluationResultsModal}}
8892
@onCloseButtonClick={{this.closeModal}}
8993
/>

mon-pix/tests/integration/components/routes/campaigns/assessment/evaluation-results-test.js

+20-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ module('Integration | Components | Routes | Campaigns | Assessment | Evaluation
8888

8989
module('when the campaign has not been shared yet and has trainings', function () {
9090
module('when clicking on the share results button', function () {
91-
test('it should display the evaluation-sent-results modal', async function (assert) {
91+
test('it should display the evaluation-sent-results modal with first 3 trainings', async function (assert) {
9292
// given
9393
class FeatureTogglesStub extends Service {
9494
featureToggles = { isModalSentResultEnabled: true };
@@ -125,6 +125,16 @@ module('Integration | Components | Routes | Campaigns | Assessment | Evaluation
125125
editorLogoUrl:
126126
'https://images.pix.fr/contenu-formatif/editeur/logo-ministere-education-nationale-et-jeunesse.svg',
127127
},
128+
{
129+
title: 'Mon super training 4 youhou',
130+
link: 'https://training.net/',
131+
type: 'webinaire',
132+
locale: 'fr-fr',
133+
duration: { hours: 6 },
134+
editorName: "Ministère de l'éducation nationale et de la jeunesse. Liberté égalité fraternité",
135+
editorLogoUrl:
136+
'https://images.pix.fr/contenu-formatif/editeur/logo-ministere-education-nationale-et-jeunesse.svg',
137+
},
128138
];
129139
this.model.campaignParticipationResult.isShared = false;
130140
this.model.campaignParticipationResult.competenceResults = [Symbol('competences')];
@@ -137,12 +147,19 @@ module('Integration | Components | Routes | Campaigns | Assessment | Evaluation
137147
// when
138148
screen = await render(hbs`<Routes::Campaigns::Assessment::EvaluationResults @model={{this.model}} />`);
139149
await click(screen.queryByRole('tab', { name: 'Formations' }));
140-
const dialog = await screen.getByRole('dialog');
141-
await click(within(dialog).queryByRole('button', { name: t('pages.skill-review.actions.send') }));
150+
const trainingsDialog = await screen.getByRole('dialog');
151+
await click(within(trainingsDialog).queryByRole('button', { name: t('pages.skill-review.actions.send') }));
142152
await waitForDialogClose();
153+
const sharedResultsModal = await screen.getByRole('dialog', { name: 'Résultats partagés' });
143154

144155
// then
145156
assert.dom(await screen.findByRole('button', { name: 'Fermer et revenir aux résultats' })).exists();
157+
assert
158+
.dom(within(sharedResultsModal).queryByRole('heading', { level: 3, name: 'Mon super training 1 youhou' }))
159+
.exists();
160+
assert
161+
.dom(within(sharedResultsModal).queryByRole('heading', { level: 3, name: 'Mon super training 4 youhou' }))
162+
.doesNotExist();
146163
});
147164

148165
module('when feature_toggle ‘isModalSentResultEnabled‘ is false', function () {

0 commit comments

Comments
 (0)