-
-
Notifications
You must be signed in to change notification settings - Fork 222
West Midlands | 25 Sep ITP | Iswat Bello | Sprint 3 | Build quote generator app #868
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
Conversation
…the heading to "Quote Generator"
…th the test cases
…e random quote rendering
…/Module-Data-Groups into >feature/quote_generator
…async click test failures
Downgraded @testing-library/user-event from v14 to v13.5.0 because version 14 introduces asynchronous userEvent handlers, causing the existing synchronous Jest tests to fail. Version 13 matches the behaviour the tests were originally written for, allowing all tests to pass again.
|
|
||
| // call pickFromArray with the quotes array to check you get a random quote | ||
| // Function to display a random quote on the page | ||
| function displayRandomQuote() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job keeping displayRandomQuote() focused on a single responsibility — fetching a quote and updating the DOM. This helps keep the logic readable and easy to maintain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much, @jaymes15.
| } | ||
|
|
||
| // Add a click event listener to the "New quote" button | ||
| document.getElementById("new-quote").addEventListener("click", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good! but we can make it cleaner by using a named function.
for example:
document.getElementById("new-quote").addEventListener("click", displayRandomQuote);
jaymes15
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work — your solution is clean and readable
Thank you so much for the feedback. |
Learners, PR Template
Self checklist
Changelist
In this pull request, I completed the quote generator project by implementing the random quote functionality. The app now displays a random quote and its author when the page loads.
Questions
Hi. Please could you review my PR? I’d really appreciate your feedback.