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

Commit

Permalink
Revert "Merge pull request #16321 from vingtetun/bug971006-final"
Browse files Browse the repository at this point in the history
This reverts commit 19304fe, reversing
changes made to b9859b9.

Conflicts:
	apps/system/js/utility_tray.js
	apps/system/test/unit/utility_tray_test.js
  • Loading branch information
Gareth Aye authored and qdot committed Feb 22, 2014
1 parent b0345f4 commit 155560b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 35 deletions.
5 changes: 1 addition & 4 deletions apps/system/js/utility_tray.js
Expand Up @@ -83,8 +83,7 @@ var UtilityTray = {
break;

case 'touchstart':
evt.preventDefault();
if (window.lockScreen && window.lockScreen.locked)
if (LockScreen.locked)
return;
if (evt.target !== this.overlay &&
evt.currentTarget !== this.statusbar &&
Expand All @@ -95,12 +94,10 @@ var UtilityTray = {
break;

case 'touchmove':
evt.preventDefault();
this.onTouchMove(evt.touches[0]);
break;

case 'touchend':
evt.preventDefault();
evt.stopImmediatePropagation();
var touch = evt.changedTouches[0];
if (Rocketbar.enabled && !this.shown && !this.active &&
Expand Down
36 changes: 5 additions & 31 deletions apps/system/test/unit/utility_tray_test.js
Expand Up @@ -19,26 +19,21 @@ suite('system/UtilityTray', function() {
var originalLocked;
mocksHelperForUtilityTray.attachTestHelpers();

var FakeEvent = function(y) {
this.pageY = y;
this.preventDefault = function() {};
};

function fakeTouches(start, end) {
UtilityTray.onTouchStart(new FakeEvent(start));
UtilityTray.onTouchStart({ pageY: start });
UtilityTray.screenHeight = 480;

var y = start;
while (y != end) {
UtilityTray.onTouchMove(new FakeEvent(y));
UtilityTray.onTouchMove({ pageY: y });

if (y < end) {
y++;
} else {
y--;
}
}
UtilityTray.onTouchEnd(new FakeEvent());
UtilityTray.onTouchEnd();
}

setup(function(done) {
Expand Down Expand Up @@ -184,19 +179,10 @@ suite('system/UtilityTray', function() {
fakeEvt = {
type: 'touchstart',
target: UtilityTray.overlay,
touches: [0],
defaultPrevented: false,
preventDefault: function() {
this.defaultPrevented = true;
}
touches: [0]
};
});

test('preventDefault() should have been called on touchstart', function() {
UtilityTray.handleEvent(fakeEvt);
assert.isTrue(fakeEvt.defaultPrevented);
});

test('Test UtilityTray.active, should be true', function() {
/* XXX: This is to test UtilityTray.active,
it works in local test but breaks in travis. */
Expand All @@ -209,20 +195,12 @@ suite('system/UtilityTray', function() {
fakeEvt = {
type: 'touchend',
changedTouches: [0],
stopImmediatePropagation: function() {},
defaultPrevented: false,
preventDefault: function() {
this.defaultPrevented = true;
}
stopImmediatePropagation: function() {}
};
UtilityTray.active = true;
UtilityTray.handleEvent(fakeEvt);
});

test('preventDefault() should have been called on touchend', function() {
assert.isTrue(fakeEvt.defaultPrevented);
});

test('Test UtilityTray.active, should be false', function() {
assert.equal(UtilityTray.active, false);
});
Expand Down Expand Up @@ -263,7 +241,6 @@ suite('system/UtilityTray', function() {
test('should display for drag on left half of statusbar', function() {
fakeEvt = {
stopImmediatePropagation: function() {},
preventDefault: function() {},
type: 'touchend',
changedTouches: [{
pageX: 0
Expand All @@ -279,7 +256,6 @@ suite('system/UtilityTray', function() {
test('does not render if utility tray not active', function() {
fakeEvt = {
stopImmediatePropagation: function() {},
preventDefault: function() {},
type: 'touchend',
changedTouches: [{
pageX: 0
Expand All @@ -295,7 +271,6 @@ suite('system/UtilityTray', function() {
test('should not show if we touch to the right', function() {
fakeEvt = {
type: 'touchstart',
preventDefault: function() {},
pageX: 70
};
UtilityTray.onTouchStart(fakeEvt);
Expand All @@ -309,7 +284,6 @@ suite('system/UtilityTray', function() {
assert.equal(UtilityTray.shown, true);
fakeEvt = {
type: 'touchstart',
preventDefault: function() {},
pageX: 0
};
UtilityTray.onTouchStart(fakeEvt);
Expand Down

0 comments on commit 155560b

Please sign in to comment.