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

View file

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

View file

@ -27,7 +27,7 @@ test('participate in a default poll', function(assert) {
let id = 'test';
let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
server.get('/polls/' + id, function() {
server.get(`/polls/${id}`, function() {
return serverGetPolls(
{
id
@ -35,20 +35,20 @@ test('participate in a default poll', function(assert) {
);
});
server.post('/users',
function (request) {
function(request) {
return serverPostUsers(request.requestBody, 1);
}
);
visit('/poll/' + id + '?encryptionKey=' + encryptionKey).then(function() {
visit(`/poll/${id}?encryptionKey=${encryptionKey}`).then(function() {
assert.equal(currentPath(), 'poll.participation');
pollParticipate('Max Meiner', ['yes', 'no']);
andThen(function(){
andThen(function() {
assert.equal(currentPath(), 'poll.evaluation');
assert.equal(
currentURL().split("?")[1],
'encryptionKey=' + encryptionKey,
`encryptionKey=${encryptionKey}`,
'encryption key is part of query params'
);
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 encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
server.get('/polls/' + id,
server.get(`/polls/${id}`,
function() {
return serverGetPolls(
{
id: id,
id,
answerType: 'FreeText',
answers: []
}, 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');
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 encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
server.get('/polls/' + id,
server.get(`/polls/${id}`,
function() {
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');
pollParticipate('Karl Käfer', ['yes', null]);
pollParticipate('Karl Käfer', ['yes', null]);
andThen(function() {
assert.equal(currentPath(), 'poll.evaluation');
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 encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
server.get('/polls/' + id,
server.get(`/polls/${id}`,
function() {
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');
pollParticipate(null, ['yes', 'no']);

View file

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

View file

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

View file

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