Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(curriculum): add dispatchevent to trigger onchange after value change in tests #54628

Merged

Conversation

@github-actions github-actions bot added the scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. label May 2, 2024
@Deep512 Deep512 changed the title Dispatch event to trigger onchange after value change in tests fix(curriculum): dispatch event to trigger onchange after value change in tests May 2, 2024
@Deep512 Deep512 changed the title fix(curriculum): dispatch event to trigger onchange after value change in tests fix(curriculum): add dispatchevent to trigger onchange after value change in tests May 2, 2024
@Deep512 Deep512 marked this pull request as ready for review May 2, 2024 19:06
@jdwilkin4 jdwilkin4 added status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. new javascript course These are for issues dealing with the new JS curriculum labels May 6, 2024
@Ksound22
Copy link
Member

I have gone through the issue this PR is trying to fix, but I'm still lost. Can you provide more explanations? Where's dispatchEvent() from?

@Deep512
Copy link
Contributor Author

Deep512 commented May 14, 2024

Sure, @Ksound22. As discussed in the aforementioned issue whenever the user reads the input value from the change event on the input element, it works well in the development environment for the camper although while running the tests on the input code the change event isn't triggered on the input element.
Hence in this PR, we are dispatching a custom event on the input element which will allow the camper's code to pass the challenge tests and not throw an error.
Hope I have answered your question

@Ksound22
Copy link
Member

Sure, @Ksound22. As discussed in the aforementioned issue whenever the user reads the input value from the change event on the input element, it works well in the development environment for the camper although while running the tests on the input code the change event isn't triggered on the input element. Hence in this PR, we are dispatching a custom event on the input element which will allow the camper's code to pass the challenge tests and not throw an error. Hope I have answered your question

I know about that through the issue. What I'm asking is where's dispatchEvent() from?

@Deep512
Copy link
Contributor Author

Deep512 commented May 15, 2024

I know about that through the issue. What I'm asking is where's dispatchEvent() from?

You can look that up here:
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent

@JoyShaheb JoyShaheb merged commit 3b54986 into freeCodeCamp:main May 16, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new javascript course These are for issues dealing with the new JS curriculum scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New JavaScript Projects tests can fail if code depends on change event of input field
4 participants