@@ -283,6 +283,64 @@ module('Integration | Component | Module | Flashcards', function (hooks) {
283
283
});
284
284
});
285
285
286
+ module (' when users reaches the end of the deck' , function () {
287
+ test (' should display the counters for each answer' , async function (assert ) {
288
+ // given
289
+ const firstCard = {
290
+ id: ' e1de6394-ff88-4de3-8834-a40057a50ff4' ,
291
+ recto: {
292
+ image: {
293
+ url: ' https://images.pix.fr/modulix/bien-ecrire-son-adresse-mail-explication-les-parties-dune-adresse-mail.svg' ,
294
+ },
295
+ text: " A quoi sert l'arobase dans mon adresse email ?" ,
296
+ },
297
+ verso: {
298
+ image: { url: ' https://images.pix.fr/modulix/didacticiel/ordi-spatial.svg' },
299
+ text: " Parce que c'est joli" ,
300
+ },
301
+ };
302
+ const secondCard = {
303
+ id: ' e1de6394-ff88-4de3-8834-a40057a50ff4' ,
304
+ recto: {
305
+ image: {
306
+ url: ' https://images.pix.fr/modulix/didacticiel/icon.svg' ,
307
+ },
308
+ text: ' Qui a écrit le Dormeur du Val ?' ,
309
+ },
310
+ verso: {
311
+ image: {
312
+ url: ' https://images.pix.fr/modulix/didacticiel/chaton.jpg' ,
313
+ },
314
+ text: ' <p>Arthur Rimbaud</p>' ,
315
+ },
316
+ };
317
+
318
+ const flashcards = {
319
+ id: ' 71de6394-ff88-4de3-8834-a40057a50ff4' ,
320
+ type: ' flashcards' ,
321
+ title: " Introduction à l'adresse e-mail" ,
322
+ instruction: ' <p>...</p>' ,
323
+ introImage: { url: ' https://images.pix.fr/modulix/placeholder-details.svg' },
324
+ cards: [firstCard, secondCard],
325
+ };
326
+
327
+ const onSelfAssessment = sinon .stub ();
328
+
329
+ // when
330
+ const screen = await render (<template ><ModulixFlashcards @ flashcards ={{flashcards }} @ onSelfAssessment ={{onSelfAssessment }} /></template >);
331
+ await clickByName (t (I18N_KEYS .introStartButton ));
332
+ await clickByName (t (' pages.modulix.buttons.flashcards.seeAnswer' ));
333
+ await clickByName (t (' pages.modulix.buttons.flashcards.answers.yes' ));
334
+ await clickByName (t (' pages.modulix.buttons.flashcards.seeAnswer' ));
335
+ await clickByName (t (' pages.modulix.buttons.flashcards.answers.notAtAll' ));
336
+
337
+ // then
338
+ assert .ok (screen .getByText (" Oui ! : 1" ));
339
+ assert .ok (screen .getByText (" Presque : 0" ));
340
+ assert .ok (screen .getByText (" Pas du tout : 1" ));
341
+ });
342
+ });
343
+
286
344
module (' when user clicks on the "Retry" button' , function () {
287
345
test (' should display intro card' , async function (assert ) {
288
346
// given
0 commit comments