-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Afficher la carte de conclusion des flashcards et gérer le …
- Loading branch information
Showing
13 changed files
with
430 additions
and
18 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
mon-pix/app/components/module/element/flashcards/flashcards-outro-card.gjs
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,36 @@ | ||
import PixButton from '@1024pix/pix-ui/components/pix-button'; | ||
import PixMessage from '@1024pix/pix-ui/components/pix-message'; | ||
import { t } from 'ember-intl'; | ||
|
||
<template> | ||
<div class="element-flashcards-outro-card"> | ||
|
||
<div class="element-flashcards-outro-card__header"> | ||
<PixMessage class="element-flashcards-outro-card__alert" @type="success" @withIcon="true"> | ||
{{t "pages.modulix.flashcards.completed"}} | ||
</PixMessage> | ||
<p class="element-flashcards-outro-card__title">{{@title}}</p> | ||
</div> | ||
|
||
<div> | ||
<p class="element-flashcards-outro-card__question">{{t "pages.modulix.flashcards.answerDirection"}}</p> | ||
<ul class="element-flashcards-outro-card__counter"> | ||
<li class="element-flashcards-outro-card__counter__yes"> | ||
{{t "pages.modulix.flashcards.counters.yes" totalYes=@counters.yes}} | ||
</li> | ||
<li class="element-flashcards-outro-card__counter__almost"> | ||
{{t "pages.modulix.flashcards.counters.almost" totalAlmost=@counters.almost}} | ||
</li> | ||
<li class="element-flashcards-outro-card__counter__no"> | ||
{{t "pages.modulix.flashcards.counters.no" totalNo=@counters.no}} | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
<div class="element-flashcards-outro-card__footer"> | ||
<PixButton @triggerAction={{@onRetry}} @iconBefore="refresh" @variant="tertiary" @size="small"> | ||
{{t "pages.modulix.buttons.flashcards.retry"}} | ||
</PixButton> | ||
</div> | ||
</div> | ||
</template> |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion
1
mon-pix/tests/integration/components/module/flashcards-card_test.gjs
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
1 change: 0 additions & 1 deletion
1
mon-pix/tests/integration/components/module/flashcards-intro-card_test.gjs
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
46 changes: 46 additions & 0 deletions
46
mon-pix/tests/integration/components/module/flashcards-outro-card_test.gjs
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,46 @@ | ||
import { clickByName, render } from '@1024pix/ember-testing-library'; | ||
import { t } from 'ember-intl/test-support'; | ||
import ModulixFlashcardsOutroCard from 'mon-pix/components/module/element/flashcards/flashcards-outro-card'; | ||
import { module, test } from 'qunit'; | ||
import sinon from 'sinon'; | ||
|
||
import setupIntlRenderingTest from '../../../helpers/setup-intl-rendering'; | ||
|
||
module('Integration | Component | Module | Flashcards Outro Card', function (hooks) { | ||
setupIntlRenderingTest(hooks); | ||
|
||
test('should display an outro card', async function (assert) { | ||
// given | ||
const counters = { yes: 1, almost: 2, no: 1 }; | ||
const title = 'Introduction à la poésie'; | ||
|
||
// when | ||
|
||
const screen = await render( | ||
<template><ModulixFlashcardsOutroCard @counters={{counters}} @title={{title}} /></template>, | ||
); | ||
|
||
// then | ||
assert.ok(screen.getByText('Introduction à la poésie')); | ||
assert.ok(screen.getByText(`Oui ! : ${counters.yes}`)); | ||
assert.ok(screen.getByText(`Presque : ${counters.almost}`)); | ||
assert.ok(screen.getByText(`Pas du tout : ${counters.no}`)); | ||
assert.dom(screen.getByRole('button', { name: t('pages.modulix.buttons.flashcards.retry') })).exists(); | ||
}); | ||
|
||
module('when we click on "Réessayer"', function () { | ||
test('should call the onRetry method', async function (assert) { | ||
// given | ||
const title = 'Introduction à la poésie'; | ||
const onRetryStub = sinon.stub(); | ||
|
||
await render(<template><ModulixFlashcardsOutroCard @title={{title}} @onRetry={{onRetryStub}} /></template>); | ||
|
||
// when | ||
await clickByName(t('pages.modulix.buttons.flashcards.retry')); | ||
|
||
// then | ||
assert.true(onRetryStub.calledOnce); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.