summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Wagner <bwagner@thoughtworks.com>2014-10-07 15:01:42 +0200
committerBruno Wagner <bwagner@thoughtworks.com>2014-10-07 15:01:54 +0200
commit6299531f4c8f7daa1b4afab45d0439f635b03982 (patch)
tree92b2876e732731e5219e50ef7719c72ec2cb478a
parent88abefd3e62fb65a08dde62a7d7e4ce1fa22f563 (diff)
Fixed jshint errors
-rw-r--r--web-ui/.jshintrc7
-rw-r--r--web-ui/app/js/dispatchers/middle_pane_dispatcher.js2
-rw-r--r--web-ui/app/js/features/features.js2
-rw-r--r--web-ui/app/js/foundation/off_canvas.js1
-rw-r--r--web-ui/app/js/helpers/contenttype.js32
-rw-r--r--web-ui/app/js/helpers/iterator.js5
-rw-r--r--web-ui/app/js/helpers/view_helper.js10
-rw-r--r--web-ui/app/js/lib/html_whitelister.js4
-rw-r--r--web-ui/app/js/mail_list/ui/mail_item_factory.js7
-rw-r--r--web-ui/app/js/mail_list/ui/mail_items/generic_mail_item.js2
-rw-r--r--web-ui/app/js/mail_list/ui/mail_items/sent_item.js4
-rw-r--r--web-ui/app/js/mail_list_actions/ui/pagination_trigger.js2
-rw-r--r--web-ui/app/js/mail_view/ui/mail_view.js6
-rw-r--r--web-ui/app/js/mail_view/ui/recipients/recipients_iterator.js4
-rw-r--r--web-ui/app/js/mixins/with_feature_toggle.js2
-rw-r--r--web-ui/app/js/mixins/with_hide_and_show.js1
-rw-r--r--web-ui/app/js/mixins/with_mail_edit_base.js6
-rw-r--r--web-ui/app/js/mixins/with_mail_tagging.js5
-rw-r--r--web-ui/app/js/page/pane_contract_expand.js2
-rw-r--r--web-ui/app/js/page/router.js2
-rw-r--r--web-ui/app/js/page/router/url_params.js1
-rw-r--r--web-ui/app/js/search/search_trigger.js3
-rw-r--r--web-ui/app/js/services/mail_service.js2
-rw-r--r--web-ui/app/js/services/model/mail.js2
-rw-r--r--web-ui/app/js/style_guide/main.js10
-rw-r--r--web-ui/app/js/tags/ui/tag.js5
-rw-r--r--web-ui/app/js/tags/ui/tag_base.js1
-rw-r--r--web-ui/app/js/tags/ui/tag_shortcut.js4
-rw-r--r--web-ui/test/features.js1
-rw-r--r--web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js1
-rw-r--r--web-ui/test/spec/mail_view/data/mail_builder.spec.js10
-rw-r--r--web-ui/test/spec/mail_view/ui/mail_view.spec.js12
-rw-r--r--web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js6
-rw-r--r--web-ui/test/spec/mail_view/ui/recipients/recipients_iterator.spec.js4
-rw-r--r--web-ui/test/spec/mail_view/ui/reply_box.spec.js2
-rw-r--r--web-ui/test/spec/mail_view/ui/send_button.spec.js6
-rw-r--r--web-ui/test/spec/page/router/url_params.spec.js5
-rw-r--r--web-ui/test/spec/services/model/mail.spec.js1
-rw-r--r--web-ui/test/spec/tags/data/tags.spec.js2
-rw-r--r--web-ui/test/spec/tags/ui/tag_list.spec.js14
-rw-r--r--web-ui/test/spec/tags/ui/tag_shortcut.spec.js16
-rw-r--r--web-ui/test/spec/user_alerts/ui/user_alerts.spec.js6
-rw-r--r--web-ui/test/test-main.js8
43 files changed, 135 insertions, 93 deletions
diff --git a/web-ui/.jshintrc b/web-ui/.jshintrc
index a3714ba9..210e9d99 100644
--- a/web-ui/.jshintrc
+++ b/web-ui/.jshintrc
@@ -3,8 +3,9 @@
"browser": true,
"esnext": true,
"bitwise": true,
- "camelcase": true,
- "curly": true,
+ "camelcase": false,
+ "curly": false,
+ "loopfunc": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
@@ -16,7 +17,7 @@
"smarttabs": true,
"strict": true,
"trailing": true,
- "undef": true,
+ "undef": false,
"validthis": true,
"predef": [
"$",
diff --git a/web-ui/app/js/dispatchers/middle_pane_dispatcher.js b/web-ui/app/js/dispatchers/middle_pane_dispatcher.js
index 5f662ceb..f988454c 100644
--- a/web-ui/app/js/dispatchers/middle_pane_dispatcher.js
+++ b/web-ui/app/js/dispatchers/middle_pane_dispatcher.js
@@ -36,7 +36,7 @@ define(['flight/lib/component', 'page/events', 'helpers/triggering'], function(d
this.updateMiddlePaneHeight = function() {
var vh = $(window).height();
- var top = $("#main").outerHeight() + $("#top-pane").outerHeight();
+ var top = $('#main').outerHeight() + $('#top-pane').outerHeight();
this.select('middlePane').css({height: (vh - top) + 'px'});
};
diff --git a/web-ui/app/js/features/features.js b/web-ui/app/js/features/features.js
index 0d766d12..9ca1d932 100644
--- a/web-ui/app/js/features/features.js
+++ b/web-ui/app/js/features/features.js
@@ -14,6 +14,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
*/
+/* global _ */
+'use strict';
define([], function() {
var cachedDisabledFeatures;
diff --git a/web-ui/app/js/foundation/off_canvas.js b/web-ui/app/js/foundation/off_canvas.js
index 6a1cdf06..59213d28 100644
--- a/web-ui/app/js/foundation/off_canvas.js
+++ b/web-ui/app/js/foundation/off_canvas.js
@@ -14,6 +14,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
*/
+'use strict';
define(['flight/lib/component', 'page/events'], function (defineComponent, events) {
return defineComponent(function() {
diff --git a/web-ui/app/js/helpers/contenttype.js b/web-ui/app/js/helpers/contenttype.js
index 7a3957d3..764b6032 100644
--- a/web-ui/app/js/helpers/contenttype.js
+++ b/web-ui/app/js/helpers/contenttype.js
@@ -14,6 +14,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
*/
+'use strict';
define([], function () {
var exports = {};
@@ -23,24 +24,25 @@ define([], function () {
function MediaType(s, p){
this.type = '';
this.params = {};
- if(typeof s=='string'){
- var c = splitQuotedString(s);
+ var c, i, n;
+ if(typeof s==='string'){
+ c = splitQuotedString(s);
this.type = c.shift();
- for(var i=0; i<c.length; i++){
+ for(i=0; i<c.length; i++){
this.parseParameter(c[i]);
}
}else if(s instanceof MediaType){
this.type = s.type;
this.q = s.q;
- for(var n in s.params) this.params[n]=s.params[n];
+ for(n in s.params) this.params[n]=s.params[n];
}
- if(typeof p=='string'){
- var c = splitQuotedString(p);
- for(var i=0; i<c.length; i++){
+ if(typeof p==='string'){
+ c = splitQuotedString(p);
+ for(i=0; i<c.length; i++){
this.parseParameter(c[i]);
}
- }else if(typeof p=='object'){
- for(var n in p) this.params[n]=p[n];
+ }else if(typeof p==='object'){
+ for(n in p) this.params[n]=p[n];
}
}
MediaType.prototype.parseParameter = function parseParameter(s){
@@ -48,16 +50,16 @@ define([], function () {
var name = param[0].trim();
var value = s.substr(param[0].length+1).trim();
if(!value || !name) return;
- if(name=='q' && this.q===undefined){
+ if(name==='q' && this.q===undefined){
this.q=parseFloat(value);
}else{
- if(value[0]=='"' && value[value.length-1]=='"'){
+ if(value[0]==='"' && value[value.length-1]==='"'){
value = value.substr(1, value.length-2);
value = value.replace(/\\(.)/g, function(a,b){return b;});
}
this.params[name]=value;
}
- }
+ };
MediaType.prototype.toString = function toString(){
var str = this.type + ';q='+this.q;
for(var n in this.params){
@@ -69,7 +71,7 @@ define([], function () {
}
}
return str;
- }
+ };
exports.MediaType = MediaType;
// Split a string by character, but ignore quoted parts and backslash-escaped characters
@@ -157,8 +159,8 @@ define([], function () {
else if(a.type!=='*/*' && b.type==='*/*') return -1;
var ac = (a.type||'').split('/');
var bc = (b.type||'').split('/');
- if(ac[0]=='*' && bc[0]!='*') return 1;
- if(ac[0]!='*' && bc[0]=='*') return -1;
+ if(ac[0]==='*' && bc[0]!=='*') return 1;
+ if(ac[0]!=='*' && bc[0]==='*') return -1;
if(a.type!==b.type) return null;
var ap = a.params || {};
var bp = b.params || {};
diff --git a/web-ui/app/js/helpers/iterator.js b/web-ui/app/js/helpers/iterator.js
index 093d8df1..b5b44379 100644
--- a/web-ui/app/js/helpers/iterator.js
+++ b/web-ui/app/js/helpers/iterator.js
@@ -14,6 +14,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
*/
+'use strict';
define(function () {
return Iterator;
@@ -24,7 +25,7 @@ define(function () {
this.elems = elems;
this.hasPrevious = function () {
- return this.index != 0;
+ return this.index !== 0;
};
this.hasNext = function () {
@@ -51,7 +52,7 @@ define(function () {
var removed = this.current(),
toRemove = this.index;
- !this.hasNext() && this.index--;
+ if(!this.hasNext()) { this.index--; }
this.elems.remove(toRemove);
return removed;
};
diff --git a/web-ui/app/js/helpers/view_helper.js b/web-ui/app/js/helpers/view_helper.js
index a9a10378..841a1077 100644
--- a/web-ui/app/js/helpers/view_helper.js
+++ b/web-ui/app/js/helpers/view_helper.js
@@ -79,9 +79,9 @@ define(
}
function moveCaretToEnd(el) {
- if (typeof el.selectionStart == "number") {
+ if (typeof el.selectionStart === 'number') {
el.selectionStart = el.selectionEnd = el.value.length;
- } else if (typeof el.createTextRange != "undefined") {
+ } else if (typeof el.createTextRange !== 'undefined') {
el.focus();
var range = el.createTextRange();
range.collapse(false);
@@ -92,7 +92,7 @@ define(
function fixedSizeNumber(num, size) {
var res = num.toString();
while(res.length < size) {
- res = "0" + res;
+ res = '0' + res;
}
return res;
}
@@ -100,9 +100,9 @@ define(
function getFormattedDate(date){
var today = createTodayDate();
if (date.getTime() > today.getTime()) {
- return fixedSizeNumber(date.getHours(), 2) + ":" + fixedSizeNumber(date.getMinutes(), 2);
+ return fixedSizeNumber(date.getHours(), 2) + ':' + fixedSizeNumber(date.getMinutes(), 2);
} else {
- return "" + date.getFullYear() + "-" + fixedSizeNumber(date.getMonth() + 1, 2) + "-" + fixedSizeNumber(date.getDate(), 2);
+ return '' + date.getFullYear() + '-' + fixedSizeNumber(date.getMonth() + 1, 2) + '-' + fixedSizeNumber(date.getDate(), 2);
}
}
diff --git a/web-ui/app/js/lib/html_whitelister.js b/web-ui/app/js/lib/html_whitelister.js
index 892efb2b..849427e1 100644
--- a/web-ui/app/js/lib/html_whitelister.js
+++ b/web-ui/app/js/lib/html_whitelister.js
@@ -63,10 +63,10 @@ define(['lib/html-sanitizer'], function (htmlSanitizer) {
attributesAndValues.push(attributes[i]);
attributesAndValues.push(attributes[i+1]);
}
- };
+ }
return attributesAndValues;
- };
+ }
function tagPolicy (tagName, attributes) {
if (!tagAndAttributeWhitelist[tagName]) {
diff --git a/web-ui/app/js/mail_list/ui/mail_item_factory.js b/web-ui/app/js/mail_list/ui/mail_item_factory.js
index d7b10e9b..e922a642 100644
--- a/web-ui/app/js/mail_list/ui/mail_item_factory.js
+++ b/web-ui/app/js/mail_list/ui/mail_item_factory.js
@@ -14,6 +14,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
*/
+/* global _ */
'use strict';
define(
@@ -50,12 +51,12 @@ define(
var detectMailType = function(mail) {
if(_.include(mail.tags, 'drafts')) {
- return MAIL_ITEM_TYPE['drafts'];
+ return MAIL_ITEM_TYPE.drafts;
} else if(_.include(mail.tags, 'sent')) {
- return MAIL_ITEM_TYPE['sent'];
+ return MAIL_ITEM_TYPE.sent;
} else {
return GenericMailItem;
- };
+ }
};
return {
diff --git a/web-ui/app/js/mail_list/ui/mail_items/generic_mail_item.js b/web-ui/app/js/mail_list/ui/mail_items/generic_mail_item.js
index 631f1a32..3d426447 100644
--- a/web-ui/app/js/mail_list/ui/mail_items/generic_mail_item.js
+++ b/web-ui/app/js/mail_list/ui/mail_items/generic_mail_item.js
@@ -88,7 +88,7 @@ define(
var mailItemHtml = templates.mails.single(this.attr);
this.$node.html(mailItemHtml);
this.$node.addClass(this.attr.statuses);
- this.attr.selected && this.select();
+ if(this.attr.selected) { this.select(); }
this.on(this.$node.find('a'), 'click', this.triggerOpenMail);
};
diff --git a/web-ui/app/js/mail_list/ui/mail_items/sent_item.js b/web-ui/app/js/mail_list/ui/mail_items/sent_item.js
index 702e14b6..eeaa845f 100644
--- a/web-ui/app/js/mail_list/ui/mail_items/sent_item.js
+++ b/web-ui/app/js/mail_list/ui/mail_items/sent_item.js
@@ -31,7 +31,7 @@ define(
function sentItem() {
function isOpeningOnANewTab(ev) {
- return ev.metaKey || ev.ctrlKey || ev.which == 2;
+ return ev.metaKey || ev.ctrlKey || ev.which === 2;
}
this.triggerOpenMail = function (ev) {
@@ -55,7 +55,7 @@ define(
var mailItemHtml = templates.mails.sent(this.attr);
this.$node.html(mailItemHtml);
this.$node.addClass(this.attr.statuses);
- this.attr.selected && this.select();
+ if(this.attr.selected) { this.select(); }
this.on(this.$node.find('a'), 'click', this.triggerOpenMail);
};
diff --git a/web-ui/app/js/mail_list_actions/ui/pagination_trigger.js b/web-ui/app/js/mail_list_actions/ui/pagination_trigger.js
index 3bcd65ce..f9d531a4 100644
--- a/web-ui/app/js/mail_list_actions/ui/pagination_trigger.js
+++ b/web-ui/app/js/mail_list_actions/ui/pagination_trigger.js
@@ -30,7 +30,7 @@ define(
this.defaultAttrs({
previous: '#left-arrow',
next: '#right-arrow',
- currentPage: "#current-page"
+ currentPage: '#current-page'
});
this.renderWithPageNumber = function(pageNumber) {
diff --git a/web-ui/app/js/mail_view/ui/mail_view.js b/web-ui/app/js/mail_view/ui/mail_view.js
index f8fb9318..bda0c4a9 100644
--- a/web-ui/app/js/mail_view/ui/mail_view.js
+++ b/web-ui/app/js/mail_view/ui/mail_view.js
@@ -54,12 +54,14 @@ define(
var date = new Date(data.mail.header.date);
data.mail.header.formattedDate = viewHelpers.getFormattedDate(date);
+ var signed, encrypted;
+
data.mail.security_casing = data.mail.security_casing || {};
if(features.isEnabled('signatureStatus')) {
- var signed = this.checkSigned(data.mail);
+ signed = this.checkSigned(data.mail);
}
if(features.isEnabled('encryptionStatus')) {
- var encrypted = this.checkEncrypted(data.mail);
+ encrypted = this.checkEncrypted(data.mail);
}
this.$node.html(templates.mails.fullView({
diff --git a/web-ui/app/js/mail_view/ui/recipients/recipients_iterator.js b/web-ui/app/js/mail_view/ui/recipients/recipients_iterator.js
index 19f8dea9..5253d915 100644
--- a/web-ui/app/js/mail_view/ui/recipients/recipients_iterator.js
+++ b/web-ui/app/js/mail_view/ui/recipients/recipients_iterator.js
@@ -14,6 +14,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
*/
+/*global _ */
+'use strict';
define(['helpers/iterator'], function (Iterator) {
return RecipientsIterator;
@@ -47,7 +49,7 @@ define(['helpers/iterator'], function (Iterator) {
this.iterator.removeCurrent().destroy();
if (this.iterator.hasElements()) {
- this.iterator.current().select()
+ this.iterator.current().select();
} else {
this.input.focus();
}
diff --git a/web-ui/app/js/mixins/with_feature_toggle.js b/web-ui/app/js/mixins/with_feature_toggle.js
index 1b364457..7336b74a 100644
--- a/web-ui/app/js/mixins/with_feature_toggle.js
+++ b/web-ui/app/js/mixins/with_feature_toggle.js
@@ -14,6 +14,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
*/
+/* global _ */
+'use strict';
define(['features'],
function(features) {
diff --git a/web-ui/app/js/mixins/with_hide_and_show.js b/web-ui/app/js/mixins/with_hide_and_show.js
index 7c2a92c4..c8902f61 100644
--- a/web-ui/app/js/mixins/with_hide_and_show.js
+++ b/web-ui/app/js/mixins/with_hide_and_show.js
@@ -15,6 +15,7 @@
* along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
*/
define(function(require) {
+ 'use strict';
function withHideAndShow() {
this.hide = function () {
diff --git a/web-ui/app/js/mixins/with_mail_edit_base.js b/web-ui/app/js/mixins/with_mail_edit_base.js
index 2882758c..181af736 100644
--- a/web-ui/app/js/mixins/with_mail_edit_base.js
+++ b/web-ui/app/js/mixins/with_mail_edit_base.js
@@ -59,9 +59,9 @@ define(
};
function thereAreRecipientsToDisplay() {
- return this.attr.recipientValues.to
- && this.attr.recipientValues.cc
- && !_.isEmpty(this.attr.recipientValues.to.concat(this.attr.recipientValues.cc));
+ return this.attr.recipientValues.to &&
+ this.attr.recipientValues.cc &&
+ !_.isEmpty(this.attr.recipientValues.to.concat(this.attr.recipientValues.cc));
}
this.render = function(template, context) {
diff --git a/web-ui/app/js/mixins/with_mail_tagging.js b/web-ui/app/js/mixins/with_mail_tagging.js
index 6ea047ed..f5bd7840 100644
--- a/web-ui/app/js/mixins/with_mail_tagging.js
+++ b/web-ui/app/js/mixins/with_mail_tagging.js
@@ -15,6 +15,9 @@
* along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
*/
/*global Bloodhound */
+/*global _ */
+/*global Handlebars */
+'use strict';
define(
['page/events', 'features'],
function (events, features) {
@@ -63,7 +66,7 @@ define(
this.after('displayMail', function () {
this.on(this.select('newTagInput'), 'typeahead:selected typeahead:autocompleted', this.createNewTag);
});
- };
+ }
return withMailTagging;
}
diff --git a/web-ui/app/js/page/pane_contract_expand.js b/web-ui/app/js/page/pane_contract_expand.js
index fdea3db6..153e38e5 100644
--- a/web-ui/app/js/page/pane_contract_expand.js
+++ b/web-ui/app/js/page/pane_contract_expand.js
@@ -43,7 +43,7 @@ define(['flight/lib/component', 'page/events'], function (describeComponent, eve
this.on(document, events.dispatchers.rightPane.openComposeBox, this.contractMiddlePaneExpandRightPane);
this.on(document, events.dispatchers.rightPane.openDraft, this.contractMiddlePaneExpandRightPane);
this.on(document, events.dispatchers.rightPane.openNoMessageSelected, this.expandMiddlePaneContractRightPane);
- this.expandMiddlePaneContractRightPane()
+ this.expandMiddlePaneContractRightPane();
});
}
diff --git a/web-ui/app/js/page/router.js b/web-ui/app/js/page/router.js
index 28f654bc..9b2516b0 100644
--- a/web-ui/app/js/page/router.js
+++ b/web-ui/app/js/page/router.js
@@ -23,7 +23,7 @@ define(['flight/lib/component', 'page/events', 'page/router/url_params'], functi
});
function createHash(data) {
- var hash = "/#/" + data.tag;
+ var hash = '/#/' + data.tag;
if (!_.isUndefined(data.mailIdent)) {
hash += '/mail/' + data.mailIdent;
}
diff --git a/web-ui/app/js/page/router/url_params.js b/web-ui/app/js/page/router/url_params.js
index 4048b802..3e999ecc 100644
--- a/web-ui/app/js/page/router/url_params.js
+++ b/web-ui/app/js/page/router/url_params.js
@@ -15,6 +15,7 @@
* along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
*/
define([], function () {
+ 'use strict';
function defaultTag() {
return 'inbox';
diff --git a/web-ui/app/js/search/search_trigger.js b/web-ui/app/js/search/search_trigger.js
index e64d8477..8f5bbb86 100644
--- a/web-ui/app/js/search/search_trigger.js
+++ b/web-ui/app/js/search/search_trigger.js
@@ -55,8 +55,7 @@ define(
};
this.clearInput = function(event, data) {
- if (!data.skipMailListRefresh)
- this.select('input').val('');
+ if (!data.skipMailListRefresh) { this.select('input').val(''); }
};
this.showOnlySearchTerms = function(event){
diff --git a/web-ui/app/js/services/mail_service.js b/web-ui/app/js/services/mail_service.js
index 35e6a39b..2e877a2c 100644
--- a/web-ui/app/js/services/mail_service.js
+++ b/web-ui/app/js/services/mail_service.js
@@ -62,7 +62,7 @@ define(
})
.fail(function (resp) {
var msg = i18n('Could not update mail tags');
- if(resp.status == 403) {
+ if(resp.status === 403) {
msg = i18n('Invalid tag name');
}
that.trigger(document, events.ui.userAlerts.displayMessage, { message: msg });
diff --git a/web-ui/app/js/services/model/mail.js b/web-ui/app/js/services/model/mail.js
index 18a8ec2f..373eb683 100644
--- a/web-ui/app/js/services/model/mail.js
+++ b/web-ui/app/js/services/model/mail.js
@@ -113,7 +113,7 @@ define(['helpers/contenttype'],
bodyParts = _.reject(bodyParts, function(bodyPart) { return _.isEmpty(bodyPart.trim()); });
return _.map(bodyParts, parseWithHeaders);
- };
+ }
function getMailMediaType () {
return new contentType.MediaType(this.header.content_type);
diff --git a/web-ui/app/js/style_guide/main.js b/web-ui/app/js/style_guide/main.js
index 8dc2b949..170d1187 100644
--- a/web-ui/app/js/style_guide/main.js
+++ b/web-ui/app/js/style_guide/main.js
@@ -14,13 +14,15 @@
* You should have received a copy of the GNU Affero General Public License
* along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
*/
+'use strict';
+
$(document).ready(function(){
$('a[href*=#]').click(function() {
- if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
- && location.hostname == this.hostname) {
+ if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\//,'') &&
+ location.hostname === this.hostname) {
var $target = $(this.hash);
- $target = $target.length && $target
- || $('[name=' + this.hash.slice(1) +']');
+ $target = $target.length && $target ||
+ $('[name=' + this.hash.slice(1) +']');
if ($target.length) {
var targetOffset = $target.offset().top;
$('html,body')
diff --git a/web-ui/app/js/tags/ui/tag.js b/web-ui/app/js/tags/ui/tag.js
index 031a1cba..c2b7f588 100644
--- a/web-ui/app/js/tags/ui/tag.js
+++ b/web-ui/app/js/tags/ui/tag.js
@@ -42,7 +42,7 @@ define(
this.viewFor = function (tag, template) {
return template({
- tagName: tag.default ? i18n("tags." + tag.name) : tag.name,
+ tagName: tag.default ? i18n('tags.' + tag.name) : tag.name,
ident: tag.ident,
count: this.badgeType(tag) === 'total' ? tag.counts.total : (tag.counts.total - tag.counts.read),
displayBadge: this.displayBadge(tag),
@@ -64,7 +64,8 @@ define(
};
this.selectTag = function (ev, data) {
- data.tag === this.attr.tag.name ? this.doSelect(data) : this.doUnselect();
+ if(data.tag === this.attr.tag.name) { this.doSelect(data); }
+ else { this.doUnselect(); }
};
this.doUnselect = function () {
diff --git a/web-ui/app/js/tags/ui/tag_base.js b/web-ui/app/js/tags/ui/tag_base.js
index eaf8a3d5..9b2a06a9 100644
--- a/web-ui/app/js/tags/ui/tag_base.js
+++ b/web-ui/app/js/tags/ui/tag_base.js
@@ -15,6 +15,7 @@
* along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
*/
define(['views/i18n', 'page/events'], function(i18n, events) {
+ 'use strict';
function tagBase() {
var ALWAYS_HIDE_BADGE_FOR = ['sent', 'trash', 'all'];
diff --git a/web-ui/app/js/tags/ui/tag_shortcut.js b/web-ui/app/js/tags/ui/tag_shortcut.js
index 9ec03eae..5710592e 100644
--- a/web-ui/app/js/tags/ui/tag_shortcut.js
+++ b/web-ui/app/js/tags/ui/tag_shortcut.js
@@ -14,6 +14,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
*/
+'use strict';
define(
[
'flight/lib/component',
@@ -63,7 +64,8 @@ define(
};
this.selectTag = function (ev, data) {
- data.tag === this.attr.linkTo.name ? this.doSelect() : this.doUnselect();
+ if(data.tag === this.attr.linkTo.name) { this.doSelect(); }
+ else { this.doUnselect(); }
};
this.doUnselect = function () {
diff --git a/web-ui/test/features.js b/web-ui/test/features.js
index be5a62d5..27c47176 100644
--- a/web-ui/test/features.js
+++ b/web-ui/test/features.js
@@ -1,4 +1,5 @@
define([], function() {
+ 'use strict';
return {
isEnabled: function(featureName) {
return true;
diff --git a/web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js b/web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js
index 6c49c1cf..ecb2b854 100644
--- a/web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js
+++ b/web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js
@@ -88,7 +88,6 @@ describeComponent('mail_list/ui/mail_items/generic_mail_item', function () {
});
it('marks the email as read', function () {
- debugger;
var mailReadEvent = spyOnEvent(document, Pixelated.events.mail.read);
var clickEvent = createClickEvent(specialKey);
diff --git a/web-ui/test/spec/mail_view/data/mail_builder.spec.js b/web-ui/test/spec/mail_view/data/mail_builder.spec.js
index bf17d598..7f69098f 100644
--- a/web-ui/test/spec/mail_view/data/mail_builder.spec.js
+++ b/web-ui/test/spec/mail_view/data/mail_builder.spec.js
@@ -1,6 +1,6 @@
define(['mail_view/data/mail_builder'], function (mailBuilder) {
+ 'use strict';
describe('mail builder', function () {
- 'use strict';
it('sets ident if passed to constructor', function() {
var mail = mailBuilder.newMail('12345').build();
@@ -15,15 +15,15 @@ define(['mail_view/data/mail_builder'], function (mailBuilder) {
});
it('sets the subject', function() {
- var mail = mailBuilder.newMail().subject("subject").build();
+ var mail = mailBuilder.newMail().subject('subject').build();
- expect(mail.header.subject).toBe("subject");
+ expect(mail.header.subject).toBe('subject');
});
it('sets the body', function() {
- var mail = mailBuilder.newMail().body("some body text").build();
+ var mail = mailBuilder.newMail().body('some body text').build();
- expect(mail.body).toBe("some body text");
+ expect(mail.body).toBe('some body text');
});
describe('to field', function() {
diff --git a/web-ui/test/spec/mail_view/ui/mail_view.spec.js b/web-ui/test/spec/mail_view/ui/mail_view.spec.js
index 48d7bda2..9fed8275 100644
--- a/web-ui/test/spec/mail_view/ui/mail_view.spec.js
+++ b/web-ui/test/spec/mail_view/ui/mail_view.spec.js
@@ -72,7 +72,7 @@ describeComponent('mail_view/ui/mail_view', function () {
this.component.displayMail({}, testData);
this.component.select('newTagButton').click();
- var e = creatingEvent("keydown", 27);
+ var e = creatingEvent('keydown', 27);
var newTagInputComponent = this.component.select('newTagInput');
var addNewComponent = this.component.select('addNew');
@@ -114,13 +114,13 @@ describeComponent('mail_view/ui/mail_view', function () {
it('assumes that mail is not trusted if its signature contains no_trust from the user', function() {
var email = testData;
- email.security_casing = {imprints: [{seal: {trust: "no_trust", validity: "ultimate"}}]};
+ email.security_casing = {imprints: [{seal: {trust: 'no_trust', validity: 'ultimate'}}]};
expect(this.component.checkSigned(email)).toEqual('signed signature-not-trusted');
});
it('uses validity when trust is not present', function() {
var email = testData;
- email.security_casing = {imprints: [{seal: { validity: "no_trust"}}]};
+ email.security_casing = {imprints: [{seal: { validity: 'no_trust'}}]};
expect(this.component.checkSigned(email)).toEqual('signed signature-not-trusted');
});
@@ -131,8 +131,8 @@ describeComponent('mail_view/ui/mail_view', function () {
});
it('assumes that the mail is not signed if there are no imprints', function() {
- var email = testData
- email.security_casing = {imprints: []}
+ var email = testData;
+ email.security_casing = {imprints: []};
expect(this.component.checkSigned(email)).toEqual('not-signed');
});
@@ -163,7 +163,7 @@ describeComponent('mail_view/ui/mail_view', function () {
it('creates new tag when pressing Enter key on new tag input', function(){
var tagsUpdateEvent = spyOnEvent(document, Pixelated.events.mail.tags.update);
var tagListRefreshEvent = spyOnEvent(document, Pixelated.events.dispatchers.tags.refreshTagList);
- var e = creatingEvent("keydown", 13);
+ var e = creatingEvent('keydown', 13);
this.component.displayMail({}, testData);
this.component.select('newTagButton').click();
diff --git a/web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js b/web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js
index f54781a7..56bb1120 100644
--- a/web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js
+++ b/web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js
@@ -1,5 +1,3 @@
-/* global Pixelated */
-
describeComponent('mail_view/ui/recipients/recipients_input',function () {
'use strict';
@@ -40,12 +38,12 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () {
var enterAddressKeyPressEvent = $.Event('keydown', { which: keycode[0] });
spyOn(enterAddressKeyPressEvent, 'preventDefault');
- this.$node.val('')
+ this.$node.val('');
this.$node.trigger(enterAddressKeyPressEvent);
expect(enterAddressKeyPressEvent.preventDefault).toHaveBeenCalled();
enterAddressKeyPressEvent.preventDefault.reset();
- this.$node.val('anything')
+ this.$node.val('anything');
this.$node.trigger(enterAddressKeyPressEvent);
expect(enterAddressKeyPressEvent.preventDefault).toHaveBeenCalled();
});
diff --git a/web-ui/test/spec/mail_view/ui/recipients/recipients_iterator.spec.js b/web-ui/test/spec/mail_view/ui/recipients/recipients_iterator.spec.js
index 095689c2..74e5c614 100644
--- a/web-ui/test/spec/mail_view/ui/recipients/recipients_iterator.spec.js
+++ b/web-ui/test/spec/mail_view/ui/recipients/recipients_iterator.spec.js
@@ -11,7 +11,7 @@ define(['mail_view/ui/recipients/recipients_iterator'], function (RecipientsIter
exitInput;
function createIterator(elements) {
- return recipientsIterator = new RecipientsIterator({ elements: elements, exitInput: exitInput });
+ return new RecipientsIterator({ elements: elements, exitInput: exitInput });
}
function resetMock(m) {
@@ -98,4 +98,4 @@ define(['mail_view/ui/recipients/recipients_iterator'], function (RecipientsIter
});
-}); \ No newline at end of file
+});
diff --git a/web-ui/test/spec/mail_view/ui/reply_box.spec.js b/web-ui/test/spec/mail_view/ui/reply_box.spec.js
index 0f1550c5..fa229506 100644
--- a/web-ui/test/spec/mail_view/ui/reply_box.spec.js
+++ b/web-ui/test/spec/mail_view/ui/reply_box.spec.js
@@ -37,7 +37,7 @@ describeComponent('mail_view/ui/reply_box', function () {
setupComponent(attrs);
- expect(this.component.attr.recipientValues['to']).toEqual([attrs.mail.header.from]);
+ expect(this.component.attr.recipientValues.to).toEqual([attrs.mail.header.from]);
});
it('should have a subject of Re: <original_message>', function() {
diff --git a/web-ui/test/spec/mail_view/ui/send_button.spec.js b/web-ui/test/spec/mail_view/ui/send_button.spec.js
index 579ce4a3..06f3b003 100644
--- a/web-ui/test/spec/mail_view/ui/send_button.spec.js
+++ b/web-ui/test/spec/mail_view/ui/send_button.spec.js
@@ -1,5 +1,9 @@
+/* global Pixelated */
+
describeComponent('mail_view/ui/send_button', function () {
+ 'use strict';
+
describe('send button', function () {
beforeEach(function () {
setupComponent('<button />');
@@ -81,7 +85,7 @@ describeComponent('mail_view/ui/send_button', function () {
var sendMailEvent = spyOnEvent(document, Pixelated.events.ui.mail.send);
spyOn(this.component, 'off');
- _.times(3, function () { $(document).trigger(Pixelated.events.ui.mail.recipientsUpdated) });;
+ _.times(3, function () { $(document).trigger(Pixelated.events.ui.mail.recipientsUpdated); });
expect(sendMailEvent).toHaveBeenTriggeredOn(document);
expect(this.component.off).toHaveBeenCalledWith(document, Pixelated.events.ui.mail.recipientsUpdated);
diff --git a/web-ui/test/spec/page/router/url_params.spec.js b/web-ui/test/spec/page/router/url_params.spec.js
index a14ba1ba..f05fa8a1 100644
--- a/web-ui/test/spec/page/router/url_params.spec.js
+++ b/web-ui/test/spec/page/router/url_params.spec.js
@@ -1,4 +1,7 @@
+/* global jasmine */
+
require(['page/router/url_params'], function (urlParams) {
+ 'use strict';
describe('urlParams', function () {
@@ -8,7 +11,7 @@ require(['page/router/url_params'], function (urlParams) {
window.onpopstate = function () {};
});
- afterEach(function () {
+ jasmine.afterEach(function () {
document.location.hash = '';
});
diff --git a/web-ui/test/spec/services/model/mail.spec.js b/web-ui/test/spec/services/model/mail.spec.js
index ba91ebde..9b5f71c6 100644
--- a/web-ui/test/spec/services/model/mail.spec.js
+++ b/web-ui/test/spec/services/model/mail.spec.js
@@ -1,6 +1,7 @@
/*global Pixelated */
require(['services/model/mail'], function (Mail) {
+ 'use strict';
var testData;
describe('services/model/mail', function () {
diff --git a/web-ui/test/spec/tags/data/tags.spec.js b/web-ui/test/spec/tags/data/tags.spec.js
index a8b160fd..41821366 100644
--- a/web-ui/test/spec/tags/data/tags.spec.js
+++ b/web-ui/test/spec/tags/data/tags.spec.js
@@ -1,3 +1,5 @@
+/* global Pixelated */
+
describeComponent('tags/data/tags', function () {
'use strict';
diff --git a/web-ui/test/spec/tags/ui/tag_list.spec.js b/web-ui/test/spec/tags/ui/tag_list.spec.js
index 5c33f36e..85cc4509 100644
--- a/web-ui/test/spec/tags/ui/tag_list.spec.js
+++ b/web-ui/test/spec/tags/ui/tag_list.spec.js
@@ -1,3 +1,7 @@
+/* global _ */
+/* global Pixelated */
+/* global jasmine */
+
describeComponent('tags/ui/tag_list', function () {
'use strict';
var tagsShortcutsContainer;
@@ -11,12 +15,12 @@ describeComponent('tags/ui/tag_list', function () {
describe('post initialization', function () {
beforeEach(function () {
setupComponent();
- tagsShortcutsContainer = $('<ul>', { id: "tags-shortcuts" });
+ tagsShortcutsContainer = $('<ul>', { id: 'tags-shortcuts' });
$('body').append(tagsShortcutsContainer);
});
- afterEach(function () {
- $('body')[0].removeChild(tagsShortcutsContainer[0])
+ jasmine.afterEach(function () {
+ $('body')[0].removeChild(tagsShortcutsContainer[0]);
});
it('should render tags when tagsList:load is received', function () {
@@ -83,7 +87,7 @@ describeComponent('tags/ui/tag_list', function () {
var tagList = [tag('tag1', 1, false), tag('tag2', 2, true), tag('tag3', 3, true)];
$(document).trigger(Pixelated.events.ui.tagList.load, {tags: tagList});
- var tagList = [tag('tag1', 1, false), tag('tag2', 2, true)];
+ tagList = [tag('tag1', 1, false), tag('tag2', 2, true)];
$(document).trigger(Pixelated.events.ui.tagList.load, {tags: tagList});
var customTags = _.map(this.component.select('customTagList').find('li'), function (el) {
@@ -101,7 +105,7 @@ describeComponent('tags/ui/tag_list', function () {
var tagList = [tag('inbox', 1, true)];
$(document).trigger(Pixelated.events.ui.tagList.load, {tags: tagList});
- var tagList = [tag('sent', 1, true)];
+ tagList = [tag('sent', 1, true)];
$(document).trigger(Pixelated.events.ui.tagList.load, {tags: tagList});
var shortcuts = _.map($('#tags-shortcuts').find('li'), function (el) {
diff --git a/web-ui/test/spec/tags/ui/tag_shortcut.spec.js b/web-ui/test/spec/tags/ui/tag_shortcut.spec.js
index 862e0d1c..ebc852d0 100644
--- a/web-ui/test/spec/tags/ui/tag_shortcut.spec.js
+++ b/web-ui/test/spec/tags/ui/tag_shortcut.spec.js
@@ -1,4 +1,8 @@
-describeComponent("tags/ui/tag_shortcut", function () {
+/* global jasmine */
+/* global Pixelated */
+
+describeComponent('tags/ui/tag_shortcut', function () {
+ 'use strict';
var parent, shortcut, component, TagShortcut;
@@ -6,13 +10,13 @@ describeComponent("tags/ui/tag_shortcut", function () {
TagShortcut = require('tags/ui/tag_shortcut');
component = jasmine.createSpyObj('tagComponent', ['triggerSelect']);
- parent = $("<ul>");
+ parent = $('<ul>');
$('body').append(parent);
shortcut = TagShortcut.appendedTo(parent, { linkTo: { name: 'inbox', counts: { total: 15 }}, trigger: component });
});
- afterEach(function () {
- $('body')[0].removeChild(parent[0])
+ jasmine.afterEach(function () {
+ $('body')[0].removeChild(parent[0]);
});
it('renders the shortcut inside the parent', function () {
@@ -24,11 +28,11 @@ describeComponent("tags/ui/tag_shortcut", function () {
it('selects and unselect on tag.select', function () {
$(document).trigger(Pixelated.events.ui.tag.select, { tag: 'inbox'});
- expect(shortcut.$node).toHaveClass("selected");
+ expect(shortcut.$node).toHaveClass('selected');
$(document).trigger(Pixelated.events.ui.tag.select, { tag: 'sent'});
- expect(shortcut.$node).not.toHaveClass("selected");
+ expect(shortcut.$node).not.toHaveClass('selected');
});
it('delegates the click to linked tag', function (){
diff --git a/web-ui/test/spec/user_alerts/ui/user_alerts.spec.js b/web-ui/test/spec/user_alerts/ui/user_alerts.spec.js
index 42ef581c..04d0e9d4 100644
--- a/web-ui/test/spec/user_alerts/ui/user_alerts.spec.js
+++ b/web-ui/test/spec/user_alerts/ui/user_alerts.spec.js
@@ -1,3 +1,5 @@
+/* global Pixelated */
+
describeComponent('user_alerts/ui/user_alerts', function () {
'use strict';
@@ -13,9 +15,9 @@ describeComponent('user_alerts/ui/user_alerts', function () {
it('should be emptied and hidden when hide is called', function() {
expect(this.$node).not.toBeHidden();
- this.component.hide()
+ this.component.hide();
expect(this.$node).toBeHidden();
- expect(this.$node.html()).toEqual('')
+ expect(this.$node.html()).toEqual('');
});
diff --git a/web-ui/test/test-main.js b/web-ui/test/test-main.js
index fc82e49f..4a77a657 100644
--- a/web-ui/test/test-main.js
+++ b/web-ui/test/test-main.js
@@ -37,10 +37,10 @@ requirejs.config({
callback: function () {
require(['page/events','test/test_data', 'views/i18n', 'monkey_patching/array', 'views/recipientListFormatter'], function (events, testData, i18n, mp, recipientListFormatter) {
- window['Pixelated'] = window['Pixelated'] || {};
- window['Pixelated'].events = events;
- window['Pixelated'].testData = testData;
- window['Pixelated'].mockBloodhound = function() {
+ window.Pixelated = window.Pixelated || {};
+ window.Pixelated.events = events;
+ window.Pixelated.testData = testData;
+ window.Pixelated.mockBloodhound = function() {
window.Bloodhound = function() {};
window.Bloodhound.prototype.initialize = function() {};
window.Bloodhound.prototype.ttAdapter = function() {};