-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Fixed leak in menu.js file. Fixes #12765 #12767
Conversation
I know it is a bit confusing, but please, revert the changes to |
I don't remember touching that file but I've reverted the changes. Sorry about that. Now the test is failing, looking into that now. |
Checking the CI logs, I think the reason for the build failure isn't anything on my end. Right? |
Yes, the build failure was on our side. It passed now 👍 cc @zaggino for review |
@daytonallen the code is great, but is missing a test and that should be done in this case as test for this is easy to write, please add it somewhere here: https://github.com/adobe/brackets/blob/master/test/spec/Menu-test.js#L660-L737 You should write it in a way that it fails when you comment out the You'll need to compare contents of |
How do I run the tests locally to check if it's done correctly? I tried the |
@daytonallen did you setup your installed Brackets with your cloned Brackets folder like in here https://github.com/adobe/brackets/wiki/How-to-Hack-on-Brackets ? See the |
If you did, please push the testcase here, maybe something else is wrong with it, you can still correct it with additional commits. |
Turns out I was testing under the wrong grouping. |
expect(typeof (command)).toBe("object"); | ||
|
||
// Test event | ||
command.on("nameChange", menuItem._nameChanged); |
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.
you shouldn't add event manually with .on
, you should just do expect
for events that are added by addMenuItem
@daytonallen
everything else doesn't need to be there |
*/ | ||
function removeMenuItemEventListeners(command) { | ||
command | ||
.off("enabledStateChange", command._enabledChanged) |
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.
looking at the code now, _enabledChanged
and other methods live on MenuItem
not on command
... are you sure that you're not calling .off("enabledStateChange", undefined)
???
Thanks @daytonallen merged to master! 👍 |
My pleasure. Thanks for all the guidance also. |
Fixes #12765