-
Notifications
You must be signed in to change notification settings - Fork 974
Download Item Removal Confirmation #7072
Download Item Removal Confirmation #7072
Conversation
I like it :-D |
@luixxiul glad to hear that, thanks :) |
36f7cd8
to
429d766
Compare
@michalbe well done! 😄 This will be a great feature Reviewing the code... would you be able to leave this component as an ImmutableComponent and instead have our AppStore be updated? Ideally, our controls would have state bound to them as a property (with binding happening in |
4e71f1d
to
2b60d47
Compare
@bsclifton Thanks, I implemented changes you've requested (even if I don't fully understand why global |
@michalbe I haven't yet read through the browser code but from my experience for instance some other bar/popup/modal may potentially be hidden by this ? |
2b60d47
to
685e61d
Compare
<DownloadItem | ||
downloadId={this.downloadId} | ||
download={this.download} | ||
deleteConfirmationVisible={this.download.get('deleteConfirmationVisible')} /> |
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.
NOTE: this was wrong before. Before, it was this.download.downloadDeleteConfirmationVisible
. Accessing child objects from an Immutable object will return undefined
.
I updated this to use the Immutable.js get
method to fetch the variable
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.
Thanks! I never worked with ImmutableJS before, so most of my code in there was just a blind guess.
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.
@michalbe no worries- it's something that bites me all the time (because it fails silently). Frankly, I wish an error would be thrown when it's accessed that way. I can't count the # times I've debugged an issue relating to that 😄
if ([downloadStates.CANCELLED, downloadStates.INTERRUPTED, downloadStates.COMPLETED].includes(state)) { | ||
describe('when delete button has been clicked', function () { | ||
beforeEach(function () { | ||
this.result.setProps({ |
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 the part I missed! Thanks!
|
||
testButton('.confirmDeleteButton', [downloadStates.CANCELLED, downloadStates.INTERRUPTED, downloadStates.COMPLETED], function (button) { | ||
const spy = sinon.spy(appActions, 'downloadDeleted') | ||
try { |
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.
Why there's a try
block in here?
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.
In case something fails. For example, with your original commit, it failed because 0 items were found. This raised an exception which then did not properly restore the sinon spy. When the next test case ran, it would try to put a spy on the same method but fail (because spy has already been done). The try is required only because I wanted to use a finally to restore the method which had been spied
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.
@michalbe I believe this is all done and working great 😄 I had one last change, if you're able to do so:
When you click delete, you can visibly see the icons jump up about 2 or 3 pixels (your GIF shows this really well). Would you be able to tweak the CSS for this? If so, I think we're good to go here 😄
685e61d
to
eec85c8
Compare
@bsclifton fixed |
eec85c8
to
6111569
Compare
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.
@michalbe CSS changes look (and work) great!
While testing, I found a bug where moving the mouse immediately to another download item (after deleting) will show the confirmation on another item. You can then click OK and that one will be deleted too.
After OK is clicked (but before the download is deleted), I think we need to clear the appState
6111569
to
97f96bd
Compare
Fixes brave#2604 Updated test to handle confirm click - rename downloadDeleteConfirmationVisible to deleteConfirmationVisible - wrap spy code with try/finally to ensure proper cleanup - confirmDeleteButton is checked independently from deleteButton Auditors: @michalbe
97f96bd
to
c5026e5
Compare
@bsclifton fixed and conflict resolved |
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.
Works great! Awesome job, @michalbe 😄
Test Plan
downloadsBar
ok
to remove the filedownloadItem
panel to hide the confirmation bar.Automated tests
npm run test -- --grep="downloadItem"
Description
Fixes #2604
git rebase -i
to squash commits (if needed).How it works: