From 6f6f8a338ec460aea761de320aaccc25b0eb2d42 Mon Sep 17 00:00:00 2001 From: Alexandre Pretto Nunes Date: Mon, 12 Jan 2015 20:08:00 -0200 Subject: Improve jshint configuration --- web-ui/.jshintignore | 4 ++++ web-ui/.jshintrc | 13 ++++++------- web-ui/app/js/dispatchers/right_pane_dispatcher.js | 1 - web-ui/app/js/features/features.js | 2 +- web-ui/app/js/helpers/monitored_ajax.js | 1 - web-ui/app/js/lib/html_whitelister.js | 1 - web-ui/app/js/mail_list/ui/mail_item_factory.js | 1 - .../app/js/mail_list/ui/mail_items/draft_item.js | 1 - .../mail_list/ui/mail_items/generic_mail_item.js | 1 - web-ui/app/js/mail_list/ui/mail_items/mail_item.js | 1 - web-ui/app/js/mail_list/ui/mail_items/sent_item.js | 1 - web-ui/app/js/mail_list/ui/mail_list.js | 1 - .../js/mail_list/ui/mail_syncing_progress_bar.js | 1 - web-ui/app/js/mail_view/data/mail_builder.js | 1 - web-ui/app/js/mail_view/ui/forward_box.js | 2 -- web-ui/app/js/mail_view/ui/mail_actions.js | 2 -- web-ui/app/js/mail_view/ui/mail_view.js | 6 +----- .../app/js/mail_view/ui/recipients/recipients.js | 1 - .../js/mail_view/ui/recipients/recipients_input.js | 2 -- .../mail_view/ui/recipients/recipients_iterator.js | 2 +- web-ui/app/js/mail_view/ui/reply_box.js | 2 -- web-ui/app/js/mail_view/ui/send_button.js | 1 - web-ui/app/js/mixins/with_auto_refresh.js | 2 -- web-ui/app/js/mixins/with_compose_inline.js | 1 - .../app/js/mixins/with_enable_disable_on_event.js | 2 -- web-ui/app/js/mixins/with_feature_toggle.js | 2 +- web-ui/app/js/mixins/with_mail_edit_base.js | 1 - web-ui/app/js/mixins/with_mail_tagging.js | 4 +--- web-ui/app/js/search/results_highlighter.js | 2 -- web-ui/app/js/search/search_trigger.js | 2 -- web-ui/app/js/services/delete_service.js | 1 - web-ui/app/js/services/mail_service.js | 2 -- web-ui/app/js/services/model/mail.js | 1 - web-ui/app/js/tags/ui/tag.js | 1 - web-ui/app/js/views/i18n.js | 2 -- web-ui/app/js/views/recipientListFormatter.js | 1 - web-ui/app/js/views/templates.js | 1 - web-ui/package.json | 2 +- web-ui/test/custom_matchers.js | 22 ++++++++++++---------- .../spec/dispatchers/left_pane_dispatcher.spec.js | 2 -- .../dispatchers/middle_pane_dispatchers.spec.js | 2 -- .../spec/dispatchers/right_pane_dispatcher.spec.js | 3 --- web-ui/test/spec/helpers/view_helper.spec.js | 2 -- .../spec/mail_list/ui/mail_items/mail_item.spec.js | 2 -- web-ui/test/spec/mail_list/ui/mail_list.spec.js | 3 --- .../test/spec/mail_view/data/mail_sender.spec.js | 2 -- web-ui/test/spec/mail_view/ui/compose_box.spec.js | 3 --- web-ui/test/spec/mail_view/ui/forward_box.spec.js | 3 --- web-ui/test/spec/mail_view/ui/mail_actions.spec.js | 2 -- web-ui/test/spec/mail_view/ui/mail_view.spec.js | 2 -- .../ui/recipients/recipients_input.spec.js | 12 ++++++------ web-ui/test/spec/mail_view/ui/reply_box.spec.js | 3 --- .../test/spec/mail_view/ui/reply_section.spec.js | 3 --- .../test/spec/mixins/with_mail_edit_base.spec.js | 5 ----- web-ui/test/spec/page/logout.spec.js | 2 -- web-ui/test/spec/page/pane_contract_expand.spec.js | 3 --- web-ui/test/spec/page/router.spec.js | 2 -- web-ui/test/spec/search/search_trigger.spec.js | 3 --- web-ui/test/spec/services/delete_service.spec.js | 3 --- web-ui/test/spec/services/mail_service.spec.js | 4 +--- web-ui/test/spec/services/model/mail.spec.js | 2 -- web-ui/test/spec/tags/ui/tag.spec.js | 2 -- web-ui/test/spec/tags/ui/tag_list.spec.js | 4 ---- web-ui/test/test_data.js | 1 - 64 files changed, 35 insertions(+), 137 deletions(-) create mode 100644 web-ui/.jshintignore diff --git a/web-ui/.jshintignore b/web-ui/.jshintignore new file mode 100644 index 00000000..6a32b1a4 --- /dev/null +++ b/web-ui/.jshintignore @@ -0,0 +1,4 @@ +app/node_modules +app/bower_components +app/js/lib +app/js/generated diff --git a/web-ui/.jshintrc b/web-ui/.jshintrc index 210e9d99..c56e2bd2 100644 --- a/web-ui/.jshintrc +++ b/web-ui/.jshintrc @@ -19,20 +19,19 @@ "trailing": true, "undef": false, "validthis": true, + "jasmine": true, "predef": [ "$", "jQuery", - "before", - "beforeEach", "define", - "describe", "describeComponent", "describeMixin", - "expect", - "it", "requirejs", "setupComponent", - "spyOn", - "spyOnEvent" + "spyOnEvent", + "_", + "Pixelated", + "Handlebars", + "Bloodhound" ] } diff --git a/web-ui/app/js/dispatchers/right_pane_dispatcher.js b/web-ui/app/js/dispatchers/right_pane_dispatcher.js index 77d578e0..8de89858 100644 --- a/web-ui/app/js/dispatchers/right_pane_dispatcher.js +++ b/web-ui/app/js/dispatchers/right_pane_dispatcher.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global Pixelated */ define( [ diff --git a/web-ui/app/js/features/features.js b/web-ui/app/js/features/features.js index 04e1fa63..9c791ccd 100644 --- a/web-ui/app/js/features/features.js +++ b/web-ui/app/js/features/features.js @@ -14,8 +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/monitored_ajax'], function(monitoredAjax) { var cachedDisabledFeatures; var cachedDispatcherFeatures; diff --git a/web-ui/app/js/helpers/monitored_ajax.js b/web-ui/app/js/helpers/monitored_ajax.js index c8c74d3e..0f851c7a 100644 --- a/web-ui/app/js/helpers/monitored_ajax.js +++ b/web-ui/app/js/helpers/monitored_ajax.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ define(['page/events', 'views/i18n'], function (events, i18n) { diff --git a/web-ui/app/js/lib/html_whitelister.js b/web-ui/app/js/lib/html_whitelister.js index 849427e1..b08354a2 100644 --- a/web-ui/app/js/lib/html_whitelister.js +++ b/web-ui/app/js/lib/html_whitelister.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ 'use strict'; 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 8eedcde3..e7e52cc2 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,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/* global _ */ 'use strict'; define( diff --git a/web-ui/app/js/mail_list/ui/mail_items/draft_item.js b/web-ui/app/js/mail_list/ui/mail_items/draft_item.js index f09add73..a2da917f 100644 --- a/web-ui/app/js/mail_list/ui/mail_items/draft_item.js +++ b/web-ui/app/js/mail_list/ui/mail_items/draft_item.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ define( [ 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 1117d44d..3931ffd8 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 @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ define( [ diff --git a/web-ui/app/js/mail_list/ui/mail_items/mail_item.js b/web-ui/app/js/mail_list/ui/mail_items/mail_item.js index 6d37a227..94f08a9f 100644 --- a/web-ui/app/js/mail_list/ui/mail_items/mail_item.js +++ b/web-ui/app/js/mail_list/ui/mail_items/mail_item.js @@ -64,7 +64,6 @@ define( this.render = function () { this.attr.tagsForListView = _.without(this.attr.tags, this.attr.tag); - debugger; var mailItemHtml = templates.mails[this.attr.templateType](this.attr); this.$node.html(mailItemHtml); this.$node.addClass(this.attr.statuses); 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 7406b3f3..3e2e2723 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 @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ define( [ diff --git a/web-ui/app/js/mail_list/ui/mail_list.js b/web-ui/app/js/mail_list/ui/mail_list.js index 539670ab..c2746c88 100644 --- a/web-ui/app/js/mail_list/ui/mail_list.js +++ b/web-ui/app/js/mail_list/ui/mail_list.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ define( [ diff --git a/web-ui/app/js/mail_list/ui/mail_syncing_progress_bar.js b/web-ui/app/js/mail_list/ui/mail_syncing_progress_bar.js index 9cdcc5dc..8d4eebb5 100644 --- a/web-ui/app/js/mail_list/ui/mail_syncing_progress_bar.js +++ b/web-ui/app/js/mail_list/ui/mail_syncing_progress_bar.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ define( [ diff --git a/web-ui/app/js/mail_view/data/mail_builder.js b/web-ui/app/js/mail_view/data/mail_builder.js index 8f57e038..74e38057 100644 --- a/web-ui/app/js/mail_view/data/mail_builder.js +++ b/web-ui/app/js/mail_view/data/mail_builder.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ define(['services/model/mail'], function (mailModel) { 'use strict'; diff --git a/web-ui/app/js/mail_view/ui/forward_box.js b/web-ui/app/js/mail_view/ui/forward_box.js index 949b1b06..fe748365 100644 --- a/web-ui/app/js/mail_view/ui/forward_box.js +++ b/web-ui/app/js/mail_view/ui/forward_box.js @@ -14,8 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global Pixelated */ -/*global _ */ define( [ diff --git a/web-ui/app/js/mail_view/ui/mail_actions.js b/web-ui/app/js/mail_view/ui/mail_actions.js index 278b703b..65cd0aaa 100644 --- a/web-ui/app/js/mail_view/ui/mail_actions.js +++ b/web-ui/app/js/mail_view/ui/mail_actions.js @@ -14,8 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global Pixelated */ -/*global _ */ define( [ 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 1d3fa173..66b33748 100644 --- a/web-ui/app/js/mail_view/ui/mail_view.js +++ b/web-ui/app/js/mail_view/ui/mail_view.js @@ -14,12 +14,8 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global Pixelated */ -/*global _ */ -/*global Bloodhound */ 'use strict'; - define( [ 'flight/lib/component', @@ -64,7 +60,7 @@ define( encrypted = this.checkEncrypted(data.mail); } - var attachments = _.map(data.mail.attachments, function(a){ + var attachments = _.map(data.mail.attachments, function(a){ return { 'encoding': a.headers['Content-Transfer-Encoding'], 'name': a.name, 'ident': a.ident }; }); diff --git a/web-ui/app/js/mail_view/ui/recipients/recipients.js b/web-ui/app/js/mail_view/ui/recipients/recipients.js index 83761810..d2a5160d 100644 --- a/web-ui/app/js/mail_view/ui/recipients/recipients.js +++ b/web-ui/app/js/mail_view/ui/recipients/recipients.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ define( [ diff --git a/web-ui/app/js/mail_view/ui/recipients/recipients_input.js b/web-ui/app/js/mail_view/ui/recipients/recipients_input.js index c1c32d77..11c1468c 100644 --- a/web-ui/app/js/mail_view/ui/recipients/recipients_input.js +++ b/web-ui/app/js/mail_view/ui/recipients/recipients_input.js @@ -14,8 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _*/ -/*global Bloodhound */ 'use strict'; define([ 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 38f18d61..6c52c52e 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,7 +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(['helpers/iterator'], function (Iterator) { diff --git a/web-ui/app/js/mail_view/ui/reply_box.js b/web-ui/app/js/mail_view/ui/reply_box.js index cd03a698..ba306d7f 100644 --- a/web-ui/app/js/mail_view/ui/reply_box.js +++ b/web-ui/app/js/mail_view/ui/reply_box.js @@ -14,8 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global Pixelated */ -/*global _ */ define( [ diff --git a/web-ui/app/js/mail_view/ui/send_button.js b/web-ui/app/js/mail_view/ui/send_button.js index f3df3739..8f168ecc 100644 --- a/web-ui/app/js/mail_view/ui/send_button.js +++ b/web-ui/app/js/mail_view/ui/send_button.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ 'use strict'; define([ diff --git a/web-ui/app/js/mixins/with_auto_refresh.js b/web-ui/app/js/mixins/with_auto_refresh.js index f01903e0..c75fda45 100644 --- a/web-ui/app/js/mixins/with_auto_refresh.js +++ b/web-ui/app/js/mixins/with_auto_refresh.js @@ -14,8 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global Pixelated */ -/*global _ */ define(['features'], function (features) { diff --git a/web-ui/app/js/mixins/with_compose_inline.js b/web-ui/app/js/mixins/with_compose_inline.js index b0a49cc7..cd5dcd8b 100644 --- a/web-ui/app/js/mixins/with_compose_inline.js +++ b/web-ui/app/js/mixins/with_compose_inline.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ define( [ diff --git a/web-ui/app/js/mixins/with_enable_disable_on_event.js b/web-ui/app/js/mixins/with_enable_disable_on_event.js index eea7f091..5b28a67b 100644 --- a/web-ui/app/js/mixins/with_enable_disable_on_event.js +++ b/web-ui/app/js/mixins/with_enable_disable_on_event.js @@ -14,8 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global Pixelated */ -/*global _ */ define([], function () { diff --git a/web-ui/app/js/mixins/with_feature_toggle.js b/web-ui/app/js/mixins/with_feature_toggle.js index 7336b74a..b286cc48 100644 --- a/web-ui/app/js/mixins/with_feature_toggle.js +++ b/web-ui/app/js/mixins/with_feature_toggle.js @@ -14,7 +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(['features'], function(features) { 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 2af5fefa..3332da91 100644 --- a/web-ui/app/js/mixins/with_mail_edit_base.js +++ b/web-ui/app/js/mixins/with_mail_edit_base.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ define( [ diff --git a/web-ui/app/js/mixins/with_mail_tagging.js b/web-ui/app/js/mixins/with_mail_tagging.js index 62ca7627..8e27d672 100644 --- a/web-ui/app/js/mixins/with_mail_tagging.js +++ b/web-ui/app/js/mixins/with_mail_tagging.js @@ -14,9 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global Bloodhound */ -/*global _ */ -/*global Handlebars */ + 'use strict'; define( ['page/events', 'features'], diff --git a/web-ui/app/js/search/results_highlighter.js b/web-ui/app/js/search/results_highlighter.js index 5a644381..4a4a8eca 100644 --- a/web-ui/app/js/search/results_highlighter.js +++ b/web-ui/app/js/search/results_highlighter.js @@ -14,8 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global Pixelated */ -/*global _ */ define( [ diff --git a/web-ui/app/js/search/search_trigger.js b/web-ui/app/js/search/search_trigger.js index 9f2dd45e..b43cef0f 100644 --- a/web-ui/app/js/search/search_trigger.js +++ b/web-ui/app/js/search/search_trigger.js @@ -14,8 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ -/*global Pixelated */ define( [ diff --git a/web-ui/app/js/services/delete_service.js b/web-ui/app/js/services/delete_service.js index 12837fae..470ab145 100644 --- a/web-ui/app/js/services/delete_service.js +++ b/web-ui/app/js/services/delete_service.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ define(['flight/lib/component', 'page/events', 'views/i18n'], function (defineComponent, events, i18n) { 'use strict'; diff --git a/web-ui/app/js/services/mail_service.js b/web-ui/app/js/services/mail_service.js index 99f812f8..ca8b1da1 100644 --- a/web-ui/app/js/services/mail_service.js +++ b/web-ui/app/js/services/mail_service.js @@ -14,8 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ -/*global Pixelated */ define( [ diff --git a/web-ui/app/js/services/model/mail.js b/web-ui/app/js/services/model/mail.js index 2c5fa0dd..17fb25b0 100644 --- a/web-ui/app/js/services/model/mail.js +++ b/web-ui/app/js/services/model/mail.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ 'use strict'; define(['helpers/contenttype'], diff --git a/web-ui/app/js/tags/ui/tag.js b/web-ui/app/js/tags/ui/tag.js index dfedb137..4245795a 100644 --- a/web-ui/app/js/tags/ui/tag.js +++ b/web-ui/app/js/tags/ui/tag.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global _ */ define( [ diff --git a/web-ui/app/js/views/i18n.js b/web-ui/app/js/views/i18n.js index 12dc74ea..b09490f5 100644 --- a/web-ui/app/js/views/i18n.js +++ b/web-ui/app/js/views/i18n.js @@ -14,8 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global Handlebars */ - define(['i18next'], function(i18n) { 'use strict'; diff --git a/web-ui/app/js/views/recipientListFormatter.js b/web-ui/app/js/views/recipientListFormatter.js index 68e6dbe1..0b887142 100644 --- a/web-ui/app/js/views/recipientListFormatter.js +++ b/web-ui/app/js/views/recipientListFormatter.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global Handlebars */ define(function() { 'use strict'; diff --git a/web-ui/app/js/views/templates.js b/web-ui/app/js/views/templates.js index 9d202207..91333da8 100644 --- a/web-ui/app/js/views/templates.js +++ b/web-ui/app/js/views/templates.js @@ -14,7 +14,6 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -/*global Handlebars */ define(['hbs/templates'], function (templates) { 'use strict'; diff --git a/web-ui/package.json b/web-ui/package.json index f32794e2..bf1757ea 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -25,7 +25,7 @@ "handlebars": "mkdir -p app/js/generated/hbs/ && handlebars app/templates/**/*.hbs > app/js/generated/hbs/templates.js --namespace=window.Pixelated --root .", "compass": "compass compile", "build": "npm run clean && npm run handlebars && npm run compass", - "jshint": "node_modules/.bin/jshint --config=.jshintrc `find app -name '*.js' | grep -v -e 'lib' -e 'bower' -e 'generated'`", + "jshint": "node_modules/.bin/jshint --config=.jshintrc app && node_modules/.bin/jshint --config=.jshintrc test", "clean": "rm -rf .tmp/ dist/**/* app/js/generated/hbs/* app/css/*", "buildmain": "node_modules/requirejs/bin/r.js -o config/buildoptions.js", "package": "/bin/bash config/package.sh", diff --git a/web-ui/test/custom_matchers.js b/web-ui/test/custom_matchers.js index 6643a3c6..b1e06d1f 100644 --- a/web-ui/test/custom_matchers.js +++ b/web-ui/test/custom_matchers.js @@ -3,7 +3,7 @@ define([], function() { function toBeRenderedInMatcher () { return { compare: function (mail, node) { - var result = {}, subject, tags, from, date, messages = [], notMessages = []; + var result = {}, equals = {}, subject, tags, from, date, messages = [], notMessages = []; subject = node.find('#mail-' + mail.ident + ' .subject-and-tags')[0]; tags = _.map(node.find('#mail-' + mail.ident + ' .subject-and-tags .tag'), function (tag) { return tag.textContent; }); @@ -11,37 +11,39 @@ define([], function() { from = node.find('#mail-' + mail.ident + ' .from'); if (subject && subject.textContent.trim() === mail.header.subject) { - result.pass = true; + equals.subject = true; notMessages.push('not to be rendered with subject ' + mail.header.subject); } else { - result.pass = false; + equals.subject = false; messages.push('to be rendered with subject ' + mail.header.subject + ', but was rendered with subject ' + subject.textContent.trim()); } if (tags && tags.join(', ') === mail.tags.join(', ')) { - result.pass &= true; + equals.tags = true; notMessages.push('not to be rendered with tags ' + mail.tags.join(', ')); } else { - result.pass |= false; - messages.push('to be rendered with tags ' + mail.tags.join(', ') + ', but was rendered with subject ' + tags.join(', ')); + equals.tags = false; + messages.push('to be rendered with tags ' + mail.tags.join(', ') + ', but was rendered with tags ' + tags.join(', ')); } if (date && date.text().trim() === mail.header.date.split('T')[0]) { - result.pass &= true; + equals.date = true; notMessages.push('not to be rendered with date ' + mail.header.date.split('T')[0]); } else { - result.pass |= false; + equals.date = false; messages.push('to be rendered with date ' + mail.header.date.split('T')[0] + ', but was rendered with date ' + date.text().trim()); } if (from && from.text().trim() === mail.header.from) { - result.pass &= true; + equals.from = true; notMessages.push('not to be rendered with from ' + mail.header.from); } else { - result.pass |= false; + equals.from = false; messages.push('to be rendered with from ' + mail.header.from + ', but was rendered with from ' + from.text().trim()); } + result.pass = equals.subject && equals.tags && equals.date && equals.from; + if (result.pass) { result.message = 'Expected mail ' + mail.ident + ' ' + notMessages.join(', '); } else { diff --git a/web-ui/test/spec/dispatchers/left_pane_dispatcher.spec.js b/web-ui/test/spec/dispatchers/left_pane_dispatcher.spec.js index a8b4946c..d56f7289 100644 --- a/web-ui/test/spec/dispatchers/left_pane_dispatcher.spec.js +++ b/web-ui/test/spec/dispatchers/left_pane_dispatcher.spec.js @@ -1,5 +1,3 @@ -/*global Pixelated */ - describeComponent('dispatchers/left_pane_dispatcher', function () { 'use strict'; diff --git a/web-ui/test/spec/dispatchers/middle_pane_dispatchers.spec.js b/web-ui/test/spec/dispatchers/middle_pane_dispatchers.spec.js index 1dfc7c84..997c51f2 100644 --- a/web-ui/test/spec/dispatchers/middle_pane_dispatchers.spec.js +++ b/web-ui/test/spec/dispatchers/middle_pane_dispatchers.spec.js @@ -1,5 +1,3 @@ -/*global Pixelated */ - describeComponent('dispatchers/middle_pane_dispatcher', function () { 'use strict'; diff --git a/web-ui/test/spec/dispatchers/right_pane_dispatcher.spec.js b/web-ui/test/spec/dispatchers/right_pane_dispatcher.spec.js index 89530ac8..4187610e 100644 --- a/web-ui/test/spec/dispatchers/right_pane_dispatcher.spec.js +++ b/web-ui/test/spec/dispatchers/right_pane_dispatcher.spec.js @@ -1,6 +1,3 @@ -/*global Pixelated */ -/*global jasmine */ - describeComponent('dispatchers/right_pane_dispatcher', function () { 'use strict'; diff --git a/web-ui/test/spec/helpers/view_helper.spec.js b/web-ui/test/spec/helpers/view_helper.spec.js index caaf16cf..806739b9 100644 --- a/web-ui/test/spec/helpers/view_helper.spec.js +++ b/web-ui/test/spec/helpers/view_helper.spec.js @@ -1,5 +1,3 @@ -/*global Pixelated */ - define(['helpers/view_helper'], function (viewHelper) { 'use strict'; diff --git a/web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js b/web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js index 5c965b71..058040c9 100644 --- a/web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js +++ b/web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js @@ -1,5 +1,3 @@ -/*global Pixelated */ - describeMixin('mail_list/ui/mail_items/mail_item', function () { 'use strict'; diff --git a/web-ui/test/spec/mail_list/ui/mail_list.spec.js b/web-ui/test/spec/mail_list/ui/mail_list.spec.js index 1551643d..72f61a39 100644 --- a/web-ui/test/spec/mail_list/ui/mail_list.spec.js +++ b/web-ui/test/spec/mail_list/ui/mail_list.spec.js @@ -1,5 +1,3 @@ -/*global Pixelated */ - describeComponent('mail_list/ui/mail_list', function () { 'use strict'; @@ -136,7 +134,6 @@ describeComponent('mail_list/ui/mail_list', function () { it('should open draft in popstate event if tag is Drafts', function () { var openDraftEvent = spyOnEvent(document, Pixelated.events.dispatchers.rightPane.openDraft); - debugger; this.component.$node.trigger(Pixelated.events.mails.available, { mails: mailList, mailIdent: '30', tag: 'drafts' }); expect(openDraftEvent).toHaveBeenTriggeredOnAndWith(document, { ident: '30'}); diff --git a/web-ui/test/spec/mail_view/data/mail_sender.spec.js b/web-ui/test/spec/mail_view/data/mail_sender.spec.js index 48d46fde..9b6c2828 100644 --- a/web-ui/test/spec/mail_view/data/mail_sender.spec.js +++ b/web-ui/test/spec/mail_view/data/mail_sender.spec.js @@ -1,5 +1,3 @@ -/*global Pixelated */ - describeComponent('mail_view/data/mail_sender', function () { 'use strict'; diff --git a/web-ui/test/spec/mail_view/ui/compose_box.spec.js b/web-ui/test/spec/mail_view/ui/compose_box.spec.js index d17d4b17..414bc022 100644 --- a/web-ui/test/spec/mail_view/ui/compose_box.spec.js +++ b/web-ui/test/spec/mail_view/ui/compose_box.spec.js @@ -1,6 +1,3 @@ -/*global jasmine */ -/*global Pixelated */ - describeComponent('mail_view/ui/compose_box', function () { 'use strict'; beforeEach(function () { diff --git a/web-ui/test/spec/mail_view/ui/forward_box.spec.js b/web-ui/test/spec/mail_view/ui/forward_box.spec.js index 30b3b064..613baa47 100644 --- a/web-ui/test/spec/mail_view/ui/forward_box.spec.js +++ b/web-ui/test/spec/mail_view/ui/forward_box.spec.js @@ -1,6 +1,3 @@ -/*global jasmine */ -/*global Pixelated */ - describeComponent('mail_view/ui/forward_box', function () { 'use strict'; diff --git a/web-ui/test/spec/mail_view/ui/mail_actions.spec.js b/web-ui/test/spec/mail_view/ui/mail_actions.spec.js index 897726b6..580758a0 100644 --- a/web-ui/test/spec/mail_view/ui/mail_actions.spec.js +++ b/web-ui/test/spec/mail_view/ui/mail_actions.spec.js @@ -1,5 +1,3 @@ -/*global Pixelated */ - describeComponent('mail_view/ui/mail_actions', function () { 'use strict'; 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 b84ecfe6..de6fc29d 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 @@ -1,5 +1,3 @@ -/*global Pixelated */ - describeComponent('mail_view/ui/mail_view', function () { 'use strict'; 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 d4fb8faf..6297a5aa 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 @@ -126,18 +126,18 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () { describe('on blur', function() { it('tokenizes and sanitize recipient email if there is an input val', function() { var addressEnteredEvent = spyOnEvent(this.$node, Pixelated.events.ui.recipients.entered); - var blurEvent = $.Event('blur'); - spyOn(blurEvent, 'preventDefault'); + var blurEvent = $.Event('blur'); + spyOn(blurEvent, 'preventDefault'); - this.$node.val('a@b.c, Friend ; d@e.f , , , , , , , ,'); - this.$node.trigger(blurEvent); + this.$node.val('a@b.c, Friend ; d@e.f , , , , , , , ,'); + this.$node.trigger(blurEvent); - expect(blurEvent.preventDefault).toHaveBeenCalled(); + expect(blurEvent.preventDefault).toHaveBeenCalled(); expect(addressEnteredEvent.callCount).toEqual(3); expect(addressEnteredEvent.calls[0].data).toEqual({name: 'to', address: 'a@b.c'}); expect(addressEnteredEvent.calls[1].data).toEqual({name: 'to', address: 'Friend '}); expect(addressEnteredEvent.calls[2].data).toEqual({name: 'to', address: 'd@e.f'}); - }) + }); }); }); 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 c81af683..8adefcd0 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 @@ -1,6 +1,3 @@ -/*global jasmine */ -/*global Pixelated */ - describeComponent('mail_view/ui/reply_box', function () { 'use strict'; diff --git a/web-ui/test/spec/mail_view/ui/reply_section.spec.js b/web-ui/test/spec/mail_view/ui/reply_section.spec.js index 6bd906bc..9cdf7405 100644 --- a/web-ui/test/spec/mail_view/ui/reply_section.spec.js +++ b/web-ui/test/spec/mail_view/ui/reply_section.spec.js @@ -1,6 +1,3 @@ -/*global jasmine */ -/*global Pixelated */ - describeComponent('mail_view/ui/reply_section', function () { 'use strict'; diff --git a/web-ui/test/spec/mixins/with_mail_edit_base.spec.js b/web-ui/test/spec/mixins/with_mail_edit_base.spec.js index c76bf31d..8f495399 100644 --- a/web-ui/test/spec/mixins/with_mail_edit_base.spec.js +++ b/web-ui/test/spec/mixins/with_mail_edit_base.spec.js @@ -1,8 +1,3 @@ -/*global Pixelated */ -/*global jasmine */ -/*global runs */ -/*global waits */ - describeMixin('mixins/with_mail_edit_base', function () { 'use strict'; diff --git a/web-ui/test/spec/page/logout.spec.js b/web-ui/test/spec/page/logout.spec.js index 9285013a..cf5e3e70 100644 --- a/web-ui/test/spec/page/logout.spec.js +++ b/web-ui/test/spec/page/logout.spec.js @@ -1,5 +1,3 @@ -/*global Pixelated */ - describeComponent('page/logout', function () { 'use strict'; diff --git a/web-ui/test/spec/page/pane_contract_expand.spec.js b/web-ui/test/spec/page/pane_contract_expand.spec.js index 61d786eb..4f4ff49b 100644 --- a/web-ui/test/spec/page/pane_contract_expand.spec.js +++ b/web-ui/test/spec/page/pane_contract_expand.spec.js @@ -1,6 +1,3 @@ -/*global Pixelated */ -/*global afterEach */ - 'use strict'; describeComponent('page/pane_contract_expand', function () { diff --git a/web-ui/test/spec/page/router.spec.js b/web-ui/test/spec/page/router.spec.js index 129e0dfb..bb7a655b 100644 --- a/web-ui/test/spec/page/router.spec.js +++ b/web-ui/test/spec/page/router.spec.js @@ -1,5 +1,3 @@ -/*global Pixelated */ -/*global jasmine */ describeComponent('page/router', function () { 'use strict'; diff --git a/web-ui/test/spec/search/search_trigger.spec.js b/web-ui/test/spec/search/search_trigger.spec.js index 845bdc7d..6ba47489 100644 --- a/web-ui/test/spec/search/search_trigger.spec.js +++ b/web-ui/test/spec/search/search_trigger.spec.js @@ -1,6 +1,3 @@ -/*global jasmine */ -/*global Pixelated */ - describeComponent('search/search_trigger', function () { 'use strict'; var self; diff --git a/web-ui/test/spec/services/delete_service.spec.js b/web-ui/test/spec/services/delete_service.spec.js index d07b36b2..9872a644 100644 --- a/web-ui/test/spec/services/delete_service.spec.js +++ b/web-ui/test/spec/services/delete_service.spec.js @@ -1,6 +1,3 @@ -/*global jasmine */ -/*global Pixelated */ - describeComponent('services/delete_service', function () { 'use strict'; diff --git a/web-ui/test/spec/services/mail_service.spec.js b/web-ui/test/spec/services/mail_service.spec.js index 9077969a..778d79da 100644 --- a/web-ui/test/spec/services/mail_service.spec.js +++ b/web-ui/test/spec/services/mail_service.spec.js @@ -1,5 +1,3 @@ -/*global jasmine */ -/*global Pixelated */ 'use strict'; describeComponent('services/mail_service', function () { @@ -43,7 +41,7 @@ describeComponent('services/mail_service', function () { it('makes the correct request to the backend', function () { expect(readRequest.calls.mostRecent().args[0]).toEqual('/mails/read'); - expect(readRequest.calls.mostRecent().args[1].data).toEqual('{"idents":[1,2]}') + expect(readRequest.calls.mostRecent().args[1].data).toEqual('{"idents":[1,2]}'); }); it('will trigger that a message has been deleted when it is done deleting', function() { diff --git a/web-ui/test/spec/services/model/mail.spec.js b/web-ui/test/spec/services/model/mail.spec.js index f9d076f0..9e24a44f 100644 --- a/web-ui/test/spec/services/model/mail.spec.js +++ b/web-ui/test/spec/services/model/mail.spec.js @@ -1,5 +1,3 @@ -/*global Pixelated */ - require(['services/model/mail'], function (Mail) { 'use strict'; diff --git a/web-ui/test/spec/tags/ui/tag.spec.js b/web-ui/test/spec/tags/ui/tag.spec.js index 36fc83f2..74587bbb 100644 --- a/web-ui/test/spec/tags/ui/tag.spec.js +++ b/web-ui/test/spec/tags/ui/tag.spec.js @@ -1,5 +1,3 @@ -/*global Pixelated */ -/*global _ */ describeComponent('tags/ui/tag', 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 78bd84d9..9391a30a 100644 --- a/web-ui/test/spec/tags/ui/tag_list.spec.js +++ b/web-ui/test/spec/tags/ui/tag_list.spec.js @@ -1,7 +1,3 @@ -/* global _ */ -/* global Pixelated */ -/* global jasmine */ - describeComponent('tags/ui/tag_list', function () { 'use strict'; var tagsShortcutsContainer; diff --git a/web-ui/test/test_data.js b/web-ui/test/test_data.js index 64ec60a7..f09260c9 100644 --- a/web-ui/test/test_data.js +++ b/web-ui/test/test_data.js @@ -1,4 +1,3 @@ -/*global _ */ 'use strict'; define(function() { -- cgit v1.2.3