fix some more JSCS code style errors

This commit is contained in:
jelhan 2016-01-20 03:19:10 +01:00
parent 8a88e3b9df
commit e9a6f9ff41
6 changed files with 52 additions and 55 deletions

View file

@ -55,7 +55,7 @@ export default Ember.Component.extend({
options[0] options[0]
); );
let i = 1; let i = 1;
while(true) { while (true) {
if ( if (
typeof options[i] !== 'undefined' && typeof options[i] !== 'undefined' &&
bestOptions[0].score === options[i].score bestOptions[0].score === options[i].score
@ -63,8 +63,7 @@ export default Ember.Component.extend({
bestOptions.push( bestOptions.push(
options[i] options[i]
); );
} } else {
else {
break; break;
} }
@ -74,8 +73,7 @@ export default Ember.Component.extend({
bestOptions.forEach((bestOption, i) => { bestOptions.forEach((bestOption, i) => {
if (this.get('poll.isFindADate')) { if (this.get('poll.isFindADate')) {
bestOptions[i].title = this.get('dates')[bestOption.key].title; bestOptions[i].title = this.get('dates')[bestOption.key].title;
} } else {
else {
bestOptions[i].title = this.get('poll.options')[bestOption.key].title; bestOptions[i].title = this.get('poll.options')[bestOption.key].title;
} }
}); });
@ -83,20 +81,19 @@ export default Ember.Component.extend({
return bestOptions; return bestOptions;
}.property('poll.users.@each'), }.property('poll.users.@each'),
evaluationBestOptionsMultiple: function(){ evaluationBestOptionsMultiple: function() {
if (this.get('evaluationBestOptions.length') > 1) { if (this.get('evaluationBestOptions.length') > 1) {
return true; return true;
} } else {
else {
return false; return false;
} }
}.property('evaluationBestOptions'), }.property('evaluationBestOptions'),
evaluationLastParticipation: function(){ evaluationLastParticipation: function() {
return this.get('sortedUsers.lastObject.creationDate'); return this.get('sortedUsers.lastObject.creationDate');
}.property('sortedUsers.@each'), }.property('sortedUsers.@each'),
evaluationParticipants: function(){ evaluationParticipants: function() {
return this.get('poll.users.length'); return this.get('poll.users.length');
}.property('poll.users.@each') }.property('poll.users.@each')
}); });

View file

@ -1,4 +1,4 @@
import Ember from "ember"; import Ember from 'ember';
export default Ember.Controller.extend({ export default Ember.Controller.extend({
}); });

View file

@ -27,7 +27,7 @@ test('participate in a default poll', function(assert) {
let id = 'test'; let id = 'test';
let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789'; let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
server.get('/polls/' + id, function() { server.get(`/polls/${id}`, function() {
return serverGetPolls( return serverGetPolls(
{ {
id id
@ -35,20 +35,20 @@ test('participate in a default poll', function(assert) {
); );
}); });
server.post('/users', server.post('/users',
function (request) { function(request) {
return serverPostUsers(request.requestBody, 1); return serverPostUsers(request.requestBody, 1);
} }
); );
visit('/poll/' + id + '?encryptionKey=' + encryptionKey).then(function() { visit(`/poll/${id}?encryptionKey=${encryptionKey}`).then(function() {
assert.equal(currentPath(), 'poll.participation'); assert.equal(currentPath(), 'poll.participation');
pollParticipate('Max Meiner', ['yes', 'no']); pollParticipate('Max Meiner', ['yes', 'no']);
andThen(function(){ andThen(function() {
assert.equal(currentPath(), 'poll.evaluation'); assert.equal(currentPath(), 'poll.evaluation');
assert.equal( assert.equal(
currentURL().split("?")[1], currentURL().split("?")[1],
'encryptionKey=' + encryptionKey, `encryptionKey=${encryptionKey}`,
'encryption key is part of query params' 'encryption key is part of query params'
); );
pollHasUsersCount(assert, 1, "user is added to user selections table"); pollHasUsersCount(assert, 1, "user is added to user selections table");
@ -57,15 +57,15 @@ test('participate in a default poll', function(assert) {
}); });
}); });
test("participate in a poll using freetext", function(assert) { test('participate in a poll using freetext', function(assert) {
let id = 'test2'; let id = 'test2';
let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789'; let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
server.get('/polls/' + id, server.get(`/polls/${id}`,
function() { function() {
return serverGetPolls( return serverGetPolls(
{ {
id: id, id,
answerType: 'FreeText', answerType: 'FreeText',
answers: [] answers: []
}, encryptionKey }, encryptionKey
@ -78,7 +78,7 @@ test("participate in a poll using freetext", function(assert) {
} }
); );
visit('/poll/' + id + '?encryptionKey=' + encryptionKey).then(function() { visit(`/poll/${id}?encryptionKey=${encryptionKey}`).then(function() {
assert.equal(currentPath(), 'poll.participation'); assert.equal(currentPath(), 'poll.participation');
pollParticipate('Max Manus', ['answer 1', 'answer 2']); pollParticipate('Max Manus', ['answer 1', 'answer 2']);
@ -94,7 +94,7 @@ test('participate in a poll which does not force an answer to all options', func
let id = 'test'; let id = 'test';
let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789'; let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
server.get('/polls/' + id, server.get(`/polls/${id}`,
function() { function() {
return serverGetPolls( return serverGetPolls(
{ {
@ -110,14 +110,14 @@ test('participate in a poll which does not force an answer to all options', func
} }
); );
visit('/poll/' + id + '?encryptionKey=' + encryptionKey).then(function() { visit(`/poll/${id}?encryptionKey=${encryptionKey}`).then(function() {
assert.equal(currentPath(), 'poll.participation'); assert.equal(currentPath(), 'poll.participation');
pollParticipate('Karl Käfer', ['yes', null]); pollParticipate('Karl Käfer', ['yes', null]);
andThen(function() { andThen(function() {
assert.equal(currentPath(), 'poll.evaluation'); assert.equal(currentPath(), 'poll.evaluation');
pollHasUsersCount(assert, 1, "user is added to user selections table"); pollHasUsersCount(assert, 1, "user is added to user selections table");
pollHasUser(assert, "Karl Käfer", [t("answerTypes.yes.label"), ""]); pollHasUser(assert, "Karl Käfer", [t("answerTypes.yes.label"), ""]);
}); });
}); });
}); });
@ -126,7 +126,7 @@ test('participate in a poll which allows anonymous participation', function(asse
let id = 'test'; let id = 'test';
let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789'; let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
server.get('/polls/' + id, server.get(`/polls/${id}`,
function() { function() {
return serverGetPolls( return serverGetPolls(
{ {
@ -142,7 +142,7 @@ test('participate in a poll which allows anonymous participation', function(asse
} }
); );
visit('/poll/' + id + '?encryptionKey=' + encryptionKey).then(function() { visit(`/poll/${id}?encryptionKey=${encryptionKey}`).then(function() {
assert.equal(currentPath(), 'poll.participation'); assert.equal(currentPath(), 'poll.participation');
pollParticipate(null, ['yes', 'no']); pollParticipate(null, ['yes', 'no']);

View file

@ -7,7 +7,7 @@ import formattedDateHelper from 'croodle/helpers/formatted-date';
/* jshint proto: true */ /* jshint proto: true */
/* global moment */ /* global moment */
var application, server; let application, server;
module('Acceptance | view evaluation', { module('Acceptance | view evaluation', {
beforeEach: function() { beforeEach: function() {
@ -24,19 +24,19 @@ module('Acceptance | view evaluation', {
}); });
test('evaluation summary is not present for poll without participants', function(assert) { test('evaluation summary is not present for poll without participants', function(assert) {
var id = 'test', let id = 'test',
encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789'; encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
server.get('/polls/' + id, function() { server.get(`/polls/${id}`, function() {
return serverGetPolls( return serverGetPolls(
{ {
id: id, id,
users: [] users: []
}, encryptionKey }, encryptionKey
); );
}); });
visit('/poll/' + id + '?encryptionKey=' + encryptionKey); visit(`/poll/${id}?encryptionKey=${encryptionKey}`);
andThen(function() { andThen(function() {
assert.equal(currentPath(), 'poll.participation'); assert.equal(currentPath(), 'poll.participation');
@ -52,10 +52,10 @@ test('evaluation is correct', function(assert) {
var id = 'test', var id = 'test',
encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789'; encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
server.get('/polls/' + id, function() { server.get(`/polls/${id}`, function() {
return serverGetPolls( return serverGetPolls(
{ {
id: id, id,
answers: [ answers: [
{ {
type: "yes", type: "yes",
@ -76,7 +76,7 @@ test('evaluation is correct', function(assert) {
], ],
users: [ users: [
{ {
id: id + '_0', id: `${id}_0`,
name: 'Maximilian', name: 'Maximilian',
selections: [ selections: [
{ {
@ -95,7 +95,7 @@ test('evaluation is correct', function(assert) {
creationDate: "2015-01-01T00:00:00.000Z" creationDate: "2015-01-01T00:00:00.000Z"
}, },
{ {
id: id + '_1', id: `${id}_1`,
name: 'Peter', name: 'Peter',
selections: [ selections: [
{ {
@ -118,7 +118,7 @@ test('evaluation is correct', function(assert) {
); );
}); });
visit('/poll/' + id + '?encryptionKey=' + encryptionKey); visit(`/poll/${id}?encryptionKey=${encryptionKey}`);
andThen(function() { andThen(function() {
assert.equal(currentPath(), 'poll.participation'); assert.equal(currentPath(), 'poll.participation');

View file

@ -6,7 +6,7 @@ import serverGetPolls from '../helpers/server-get-polls';
/* jshint proto: true */ /* jshint proto: true */
/* global jstz, moment, start, stop */ /* global jstz, moment, start, stop */
var application, server; let application, server;
module('Acceptance | view poll', { module('Acceptance | view poll', {
beforeEach: function() { beforeEach: function() {
@ -26,11 +26,11 @@ test('view poll url', function(assert) {
var id = 'test', var id = 'test',
encryptionKey = 'abcdefghijklmnopqrstuvwxyz012345789'; encryptionKey = 'abcdefghijklmnopqrstuvwxyz012345789';
server.get('/polls/' + id, function() { server.get(`/polls/${id}`, function() {
return serverGetPolls({ id: id }, encryptionKey); return serverGetPolls({ id }, encryptionKey);
}); });
visit('/poll/' + id + '?encryptionKey=' + encryptionKey); visit(`/poll/${id}?encryptionKey=${encryptionKey}`);
andThen(function() { andThen(function() {
assert.equal( assert.equal(
find('.share-link .link a').text(), find('.share-link .link a').text(),
@ -44,10 +44,10 @@ test('view a poll with dates', function(assert) {
var id = 'test', var id = 'test',
encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789'; encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
server.get('/polls/' + id, function() { server.get(`/polls/${id}`, function() {
return serverGetPolls( return serverGetPolls(
{ {
id: id, id,
options: [ options: [
{title: '2015-12-12'}, {title: '2015-12-12'},
{title: '2016-01-01'} {title: '2016-01-01'}
@ -56,7 +56,7 @@ test('view a poll with dates', function(assert) {
); );
}); });
visit('/poll/' + id + '?encryptionKey=' + encryptionKey).then(function() { visit(`/poll/${id}?encryptionKey=${encryptionKey}`).then(function() {
pollHasOptions(assert, [ pollHasOptions(assert, [
moment('2015-12-12').format( moment('2015-12-12').format(
moment.localeData().longDateFormat('LLLL') moment.localeData().longDateFormat('LLLL')
@ -79,10 +79,10 @@ test('view a poll with dates and times', function(assert) {
encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789', encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789',
timezone = jstz.determine().name(); timezone = jstz.determine().name();
server.get('/polls/' + id, function() { server.get(`/polls/${id}`, function() {
return serverGetPolls( return serverGetPolls(
{ {
id: id, id,
isDateTime: true, isDateTime: true,
options: [ options: [
{title: '2015-12-12T11:11:00.000Z'}, {title: '2015-12-12T11:11:00.000Z'},
@ -94,7 +94,7 @@ test('view a poll with dates and times', function(assert) {
); );
}); });
visit('/poll/' + id + '?encryptionKey=' + encryptionKey).then(function() { visit(`/poll/${id}?encryptionKey=${encryptionKey}`).then(function() {
pollHasOptions(assert, [ pollHasOptions(assert, [
// full date // full date
moment.tz('2015-12-12T11:11:00.000Z', timezone).format('LLLL'), moment.tz('2015-12-12T11:11:00.000Z', timezone).format('LLLL'),
@ -119,10 +119,10 @@ test('view a poll while timezone differs from the one poll got created in and ch
timezonePoll = 'Europe/Moscow'; timezonePoll = 'Europe/Moscow';
} }
server.get('/polls/' + id, function() { server.get(`/polls/${id}`, function() {
return serverGetPolls( return serverGetPolls(
{ {
id: id, id,
isDateTime: true, isDateTime: true,
options: [ options: [
{title: '2015-12-12T11:11:00.000Z'}, {title: '2015-12-12T11:11:00.000Z'},
@ -133,7 +133,7 @@ test('view a poll while timezone differs from the one poll got created in and ch
); );
}); });
visit('/poll/' + id + '?encryptionKey=' + encryptionKey).then(function() { visit(`/poll/${id}?encryptionKey=${encryptionKey}`).then(function() {
stop(); stop();
Ember.run.later(function(){ Ember.run.later(function(){
start(); start();
@ -180,10 +180,10 @@ test('view a poll while timezone differs from the one poll got created in and ch
timezonePoll = 'Europe/Moscow'; timezonePoll = 'Europe/Moscow';
} }
server.get('/polls/' + id, function() { server.get(`/polls/${id}`, function() {
return serverGetPolls( return serverGetPolls(
{ {
id: id, id,
isDateTime: true, isDateTime: true,
options: [ options: [
{title: '2015-12-12T11:11:00.000Z'}, {title: '2015-12-12T11:11:00.000Z'},
@ -194,7 +194,7 @@ test('view a poll while timezone differs from the one poll got created in and ch
); );
}); });
visit('/poll/' + id + '?encryptionKey=' + encryptionKey).then(function() { visit(`/poll/${id}?encryptionKey=${encryptionKey}`).then(function() {
stop(); stop();
Ember.run.later(function(){ Ember.run.later(function(){
start(); start();

View file

@ -3,7 +3,7 @@ import { module, test } from 'qunit';
import startApp from 'croodle/tests/helpers/start-app'; import startApp from 'croodle/tests/helpers/start-app';
/* global moment */ /* global moment */
var application; let application;
module('Integration | legacy support', { module('Integration | legacy support', {
beforeEach: function() { beforeEach: function() {
@ -20,7 +20,7 @@ test('show a default poll created with v0.3.0', function(assert) {
encryptionKey = '5MKFuNTKILUXw6RuqkAw6ooZw4k3mWWx98ZQw8vH', encryptionKey = '5MKFuNTKILUXw6RuqkAw6ooZw4k3mWWx98ZQw8vH',
timezone = 'Europe/Berlin'; timezone = 'Europe/Berlin';
visit('/poll/' + id + '?encryptionKey=' + encryptionKey); visit(`/poll/${id}?encryptionKey=${encryptionKey}`);
andThen(function() { andThen(function() {
pollTitleEqual(assert, 'default poll created with v0.3.0'); pollTitleEqual(assert, 'default poll created with v0.3.0');
@ -87,7 +87,7 @@ test('find a poll using free text created with v0.3.0', function(assert) {
var id = 'PjW3XwbuRc', var id = 'PjW3XwbuRc',
encryptionKey = 'Rre6dAGOYLW9gYKOP4LhX7Qwfhe5Th3je0uKDtyy'; encryptionKey = 'Rre6dAGOYLW9gYKOP4LhX7Qwfhe5Th3je0uKDtyy';
visit('/poll/' + id + '?encryptionKey=' + encryptionKey); visit(`/poll/${id}?encryptionKey=${encryptionKey}`);
andThen(function() { andThen(function() {
pollTitleEqual(assert, 'Which cake for birthday?'); pollTitleEqual(assert, 'Which cake for birthday?');