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 #33261 from jedireza/home-button-closes-update-man…
Browse files Browse the repository at this point in the history
…ager-dialogs

Bug 1225330 - Status bar icons change color before homescreen transition when home button is pressed
  • Loading branch information
jedireza committed Nov 30, 2015
2 parents 83ab258 + 58ab05f commit 64aba1a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
5 changes: 4 additions & 1 deletion apps/system/js/update_manager.js
Expand Up @@ -442,6 +442,7 @@
}, this);

window.dispatchEvent(new CustomEvent('updatepromptshown'));
this._hasDialog = true;
this.downloadDialog.classList.add('visible');
this.updateDownloadButton();
},
Expand Down Expand Up @@ -813,7 +814,9 @@
break;
case 'home':
case 'holdhome':
this.cancelPrompt();
if (this._hasDialog) {
this.cancelPrompt();
}
break;
}

Expand Down
16 changes: 14 additions & 2 deletions apps/system/test/unit/update_manager_test.js
Expand Up @@ -428,8 +428,6 @@ suite('system/UpdateManager', function() {
assert.isFalse(UpdateManager.downloadViaDataConnectionDialog.
classList.contains('visible'));
assert.isFalse(MockCustomDialog.mShown);
// should not close all custom dialog when no custom dialog is opened
assert.isFalse(Service.request.calledWith('hideCustomDialog'));
});

test('should decline install if showing apply prompt', function() {
Expand Down Expand Up @@ -553,15 +551,29 @@ suite('system/UpdateManager', function() {

test('should close dialogs when home button is pressed',
function () {
UpdateManager.showDownloadPrompt();
window.dispatchEvent(new CustomEvent('home'));
assert.ok(Service.request.calledWith('hideCustomDialog'));
});

test('should close dialogs when home button is held',
function () {
UpdateManager.showDownloadPrompt();
window.dispatchEvent(new CustomEvent('holdhome'));
assert.ok(Service.request.calledWith('hideCustomDialog'));
});

test('should not close dialogs when none exist (home button)',
function() {
window.dispatchEvent(new CustomEvent('home'));
assert.isFalse(Service.request.calledWith('hideCustomDialog'));
});

test('should not close dialogs when none exist (hold home button)',
function() {
window.dispatchEvent(new CustomEvent('holdhome'));
assert.isFalse(Service.request.calledWith('hideCustomDialog'));
});
});
});

Expand Down

0 comments on commit 64aba1a

Please sign in to comment.