fix coding style errors
> helpers/poll-has-users.js should pass jscs. > requireSemicolons: Missing semicolon after statement at helpers/poll-has-users.js is incostitent with JSHint which complains about this semicolon other ones should be fixed by rewrite of create/options
This commit is contained in:
parent
95c5142ad1
commit
682e6a658e
19 changed files with 108 additions and 110 deletions
|
@ -116,8 +116,8 @@ test('participate in a poll which does not force an answer to all options', func
|
|||
|
||||
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"), ""]);
|
||||
pollHasUsersCount(assert, 1, 'user is added to user selections table');
|
||||
pollHasUser(assert, 'Karl Käfer', [t('answerTypes.yes.label'), '']);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -148,8 +148,8 @@ test('participate in a poll which allows anonymous participation', function(asse
|
|||
|
||||
andThen(function() {
|
||||
assert.equal(currentPath(), 'poll.evaluation');
|
||||
pollHasUsersCount(assert, 1, "user is added to user selections table");
|
||||
pollHasUser(assert, "", [t("answerTypes.yes.label"), t("answerTypes.no.label")]);
|
||||
pollHasUsersCount(assert, 1, 'user is added to user selections table');
|
||||
pollHasUser(assert, '', [t('answerTypes.yes.label'), t('answerTypes.no.label')]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -89,7 +89,7 @@ test('view a poll with dates and times', function(assert) {
|
|||
{ title: '2015-12-12T13:13:00.000Z' },
|
||||
{ title: '2016-01-01T11:11:00.000Z' }
|
||||
],
|
||||
timezone: timezone
|
||||
timezone
|
||||
}, encryptionKey
|
||||
);
|
||||
});
|
||||
|
@ -107,15 +107,14 @@ test('view a poll with dates and times', function(assert) {
|
|||
});
|
||||
|
||||
test('view a poll while timezone differs from the one poll got created in and choose local timezone', function(assert) {
|
||||
var id = 'test',
|
||||
encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789',
|
||||
timezoneLocal = jstz.determine().name(),
|
||||
timezonePoll;
|
||||
const id = 'test';
|
||||
const encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||
const timezoneLocal = jstz.determine().name();
|
||||
let timezonePoll;
|
||||
|
||||
if (timezoneLocal !== 'America/Caracas') {
|
||||
timezonePoll = 'America/Caracas';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
timezonePoll = 'Europe/Moscow';
|
||||
}
|
||||
|
||||
|
@ -168,15 +167,14 @@ test('view a poll while timezone differs from the one poll got created in and ch
|
|||
});
|
||||
|
||||
test('view a poll while timezone differs from the one poll got created in and choose poll timezone', function(assert) {
|
||||
var id = 'test',
|
||||
encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789',
|
||||
timezoneLocal = jstz.determine().name(),
|
||||
timezonePoll;
|
||||
const id = 'test';
|
||||
const encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||
const timezoneLocal = jstz.determine().name();
|
||||
let timezonePoll;
|
||||
|
||||
if (timezoneLocal !== 'America/Caracas') {
|
||||
timezonePoll = 'America/Caracas';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
timezonePoll = 'Europe/Moscow';
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Test.registerHelper('pollHasAnswers', function(app, assert, answers) {
|
||||
const elBase = find('.participation .selections .form-group')[0];
|
||||
const [ elBase ] = find('.participation .selections .form-group');
|
||||
assert.equal(
|
||||
find('.radio label', elBase).length,
|
||||
answers.length,
|
||||
|
@ -9,9 +9,9 @@ export default Ember.Test.registerHelper('pollHasAnswers', function(app, assert,
|
|||
);
|
||||
answers.forEach((answer, index) => {
|
||||
assert.equal(
|
||||
find('.radio:nth-child(' + (index + 1) + ') label', elBase).text().trim(),
|
||||
find(`.radio:nth-child(${index + 1}) label`, elBase).text().trim(),
|
||||
answer,
|
||||
'poll answer ' + index + ' is as expected'
|
||||
`poll answer ${index} is as expected`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -11,9 +11,9 @@ export default Ember.Test.registerHelper('pollHasOptions', function(app, assert,
|
|||
|
||||
expectedOptions.forEach((option, index) => {
|
||||
assert.equal(
|
||||
find('.form-group:nth-child(' + (index + 1) + ') label.control-label', elBase).text().trim(),
|
||||
find(`.form-group:nth-child(${index + 1}) label.control-label`, elBase).text().trim(),
|
||||
option,
|
||||
'poll option ' + index + ' is as expected'
|
||||
`poll option ${index} is as expected`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,9 +9,9 @@ export default Ember.Test.registerAsyncHelper('pollParticipate', function(app, n
|
|||
selections.forEach((selection, index) => {
|
||||
if (!Ember.isEmpty(selection)) {
|
||||
if (isFreeText) {
|
||||
fillIn('.participation .selections .form-group:nth-child(' + (index + 1) + ') input', selection);
|
||||
fillIn(`.participation .selections .form-group:nth-child(${index + 1}) input`, selection);
|
||||
} else {
|
||||
click('.participation .selections .form-group:nth-child(' + (index + 1) + ') input[type="radio"][value="' + selection + '"]');
|
||||
click(`.participation .selections .form-group:nth-child(${index + 1}) input[type="radio"][value="${selection}"]`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Test.registerAsyncHelper('selectDates', function(app, datepickerElement, dates) {
|
||||
var normalizedDates = dates.map((date) => {
|
||||
const normalizedDates = dates.map((date) => {
|
||||
if (typeof date.toDate === 'function') {
|
||||
date = date.toDate();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import Ember from 'ember';
|
|||
/* global sjcl */
|
||||
|
||||
export default function(attr, key) {
|
||||
var defaultAttr = {
|
||||
const defaultAttr = {
|
||||
id: 'test',
|
||||
title: 'default title',
|
||||
description: 'default description',
|
||||
|
@ -10,27 +10,27 @@ export default function (attr, key) {
|
|||
answerType: 'YesNo',
|
||||
answers: [
|
||||
{
|
||||
type: "yes",
|
||||
labelTranslation: "answerTypes.yes.label",
|
||||
icon: "glyphicon glyphicon-thumbs-up",
|
||||
label: "Ja"
|
||||
type: 'yes',
|
||||
labelTranslation: 'answerTypes.yes.label',
|
||||
icon: 'glyphicon glyphicon-thumbs-up',
|
||||
label: 'Ja'
|
||||
},
|
||||
{
|
||||
type: "no",
|
||||
labelTranslation: "answerTypes.no.label",
|
||||
icon: "glyphicon glyphicon-thumbs-down",
|
||||
label: "Nein"
|
||||
type: 'no',
|
||||
labelTranslation: 'answerTypes.no.label',
|
||||
icon: 'glyphicon glyphicon-thumbs-down',
|
||||
label: 'Nein'
|
||||
}
|
||||
],
|
||||
options: [
|
||||
{
|
||||
title: "2017-12-24"
|
||||
title: '2017-12-24'
|
||||
},
|
||||
{
|
||||
title: "2018-01-01"
|
||||
title: '2018-01-01'
|
||||
}
|
||||
],
|
||||
creationDate: "2015-04-01T11:11:11.111Z",
|
||||
creationDate: '2015-04-01T11:11:11.111Z',
|
||||
forceAnswer: true,
|
||||
anonymousUser: false,
|
||||
isDateTime: false,
|
||||
|
@ -40,18 +40,18 @@ export default function (attr, key) {
|
|||
version: 'v0.3'
|
||||
};
|
||||
|
||||
var encrypt = function(prop) {
|
||||
const encrypt = function(prop) {
|
||||
return sjcl.encrypt(
|
||||
key,
|
||||
JSON.stringify(prop)
|
||||
);
|
||||
};
|
||||
|
||||
var data = Ember.merge(defaultAttr, attr);
|
||||
let data = Ember.merge(defaultAttr, attr);
|
||||
|
||||
var users = data.users.map(function(user, index) {
|
||||
const users = data.users.map(function(user, index) {
|
||||
return {
|
||||
id: data.id + '_' + index,
|
||||
id: `${data.id}_${index}`,
|
||||
creationDate: encrypt(user.creationDate),
|
||||
name: encrypt(user.name),
|
||||
poll: data.id,
|
||||
|
@ -62,7 +62,7 @@ export default function (attr, key) {
|
|||
|
||||
return [
|
||||
200,
|
||||
{ "Content-Type": "application/json" },
|
||||
{ 'Content-Type': 'application/json' },
|
||||
JSON.stringify({
|
||||
poll: {
|
||||
id: data.id,
|
||||
|
@ -78,7 +78,7 @@ export default function (attr, key) {
|
|||
isDateTime: encrypt(data.isDateTime),
|
||||
timezone: encrypt(data.timezone),
|
||||
expirationDate: encrypt(data.expirationDate),
|
||||
users: users,
|
||||
users,
|
||||
version: data.version
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
export default function(requestBody, id) {
|
||||
var poll = JSON.parse(requestBody);
|
||||
let poll = JSON.parse(requestBody);
|
||||
poll.poll.id = id;
|
||||
return [
|
||||
200,
|
||||
{"Content-Type": "application/json"},
|
||||
{ 'Content-Type': 'application/json' },
|
||||
JSON.stringify(poll)
|
||||
];
|
||||
}
|
||||
|
|
|
@ -3,11 +3,11 @@ export default function (requestBody, id) {
|
|||
id = 1;
|
||||
}
|
||||
|
||||
var poll = JSON.parse(requestBody);
|
||||
let poll = JSON.parse(requestBody);
|
||||
poll.user.id = id;
|
||||
return [
|
||||
200,
|
||||
{"Content-Type": "application/json"},
|
||||
{ 'Content-Type': 'application/json' },
|
||||
JSON.stringify(poll)
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Test.registerAsyncHelper('switchTab', function(app, tab) {
|
||||
click('.nav-tabs .' + tab + ' a');
|
||||
click(`.nav-tabs .${tab} a`);
|
||||
});
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
import Ember from "ember";
|
||||
import Ember from 'ember';
|
||||
import { module, test } from 'qunit';
|
||||
import startApp from '../helpers/start-app';
|
||||
import moment from 'moment';
|
||||
/* jshint proto: true */
|
||||
|
||||
var application;
|
||||
let application;
|
||||
|
||||
module('Integration', {
|
||||
beforeEach: function() {
|
||||
beforeEach() {
|
||||
application = startApp();
|
||||
moment.locale(
|
||||
application.__container__.lookup('service:i18n').get('locale')
|
||||
);
|
||||
},
|
||||
afterEach: function() {
|
||||
afterEach() {
|
||||
Ember.run(application, 'destroy');
|
||||
}
|
||||
});
|
||||
|
||||
test("create a default poll and participate", function(assert) {
|
||||
var dates =
|
||||
test('create a default poll and participate', function(assert) {
|
||||
const dates =
|
||||
[
|
||||
moment().add(1, 'day'),
|
||||
moment().add(1, 'week'),
|
||||
moment().add(1, 'month')
|
||||
];
|
||||
|
||||
var formattedDates =
|
||||
const formattedDates =
|
||||
dates.map((date) => {
|
||||
return date.format(
|
||||
moment.localeData().longDateFormat('LLLL')
|
||||
|
|
|
@ -6,19 +6,19 @@ import startApp from 'croodle/tests/helpers/start-app';
|
|||
let application;
|
||||
|
||||
module('Integration | legacy support', {
|
||||
beforeEach: function() {
|
||||
beforeEach() {
|
||||
application = startApp();
|
||||
},
|
||||
|
||||
afterEach: function() {
|
||||
afterEach() {
|
||||
Ember.run(application, 'destroy');
|
||||
}
|
||||
});
|
||||
|
||||
test('show a default poll created with v0.3.0', function(assert) {
|
||||
var id = 'JlHpRs0Pzi',
|
||||
encryptionKey = '5MKFuNTKILUXw6RuqkAw6ooZw4k3mWWx98ZQw8vH',
|
||||
timezone = 'Europe/Berlin';
|
||||
const id = 'JlHpRs0Pzi';
|
||||
const encryptionKey = '5MKFuNTKILUXw6RuqkAw6ooZw4k3mWWx98ZQw8vH';
|
||||
const timezone = 'Europe/Berlin';
|
||||
|
||||
visit(`/poll/${id}?encryptionKey=${encryptionKey}`);
|
||||
|
||||
|
@ -84,8 +84,8 @@ test('show a default poll created with v0.3.0', function(assert) {
|
|||
});
|
||||
|
||||
test('find a poll using free text created with v0.3.0', function(assert) {
|
||||
var id = 'PjW3XwbuRc',
|
||||
encryptionKey = 'Rre6dAGOYLW9gYKOP4LhX7Qwfhe5Th3je0uKDtyy';
|
||||
const id = 'PjW3XwbuRc';
|
||||
const encryptionKey = 'Rre6dAGOYLW9gYKOP4LhX7Qwfhe5Th3je0uKDtyy';
|
||||
|
||||
visit(`/poll/${id}?encryptionKey=${encryptionKey}`);
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ moduleFor('service:i18n', 'Integration | translations', {
|
|||
|
||||
// Replace this with your real tests.
|
||||
test('configuration is correct', function(assert) {
|
||||
const i18n = this.subject(),
|
||||
locales = i18n.get('locales'),
|
||||
defaultLocale = config.i18n.defaultLocale;
|
||||
const i18n = this.subject();
|
||||
const locales = i18n.get('locales');
|
||||
const { defaultLocale } = config.i18n;
|
||||
|
||||
assert.ok(defaultLocale, 'default locale is set');
|
||||
assert.ok(locales, 'there are locales');
|
||||
|
@ -18,10 +18,10 @@ test('configuration is correct', function(assert) {
|
|||
});
|
||||
|
||||
test('all locales have same amount of translation strings as default locale', function(assert) {
|
||||
const i18n = this.subject(),
|
||||
locales = i18n.get('locales'),
|
||||
defaultLocale = config.i18n.defaultLocale,
|
||||
defaultTranslations = new LocaleHelper(defaultLocale, i18n.get('container')).translations;
|
||||
const i18n = this.subject();
|
||||
const locales = i18n.get('locales');
|
||||
const { defaultLocale } = config.i18n;
|
||||
const { translations: defaultTranslations } = new LocaleHelper(defaultLocale, i18n.get('container'));
|
||||
|
||||
assert.expect((locales.length - 1) * 2);
|
||||
|
||||
|
@ -29,21 +29,21 @@ test('all locales have same amount of translation strings as default locale', fu
|
|||
if (locale === defaultLocale) {
|
||||
return;
|
||||
}
|
||||
var translations = new LocaleHelper(locale, i18n.get('container')).translations;
|
||||
assert.ok(translations, 'could retrive locale ' + locale);
|
||||
const { translations } = new LocaleHelper(locale, i18n.get('container'));
|
||||
assert.ok(translations, `could retrive locale ${locale}`);
|
||||
assert.equal(
|
||||
Object.keys(translations).length,
|
||||
Object.keys(defaultTranslations).length,
|
||||
'correct amount of translations for locale ' + locale
|
||||
`correct amount of translations for locale ${locale}`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test('all locales have same translation strings as default locale', function(assert) {
|
||||
const i18n = this.subject(),
|
||||
locales = i18n.get('locales'),
|
||||
defaultLocale = config.i18n.defaultLocale,
|
||||
defaultTranslations = new LocaleHelper(defaultLocale, i18n.get('container')).translations;
|
||||
const i18n = this.subject();
|
||||
const locales = i18n.get('locales');
|
||||
const { defaultLocale } = config.i18n;
|
||||
const { translations: defaultTranslations } = new LocaleHelper(defaultLocale, i18n.get('container'));
|
||||
|
||||
assert.expect(
|
||||
// count of non default locales * translation strings of default locale
|
||||
|
@ -59,7 +59,7 @@ test('all locales have same translation strings as default locale', function(ass
|
|||
i18n.set('locale', locale);
|
||||
assert.ok(
|
||||
i18n.exists(translationString),
|
||||
'translation for ' + translationString + ' exists in locale ' + locale
|
||||
`translation for ${translationString} exists in locale ${locale}`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,7 +10,7 @@ test('it renders', function(assert) {
|
|||
assert.expect(2);
|
||||
|
||||
// Creates the component instance
|
||||
var component = this.subject();
|
||||
let component = this.subject();
|
||||
assert.equal(component._state, 'preRender');
|
||||
|
||||
// Renders the component to the page
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('controller:error', {
|
||||
moduleFor('controller:error', 'Unit | Controller | error', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['controller:foo']
|
||||
});
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
var controller = this.subject();
|
||||
let controller = this.subject();
|
||||
assert.ok(controller);
|
||||
});
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('controller:poll/participation', {
|
||||
moduleFor('controller:poll/participation', 'Unit | Controller | poll/participation', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['controller:foo']
|
||||
});
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
var controller = this.subject();
|
||||
let controller = this.subject();
|
||||
assert.ok(controller);
|
||||
});
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('service:encryption', 'Unit | Service | encryption key', {
|
||||
moduleFor('service:encryption', 'Unit | Service | encryption', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['service:foo']
|
||||
});
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
var service = this.subject();
|
||||
let service = this.subject();
|
||||
assert.ok(service);
|
||||
});
|
||||
|
|
|
@ -5,44 +5,44 @@ moduleFor('validator:time', 'Unit | Validator | time', {
|
|||
});
|
||||
|
||||
test('HH:mm is treated as valid', function(assert) {
|
||||
var validator = this.subject();
|
||||
let validator = this.subject();
|
||||
|
||||
assert.ok(validator.validate('00:00'));
|
||||
assert.ok(validator.validate('23:59'));
|
||||
});
|
||||
|
||||
test('24:00 is invalid', function(assert) {
|
||||
var validator = this.subject();
|
||||
let validator = this.subject();
|
||||
|
||||
assert.ok(typeof validator.validate('24:00') === 'string');
|
||||
});
|
||||
|
||||
test('00:60 is invalid', function(assert) {
|
||||
var validator = this.subject();
|
||||
let validator = this.subject();
|
||||
|
||||
assert.ok(typeof validator.validate('00:60') === 'string');
|
||||
});
|
||||
|
||||
test('an empty string is invalid', function(assert) {
|
||||
var validator = this.subject();
|
||||
let validator = this.subject();
|
||||
|
||||
assert.ok(typeof validator.validate('') === 'string');
|
||||
});
|
||||
|
||||
test('null is invalid', function(assert) {
|
||||
var validator = this.subject();
|
||||
let validator = this.subject();
|
||||
|
||||
assert.ok(typeof validator.validate(null) === 'string');
|
||||
});
|
||||
|
||||
test('undefined is invalid', function(assert) {
|
||||
var validator = this.subject();
|
||||
let validator = this.subject();
|
||||
|
||||
assert.ok(typeof validator.validate(undefined) === 'string');
|
||||
});
|
||||
|
||||
test('a valid time wrapped by spaces is valid', function(assert) {
|
||||
var validator = this.subject();
|
||||
let validator = this.subject();
|
||||
|
||||
assert.ok(validator.validate(' 10:00 '));
|
||||
});
|
||||
|
|
|
@ -5,6 +5,6 @@ moduleFor('validator:valid-collection', 'Unit | Validator | valid-collection', {
|
|||
});
|
||||
|
||||
test('it works', function(assert) {
|
||||
var validator = this.subject();
|
||||
let validator = this.subject();
|
||||
assert.ok(validator);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue