-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
work doesn't get selected when "Want to Read" button is pressed #8529
work doesn't get selected when "Want to Read" button is pressed #8529
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8529 +/- ##
==========================================
+ Coverage 16.51% 17.61% +1.09%
==========================================
Files 85 85
Lines 4456 4456
Branches 782 782
==========================================
+ Hits 736 785 +49
+ Misses 3227 3187 -40
+ Partials 493 484 -9 ☔ View full report in Codecov by Sentry. |
Thanks for this, @Billa05! The feature works like it should, which is definitely a win. :) The set up for the tests in this case turned out to be more involved than I thought, and you were 90% of the way there. One thing to remember with tests is you want to make sure that the test doesn't always pass. In this case, even without the change to I'm still not 100% sold on the test set up myself, so if you have any suggestions, please let me know. Also, if you want to make further changes, please pull from your remote branch first on your Open Library fork, so you can integrate these changes into your own local branch. Once you're happy with everything, I will go ahead and merge this. |
@scottbarnes — I have a PR in review with Drini that refactors this file in some significant ways (e.g. toggleSelected is called something else and has new parameters). If you could hold off on merging this for a few days until that one lands, it would avoid some confusion. |
Will do! Thanks for the heads up. |
Sorry for the delayed response I was travelling. @scottbarnes thank you for the feedback this was my first time writing a test case in js. I appreciate your insights on the test setup, and I understand the importance of ensuring test reliability. Your adjustments make sense, as it checks individually for clicking on ctaDiv and listItem elements. will make the needful changes once @mheiman pr gets reviewed. |
Merging is blocked until #8441 is merged. |
$(clickEvent.target).closest('.searchResultItemCTA').length > 0 || | ||
($(clickEvent.target).closest('a').is('a') && |
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.
We can make this a little tighter :) This will also handle any other <button>
elements.
$(clickEvent.target).closest('.searchResultItemCTA').length > 0 || | |
($(clickEvent.target).closest('a').is('a') && | |
($(clickEvent.target).closest('a, button').length > 0 && |
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.
looks good to me. tested and it is working properly
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.
the read and want to read buttons are not button elements. but still, this solves the issue. @scottbarnes could you look into this?
No longer blocked! This will need a rebase though |
@scottbarnes is there any need to change the test case? I think the test case for ctaDiv has to be removed. if required I can try to add a test case for the button, if it makes sense. |
I have modified the testcase file. @scottbarnes could you please review it. |
Hi, @Billa05. Thanks for updating this. Can you rebase it against the latest Please see Making Updates to Your Pull Request if you run into issues rebasing. |
this is the first time I have done rebasing. is this right? and should I remove all the commented code from the test case? |
Alas, @Billa05, the rebasing has gone slightly awry. You'll want to remove ( Using the following should get you started: git fetch upstream master
git rebase -i upstream/master I have done this exact same thing during some of my first rebases. :) If you get stuck let me know and I can give further direction, though it won't be until tomorrow evening Pacific time at the earliest, most likely. I happened to have all your commits, at least of perhaps 12 hours or so ago, handy, so this may help:
|
firstly this shows up: I tired to undo the rebasing but got nothing other than frustration 😩 according to the commit messages I was resolving the conflicts, I accepted the changes from the respective commits instead of the current code. it that the right way? at last i was left with this: should I push this? |
hey, @scottbarnes could you please look into this? |
@Billa05, I think that the last screenshot, with the following, looks correct:
Assuming you resolved all the conflicts, the fix works, and the tests work, then yeah, push it and I can take a look. In answer to your question about the commented out code, yes, please go ahead and remove it, and as for whether the tests need to change, I can look more closely at that once the rebase is done and the code pushed here. With respect to why not merge |
@scottbarnes thank you for the explanation. I have pushed the commits but it doesn't seem to fix it. |
@Billa05, I was able to rebase the branch with this latest code. I can simply push it here, but if you'd like we could also do a screenshare for a few minutes and I can show you what I've done. Let me know if you'd like to do a screenshare, or if I should just push the rebased branch. :) |
@scottbarnes, I would love to do that. I want to clear the mess I have created 😅 |
@Billa05, I'll send you a message on Slack to coordinate. |
sure, I am waiting |
8e7e503
to
e093fe0
Compare
@scottbarnes could you please review the test case |
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.
Looks good to me. Thanks, @Billa05!
Thank you, @scottbarnes, for all your help throughout the issue. |
Closes #6881
It fixes the bug that was causing to select the work when pressed on the Want to Read button.
also, I have added a test case for toggelSelected method
Testing
Screenshot
example.mp4
Stakeholders
@scottbarnes