mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): add missing dispatchEvent (#55216)
This commit is contained in:
+3
@@ -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');
|
||||
|
||||
+2
@@ -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
|
||||
|
||||
+2
@@ -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');
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user