Skip to content

Commit 1260c03

Browse files
[FEATURE] Afficher la consigne au-dessus des Flashcards (PIX-15035)
#10417
2 parents 66f83a2 + 95bad70 commit 1260c03

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

api/src/devcomp/infrastructure/datasources/learning-content/modules/didacticiel-modulix.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
"element": {
4848
"id": "47823e8f-a4af-44d6-96f7-5b6fc7bc6b51",
4949
"type": "flashcards",
50+
"instruction": "<p>Lisez la question, essayez de trouver la réponse puis retourner la carte en cliquant dessus.<br>Cela permet de tester votre mémoire 🎯</p>",
5051
"title": "Introduction à la poésie",
51-
"instruction": "<p>...</p>",
5252
"introImage": {
5353
"url": "https://images.pix.fr/modulix/didacticiel/intro-flashcards.png"
5454
},

api/tests/devcomp/unit/infrastructure/datasources/learning-content/validation/element/flashcards-schema.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ const versoSide = Joi.object({
1919
const flashcardsElementSchema = Joi.object({
2020
id: uuidSchema,
2121
type: Joi.string().valid('flashcards').required(),
22-
title: htmlNotAllowedSchema.required(),
2322
instruction: htmlSchema.optional(),
23+
title: htmlNotAllowedSchema.required(),
2424
introImage: image,
2525
cards: Joi.array().items({
2626
id: uuidSchema,

mon-pix/app/components/module/element/flashcards/flashcards.gjs

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { eq } from 'ember-truth-helpers';
99
import ModulixFlashcardsCard from 'mon-pix/components/module/element/flashcards/flashcards-card';
1010
import ModulixFlashcardsIntroCard from 'mon-pix/components/module/element/flashcards/flashcards-intro-card';
1111
import ModulixFlashcardsOutroCard from 'mon-pix/components/module/element/flashcards/flashcards-outro-card';
12+
import htmlUnsafe from 'mon-pix/helpers/html-unsafe';
1213

1314
const INITIAL_COUNTERS_VALUE = { yes: 0, almost: 0, no: 0 };
1415

@@ -113,6 +114,9 @@ export default class ModulixFlashcards extends Component {
113114
}
114115

115116
<template>
117+
<div class="element-flashcards__instruction">
118+
{{htmlUnsafe @flashcards.instruction}}
119+
</div>
116120
<div class="element-flashcards">
117121
{{#if this.modulixPreviewMode.isEnabled}}
118122
<ModulixFlashcardsIntroCard

mon-pix/app/styles/components/module/_flashcards.scss

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
background-repeat: no-repeat;
88
background-position: top center;
99

10+
&__instruction {
11+
padding-bottom: var(--pix-spacing-6x);
12+
font-weight: var(--pix-font-medium);
13+
}
14+
1015
&__recto-verso {
1116
display: flex;
1217

mon-pix/tests/integration/components/module/flashcards_test.gjs

+14-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ import setupIntlRenderingTest from '../../../helpers/setup-intl-rendering';
1111
module('Integration | Component | Module | Flashcards', function (hooks) {
1212
setupIntlRenderingTest(hooks);
1313

14+
test('should display provided instructions about Flashcards', async function (assert) {
15+
// given
16+
const { flashcards } = _getFlashcards();
17+
18+
// when
19+
const screen = await render(<template><ModulixFlashcards @flashcards={{flashcards}} /></template>);
20+
21+
// then
22+
assert.ok(
23+
screen.getByText('Lisez la question, essayez de trouver la réponse puis retourner la carte en cliquant dessus'),
24+
);
25+
});
26+
1427
test('should display the intro card by default', async function (assert) {
1528
// given
1629
const { flashcards } = _getFlashcards();
@@ -341,7 +354,7 @@ function _getFlashcards() {
341354
id: '71de6394-ff88-4de3-8834-a40057a50ff4',
342355
type: 'flashcards',
343356
title: "Introduction à l'adresse e-mail",
344-
instruction: '<p>...</p>',
357+
instruction: 'Lisez la question, essayez de trouver la réponse puis retourner la carte en cliquant dessus',
345358
introImage: { url: 'https://images.pix.fr/modulix/flashcards-intro.png' },
346359
cards: [firstCard, secondCard],
347360
};

0 commit comments

Comments
 (0)