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 #32297 from Cwiiis/bug1212345-new-homescreen-remov…
Browse files Browse the repository at this point in the history
…e-longpress-menu

Bug 1212345 - Remove long-press menu. r=gmarty
  • Loading branch information
Cwiiis committed Oct 9, 2015
2 parents 9711ea4 + 669447e commit 69b3a59
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 104 deletions.
4 changes: 0 additions & 4 deletions apps/homescreen/index.html
Expand Up @@ -83,10 +83,6 @@
<button class="action" data-l10n-id="resume-download-action"></button>
<button on-click="close" data-l10n-id="cancel-action"></button>
</gaia-dialog>
<gaia-dialog id="settings" class="dialog-action">
<button class="action" data-l10n-id="homescreen-settings"></button>
<button on-click="close" data-l10n-id="cancel-action"></button>
</gaia-dialog>
</div><!--
--><div id="pages-panel">
<div class="shadow"></div>
Expand Down
24 changes: 1 addition & 23 deletions apps/homescreen/js/app.js
Expand Up @@ -87,9 +87,7 @@ const SETTINGS_VERSION = 0;
this.edit = document.getElementById('edit');
this.cancelDownload = document.getElementById('cancel-download');
this.resumeDownload = document.getElementById('resume-download');
this.settingsDialog = document.getElementById('settings');
this.dialogs =
[this.cancelDownload, this.resumeDownload, this.settingsDialog];
this.dialogs = [this.cancelDownload, this.resumeDownload];

// XXX Working around gaia-components issue #8
var dialog;
Expand Down Expand Up @@ -141,7 +139,6 @@ const SETTINGS_VERSION = 0;
this.updatePanelIndicator();

// Signal handlers
document.body.addEventListener('contextmenu', this);
this.panels.addEventListener('scroll', this);
this.scrollable.addEventListener('scroll', this);
this.icons.addEventListener('activate', this);
Expand Down Expand Up @@ -685,25 +682,6 @@ const SETTINGS_VERSION = 0;
var icon, child, id;

switch (e.type) {
// Show the settings menu when the user long-presses and we aren't in
// a drag
case 'contextmenu':
if (!document.body.classList.contains('dragging')) {
this.showActionDialog(this.settingsDialog, null,
[() => {
new MozActivity({
name: 'configure',
data: {
target: 'device',
section: 'homescreens'
}
});
}]);
e.stopImmediatePropagation();
e.preventDefault();
}
break;

// Display the top shadow when scrolling down
case 'scroll':
if (e.target === this.panels) {
Expand Down
2 changes: 0 additions & 2 deletions apps/homescreen/locales/homescreen.en-US.properties
Expand Up @@ -4,8 +4,6 @@ stop-download-action=Stop
resume-download-body=Do you want to download {{name}}?
resume-download-action=Download

homescreen-settings=Homescreen Settings

cancel-action=Cancel

apps-panel.ariaLabel=Applications
Expand Down
16 changes: 0 additions & 16 deletions apps/homescreen/test/marionette/lib/homescreen.js
Expand Up @@ -251,22 +251,6 @@ Homescreen.prototype = {
}, [icon, this.appsScrollable, icon.location().y]);
},

/**
* Opens the settings menu by long-pressing on the empty space at the bottom
* of the icon grid.
*/
openSettingsMenu: function() {
var rect = this.appsScrollable.scriptWith(function(el) {
el.scrollTop = el.scrollTopMax;
return el.getBoundingClientRect();
});
var actions = this.client.loader.getActions();
actions.press(this.appsScrollable, rect.width / 2, rect.height - 1).
wait(0.5).
release().
perform();
},

/**
* Restart the homescreen then refocus on it.
*/
Expand Down
22 changes: 0 additions & 22 deletions apps/homescreen/test/marionette/localization_test.js
Expand Up @@ -37,26 +37,4 @@ marionette('Homescreen - Localization', function() {
return !!home.getIconByName(newIconName);
});
});

test('Menu option localization', function() {
// Change the language to french
client.switchToFrame();
client.executeAsyncScript(function() {
var req = navigator.mozSettings.createLock().set({
'language.current': 'qps-ploc'
});

req.onsuccess = function() {
marionetteScriptFinished();
};
});
client.switchToFrame(system.getHomescreenIframe());

home.openSettingsMenu();

var expected = home.l10n('cancel-action');
client.waitFor(function(){
return home.settingsDialogButtons.pop().text() === expected;
});
});
});
5 changes: 0 additions & 5 deletions apps/homescreen/test/unit/_index.html
Expand Up @@ -31,11 +31,6 @@
<button class="action">resume-download-action</button>
<button>cancel-action</button>
</div>

<div id="settings" class="dialog">
<button class="action">homescreen-settings</button>
<button>cancel-action</button>
</div>
</div>

<div id="pages-panel">
Expand Down
38 changes: 6 additions & 32 deletions apps/homescreen/test/unit/app_test.js
Expand Up @@ -584,7 +584,7 @@ suite('Homescreen app', () => {
});

test('should attach events on click', () => {
var dialog = app.settingsDialog;
var dialog = app.dialogs[0];
dialog.open = () => {};
app.showActionDialog(dialog, null, [() => {}]);
assert.ok(dialog.querySelector('button').onclick);
Expand Down Expand Up @@ -666,37 +666,6 @@ suite('Homescreen app', () => {
});

suite('App#handleEvent()', () => {
var showActionDialogStub;

suite('contextmenu', () => {
setup(function() {
showActionDialogStub = sinon.stub(app, 'showActionDialog',
(dialog, args, callbacks) => {
callbacks[0]();
});
app.settingsDialog = {
open: () => {},
close: () => {}
};
});

teardown(function() {
showActionDialogStub.restore();
});

test('should open a dialog', () => {
app.handleEvent(new CustomEvent('contextmenu'));
assert.isTrue(showActionDialogStub.called);
});

test('should attach a configure web activity to a button click', () => {
app.handleEvent(new CustomEvent('contextmenu'));
assert.isTrue(showActionDialogStub.called);
assert.equal(MockMozActivity.calls.length, 1);
assert.equal(MockMozActivity.calls[0].name, 'configure');
});
});

suite('scroll', () => {
test('should show and hide the drop shadow accordingly', () => {
assert.isFalse(app.scrolled);
Expand Down Expand Up @@ -745,6 +714,7 @@ suite('Homescreen app', () => {
assert.isTrue(showActionDialogStub.called);
var stubCall = showActionDialogStub.getCall(0);
assert.equal(stubCall.args[0], app.cancelDownload);
showActionDialogStub.restore();
});

suite('error and paused', () => {
Expand All @@ -759,6 +729,10 @@ suite('Homescreen app', () => {
{ detail: { target: icon } }));
};

teardown(() => {
showActionDialogStub.restore();
});

test('error app should open a resume download dialog', () => {
testApp('error');
assert.isTrue(showActionDialogStub.called);
Expand Down

0 comments on commit 69b3a59

Please sign in to comment.