Skip to content

Commit

Permalink
Bug 979969 - [Calendar] calendar.isViewActive should check if element…
Browse files Browse the repository at this point in the history
… is really "active" on the marionette tests
  • Loading branch information
millermedeiros committed Mar 5, 2014

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 66101d5 commit c12edf5
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion apps/calendar/test/marionette/calendar.js
Original file line number Diff line number Diff line change
@@ -23,6 +23,14 @@ Calendar.ORIGIN = 'app://calendar.gaiamobile.org';
* @type {Object}
*/
Calendar.Selector = Object.freeze({
// main view elements, used by waitForView
day: '#day-view',
week: '#week-view',
month: '#month-view',
'event/show': '#event-view',
'event/add': '#modify-event-view.create',
'event/edit': '#modify-event-view.update',

addAccountPasswordInput: '#modify-account-view input[name="password"]',
addAccountSaveButton: '#modify-account-view button.save',
addAccountUrlInput: '#modify-account-view input[name="fullUrl"]',
@@ -307,13 +315,21 @@ Calendar.prototype = {
* @return {boolean} Whether or not view is active
*/
isViewActive: function(id) {
id = id || '';
return this._isPath(id) && this._isElementActive(id);
},

_isPath: function(id) {
// we do not use the URL since that might happen before the [data-path] is
// updated and styles/views are toggled based on [data-path]
var path = this.client.findElement('body').getAttribute('data-path');
return path.indexOf(id) !== -1;
},

_isElementActive: function(id) {
return this.findElement(id)
.getAttribute('class').indexOf('active') !== -1;
},

/**
* @return {boolean} Whether or not week view is active
*/

0 comments on commit c12edf5

Please sign in to comment.