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

New JavaScript Projects tests can fail if code depends on change event of input field #53390

Closed
gikf opened this issue Jan 27, 2024 · 9 comments · Fixed by #54628
Closed

New JavaScript Projects tests can fail if code depends on change event of input field #53390

gikf opened this issue Jan 27, 2024 · 9 comments · Fixed by #54628
Labels
help wanted Open for all. You do not need permission to work on these. 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.

Comments

@gikf
Copy link
Member

gikf commented Jan 27, 2024

Describe the bug
A bit of mouthful. Most of the tests in new projects are directly setting the value of input field. This can create unexpected troubles if camper's code depend on the onchange of the said input field.

For example camper added onchange to the input field (inputField). Function was updating global value, which was later used by the function when the action button was clicked. Because inputField.value = 'something' is not triggering onchange on the inputField, the value was empty, and results failed.

While all worked well when checked by hand.

There's couple options:

  • Add to tests action, performed after value is changed, that will trigger possible onchange on the input field. For example inputField.dispatchEvent(new Keyboard('keyup', {key: 'ArrowRight'})) should work.
  • Add specific note to projects to not depend on events of input field.
  • Keep it as it is.

Additional context
https://forum.freecodecamp.org/t/problem-with-palindrome-checker/667410

@gikf gikf added scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. new javascript course These are for issues dealing with the new JS curriculum labels Jan 27, 2024
@jdwilkin4
Copy link
Contributor

Add to tests action, performed after value is changed, that will trigger possible onchange on the input field. For example inputField.dispatchEvent(new Keyboard('keyup', {key: 'ArrowRight'})) should work.

I am kinda of leaning towards this option.

Let's see what the others think

@jdwilkin4 jdwilkin4 added the status: discussing Under discussion threads. Closed as stale after 60 days of inactivity. label Feb 1, 2024
@naomi-lgbt
Copy link
Member

Yes, I agree - let's go that route.

@naomi-lgbt naomi-lgbt added help wanted Open for all. You do not need permission to work on these. and removed status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. labels Apr 22, 2024
@Deep512
Copy link
Contributor

Deep512 commented Apr 30, 2024

Hi @gikf, When you say

Add to tests action, performed after value is changed, that will trigger possible onchange on the input field. For example inputField.dispatchEvent(new Keyboard('keyup', {key: 'ArrowRight'})) should work.

Do you mean to add to all the coding challenges similar to the palindrome checker? Or just the palindrome checker?

@gikf gikf removed the status: discussing Under discussion threads. Closed as stale after 60 days of inactivity. label May 2, 2024
@Deep512
Copy link
Contributor

Deep512 commented May 2, 2024

One last question @gikf
When we make changes here, do we make them in the English language section only
Or across all languages?
I was planning to make them across all

@gikf
Copy link
Member Author

gikf commented May 2, 2024

@Deep512, English only, other languages will be later updated using translation workflow.

@Deep512
Copy link
Contributor

Deep512 commented May 2, 2024

@gikf @jdwilkin4 @naomi-lgbt Have raised a PR for this issue, please review

@camperbot
Copy link
Contributor

We realize you're looking to get help as soon as possible. Rather than pinging someone directly, which can be considered rude, would you mind joining our Discord and asking your question there? Someone might be more readily available to help.

@Nthaz
Copy link

Nthaz commented May 6, 2024

I'm new to this and would be waiting to see what others say and learn along the way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Open for all. You do not need permission to work on these. 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.
Projects
None yet
6 participants