Skip to content

Commit

Permalink
Bug 991062 - Call log: Take out filters while in edit mode
Browse files Browse the repository at this point in the history
  • Loading branch information
rnowm authored and gtorodelvalle committed May 6, 2014
1 parent 2a57f79 commit 647f369
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 24 deletions.
8 changes: 0 additions & 8 deletions apps/communications/dialer/js/call_log.js
Expand Up @@ -660,10 +660,6 @@ var CallLog = {
},

filter: function cl_filter() {
if (document.body.classList.contains('recents-edit')) {
this.hideEditMode();
}

this.callLogContainer.classList.add('filter');
AccessibilityHelper.setAriaSelected(this.missedFilter.firstElementChild, [
this.allFilter.firstElementChild, this.missedFilter.firstElementChild]);
Expand All @@ -690,10 +686,6 @@ var CallLog = {
},

unfilter: function cl_unfilter() {
if (document.body.classList.contains('recents-edit')) {
this.hideEditMode();
}

// If the call log is empty display the appropriate message, otherwise hide
// the empty call log message and enable edit mode
if (this._empty) {
Expand Down
8 changes: 8 additions & 0 deletions apps/communications/dialer/style/call_log.css
Expand Up @@ -289,6 +289,14 @@ ol, ul {
display: block;
}

.recents-edit .recents-filter-container {
display: none;
}

.recents-edit .view-body {
height: calc(100% - 7.6rem);
}

.filter .log-item:not(.missed-call) {
display: none;
}
Expand Down
79 changes: 79 additions & 0 deletions apps/communications/dialer/test/marionette/call_log_test.js
@@ -0,0 +1,79 @@
'use strict';

var Dialer = require('./lib/dialer');
var ReflowHelper =
require('../../../../../tests/js-marionette/reflow_helper.js');

marionette('Dialer > Keypad', function() {
var assert = require('assert');

var client = marionette.client(Dialer.config);
var subject;
var selectors;

var Actions = require('marionette-client').Actions;
var actions = new Actions(client);

var reflowHelper;

setup(function() {
subject = new Dialer(client);
subject.launch();

selectors = Dialer.Selectors;

var tabItem = subject.client.findElement(selectors.callLogTabItem);
actions.tap(tabItem).perform();

subject.client.helper.waitForElement(selectors.callLogTabs);

subject.client.helper.waitForElement(selectors.callLogNoResultsContainer);

reflowHelper = new ReflowHelper(client);
});

/* Currently the starting of the Call Log 'sub-app' inside the Communications
app throws an error due to navigator.mozIccManager being undefined when
run in the B2G Desktop. This avoids running integration tests for the
Call Log. I'll skip this test for the time being until a way to run
integration tests in the Call Log is available. Please see:
https://bugzilla.mozilla.org/show_bug.cgi?id=991062#c13 */
test.skip('Entering the edit mode hides the filters', function() {
reflowHelper.startTracking(Dialer.URL + '/manifest.webapp');

var addEntryToCallLog = function() {
window.wrappedJSObject.CallLog.sticky = {
refresh: function() {}
};
var entry = {
'date': Date.now(),
'type': 'incoming',
'number': '63030212029795',
'serviceId': 0,
'emergency': false,
'voicemail': false,
'status': 'connected'
};
window.wrappedJSObject.postMessage(
{
type: 'recent',
entry: entry
},
'app://communications.gaiamobile.org'
);
};
subject.client.executeScript(addEntryToCallLog);
subject.client.helper.waitForElement(selectors.callLogItem);

subject.client.findElement(selectors.callLogEditButton).tap();

subject.client.helper.waitForElement(selectors.callLogEditForm);

var filters = subject.client.findElement(selectors.callLogTabs);
assert.isFalse(filters.displayed());

var reflowCount = reflowHelper.getCount();
assert.equal(reflowCount, 16, 'you need more than 16 reflows for that?');
reflowHelper.stopTracking();
});
});
4 changes: 4 additions & 0 deletions apps/communications/dialer/test/marionette/lib/dialer.js
Expand Up @@ -37,7 +37,11 @@ Dialer.Selectors = {
keypadCallBarAddContact: '#keypad-callbar-add-contact',

callLogTabItem: '#option-recents',
callLogEditButton: '#call-log-icon-edit',
callLogTabs: '#call-log-filter',
callLogNoResultsContainer: '#no-result-container',
callLogItem: '.log-item',
callLogEditForm: '#edit-mode',

contactsTabItem: '#option-contacts',
contactsIframe: '#iframe-contacts',
Expand Down
16 changes: 0 additions & 16 deletions apps/communications/dialer/test/unit/call_log_test.js
Expand Up @@ -671,22 +671,6 @@ suite('dialer/call_log', function() {
}
});
});

test('Filtering should exit edit mode', function() {
CallLog.showEditMode();
CallLog.filter();

assert.isFalse(document.body.classList.contains('recents-edit'));
});

test('Unfiltering should exit edit mode', function() {
CallLog.filter();
CallLog.callLogIconEdit.removeAttribute('disabled');
CallLog.showEditMode();
CallLog.unfilter();

assert.isFalse(document.body.classList.contains('recents-edit'));
});
});

suite('Filter', function() {
Expand Down

0 comments on commit 647f369

Please sign in to comment.