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): update test todo app step 6 #54650

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ assert.match(code, /openTaskFormBtn\.addEventListener\(\s*('|"|`)click\1/)
Your event listener's callback function should use the `classList.toggle()` method to toggle the `hidden` class on the `taskForm` element. Refer back to the example provided in the description.

```js
assert.match(code, /openTaskFormBtn\.addEventListener\(\s*('|"|`)click\1\s*,\s*(?:\(\s*\)\s*=>\s*taskForm\s*\.classList\s*\.\s*toggle\s*\(\s*('|"|`)hidden\2\s*\)\s*\)|\s*function\s*\(\s*\)\s*\s*{\s*taskForm\s*\.classList\s*\.\s*toggle\s*\(\s*('|"|`)hidden\3\s*\)\s*}\s*\)\s*;)/)
assert.match(code, /openTaskFormBtn\.addEventListener\(\s*('|"|`)click\1\s*,\s*(?:\(\s*\)\s*=>\s*taskForm\s*\.classList\s*\.\s*toggle\s*\(\s*('|"|`)hidden\2\s*\)\s*\)|\s*function\s*\(\s*\)\s*\s*{\s*taskForm\s*\.classList\s*\.\s*toggle\s*\(\s*('|"|`)hidden\3\s*\)\s*}\s*\)\s*;|\s*\(\s*\)\s*=\s*>\s*\{\s*taskForm\s*\.classList\s*\.\s*toggle\s*\(\s*('|"|`)hidden\4\s*\)\s*\}\s*\)\s*;)/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's actually remove the regex altogether and simulate the click event instead.
something like this should work.
I suggest testing it on your end too but this should be easier to manage

Suggested change
assert.match(code, /openTaskFormBtn\.addEventListener\(\s*('|"|`)click\1\s*,\s*(?:\(\s*\)\s*=>\s*taskForm\s*\.classList\s*\.\s*toggle\s*\(\s*('|"|`)hidden\2\s*\)\s*\)|\s*function\s*\(\s*\)\s*\s*{\s*taskForm\s*\.classList\s*\.\s*toggle\s*\(\s*('|"|`)hidden\3\s*\)\s*}\s*\)\s*;|\s*\(\s*\)\s*=\s*>\s*\{\s*taskForm\s*\.classList\s*\.\s*toggle\s*\(\s*('|"|`)hidden\4\s*\)\s*\}\s*\)\s*;)/)
assert(taskForm.classList.contains('hidden'));
openTaskFormBtn.click();
assert(!taskForm.classList.contains('hidden'));

```

# --seed--
Expand Down