Skip to content

Commit

Permalink
Utilise le nomTechnique pour le bouton lecture même dans objets trouvés
Browse files Browse the repository at this point in the history
Co-authored-by: Marie Leuliette <marie.leuliette@captive.fr>
  • Loading branch information
etienneCharignon and marouria committed Oct 18, 2021
1 parent 62b5f67 commit 0f6bec1
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/situations/commun/vues/bouton_lecture.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import JoueurAudioBuffer from 'commun/composants/joueur_audio_buffer';
export default {
props: {
idQuestion: {
nomTechnique: {
type: String,
required: true
}
Expand All @@ -58,15 +58,15 @@ export default {
this.joueSon = !this.joueSon;
},
audioBuffer (idQuestion) {
return this.$depotRessources.messageAudio(idQuestion);
audioBuffer (nomTechnique) {
return this.$depotRessources.messageAudio(nomTechnique);
}
},
watch: {
joueSon (joue) {
if (joue) {
this.joueurSon.start(this.audioBuffer(this.idQuestion), () => { this.joueSon = false; });
this.joueurSon.start(this.audioBuffer(this.nomTechnique), () => { this.joueSon = false; });
} else {
this.joueurSon.stop();
}
Expand Down
2 changes: 1 addition & 1 deletion src/situations/commun/vues/qcm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</div>
<bouton-lecture
class="bouton-lecture"
:idQuestion="question.nom_technique"
:nomTechnique="question.nom_technique"
/>
</div>
<div class="entete-questions">
Expand Down
2 changes: 2 additions & 0 deletions src/situations/objets_trouves/data/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ const questionMessage3 = {

const questionRepondeur1 = {
id: 'heure-bureau-mickael',
nomTechnique: 'heure-bureau-mickael',
icone: iconeRepondeur,
illustration: AppRepondeur1,
intitule: 'A quelle heure Sophie doit-elle se rendre dans le bureau de Mickael ?',
Expand Down Expand Up @@ -427,6 +428,7 @@ const questionRepondeur1 = {

const questionRepondeur2 = {
id: 'nombre-tours-de-manege',
nomTechnique: 'nombre-tours-de-manege',
icone: iconeRepondeur,
illustration: AppRepondeur2,
description: 'Vous savez que Sophie lance un tour de manège pour 7 enfants.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export default class DepotRessourcesObjetsTrouves extends DepotRessourcesCommune
return this.ressource(iconeDeverrouillageDebloque);
}

messageAudio (questionId) {
return this.ressource(MESSAGES[questionId]);
messageAudio (nomTechniqueQuestion) {
return this.ressource(MESSAGES[nomTechniqueQuestion]);
}

existeMessageAudio (nomTechniqueQuestion) {
Expand Down
4 changes: 2 additions & 2 deletions src/situations/objets_trouves/vues/lecture-message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="telephone-conteneur">
<bouton-lecture
class="bouton-lecture"
:idQuestion="question.id"
:nomTechnique="question.nomTechnique"
:class="classPositionBoutonLecture"
/>
</div>
Expand All @@ -24,7 +24,7 @@ export default {
computed: {
classPositionBoutonLecture () {
return `bouton-lecture--${this.question.id}`;
return `bouton-lecture--${this.question.nomTechnique}`;
}
}
};
Expand Down
10 changes: 5 additions & 5 deletions tests/situations/commun/vues/bouton-lecture.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ import BoutonLecture from 'commun/vues/bouton_lecture';

describe('Le bouton de lecture de message audio', function () {
it("affiche le bouton play quand aucun son n'est joué", function () {
const wrapper = shallowMount(BoutonLecture, { propsData: { idQuestion: '1' } });
const wrapper = shallowMount(BoutonLecture, { propsData: { nomTechnique: 'question1' } });
expect(wrapper.find('.bouton-lecture').exists()).toBe(true);
});

it('joue le son et affiche le bouton pause', function (done) {
const localVue = createLocalVue();
localVue.prototype.$depotRessources = {
messageAudio: (idQuestion) => {
expect(idQuestion).toEqual('question1');
messageAudio: (nomTechnique) => {
expect(nomTechnique).toEqual('question1');
}
};

const wrapper = shallowMount(BoutonLecture, {
localVue: localVue,
propsData: { idQuestion: 'question1', joueSon: true }
propsData: { nomTechnique: 'question1', joueSon: true }
});
let sonJoue = false;
wrapper.vm.joueurSon = {
Expand All @@ -34,7 +34,7 @@ describe('Le bouton de lecture de message audio', function () {
});

it("stop le son quand le bouton n'est plus affiché", function () {
const wrapper = shallowMount(BoutonLecture, { propsData: { idQuestion: '1' } });
const wrapper = shallowMount(BoutonLecture, { propsData: { nomTechnique: 'question1' } });
let sonStope = false;
wrapper.vm.joueurSon = {
stop: () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/situations/objets_trouves/vues/lecture-message.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('La lecture de message pour objets trouvés', function () {
let wrapper;

beforeEach(function () {
question = { id: 'message-bureau-mickael' };
question = { nomTechnique: 'message-bureau-mickael' };

wrapper = shallowMount(VueLectureMessage, {
propsData: { question }
Expand All @@ -20,7 +20,7 @@ describe('La lecture de message pour objets trouvés', function () {
});

it('joue le message audio de la question', function () {
expect(wrapper.findComponent(BoutonLecture).props().idQuestion).toBe(question.id);
expect(wrapper.findComponent(BoutonLecture).props().nomTechnique).toBe(question.nomTechnique);
});

it('affiche le bouton à la bonne position en fonction de la question', function () {
Expand Down

0 comments on commit 0f6bec1

Please sign in to comment.