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 #29394 from albertopq/1100332-shb-utility-tray
Browse files Browse the repository at this point in the history
Bug 1100332 - Fixing issues when closing the utility-tray with SHB r=mhenretty
  • Loading branch information
albertopq committed Apr 9, 2015
2 parents 674acc3 + 9574609 commit 3ec5757
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
14 changes: 12 additions & 2 deletions apps/system/js/utility_tray.js
Expand Up @@ -23,6 +23,8 @@ window.UtilityTray = {

ambientIndicator: document.getElementById('ambient-indicator'),

softwareButtons: document.getElementById('software-buttons'),

grippy: document.getElementById('utility-tray-grippy'),

container: document.getElementById('desktop-notifications-container'),
Expand Down Expand Up @@ -53,6 +55,7 @@ window.UtilityTray = {
this.statusbarIcons.addEventListener(name, this);
this.grippy.addEventListener(name, this);
this.topPanel.addEventListener(name, this);
this.softwareButtons.addEventListener(name, this);
}, this);

window.addEventListener('screenchange', this);
Expand Down Expand Up @@ -238,14 +241,21 @@ window.UtilityTray = {
return;
}

// Prevent swipe up gesture when closed.
if (target === this.softwareButtons && !this.showing) {
return;
}

// Prevent swipe down gesture when already opened/opening.
if (target !== this.grippy && this.showing) {
if (target !== this.grippy &&
target !== this.softwareButtons && this.showing) {
return;
}

if (target !== this.overlay && target !== this.grippy &&
evt.currentTarget !== this.statusbarIcons &&
evt.currentTarget !== this.topPanel) {
evt.currentTarget !== this.topPanel &&
evt.currentTarget !== this.softwareButtons) {
return;
}

Expand Down
10 changes: 10 additions & 0 deletions apps/system/test/unit/utility_tray_test.js
Expand Up @@ -94,6 +94,9 @@ suite('system/UtilityTray', function() {
var ambientIndicator = document.createElement('div');
ambientIndicator.style.cssText = 'height: 2px; display: block;';

var softwareButtons = document.createElement('div');
softwareButtons.style.cssText = 'height: 20px; display: block;';

stubById = this.sinon.stub(document, 'getElementById', function(id) {
switch (id) {
case 'statusbar':
Expand All @@ -114,6 +117,8 @@ suite('system/UtilityTray', function() {
return topPanel;
case 'ambient-indicator':
return ambientIndicator;
case 'software-buttons':
return softwareButtons;
default:
return null;
}
Expand Down Expand Up @@ -275,6 +280,11 @@ suite('system/UtilityTray', function() {
fakeTouches(480, 380, UtilityTray.grippy);
assert.equal(UtilityTray.showing, false);
});

test('should be hidden by a drag from the softwareButtons', function() {
fakeTouches(480, 380, UtilityTray.softwareButtons);
assert.equal(UtilityTray.showing, false);
});
});
});

Expand Down

0 comments on commit 3ec5757

Please sign in to comment.