From 6299531f4c8f7daa1b4afab45d0439f635b03982 Mon Sep 17 00:00:00 2001 From: Bruno Wagner Date: Tue, 7 Oct 2014 15:01:42 +0200 Subject: Fixed jshint errors --- web-ui/.jshintrc | 7 +++-- .../app/js/dispatchers/middle_pane_dispatcher.js | 2 +- web-ui/app/js/features/features.js | 2 ++ web-ui/app/js/foundation/off_canvas.js | 1 + web-ui/app/js/helpers/contenttype.js | 32 ++++++++++++---------- web-ui/app/js/helpers/iterator.js | 5 ++-- web-ui/app/js/helpers/view_helper.js | 10 +++---- web-ui/app/js/lib/html_whitelister.js | 4 +-- web-ui/app/js/mail_list/ui/mail_item_factory.js | 7 +++-- .../mail_list/ui/mail_items/generic_mail_item.js | 2 +- web-ui/app/js/mail_list/ui/mail_items/sent_item.js | 4 +-- .../js/mail_list_actions/ui/pagination_trigger.js | 2 +- web-ui/app/js/mail_view/ui/mail_view.js | 6 ++-- .../mail_view/ui/recipients/recipients_iterator.js | 4 ++- web-ui/app/js/mixins/with_feature_toggle.js | 2 ++ web-ui/app/js/mixins/with_hide_and_show.js | 1 + web-ui/app/js/mixins/with_mail_edit_base.js | 6 ++-- web-ui/app/js/mixins/with_mail_tagging.js | 5 +++- web-ui/app/js/page/pane_contract_expand.js | 2 +- web-ui/app/js/page/router.js | 2 +- web-ui/app/js/page/router/url_params.js | 1 + web-ui/app/js/search/search_trigger.js | 3 +- web-ui/app/js/services/mail_service.js | 2 +- web-ui/app/js/services/model/mail.js | 2 +- web-ui/app/js/style_guide/main.js | 10 ++++--- web-ui/app/js/tags/ui/tag.js | 5 ++-- web-ui/app/js/tags/ui/tag_base.js | 1 + web-ui/app/js/tags/ui/tag_shortcut.js | 4 ++- web-ui/test/features.js | 1 + .../ui/mail_items/generic_mail_item.spec.js | 1 - .../test/spec/mail_view/data/mail_builder.spec.js | 10 +++---- web-ui/test/spec/mail_view/ui/mail_view.spec.js | 12 ++++---- .../ui/recipients/recipients_input.spec.js | 6 ++-- .../ui/recipients/recipients_iterator.spec.js | 4 +-- web-ui/test/spec/mail_view/ui/reply_box.spec.js | 2 +- web-ui/test/spec/mail_view/ui/send_button.spec.js | 6 +++- web-ui/test/spec/page/router/url_params.spec.js | 5 +++- web-ui/test/spec/services/model/mail.spec.js | 1 + web-ui/test/spec/tags/data/tags.spec.js | 2 ++ web-ui/test/spec/tags/ui/tag_list.spec.js | 14 ++++++---- web-ui/test/spec/tags/ui/tag_shortcut.spec.js | 16 +++++++---- .../test/spec/user_alerts/ui/user_alerts.spec.js | 6 ++-- web-ui/test/test-main.js | 8 +++--- 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 . */ +/* 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 . */ +'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 . */ +'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. */ +'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 . */ +/* 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 . */ +/*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 . */ +/* 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 . */ 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 . */ /*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 . */ 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 . */ +'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 . */ 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 . */ +'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: ', 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('