From 32fbef544c592e007dc578e3302c1e7af50afba6 Mon Sep 17 00:00:00 2001 From: Krzysztof G <60067306+gikf@users.noreply.github.com> Date: Wed, 19 Jun 2024 08:06:53 +0200 Subject: [PATCH] fix(curriculum): add missing dispatchEvent (#55216) --- .../build-a-palindrome-checker.md | 3 +++ .../build-a-pokemon-search-app.md | 2 ++ .../build-a-roman-numeral-converter.md | 2 ++ 3 files changed, 7 insertions(+) diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/build-a-palindrome-checker-project/build-a-palindrome-checker.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/build-a-palindrome-checker-project/build-a-palindrome-checker.md index 34eb09b4444..b996b6485c8 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/build-a-palindrome-checker-project/build-a-palindrome-checker.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/build-a-palindrome-checker-project/build-a-palindrome-checker.md @@ -68,6 +68,7 @@ let alertMessage; window.alert = (message) => alertMessage = message; // Override alert and store message inputEl.value = ''; +inputEl.dispatchEvent(new Event('change')) checkBtn.click(); assert.strictEqual(alertMessage.trim().replace(/[.,?!]+$/g, '').toLowerCase(), 'please input a value'); ``` @@ -259,6 +260,7 @@ const fourthLetter = characters.charAt(Math.floor(Math.random() * charactersLeng const phrase = firstLetter + secondLetter + thirdLetter + fourthLetter + fourthLetter + thirdLetter + secondLetter + firstLetter; inputEl.value = phrase; +inputEl.dispatchEvent(new Event('change')) checkBtn.click(); assert.strictEqual(resultEl.innerText.trim().replace(/[.,?!]+$/g, '').toLowerCase(), phrase + ' is a palindrome'); @@ -298,6 +300,7 @@ charactersLength--; const phrase = firstLetter + secondLetter + thirdLetter + fourthLetter; inputEl.value = phrase; +inputEl.dispatchEvent(new Event('change')) checkBtn.click(); assert.strictEqual(resultEl.innerText.trim().replace(/[.,?!]+$/g, '').toLowerCase(), phrase + ' is not a palindrome'); diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/build-a-pokemon-search-app-project/build-a-pokemon-search-app.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/build-a-pokemon-search-app-project/build-a-pokemon-search-app.md index 44e9bbc07b3..a47935c4886 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/build-a-pokemon-search-app-project/build-a-pokemon-search-app.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/build-a-pokemon-search-app-project/build-a-pokemon-search-app.md @@ -378,6 +378,7 @@ async () => { const randomInvalidPokeId = badName; searchInput.value = randomInvalidPokeId; + searchInput.dispatchEvent(new Event('change')); searchButton.click(); const res = await fetch('https://pokeapi-proxy.freecodecamp.rocks/api/pokemon/' + randomInvalidPokeId.toString()); // Fetch from proxy to simulate network delay @@ -406,6 +407,7 @@ async () => { const randomValidPokeId = Math.floor(Math.random() * 1025) + 1; searchInput.value = randomValidPokeId; + searchInput.dispatchEvent(new Event('change')); searchButton.click(); const res = await fetch('https://pokeapi-proxy.freecodecamp.rocks/api/pokemon/' + randomValidPokeId.toString()); // Fetch from proxy to simulate network delay diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/build-a-roman-numeral-converter-project/build-a-roman-numeral-converter.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/build-a-roman-numeral-converter-project/build-a-roman-numeral-converter.md index ed36a831782..6029877395e 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/build-a-roman-numeral-converter-project/build-a-roman-numeral-converter.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/build-a-roman-numeral-converter-project/build-a-roman-numeral-converter.md @@ -180,6 +180,7 @@ const outputEl = document.getElementById('output'); const randomNegativeNumber = Math.floor(Math.random() * -4000) - 2; numberInputEl.value = randomNegativeNumber; +numberInputEl.dispatchEvent(new Event('change')); convertBtnEl.click(); assert.strictEqual(outputEl.innerText.trim().replace(/[.,?!]+$/g, '').toLowerCase(), 'please enter a number greater than or equal to 1'); ``` @@ -194,6 +195,7 @@ const outputEl = document.getElementById('output'); const randomBigNumber = Math.floor(Math.random() * (1000000)) + 4000; numberInputEl.value = randomBigNumber; +numberInputEl.dispatchEvent(new Event('change')); convertBtnEl.click(); assert.strictEqual(outputEl.innerText.trim().replace(/[.,?!]+$/g, '').toLowerCase(), 'please enter a number less than or equal to 3999'); ```