Skip to content

Conversation

@TzeMingHo
Copy link

@TzeMingHo TzeMingHo commented Oct 26, 2025

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Implemented a button to change the quote and author generated randomly from the array.
Added a toggle button for auto-displaying a new quote and author in a few seconds.
Some styling in css

@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@TzeMingHo TzeMingHo added 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 26, 2025
@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

1 similar comment
@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@sambabib sambabib added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 29, 2025
@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

2 similar comments
@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

updateQuoteAndAuthor();
document
.getElementById("new-quote")
.addEventListener("click", updateQuoteAndAuthor);
Copy link

Choose a reason for hiding this comment

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

You have implemented the first part of this task quite well. However, you have yet to attempt the "auto-generate" task. Why is that?

Copy link
Author

Choose a reason for hiding this comment

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

I was concerned that I couldn't figure out why the second test keeps failing. So, I made this pull request to seek for guidelines. However, if it is ok to move on, I would love to try implementing new features.

Copy link
Author

Choose a reason for hiding this comment

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

Hi sambabib,
I have added an auto-update feature for the quote generator.

@sambabib sambabib added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Nov 1, 2025
@github-actions
Copy link

github-actions bot commented Nov 1, 2025

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

1 similar comment
@github-actions
Copy link

github-actions bot commented Nov 1, 2025

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@TzeMingHo TzeMingHo added 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Nov 3, 2025
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

3 similar comments
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

@mjpeet
Copy link

mjpeet commented Nov 5, 2025

@TzeMingHo for some reason the github action thinks some of the template fields have not been filled properly

the only thing i can see is the title maybe?

if you look at this PR #788

--> the title says Quote Generator (at the end (without dash), can you try and rename your PR? (if you get any more github action issues, try to see what the difference is against the above mentioned PR)

@TzeMingHo TzeMingHo changed the title NW | 25-ITP-Sep | TzeMing Ho | Sprint 3 | quote-generator NW | 25-ITP-Sep | TzeMing Ho | Sprint 3 | Quote Generator Nov 5, 2025
@TzeMingHo TzeMingHo requested a review from sambabib November 5, 2025 15:35
@cifarquhar
Copy link

@sambabib @mjpeet When you next look at this could you see if the tests pass? I had a look at this with @TzeMingHo in a paired session this morning and the can change quote to another random quote test gives an assertion error - it looks like the text isn't updating. I saw the app working though, it's updating the DOM correctly. Doesn't look like it's been flagged in any other PRs for this exercise. Have I missed a bug, or do you think the test is checking the value before the function has finished updating it?

@sambabib
Copy link

@sambabib @mjpeet When you next look at this could you see if the tests pass? I had a look at this with @TzeMingHo in a paired session this morning and the can change quote to another random quote test gives an assertion error - it looks like the text isn't updating. I saw the app working though, it's updating the DOM correctly. Doesn't look like it's been flagged in any other PRs for this exercise. Have I missed a bug, or do you think the test is checking the value before the function has finished updating it?

is there a way for me to see these written tests?

@TzeMingHo
Copy link
Author

@sambabib @mjpeet When you next look at this could you see if the tests pass? I had a look at this with @TzeMingHo in a paired session this morning and the can change quote to another random quote test gives an assertion error - it looks like the text isn't updating. I saw the app working though, it's updating the DOM correctly. Doesn't look like it's been flagged in any other PRs for this exercise. Have I missed a bug, or do you think the test is checking the value before the function has finished updating it?

is there a way for me to see these written tests?

The test file is in the same folder named Quote-Generator in this repository. I was not supposed to make any changes to the test file, so it is not in the file changed section.

@sambabib
Copy link

@sambabib @mjpeet When you next look at this could you see if the tests pass? I had a look at this with @TzeMingHo in a paired session this morning and the can change quote to another random quote test gives an assertion error - it looks like the text isn't updating. I saw the app working though, it's updating the DOM correctly. Doesn't look like it's been flagged in any other PRs for this exercise. Have I missed a bug, or do you think the test is checking the value before the function has finished updating it?

is there a way for me to see these written tests?

The test file is in the same folder named Quote-Generator in this repository. I was not supposed to make any changes to the test file, so it is not in the file changed section.

what seems to be the issue then?

@TzeMingHo
Copy link
Author

@sambabib @mjpeet When you next look at this could you see if the tests pass? I had a look at this with @TzeMingHo in a paired session this morning and the can change quote to another random quote test gives an assertion error - it looks like the text isn't updating. I saw the app working though, it's updating the DOM correctly. Doesn't look like it's been flagged in any other PRs for this exercise. Have I missed a bug, or do you think the test is checking the value before the function has finished updating it?

is there a way for me to see these written tests?

The test file is in the same folder named Quote-Generator in this repository. I was not supposed to make any changes to the test file, so it is not in the file changed section.

what seems to be the issue then?

When I tried to run the tests, the second one kept failing, even though I could actually randomly generate a new quote when I clicked the button. I was asking for a hint why this may happened.

Colin had a look of the code, it may be induced by a race condition and the app didn't have enough time to update the quote to pass the test.

@TzeMingHo
Copy link
Author

@sambabib @mjpeet @cifarquhar

Hello. The issue of not passing the second test has been resolved. After Jennet had very kindly looked for the different versions of userEvent used in the tests, she found that the tests were written in version 13 instead of 14, which some students had.

When I reinstall "@testing-library/user-event": "^13.5.0", both tests pass.

@sambabib
Copy link

@sambabib @mjpeet @cifarquhar

Hello. The issue of not passing the second test has been resolved. After Jennet had very kindly looked for the different versions of userEvent used in the tests, she found that the tests were written in version 13 instead of 14, which some students had.

When I reinstall "@testing-library/user-event": "^13.5.0", both tests pass.

will you be attempting the "stretch" portion of this assignment then?

@TzeMingHo
Copy link
Author

@sambabib @mjpeet @cifarquhar

Hello. The issue of not passing the second test has been resolved. After Jennet had very kindly looked for the different versions of userEvent used in the tests, she found that the tests were written in version 13 instead of 14, which some students had.

When I reinstall "@testing-library/user-event": "^13.5.0", both tests pass.

will you be attempting the "stretch" portion of this assignment then?

If you are talking about the auto generator of quotes, I have already attempted to implement it.

Copy link

@bp7968h bp7968h left a comment

Choose a reason for hiding this comment

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

Nice work, some minor code improvements, otherwise looks good to me

Comment on lines 12 to 15
<label class="switch">
<input id="toggle-btn" type="checkbox" />
<span class="slider round"></span>
</label>
Copy link

Choose a reason for hiding this comment

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

Would the screen reader be able to understand what this button is for from the context?

Copy link
Author

Choose a reason for hiding this comment

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

Thank you, Bhuwan. I should have added an aria-label for the input.

Comment on lines 510 to 512
intervalId = setInterval(() => {
updateQuoteAndAuthor();
}, 3000);
Copy link

Choose a reason for hiding this comment

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

In the readme for this task, the submission it mentions that auto quote should have 60 seconds interval when changing. Does this auto change in 60 secs, how would you fix that. Also this 3000 in your code are known as magic numbers, is there better way to handle magic numbers

Copy link
Author

Choose a reason for hiding this comment

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

Yes. I have added two variables for a preferred second and MS, which could improve readability.

@bp7968h bp7968h added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Dec 3, 2025
@TzeMingHo TzeMingHo requested a review from bp7968h December 3, 2025 13:35
Copy link

@bp7968h bp7968h left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@bp7968h bp7968h added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants