diff --git a/apps/communications/dialer/js/call_log.js b/apps/communications/dialer/js/call_log.js index 227ab416bde5..2f6e3e47c1c1 100644 --- a/apps/communications/dialer/js/call_log.js +++ b/apps/communications/dialer/js/call_log.js @@ -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]); @@ -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) { diff --git a/apps/communications/dialer/style/call_log.css b/apps/communications/dialer/style/call_log.css index 47a12ada51f0..d0d5cedd3015 100644 --- a/apps/communications/dialer/style/call_log.css +++ b/apps/communications/dialer/style/call_log.css @@ -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; } diff --git a/apps/communications/dialer/test/marionette/call_log_test.js b/apps/communications/dialer/test/marionette/call_log_test.js new file mode 100644 index 000000000000..02bc2cfd66af --- /dev/null +++ b/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(); + }); +}); diff --git a/apps/communications/dialer/test/marionette/lib/dialer.js b/apps/communications/dialer/test/marionette/lib/dialer.js index b7070123d12f..7ea3980a6431 100644 --- a/apps/communications/dialer/test/marionette/lib/dialer.js +++ b/apps/communications/dialer/test/marionette/lib/dialer.js @@ -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', diff --git a/apps/communications/dialer/test/unit/call_log_test.js b/apps/communications/dialer/test/unit/call_log_test.js index 463bdd2caf0b..fe83a75f1b27 100644 --- a/apps/communications/dialer/test/unit/call_log_test.js +++ b/apps/communications/dialer/test/unit/call_log_test.js @@ -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() {