From ae2ddd3bfcaa3d8db9ba344276e4a734bada1b5b Mon Sep 17 00:00:00 2001 From: Liliana Date: Wed, 10 Apr 2024 18:18:19 +0200 Subject: [PATCH] change menu test and progress bar at 0% with correct answer --- webapp/src/components/FirstGame.js | 7 +------ webapp/src/components/Menu.test.js | 5 ++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/webapp/src/components/FirstGame.js b/webapp/src/components/FirstGame.js index 8c84f77b..aa7f9571 100644 --- a/webapp/src/components/FirstGame.js +++ b/webapp/src/components/FirstGame.js @@ -35,13 +35,8 @@ const Quiz = () => { setRemTime((progress) => { if(progress == 100){ newQuestion(); - //getQuestions() - //repetir checkAndswer return 0; } - // const diff = Math.random() * 10; - // return Math.min(progress + diff, 100); - const diff = crypto.getRandomValues(new Uint32Array(1))[0] % 11; // Generate a random number between 0 and 10 return Math.min(progress + diff, 100); }); @@ -209,6 +204,7 @@ const Quiz = () => { currentQuestionIndex = (currentQuestionIndex + 1); } isCorrect = (false) + setRemTime(0) changeButtons("false") @@ -219,7 +215,6 @@ const Quiz = () => { haveFailedQuestion = false; navigator('/menu') } - }; return ( diff --git a/webapp/src/components/Menu.test.js b/webapp/src/components/Menu.test.js index a14145fb..23dfbab2 100644 --- a/webapp/src/components/Menu.test.js +++ b/webapp/src/components/Menu.test.js @@ -3,7 +3,7 @@ import { ContextFun } from './Context'; import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; import { BrowserRouter as Router } from 'react-router-dom'; -import { Menu } from './Menu'; +import Menu from './Menu'; const mockAxios = new MockAdapter(axios); @@ -14,9 +14,8 @@ describe("Menu component", () => { }); test("renders menu",async () => { - render( - + ); const linkElement = screen.getByText(/Cómo jugar/i);