Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #33807 from albertopq/1228123-followup
Browse files Browse the repository at this point in the history
Bug 1228123 - Avoid publishing hide events if the action menu is not shown r=etienne
  • Loading branch information
albertopq committed Jan 11, 2016
2 parents b4213d9 + e910de4 commit 59229f2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/system/js/action_menu.js
Expand Up @@ -68,6 +68,10 @@
};

ActionMenu.prototype.hide = function() {
if (!this.active) {
return;
}

eventSafety(this.form, 'transitionend', function doHide(e) {
this.form.style.position = '';
SystemDialog.prototype.hide.apply(this);
Expand Down
13 changes: 13 additions & 0 deletions apps/system/test/unit/action_menu_test.js
Expand Up @@ -99,6 +99,11 @@ suite('ActionMenu', function() {
});

suite('Hide > ', function() {

setup(function() {
actionMenu.active = true;
});

test('Should force position:fixed during the transition', function() {
actionMenu.hide();
assert.equal(actionMenu.form.style.position, 'fixed');
Expand All @@ -114,6 +119,14 @@ suite('ActionMenu', function() {
assert.isTrue(systemHideStub.called);
assert.isFalse(actionMenu.form.classList.contains('visible'));
});

test('Does nothing if not active', function() {
actionMenu.active = false;
actionMenu.hide();
var evt = new CustomEvent('transitionend');
actionMenu.form.dispatchEvent(evt);
assert.isFalse(systemHideStub.called);
});
});

suite('Events > ', function() {
Expand Down

0 comments on commit 59229f2

Please sign in to comment.