fix ESLint warnings for QUnit (#725)
This commit is contained in:
parent
bf87f6f305
commit
0c4ef6fc5b
9 changed files with 251 additions and 271 deletions
|
@ -58,12 +58,7 @@ module.exports = {
|
||||||
// test files
|
// test files
|
||||||
files: ['tests/**/*-test.{js,ts}'],
|
files: ['tests/**/*-test.{js,ts}'],
|
||||||
extends: ['plugin:qunit/recommended'],
|
extends: ['plugin:qunit/recommended'],
|
||||||
rules: {
|
rules: {},
|
||||||
'qunit/no-assert-equal': 'warn',
|
|
||||||
'qunit/no-assert-logical-expression': 'warn',
|
|
||||||
'qunit/no-async-module-callbacks': 'warn',
|
|
||||||
'qunit/require-expect': 'warn',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,7 +47,7 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
];
|
];
|
||||||
|
|
||||||
await pageCreateIndex.visit();
|
await pageCreateIndex.visit();
|
||||||
assert.equal(currentRouteName(), 'create.index');
|
assert.strictEqual(currentRouteName(), 'create.index');
|
||||||
assert
|
assert
|
||||||
.dom('[data-test-form-step].is-active')
|
.dom('[data-test-form-step].is-active')
|
||||||
.hasText(
|
.hasText(
|
||||||
|
@ -76,7 +76,7 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
);
|
);
|
||||||
|
|
||||||
await pageCreateIndex.next();
|
await pageCreateIndex.next();
|
||||||
assert.equal(currentRouteName(), 'create.meta');
|
assert.strictEqual(currentRouteName(), 'create.meta');
|
||||||
assert
|
assert
|
||||||
.dom('[data-test-form-step].is-active')
|
.dom('[data-test-form-step].is-active')
|
||||||
.hasText(
|
.hasText(
|
||||||
|
@ -91,7 +91,7 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
assert.ok(pageCreateMeta.titleHasFocus, 'title input has autofocus');
|
assert.ok(pageCreateMeta.titleHasFocus, 'title input has autofocus');
|
||||||
|
|
||||||
await pageCreateMeta.title('default poll').next();
|
await pageCreateMeta.title('default poll').next();
|
||||||
assert.equal(currentRouteName(), 'create.options');
|
assert.strictEqual(currentRouteName(), 'create.options');
|
||||||
assert
|
assert
|
||||||
.dom('[data-test-form-step].is-active')
|
.dom('[data-test-form-step].is-active')
|
||||||
.hasText(
|
.hasText(
|
||||||
|
@ -106,7 +106,7 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
|
|
||||||
await pageCreateOptions.selectDates(dates);
|
await pageCreateOptions.selectDates(dates);
|
||||||
await pageCreateOptions.next();
|
await pageCreateOptions.next();
|
||||||
assert.equal(currentRouteName(), 'create.options-datetime');
|
assert.strictEqual(currentRouteName(), 'create.options-datetime');
|
||||||
assert
|
assert
|
||||||
.dom('[data-test-form-step].is-active')
|
.dom('[data-test-form-step].is-active')
|
||||||
.hasText(
|
.hasText(
|
||||||
|
@ -124,7 +124,7 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
);
|
);
|
||||||
|
|
||||||
await pageCreateOptionsDatetime.next();
|
await pageCreateOptionsDatetime.next();
|
||||||
assert.equal(currentRouteName(), 'create.settings');
|
assert.strictEqual(currentRouteName(), 'create.settings');
|
||||||
assert
|
assert
|
||||||
.dom('[data-test-form-step].is-active')
|
.dom('[data-test-form-step].is-active')
|
||||||
.hasText(
|
.hasText(
|
||||||
|
@ -148,7 +148,7 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
await assert.asyncThrows(async () => {
|
await assert.asyncThrows(async () => {
|
||||||
await pageCreateSettings.save();
|
await pageCreateSettings.save();
|
||||||
}, 'Unexpected server-side error. Server responded with 503 (Service Unavailable)');
|
}, 'Unexpected server-side error. Server responded with 503 (Service Unavailable)');
|
||||||
assert.equal(currentRouteName(), 'create.settings');
|
assert.strictEqual(currentRouteName(), 'create.settings');
|
||||||
|
|
||||||
// simulate server is available again
|
// simulate server is available again
|
||||||
// defer creation for testing loading spinner
|
// defer creation for testing loading spinner
|
||||||
|
@ -174,17 +174,17 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
resolveSubmission(resolveSubmissionWith);
|
resolveSubmission(resolveSubmissionWith);
|
||||||
await settled();
|
await settled();
|
||||||
|
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.strictEqual(currentRouteName(), 'poll.participation');
|
||||||
assert.true(
|
assert.true(
|
||||||
pagePollParticipation.urlIsValid(),
|
pagePollParticipation.urlIsValid(),
|
||||||
`poll url ${currentURL()} is valid`,
|
`poll url ${currentURL()} is valid`,
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pagePollParticipation.title,
|
pagePollParticipation.title,
|
||||||
'default poll',
|
'default poll',
|
||||||
'poll title is correct',
|
'poll title is correct',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pagePollParticipation.description,
|
pagePollParticipation.description,
|
||||||
'',
|
'',
|
||||||
'poll description is correct',
|
'poll description is correct',
|
||||||
|
@ -228,7 +228,7 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
);
|
);
|
||||||
|
|
||||||
await pageCreateIndex.pollType('MakeAPoll').next();
|
await pageCreateIndex.pollType('MakeAPoll').next();
|
||||||
assert.equal(currentRouteName(), 'create.meta');
|
assert.strictEqual(currentRouteName(), 'create.meta');
|
||||||
assert
|
assert
|
||||||
.dom('[data-test-form-step].is-active')
|
.dom('[data-test-form-step].is-active')
|
||||||
.hasText(
|
.hasText(
|
||||||
|
@ -252,7 +252,7 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
);
|
);
|
||||||
|
|
||||||
await pageCreateMeta.title('default poll').next();
|
await pageCreateMeta.title('default poll').next();
|
||||||
assert.equal(currentRouteName(), 'create.options');
|
assert.strictEqual(currentRouteName(), 'create.options');
|
||||||
assert
|
assert
|
||||||
.dom('[data-test-form-step].is-active')
|
.dom('[data-test-form-step].is-active')
|
||||||
.hasText(
|
.hasText(
|
||||||
|
@ -268,7 +268,7 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
pageCreateOptions.firstTextOption.inputHasFocus,
|
pageCreateOptions.firstTextOption.inputHasFocus,
|
||||||
'first option input has autofocus',
|
'first option input has autofocus',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pageCreateOptions.textOptions.length,
|
pageCreateOptions.textOptions.length,
|
||||||
2,
|
2,
|
||||||
'there are two input fields as default',
|
'there are two input fields as default',
|
||||||
|
@ -287,26 +287,41 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
'status bar shows correct item as current path (options.text)',
|
'status bar shows correct item as current path (options.text)',
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
pageCreateOptions.textOptions.objectAt(0).hasError &&
|
pageCreateOptions.textOptions.objectAt(0).hasError,
|
||||||
|
'validation error is shown after submit for first text option',
|
||||||
|
);
|
||||||
|
assert.ok(
|
||||||
pageCreateOptions.textOptions.objectAt(1).hasError,
|
pageCreateOptions.textOptions.objectAt(1).hasError,
|
||||||
'validation errors are shown after submit',
|
'validation error is shown after submit for second text option',
|
||||||
);
|
);
|
||||||
|
|
||||||
await pageCreateOptions.textOptions.objectAt(0).title('option a');
|
await pageCreateOptions.textOptions.objectAt(0).title('option a');
|
||||||
await pageCreateOptions.textOptions.objectAt(1).title('option c');
|
await pageCreateOptions.textOptions.objectAt(1).title('option c');
|
||||||
await pageCreateOptions.textOptions.objectAt(0).add();
|
await pageCreateOptions.textOptions.objectAt(0).add();
|
||||||
assert.equal(pageCreateOptions.textOptions.length, 3, 'option was added');
|
assert.strictEqual(
|
||||||
|
pageCreateOptions.textOptions.length,
|
||||||
|
3,
|
||||||
|
'option was added',
|
||||||
|
);
|
||||||
|
|
||||||
await pageCreateOptions.textOptions.objectAt(1).title('option b');
|
await pageCreateOptions.textOptions.objectAt(1).title('option b');
|
||||||
await pageCreateOptions.textOptions.objectAt(2).add();
|
await pageCreateOptions.textOptions.objectAt(2).add();
|
||||||
assert.equal(pageCreateOptions.textOptions.length, 4, 'option was added');
|
assert.strictEqual(
|
||||||
|
pageCreateOptions.textOptions.length,
|
||||||
|
4,
|
||||||
|
'option was added',
|
||||||
|
);
|
||||||
|
|
||||||
await pageCreateOptions.textOptions.objectAt(3).title('to be deleted');
|
await pageCreateOptions.textOptions.objectAt(3).title('to be deleted');
|
||||||
await pageCreateOptions.textOptions.objectAt(3).delete();
|
await pageCreateOptions.textOptions.objectAt(3).delete();
|
||||||
assert.equal(pageCreateOptions.textOptions.length, 3, 'option got deleted');
|
assert.strictEqual(
|
||||||
|
pageCreateOptions.textOptions.length,
|
||||||
|
3,
|
||||||
|
'option got deleted',
|
||||||
|
);
|
||||||
|
|
||||||
await pageCreateOptions.next();
|
await pageCreateOptions.next();
|
||||||
assert.equal(currentRouteName(), 'create.settings');
|
assert.strictEqual(currentRouteName(), 'create.settings');
|
||||||
assert
|
assert
|
||||||
.dom('[data-test-form-step].is-active')
|
.dom('[data-test-form-step].is-active')
|
||||||
.hasText(
|
.hasText(
|
||||||
|
@ -320,14 +335,14 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
);
|
);
|
||||||
|
|
||||||
await pageCreateSettings.save();
|
await pageCreateSettings.save();
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.strictEqual(currentRouteName(), 'poll.participation');
|
||||||
assert.true(pagePollParticipation.urlIsValid(), 'poll url is valid');
|
assert.true(pagePollParticipation.urlIsValid(), 'poll url is valid');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pagePollParticipation.title,
|
pagePollParticipation.title,
|
||||||
'default poll',
|
'default poll',
|
||||||
'poll title is correct',
|
'poll title is correct',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pagePollParticipation.description,
|
pagePollParticipation.description,
|
||||||
'',
|
'',
|
||||||
'poll description is correct',
|
'poll description is correct',
|
||||||
|
@ -349,17 +364,17 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
|
|
||||||
await pageCreateIndex.visit();
|
await pageCreateIndex.visit();
|
||||||
await pageCreateIndex.next();
|
await pageCreateIndex.next();
|
||||||
assert.equal(currentRouteName(), 'create.meta');
|
assert.strictEqual(currentRouteName(), 'create.meta');
|
||||||
|
|
||||||
await pageCreateMeta
|
await pageCreateMeta
|
||||||
.title('default poll')
|
.title('default poll')
|
||||||
.description('a sample description')
|
.description('a sample description')
|
||||||
.next();
|
.next();
|
||||||
assert.equal(currentRouteName(), 'create.options');
|
assert.strictEqual(currentRouteName(), 'create.options');
|
||||||
|
|
||||||
await pageCreateOptions.selectDates(days);
|
await pageCreateOptions.selectDates(days);
|
||||||
await pageCreateOptions.next();
|
await pageCreateOptions.next();
|
||||||
assert.equal(currentRouteName(), 'create.options-datetime');
|
assert.strictEqual(currentRouteName(), 'create.options-datetime');
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
findAll('[data-test-day] label').map((el) => el.textContent.trim()),
|
findAll('[data-test-day] label').map((el) => el.textContent.trim()),
|
||||||
days.map((day) =>
|
days.map((day) =>
|
||||||
|
@ -373,17 +388,17 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
await pageCreateOptionsDatetime.times.objectAt(1).time('18:00');
|
await pageCreateOptionsDatetime.times.objectAt(1).time('18:00');
|
||||||
await pageCreateOptionsDatetime.times.objectAt(2).time('12:00');
|
await pageCreateOptionsDatetime.times.objectAt(2).time('12:00');
|
||||||
await pageCreateOptionsDatetime.next();
|
await pageCreateOptionsDatetime.next();
|
||||||
assert.equal(currentRouteName(), 'create.settings');
|
assert.strictEqual(currentRouteName(), 'create.settings');
|
||||||
|
|
||||||
await pageCreateSettings.save();
|
await pageCreateSettings.save();
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.strictEqual(currentRouteName(), 'poll.participation');
|
||||||
assert.true(pagePollParticipation.urlIsValid(), 'poll url is valid');
|
assert.true(pagePollParticipation.urlIsValid(), 'poll url is valid');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pagePollParticipation.title,
|
pagePollParticipation.title,
|
||||||
'default poll',
|
'default poll',
|
||||||
'poll title is correct',
|
'poll title is correct',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pagePollParticipation.description,
|
pagePollParticipation.description,
|
||||||
'a sample description',
|
'a sample description',
|
||||||
'poll description is correct',
|
'poll description is correct',
|
||||||
|
@ -414,17 +429,17 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
|
|
||||||
await pageCreateIndex.visit();
|
await pageCreateIndex.visit();
|
||||||
await pageCreateIndex.next();
|
await pageCreateIndex.next();
|
||||||
assert.equal(currentRouteName(), 'create.meta');
|
assert.strictEqual(currentRouteName(), 'create.meta');
|
||||||
|
|
||||||
await pageCreateMeta
|
await pageCreateMeta
|
||||||
.title('default poll')
|
.title('default poll')
|
||||||
.description('a sample description')
|
.description('a sample description')
|
||||||
.next();
|
.next();
|
||||||
assert.equal(currentRouteName(), 'create.options');
|
assert.strictEqual(currentRouteName(), 'create.options');
|
||||||
|
|
||||||
await pageCreateOptions.selectDates([day]);
|
await pageCreateOptions.selectDates([day]);
|
||||||
await pageCreateOptions.next();
|
await pageCreateOptions.next();
|
||||||
assert.equal(currentRouteName(), 'create.options-datetime');
|
assert.strictEqual(currentRouteName(), 'create.options-datetime');
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
findAll('[data-test-day] label').map((el) => el.textContent.trim()),
|
findAll('[data-test-day] label').map((el) => el.textContent.trim()),
|
||||||
[Intl.DateTimeFormat('en-US', { dateStyle: 'full' }).format(day)],
|
[Intl.DateTimeFormat('en-US', { dateStyle: 'full' }).format(day)],
|
||||||
|
@ -486,17 +501,17 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
);
|
);
|
||||||
|
|
||||||
await pageCreateOptionsDatetime.next();
|
await pageCreateOptionsDatetime.next();
|
||||||
assert.equal(currentRouteName(), 'create.settings');
|
assert.strictEqual(currentRouteName(), 'create.settings');
|
||||||
|
|
||||||
await pageCreateSettings.save();
|
await pageCreateSettings.save();
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.strictEqual(currentRouteName(), 'poll.participation');
|
||||||
assert.true(pagePollParticipation.urlIsValid(), 'poll url is valid');
|
assert.true(pagePollParticipation.urlIsValid(), 'poll url is valid');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pagePollParticipation.title,
|
pagePollParticipation.title,
|
||||||
'default poll',
|
'default poll',
|
||||||
'poll title is correct',
|
'poll title is correct',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pagePollParticipation.description,
|
pagePollParticipation.description,
|
||||||
'a sample description',
|
'a sample description',
|
||||||
'poll description is correct',
|
'poll description is correct',
|
||||||
|
@ -523,17 +538,17 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
|
|
||||||
await pageCreateIndex.visit();
|
await pageCreateIndex.visit();
|
||||||
await pageCreateIndex.next();
|
await pageCreateIndex.next();
|
||||||
assert.equal(currentRouteName(), 'create.meta');
|
assert.strictEqual(currentRouteName(), 'create.meta');
|
||||||
|
|
||||||
await pageCreateMeta
|
await pageCreateMeta
|
||||||
.title('default poll')
|
.title('default poll')
|
||||||
.description('a sample description')
|
.description('a sample description')
|
||||||
.next();
|
.next();
|
||||||
assert.equal(currentRouteName(), 'create.options');
|
assert.strictEqual(currentRouteName(), 'create.options');
|
||||||
|
|
||||||
await pageCreateOptions.selectDates([day]);
|
await pageCreateOptions.selectDates([day]);
|
||||||
await pageCreateOptions.next();
|
await pageCreateOptions.next();
|
||||||
assert.equal(currentRouteName(), 'create.options-datetime');
|
assert.strictEqual(currentRouteName(), 'create.options-datetime');
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
findAll('[data-test-day] label').map((el) => el.textContent.trim()),
|
findAll('[data-test-day] label').map((el) => el.textContent.trim()),
|
||||||
[Intl.DateTimeFormat('en-US', { dateStyle: 'full' }).format(day)],
|
[Intl.DateTimeFormat('en-US', { dateStyle: 'full' }).format(day)],
|
||||||
|
@ -541,17 +556,17 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
);
|
);
|
||||||
|
|
||||||
await pageCreateOptionsDatetime.next();
|
await pageCreateOptionsDatetime.next();
|
||||||
assert.equal(currentRouteName(), 'create.settings');
|
assert.strictEqual(currentRouteName(), 'create.settings');
|
||||||
|
|
||||||
await pageCreateSettings.save();
|
await pageCreateSettings.save();
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.strictEqual(currentRouteName(), 'poll.participation');
|
||||||
assert.true(pagePollParticipation.urlIsValid(), 'poll url is valid');
|
assert.true(pagePollParticipation.urlIsValid(), 'poll url is valid');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pagePollParticipation.title,
|
pagePollParticipation.title,
|
||||||
'default poll',
|
'default poll',
|
||||||
'poll title is correct',
|
'poll title is correct',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pagePollParticipation.description,
|
pagePollParticipation.description,
|
||||||
'a sample description',
|
'a sample description',
|
||||||
'poll description is correct',
|
'poll description is correct',
|
||||||
|
@ -570,17 +585,17 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
|
|
||||||
await pageCreateIndex.visit();
|
await pageCreateIndex.visit();
|
||||||
await pageCreateIndex.next();
|
await pageCreateIndex.next();
|
||||||
assert.equal(currentRouteName(), 'create.meta');
|
assert.strictEqual(currentRouteName(), 'create.meta');
|
||||||
|
|
||||||
await pageCreateMeta
|
await pageCreateMeta
|
||||||
.title('default poll')
|
.title('default poll')
|
||||||
.description('a sample description')
|
.description('a sample description')
|
||||||
.next();
|
.next();
|
||||||
assert.equal(currentRouteName(), 'create.options');
|
assert.strictEqual(currentRouteName(), 'create.options');
|
||||||
|
|
||||||
await pageCreateOptions.selectDates([day]);
|
await pageCreateOptions.selectDates([day]);
|
||||||
await pageCreateOptions.next();
|
await pageCreateOptions.next();
|
||||||
assert.equal(currentRouteName(), 'create.options-datetime');
|
assert.strictEqual(currentRouteName(), 'create.options-datetime');
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
findAll('[data-test-day] label').map((el) => el.textContent.trim()),
|
findAll('[data-test-day] label').map((el) => el.textContent.trim()),
|
||||||
[Intl.DateTimeFormat('en-US', { dateStyle: 'full' }).format(day)],
|
[Intl.DateTimeFormat('en-US', { dateStyle: 'full' }).format(day)],
|
||||||
|
@ -589,17 +604,17 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
|
|
||||||
await pageCreateOptionsDatetime.times.objectAt(0).time('22:30');
|
await pageCreateOptionsDatetime.times.objectAt(0).time('22:30');
|
||||||
await pageCreateOptionsDatetime.next();
|
await pageCreateOptionsDatetime.next();
|
||||||
assert.equal(currentRouteName(), 'create.settings');
|
assert.strictEqual(currentRouteName(), 'create.settings');
|
||||||
|
|
||||||
await pageCreateSettings.save();
|
await pageCreateSettings.save();
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.strictEqual(currentRouteName(), 'poll.participation');
|
||||||
assert.true(pagePollParticipation.urlIsValid(), 'poll url is valid');
|
assert.true(pagePollParticipation.urlIsValid(), 'poll url is valid');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pagePollParticipation.title,
|
pagePollParticipation.title,
|
||||||
'default poll',
|
'default poll',
|
||||||
'poll title is correct',
|
'poll title is correct',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pagePollParticipation.description,
|
pagePollParticipation.description,
|
||||||
'a sample description',
|
'a sample description',
|
||||||
'poll description is correct',
|
'poll description is correct',
|
||||||
|
@ -626,18 +641,18 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
|
|
||||||
await visit('/create');
|
await visit('/create');
|
||||||
await click('button[type="submit"]');
|
await click('button[type="submit"]');
|
||||||
assert.equal(currentRouteName(), 'create.meta');
|
assert.strictEqual(currentRouteName(), 'create.meta');
|
||||||
|
|
||||||
await fillIn(
|
await fillIn(
|
||||||
'[data-test-form-element="title"] input[type="text"]',
|
'[data-test-form-element="title"] input[type="text"]',
|
||||||
'example poll for to test time adopting workflow',
|
'example poll for to test time adopting workflow',
|
||||||
);
|
);
|
||||||
await click('button[type="submit"]');
|
await click('button[type="submit"]');
|
||||||
assert.equal(currentRouteName(), 'create.options');
|
assert.strictEqual(currentRouteName(), 'create.options');
|
||||||
|
|
||||||
await pageCreateOptions.selectDates(days);
|
await pageCreateOptions.selectDates(days);
|
||||||
await click('button[type="submit"]');
|
await click('button[type="submit"]');
|
||||||
assert.equal(currentRouteName(), 'create.options-datetime');
|
assert.strictEqual(currentRouteName(), 'create.options-datetime');
|
||||||
|
|
||||||
for (let i = 1; i <= 3; i++) {
|
for (let i = 1; i <= 3; i++) {
|
||||||
await click(
|
await click(
|
||||||
|
@ -729,10 +744,10 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
);
|
);
|
||||||
|
|
||||||
await click('button[type="submit"]');
|
await click('button[type="submit"]');
|
||||||
assert.equal(currentRouteName(), 'create.settings');
|
assert.strictEqual(currentRouteName(), 'create.settings');
|
||||||
|
|
||||||
await click('button[type="submit"]');
|
await click('button[type="submit"]');
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.strictEqual(currentRouteName(), 'poll.participation');
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
findAll(
|
findAll(
|
||||||
`[data-test-form-element^="option"] label:not(.custom-control-label)`,
|
`[data-test-form-element^="option"] label:not(.custom-control-label)`,
|
||||||
|
@ -761,11 +776,11 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
await pageCreateIndex.visit();
|
await pageCreateIndex.visit();
|
||||||
|
|
||||||
await pageCreateIndex.pollType('MakeAPoll').next();
|
await pageCreateIndex.pollType('MakeAPoll').next();
|
||||||
assert.equal(currentRouteName(), 'create.meta');
|
assert.strictEqual(currentRouteName(), 'create.meta');
|
||||||
|
|
||||||
await pageCreateMeta.title('default poll').next();
|
await pageCreateMeta.title('default poll').next();
|
||||||
assert.equal(currentRouteName(), 'create.options');
|
assert.strictEqual(currentRouteName(), 'create.options');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pageCreateOptions.textOptions.length,
|
pageCreateOptions.textOptions.length,
|
||||||
2,
|
2,
|
||||||
'there are two input fields as default',
|
'there are two input fields as default',
|
||||||
|
@ -773,20 +788,24 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
|
|
||||||
await pageCreateOptions.textOptions.objectAt(0).title('option a');
|
await pageCreateOptions.textOptions.objectAt(0).title('option a');
|
||||||
await pageCreateOptions.textOptions.objectAt(1).delete();
|
await pageCreateOptions.textOptions.objectAt(1).delete();
|
||||||
assert.equal(pageCreateOptions.textOptions.length, 1, 'option was deleted');
|
assert.strictEqual(
|
||||||
|
pageCreateOptions.textOptions.length,
|
||||||
|
1,
|
||||||
|
'option was deleted',
|
||||||
|
);
|
||||||
|
|
||||||
await pageCreateOptions.next();
|
await pageCreateOptions.next();
|
||||||
assert.equal(currentRouteName(), 'create.settings');
|
assert.strictEqual(currentRouteName(), 'create.settings');
|
||||||
|
|
||||||
await pageCreateSettings.save();
|
await pageCreateSettings.save();
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.strictEqual(currentRouteName(), 'poll.participation');
|
||||||
assert.true(pagePollParticipation.urlIsValid(), 'poll url is valid');
|
assert.true(pagePollParticipation.urlIsValid(), 'poll url is valid');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pagePollParticipation.title,
|
pagePollParticipation.title,
|
||||||
'default poll',
|
'default poll',
|
||||||
'poll title is correct',
|
'poll title is correct',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pagePollParticipation.description,
|
pagePollParticipation.description,
|
||||||
'',
|
'',
|
||||||
'poll description is correct',
|
'poll description is correct',
|
||||||
|
@ -807,17 +826,17 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
|
|
||||||
await pageCreateIndex.visit();
|
await pageCreateIndex.visit();
|
||||||
await pageCreateIndex.next();
|
await pageCreateIndex.next();
|
||||||
assert.equal(currentRouteName(), 'create.meta');
|
assert.strictEqual(currentRouteName(), 'create.meta');
|
||||||
|
|
||||||
await pageCreateMeta
|
await pageCreateMeta
|
||||||
.title('default poll')
|
.title('default poll')
|
||||||
.description('a sample description')
|
.description('a sample description')
|
||||||
.next();
|
.next();
|
||||||
assert.equal(currentRouteName(), 'create.options');
|
assert.strictEqual(currentRouteName(), 'create.options');
|
||||||
|
|
||||||
await pageCreateOptions.selectDates(days);
|
await pageCreateOptions.selectDates(days);
|
||||||
await pageCreateOptions.next();
|
await pageCreateOptions.next();
|
||||||
assert.equal(currentRouteName(), 'create.options-datetime');
|
assert.strictEqual(currentRouteName(), 'create.options-datetime');
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
findAll('[data-test-day] label').map((el) => el.textContent.trim()),
|
findAll('[data-test-day] label').map((el) => el.textContent.trim()),
|
||||||
days.map((day) =>
|
days.map((day) =>
|
||||||
|
@ -832,7 +851,7 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
.hasValue('10:00', 'time input has the value entered by the user');
|
.hasValue('10:00', 'time input has the value entered by the user');
|
||||||
|
|
||||||
await backButton();
|
await backButton();
|
||||||
assert.equal(currentRouteName(), 'create.options');
|
assert.strictEqual(currentRouteName(), 'create.options');
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
findAll('.ember-power-calendar-day--selected').map(
|
findAll('.ember-power-calendar-day--selected').map(
|
||||||
(el) => el.dataset.date,
|
(el) => el.dataset.date,
|
||||||
|
@ -842,7 +861,7 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
);
|
);
|
||||||
|
|
||||||
await pageCreateOptions.next();
|
await pageCreateOptions.next();
|
||||||
assert.equal(currentRouteName(), 'create.options-datetime');
|
assert.strictEqual(currentRouteName(), 'create.options-datetime');
|
||||||
assert
|
assert
|
||||||
.dom('[data-test-day="2016-01-02"] input[type="time"]')
|
.dom('[data-test-day="2016-01-02"] input[type="time"]')
|
||||||
.hasValue('', 'time input the user has not touched is still empty');
|
.hasValue('', 'time input the user has not touched is still empty');
|
||||||
|
@ -854,17 +873,17 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
);
|
);
|
||||||
|
|
||||||
await pageCreateOptionsDatetime.next();
|
await pageCreateOptionsDatetime.next();
|
||||||
assert.equal(currentRouteName(), 'create.settings');
|
assert.strictEqual(currentRouteName(), 'create.settings');
|
||||||
|
|
||||||
await pageCreateSettings.save();
|
await pageCreateSettings.save();
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.strictEqual(currentRouteName(), 'poll.participation');
|
||||||
assert.true(pagePollParticipation.urlIsValid(), 'poll url is valid');
|
assert.true(pagePollParticipation.urlIsValid(), 'poll url is valid');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pagePollParticipation.title,
|
pagePollParticipation.title,
|
||||||
'default poll',
|
'default poll',
|
||||||
'poll title is correct',
|
'poll title is correct',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pagePollParticipation.description,
|
pagePollParticipation.description,
|
||||||
'a sample description',
|
'a sample description',
|
||||||
'poll description is correct',
|
'poll description is correct',
|
||||||
|
@ -886,60 +905,60 @@ module('Acceptance | create a poll', function (hooks) {
|
||||||
|
|
||||||
test('Start at first step is enforced', async function (assert) {
|
test('Start at first step is enforced', async function (assert) {
|
||||||
await pageCreateSettings.visit();
|
await pageCreateSettings.visit();
|
||||||
assert.equal(currentRouteName(), 'create.index');
|
assert.strictEqual(currentRouteName(), 'create.index');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('back button', async function (assert) {
|
test('back button', async function (assert) {
|
||||||
await pageCreateIndex.visit();
|
await pageCreateIndex.visit();
|
||||||
assert.equal(currentRouteName(), 'create.index');
|
assert.strictEqual(currentRouteName(), 'create.index');
|
||||||
|
|
||||||
await pageCreateIndex.next();
|
await pageCreateIndex.next();
|
||||||
assert.equal(currentRouteName(), 'create.meta');
|
assert.strictEqual(currentRouteName(), 'create.meta');
|
||||||
|
|
||||||
await pageCreateMeta.title('foo').next();
|
await pageCreateMeta.title('foo').next();
|
||||||
assert.equal(currentRouteName(), 'create.options');
|
assert.strictEqual(currentRouteName(), 'create.options');
|
||||||
|
|
||||||
await pageCreateOptions.selectDates([new Date()]);
|
await pageCreateOptions.selectDates([new Date()]);
|
||||||
await pageCreateOptions.next();
|
await pageCreateOptions.next();
|
||||||
assert.equal(currentRouteName(), 'create.options-datetime');
|
assert.strictEqual(currentRouteName(), 'create.options-datetime');
|
||||||
|
|
||||||
await pageCreateOptionsDatetime.next();
|
await pageCreateOptionsDatetime.next();
|
||||||
assert.equal(currentRouteName(), 'create.settings');
|
assert.strictEqual(currentRouteName(), 'create.settings');
|
||||||
|
|
||||||
await pageCreateSettings.back();
|
await pageCreateSettings.back();
|
||||||
assert.equal(currentRouteName(), 'create.options-datetime');
|
assert.strictEqual(currentRouteName(), 'create.options-datetime');
|
||||||
|
|
||||||
await pageCreateOptionsDatetime.back();
|
await pageCreateOptionsDatetime.back();
|
||||||
assert.equal(currentRouteName(), 'create.options');
|
assert.strictEqual(currentRouteName(), 'create.options');
|
||||||
|
|
||||||
await pageCreateOptions.back();
|
await pageCreateOptions.back();
|
||||||
assert.equal(currentRouteName(), 'create.meta');
|
assert.strictEqual(currentRouteName(), 'create.meta');
|
||||||
|
|
||||||
await pageCreateMeta.back();
|
await pageCreateMeta.back();
|
||||||
assert.equal(currentRouteName(), 'create.index');
|
assert.strictEqual(currentRouteName(), 'create.index');
|
||||||
|
|
||||||
await pageCreateIndex.pollType('MakeAPoll').next();
|
await pageCreateIndex.pollType('MakeAPoll').next();
|
||||||
assert.equal(currentRouteName(), 'create.meta');
|
assert.strictEqual(currentRouteName(), 'create.meta');
|
||||||
|
|
||||||
await pageCreateMeta.next();
|
await pageCreateMeta.next();
|
||||||
assert.equal(currentRouteName(), 'create.options');
|
assert.strictEqual(currentRouteName(), 'create.options');
|
||||||
|
|
||||||
await pageCreateOptions.textOptions.objectAt(0).title('foo');
|
await pageCreateOptions.textOptions.objectAt(0).title('foo');
|
||||||
await pageCreateOptions.textOptions.objectAt(1).title('bar');
|
await pageCreateOptions.textOptions.objectAt(1).title('bar');
|
||||||
await pageCreateOptions.next();
|
await pageCreateOptions.next();
|
||||||
assert.equal(currentRouteName(), 'create.settings');
|
assert.strictEqual(currentRouteName(), 'create.settings');
|
||||||
|
|
||||||
await pageCreateSettings.back();
|
await pageCreateSettings.back();
|
||||||
assert.equal(currentRouteName(), 'create.options');
|
assert.strictEqual(currentRouteName(), 'create.options');
|
||||||
|
|
||||||
await pageCreateOptions.back();
|
await pageCreateOptions.back();
|
||||||
assert.equal(currentRouteName(), 'create.meta');
|
assert.strictEqual(currentRouteName(), 'create.meta');
|
||||||
|
|
||||||
await pageCreateMeta.back();
|
await pageCreateMeta.back();
|
||||||
assert.equal(currentRouteName(), 'create.index');
|
assert.strictEqual(currentRouteName(), 'create.index');
|
||||||
});
|
});
|
||||||
|
|
||||||
module('validation', async function () {
|
module('validation', function () {
|
||||||
test('validates user input when creating a poll with dates and times', async function (assert) {
|
test('validates user input when creating a poll with dates and times', async function (assert) {
|
||||||
const day = DateTime.now();
|
const day = DateTime.now();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { fillIn, find, visit } from '@ember/test-helpers';
|
import { fillIn, visit } from '@ember/test-helpers';
|
||||||
import { module, test } from 'qunit';
|
import { module, test } from 'qunit';
|
||||||
import { setupApplicationTest } from 'ember-qunit';
|
import { setupApplicationTest } from 'ember-qunit';
|
||||||
|
|
||||||
|
@ -11,15 +11,13 @@ module('Acceptance | i18n', function (hooks) {
|
||||||
|
|
||||||
test('locale is saved in localStorage', async function (assert) {
|
test('locale is saved in localStorage', async function (assert) {
|
||||||
await visit('/');
|
await visit('/');
|
||||||
assert.equal(
|
assert
|
||||||
find('.language-select').value,
|
.dom('.language-select')
|
||||||
'de',
|
.hasValue('de', 'picks up locale in locale storage');
|
||||||
'picks up locale in locale storage',
|
|
||||||
);
|
|
||||||
|
|
||||||
await fillIn('.language-select', 'en');
|
await fillIn('.language-select', 'en');
|
||||||
assert.equal(find('.language-select').value, 'en');
|
assert.dom('.language-select').hasValue('en', 'shows changed locale');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
window.localStorage.getItem('locale'),
|
window.localStorage.getItem('locale'),
|
||||||
'en',
|
'en',
|
||||||
'persisted in localeStorage',
|
'persisted in localeStorage',
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import {
|
import {
|
||||||
click,
|
click,
|
||||||
find,
|
|
||||||
findAll,
|
findAll,
|
||||||
currentURL,
|
currentURL,
|
||||||
currentRouteName,
|
currentRouteName,
|
||||||
|
@ -38,20 +37,20 @@ module('Acceptance | participate in a poll', function (hooks) {
|
||||||
});
|
});
|
||||||
|
|
||||||
await visit(`/poll/${poll.id}?encryptionKey=${encryptionKey}`);
|
await visit(`/poll/${poll.id}?encryptionKey=${encryptionKey}`);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
currentRouteName(),
|
currentRouteName(),
|
||||||
'poll.participation',
|
'poll.participation',
|
||||||
'poll is redirected to poll.participation',
|
'poll is redirected to poll.participation',
|
||||||
);
|
);
|
||||||
|
|
||||||
await pollParticipate('Max Meiner', ['yes', 'no']);
|
await pollParticipate('Max Meiner', ['yes', 'no']);
|
||||||
assert.equal(currentRouteName(), 'poll.evaluation');
|
assert.strictEqual(currentRouteName(), 'poll.evaluation');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
currentURL().split('?')[1],
|
currentURL().split('?')[1],
|
||||||
`encryptionKey=${encryptionKey}`,
|
`encryptionKey=${encryptionKey}`,
|
||||||
'encryption key is part of query params',
|
'encryption key is part of query params',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
PollEvaluationPage.participants.length,
|
PollEvaluationPage.participants.length,
|
||||||
1,
|
1,
|
||||||
'user is added to participants table',
|
'user is added to participants table',
|
||||||
|
@ -68,16 +67,16 @@ module('Acceptance | participate in a poll', function (hooks) {
|
||||||
);
|
);
|
||||||
|
|
||||||
await click('.nav [data-test-link="participation"]');
|
await click('.nav [data-test-link="participation"]');
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.strictEqual(currentRouteName(), 'poll.participation');
|
||||||
assert.equal(find('.name input').value, '', 'input for name is cleared');
|
assert.dom('.name input').hasNoValue('input for name is cleared');
|
||||||
assert.notOk(
|
assert.notOk(
|
||||||
findAll('input[type="radio"]').some((el) => el.checked),
|
findAll('input[type="radio"]').some((el) => el.checked),
|
||||||
'radios are cleared',
|
'radios are cleared',
|
||||||
);
|
);
|
||||||
|
|
||||||
await pollParticipate('Peter Müller', ['yes', 'yes']);
|
await pollParticipate('Peter Müller', ['yes', 'yes']);
|
||||||
assert.equal(currentRouteName(), 'poll.evaluation');
|
assert.strictEqual(currentRouteName(), 'poll.evaluation');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
PollEvaluationPage.participants.length,
|
PollEvaluationPage.participants.length,
|
||||||
2,
|
2,
|
||||||
'user is added to participants table',
|
'user is added to participants table',
|
||||||
|
@ -103,11 +102,11 @@ module('Acceptance | participate in a poll', function (hooks) {
|
||||||
});
|
});
|
||||||
|
|
||||||
await visit(`/poll/${poll.id}?encryptionKey=${encryptionKey}`);
|
await visit(`/poll/${poll.id}?encryptionKey=${encryptionKey}`);
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.strictEqual(currentRouteName(), 'poll.participation');
|
||||||
|
|
||||||
await pollParticipate('Max Manus', ['answer 1', 'answer 2']);
|
await pollParticipate('Max Manus', ['answer 1', 'answer 2']);
|
||||||
assert.equal(currentRouteName(), 'poll.evaluation');
|
assert.strictEqual(currentRouteName(), 'poll.evaluation');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
PollEvaluationPage.participants.length,
|
PollEvaluationPage.participants.length,
|
||||||
1,
|
1,
|
||||||
'user is added to participants table',
|
'user is added to participants table',
|
||||||
|
@ -135,11 +134,11 @@ module('Acceptance | participate in a poll', function (hooks) {
|
||||||
await visit(
|
await visit(
|
||||||
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`,
|
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`,
|
||||||
);
|
);
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.strictEqual(currentRouteName(), 'poll.participation');
|
||||||
|
|
||||||
await pollParticipate('Karl Käfer', ['yes', null]);
|
await pollParticipate('Karl Käfer', ['yes', null]);
|
||||||
assert.equal(currentRouteName(), 'poll.evaluation');
|
assert.strictEqual(currentRouteName(), 'poll.evaluation');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
PollEvaluationPage.participants.length,
|
PollEvaluationPage.participants.length,
|
||||||
1,
|
1,
|
||||||
'user is added to participants table',
|
'user is added to participants table',
|
||||||
|
@ -167,11 +166,11 @@ module('Acceptance | participate in a poll', function (hooks) {
|
||||||
await visit(
|
await visit(
|
||||||
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`,
|
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`,
|
||||||
);
|
);
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.strictEqual(currentRouteName(), 'poll.participation');
|
||||||
|
|
||||||
await pollParticipate(null, ['yes', 'no']);
|
await pollParticipate(null, ['yes', 'no']);
|
||||||
assert.equal(currentRouteName(), 'poll.evaluation');
|
assert.strictEqual(currentRouteName(), 'poll.evaluation');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
PollEvaluationPage.participants.length,
|
PollEvaluationPage.participants.length,
|
||||||
1,
|
1,
|
||||||
'user is added to participants table',
|
'user is added to participants table',
|
||||||
|
@ -197,7 +196,7 @@ module('Acceptance | participate in a poll', function (hooks) {
|
||||||
await visit(
|
await visit(
|
||||||
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`,
|
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`,
|
||||||
);
|
);
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.strictEqual(currentRouteName(), 'poll.participation');
|
||||||
assert
|
assert
|
||||||
.dom('[data-test-modal="saving-failed"] .modal-content')
|
.dom('[data-test-modal="saving-failed"] .modal-content')
|
||||||
.isNotVisible(
|
.isNotVisible(
|
||||||
|
@ -217,8 +216,8 @@ module('Acceptance | participate in a poll', function (hooks) {
|
||||||
.isNotVisible(
|
.isNotVisible(
|
||||||
'Notification is hidden after another save attempt was successful',
|
'Notification is hidden after another save attempt was successful',
|
||||||
);
|
);
|
||||||
assert.equal(currentRouteName(), 'poll.evaluation');
|
assert.strictEqual(currentRouteName(), 'poll.evaluation');
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
PollEvaluationPage.participants.length,
|
PollEvaluationPage.participants.length,
|
||||||
1,
|
1,
|
||||||
'user is added to participants table',
|
'user is added to participants table',
|
||||||
|
@ -301,7 +300,7 @@ module('Acceptance | participate in a poll', function (hooks) {
|
||||||
|
|
||||||
assert.dom('[data-test-form-element="name"] input').isFocused();
|
assert.dom('[data-test-form-element="name"] input').isFocused();
|
||||||
|
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
currentRouteName(),
|
currentRouteName(),
|
||||||
'poll.participation',
|
'poll.participation',
|
||||||
'invalid form prevents a transition',
|
'invalid form prevents a transition',
|
||||||
|
@ -337,7 +336,7 @@ module('Acceptance | participate in a poll', function (hooks) {
|
||||||
assert
|
assert
|
||||||
.dom('[data-test-form-element="option-2017-12-24"] input[id$="yes"]')
|
.dom('[data-test-form-element="option-2017-12-24"] input[id$="yes"]')
|
||||||
.isFocused();
|
.isFocused();
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
currentRouteName(),
|
currentRouteName(),
|
||||||
'poll.participation',
|
'poll.participation',
|
||||||
'invalid form prevents a transition',
|
'invalid form prevents a transition',
|
||||||
|
@ -374,7 +373,7 @@ module('Acceptance | participate in a poll', function (hooks) {
|
||||||
|
|
||||||
assert.dom('[data-test-form-element="name"] input').isFocused();
|
assert.dom('[data-test-form-element="name"] input').isFocused();
|
||||||
|
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
currentRouteName(),
|
currentRouteName(),
|
||||||
'poll.participation',
|
'poll.participation',
|
||||||
'invalid form prevents a transition',
|
'invalid form prevents a transition',
|
||||||
|
|
|
@ -1,10 +1,4 @@
|
||||||
import {
|
import { findAll, click, currentRouteName, visit } from '@ember/test-helpers';
|
||||||
findAll,
|
|
||||||
click,
|
|
||||||
currentRouteName,
|
|
||||||
find,
|
|
||||||
visit,
|
|
||||||
} from '@ember/test-helpers';
|
|
||||||
import { module, test } from 'qunit';
|
import { module, test } from 'qunit';
|
||||||
import { setupApplicationTest } from 'ember-qunit';
|
import { setupApplicationTest } from 'ember-qunit';
|
||||||
import { setupMirage } from 'ember-cli-mirage/test-support';
|
import { setupMirage } from 'ember-cli-mirage/test-support';
|
||||||
|
@ -28,14 +22,12 @@ module('Acceptance | view evaluation', function (hooks) {
|
||||||
});
|
});
|
||||||
|
|
||||||
await visit(`/poll/${poll.id}?encryptionKey=${encryptionKey}`);
|
await visit(`/poll/${poll.id}?encryptionKey=${encryptionKey}`);
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.strictEqual(currentRouteName(), 'poll.participation');
|
||||||
|
|
||||||
await click('.nav [data-test-link="evaluation"]');
|
await click('.nav [data-test-link="evaluation"]');
|
||||||
assert.equal(
|
assert
|
||||||
findAll('.tab-content .tab-pane .evaluation-summary').length,
|
.dom('.tab-content .tab-pane .evaluation-summary')
|
||||||
0,
|
.doesNotExist('evaluation summary is not present');
|
||||||
'evaluation summary is not present',
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('evaluation is correct for FindADate (date-only)', async function (assert) {
|
test('evaluation is correct for FindADate (date-only)', async function (assert) {
|
||||||
|
@ -102,24 +94,23 @@ module('Acceptance | view evaluation', function (hooks) {
|
||||||
});
|
});
|
||||||
|
|
||||||
await visit(`/poll/${poll.id}/evaluation?encryptionKey=${encryptionKey}`);
|
await visit(`/poll/${poll.id}/evaluation?encryptionKey=${encryptionKey}`);
|
||||||
assert.equal(currentRouteName(), 'poll.evaluation');
|
assert.strictEqual(currentRouteName(), 'poll.evaluation');
|
||||||
assert.equal(
|
assert
|
||||||
findAll('.tab-content .tab-pane .evaluation-summary').length,
|
.dom('.tab-content .tab-pane .evaluation-summary')
|
||||||
1,
|
.exists({ count: 1 }, 'evaluation summary is present');
|
||||||
'evaluation summary is present',
|
assert
|
||||||
);
|
.dom('.participants')
|
||||||
assert.equal(
|
.hasText(
|
||||||
find('.participants').textContent.trim(),
|
|
||||||
t('poll.evaluation.participants', { count: 2 }).toString(),
|
t('poll.evaluation.participants', { count: 2 }).toString(),
|
||||||
'shows number of participants',
|
'shows number of participants',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert
|
||||||
find('.best-options strong').textContent.trim(),
|
.dom('.best-options strong')
|
||||||
|
.hasText(
|
||||||
'Friday, January 1, 2016',
|
'Friday, January 1, 2016',
|
||||||
'shows option most participants replied with yes to as best option',
|
'shows option most participants replied with yes to as best option',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.dom('.last-participation').hasText(
|
||||||
find('.last-participation').textContent.trim(),
|
|
||||||
t('poll.evaluation.lastParticipation', {
|
t('poll.evaluation.lastParticipation', {
|
||||||
ago: '3 months ago',
|
ago: '3 months ago',
|
||||||
}).toString(),
|
}).toString(),
|
||||||
|
@ -260,24 +251,23 @@ module('Acceptance | view evaluation', function (hooks) {
|
||||||
});
|
});
|
||||||
|
|
||||||
await visit(`/poll/${poll.id}/evaluation?encryptionKey=${encryptionKey}`);
|
await visit(`/poll/${poll.id}/evaluation?encryptionKey=${encryptionKey}`);
|
||||||
assert.equal(currentRouteName(), 'poll.evaluation');
|
assert.strictEqual(currentRouteName(), 'poll.evaluation');
|
||||||
assert.equal(
|
assert
|
||||||
findAll('.tab-content .tab-pane .evaluation-summary').length,
|
.dom('.tab-content .tab-pane .evaluation-summary')
|
||||||
1,
|
.exists({ count: 1 }, 'evaluation summary is present');
|
||||||
'evaluation summary is present',
|
assert
|
||||||
);
|
.dom('.participants')
|
||||||
assert.equal(
|
.hasText(
|
||||||
find('.participants').textContent.trim(),
|
|
||||||
t('poll.evaluation.participants', { count: 2 }).toString(),
|
t('poll.evaluation.participants', { count: 2 }).toString(),
|
||||||
'shows number of participants',
|
'shows number of participants',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert
|
||||||
find('.best-options strong').textContent.trim(),
|
.dom('.best-options strong')
|
||||||
|
.hasText(
|
||||||
'Saturday, December 12, 2015 at 12:12 PM',
|
'Saturday, December 12, 2015 at 12:12 PM',
|
||||||
'shows option most participants replied with yes to as best option',
|
'shows option most participants replied with yes to as best option',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.dom('.last-participation').hasText(
|
||||||
find('.last-participation').textContent.trim(),
|
|
||||||
t('poll.evaluation.lastParticipation', {
|
t('poll.evaluation.lastParticipation', {
|
||||||
ago: '3 months ago',
|
ago: '3 months ago',
|
||||||
}).toString(),
|
}).toString(),
|
||||||
|
@ -450,22 +440,19 @@ module('Acceptance | view evaluation', function (hooks) {
|
||||||
});
|
});
|
||||||
|
|
||||||
await visit(`/poll/${poll.id}/evaluation?encryptionKey=${encryptionKey}`);
|
await visit(`/poll/${poll.id}/evaluation?encryptionKey=${encryptionKey}`);
|
||||||
assert.equal(currentRouteName(), 'poll.evaluation');
|
assert.strictEqual(currentRouteName(), 'poll.evaluation');
|
||||||
assert.equal(
|
assert
|
||||||
findAll('.tab-content .tab-pane .evaluation-summary').length,
|
.dom('.tab-content .tab-pane .evaluation-summary')
|
||||||
1,
|
.exists({ count: 1 }, 'evaluation summary is present');
|
||||||
'evaluation summary is present',
|
assert
|
||||||
);
|
.dom('.participants')
|
||||||
assert.equal(
|
.hasText(
|
||||||
find('.participants').textContent.trim(),
|
|
||||||
t('poll.evaluation.participants', { count: 2 }).toString(),
|
t('poll.evaluation.participants', { count: 2 }).toString(),
|
||||||
'participants are counted correctly',
|
'participants are counted correctly',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert
|
||||||
find('.best-options strong').textContent.trim(),
|
.dom('.best-options strong')
|
||||||
'second option',
|
.hasText('second option', 'options are evaluated correctly');
|
||||||
'options are evaluated correctly',
|
|
||||||
);
|
|
||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
PollEvaluationPage.options.map((_) => _.label),
|
PollEvaluationPage.options.map((_) => _.label),
|
||||||
|
@ -489,8 +476,7 @@ module('Acceptance | view evaluation', function (hooks) {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.equal(
|
assert.dom('.last-participation').hasText(
|
||||||
find('.last-participation').textContent.trim(),
|
|
||||||
t('poll.evaluation.lastParticipation', {
|
t('poll.evaluation.lastParticipation', {
|
||||||
ago: '3 days ago',
|
ago: '3 days ago',
|
||||||
}).toString(),
|
}).toString(),
|
||||||
|
@ -560,14 +546,12 @@ module('Acceptance | view evaluation', function (hooks) {
|
||||||
});
|
});
|
||||||
|
|
||||||
await visit(`/poll/${poll.id}?encryptionKey=${encryptionKey}`);
|
await visit(`/poll/${poll.id}?encryptionKey=${encryptionKey}`);
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.strictEqual(currentRouteName(), 'poll.participation');
|
||||||
|
|
||||||
await click('.nav [data-test-link="evaluation"]');
|
await click('.nav [data-test-link="evaluation"]');
|
||||||
assert.equal(currentRouteName(), 'poll.evaluation');
|
assert.strictEqual(currentRouteName(), 'poll.evaluation');
|
||||||
assert.equal(
|
assert
|
||||||
find('.tab-pane h2').textContent.trim(),
|
.dom('.tab-pane h2')
|
||||||
t('poll.evaluation.label').toString(),
|
.hasText(t('poll.evaluation.label').toString(), 'headline is there');
|
||||||
'headline is there',
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,7 +24,7 @@ module('Acceptance | view poll', function (hooks) {
|
||||||
let pollUrl = `/poll/${poll.id}?encryptionKey=${encryptionKey}`;
|
let pollUrl = `/poll/${poll.id}?encryptionKey=${encryptionKey}`;
|
||||||
|
|
||||||
await visit(pollUrl);
|
await visit(pollUrl);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
pageParticipation.url,
|
pageParticipation.url,
|
||||||
window.location.href,
|
window.location.href,
|
||||||
'share link is shown',
|
'share link is shown',
|
||||||
|
@ -259,12 +259,12 @@ module('Acceptance | view poll', function (hooks) {
|
||||||
let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||||
|
|
||||||
await visit(`/poll/${pollId}?encryptionKey=${encryptionKey}`);
|
await visit(`/poll/${pollId}?encryptionKey=${encryptionKey}`);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
currentURL(),
|
currentURL(),
|
||||||
`/poll/${pollId}?encryptionKey=${encryptionKey}`,
|
`/poll/${pollId}?encryptionKey=${encryptionKey}`,
|
||||||
'shows URL entered by user',
|
'shows URL entered by user',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
currentRouteName(),
|
currentRouteName(),
|
||||||
'poll_error',
|
'poll_error',
|
||||||
'shows error substate of poll route',
|
'shows error substate of poll route',
|
||||||
|
@ -279,12 +279,12 @@ module('Acceptance | view poll', function (hooks) {
|
||||||
let poll = this.server.create('poll', { encryptionKey: 'anotherkey' });
|
let poll = this.server.create('poll', { encryptionKey: 'anotherkey' });
|
||||||
|
|
||||||
await visit(`/poll/${poll.id}?encryptionKey=${encryptionKey}`);
|
await visit(`/poll/${poll.id}?encryptionKey=${encryptionKey}`);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
currentURL(),
|
currentURL(),
|
||||||
`/poll/${poll.id}?encryptionKey=${encryptionKey}`,
|
`/poll/${poll.id}?encryptionKey=${encryptionKey}`,
|
||||||
'shows URL entered by user',
|
'shows URL entered by user',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
currentRouteName(),
|
currentRouteName(),
|
||||||
'poll_error',
|
'poll_error',
|
||||||
'shows error substate of poll route',
|
'shows error substate of poll route',
|
||||||
|
@ -302,12 +302,12 @@ module('Acceptance | view poll', function (hooks) {
|
||||||
this.server.get('polls/:id', () => {}, 500);
|
this.server.get('polls/:id', () => {}, 500);
|
||||||
|
|
||||||
await visit(`/poll/${pollId}?encryptionKey=${encryptionKey}`);
|
await visit(`/poll/${pollId}?encryptionKey=${encryptionKey}`);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
currentURL(),
|
currentURL(),
|
||||||
`/poll/${pollId}?encryptionKey=${encryptionKey}`,
|
`/poll/${pollId}?encryptionKey=${encryptionKey}`,
|
||||||
'shows URL entered by user',
|
'shows URL entered by user',
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.strictEqual(
|
||||||
currentRouteName(),
|
currentRouteName(),
|
||||||
'poll_error',
|
'poll_error',
|
||||||
'shows error substate of poll route',
|
'shows error substate of poll route',
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { module, test } from 'qunit';
|
import { module, test } from 'qunit';
|
||||||
import { setupRenderingTest } from 'ember-qunit';
|
import { setupRenderingTest } from 'ember-qunit';
|
||||||
import { render, click, find, findAll } from '@ember/test-helpers';
|
import { render, click, findAll } from '@ember/test-helpers';
|
||||||
import hbs from 'htmlbars-inline-precompile';
|
import hbs from 'htmlbars-inline-precompile';
|
||||||
import { setupIntl } from 'ember-intl/test-support';
|
import { setupIntl } from 'ember-intl/test-support';
|
||||||
|
|
||||||
|
@ -26,16 +26,12 @@ module('Integration | Component | create options datetime', function (hooks) {
|
||||||
hbs`<CreateOptionsDatetime @dates={{this.dates}} @times={{this.times}} />`,
|
hbs`<CreateOptionsDatetime @dates={{this.dates}} @times={{this.times}} />`,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert
|
||||||
findAll('.days .form-group input').length,
|
.dom('.days .form-group input')
|
||||||
1,
|
.exists({ count: 1 }, 'there is one input field');
|
||||||
'there is one input field',
|
assert
|
||||||
);
|
.dom('.days .form-group input')
|
||||||
assert.equal(
|
.hasNoValue('value is an empty string');
|
||||||
find('.days .form-group input').value,
|
|
||||||
'',
|
|
||||||
'value is an empty string',
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('it generates input field for options iso 8601 datetime string (with time)', async function (assert) {
|
test('it generates input field for options iso 8601 datetime string (with time)', async function (assert) {
|
||||||
|
@ -45,16 +41,12 @@ module('Integration | Component | create options datetime', function (hooks) {
|
||||||
hbs`<CreateOptionsDatetime @dates={{this.dates}} @times={{this.times}} />`,
|
hbs`<CreateOptionsDatetime @dates={{this.dates}} @times={{this.times}} />`,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert
|
||||||
findAll('.days .form-group input').length,
|
.dom('.days .form-group input')
|
||||||
1,
|
.exists({ count: 1 }, 'there is one input field');
|
||||||
'there is one input field',
|
assert
|
||||||
);
|
.dom('.days .form-group input')
|
||||||
assert.equal(
|
.hasValue('11:11', 'it has time in option as value');
|
||||||
find('.days .form-group input').value,
|
|
||||||
'11:11',
|
|
||||||
'it has time in option as value',
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('it hides repeated labels', async function (assert) {
|
test('it hides repeated labels', async function (assert) {
|
||||||
|
@ -64,14 +56,13 @@ module('Integration | Component | create options datetime', function (hooks) {
|
||||||
hbs`<CreateOptionsDatetime @dates={{this.dates}} @times={{this.times}} />`,
|
hbs`<CreateOptionsDatetime @dates={{this.dates}} @times={{this.times}} />`,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert
|
||||||
findAll('.days label').length,
|
.dom('.days label')
|
||||||
3,
|
.exists({ count: 3 }, 'every form-group has a label');
|
||||||
'every form-group has a label',
|
assert
|
||||||
);
|
.dom('.days label:not(.sr-only)')
|
||||||
assert.equal(
|
.exists(
|
||||||
findAll('.days label:not(.sr-only)').length,
|
{ count: 2 },
|
||||||
2,
|
|
||||||
'there are two not hidden labels for two different dates',
|
'there are two not hidden labels for two different dates',
|
||||||
);
|
);
|
||||||
assert.notOk(
|
assert.notOk(
|
||||||
|
@ -101,19 +92,15 @@ module('Integration | Component | create options datetime', function (hooks) {
|
||||||
hbs`<CreateOptionsDatetime @dates={{this.dates}} @times={{this.times}} />`,
|
hbs`<CreateOptionsDatetime @dates={{this.dates}} @times={{this.times}} />`,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert
|
||||||
findAll('.days .form-group input').length,
|
.dom('.days .form-group input')
|
||||||
2,
|
.exists({ count: 2 }, 'there are two input fields before');
|
||||||
'there are two input fields before',
|
|
||||||
);
|
|
||||||
|
|
||||||
await click(findAll('.days .form-group')[0].querySelector('.add'));
|
await click(findAll('.days .form-group')[0].querySelector('.add'));
|
||||||
assert.equal(
|
assert
|
||||||
findAll('.days .form-group input').length,
|
.dom('.days .form-group input')
|
||||||
3,
|
.exists({ count: 3 }, 'another input field is added');
|
||||||
'another input field is added',
|
assert.strictEqual(
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
findAll('.days .form-group')[1].querySelector('label').textContent,
|
findAll('.days .form-group')[1].querySelector('label').textContent,
|
||||||
findAll('.days .form-group')[0].querySelector('label').textContent,
|
findAll('.days .form-group')[0].querySelector('label').textContent,
|
||||||
'new input has correct label',
|
'new input has correct label',
|
||||||
|
@ -133,26 +120,20 @@ module('Integration | Component | create options datetime', function (hooks) {
|
||||||
hbs`<CreateOptionsDatetime @dates={{this.dates}} @times={{this.times}} />`,
|
hbs`<CreateOptionsDatetime @dates={{this.dates}} @times={{this.times}} />`,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert
|
||||||
findAll('.days input').length,
|
.dom('.days input')
|
||||||
2,
|
.exists({ count: 2 }, 'there are two input fields before');
|
||||||
'there are two input fields before',
|
|
||||||
);
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
findAll('.delete').every((el) => el.disabled === false),
|
findAll('.delete').every((el) => el.disabled === false),
|
||||||
'options are deleteable',
|
'options are deleteable',
|
||||||
);
|
);
|
||||||
|
|
||||||
await click(findAll('.days .form-group')[0].querySelector('.delete'));
|
await click(findAll('.days .form-group')[0].querySelector('.delete'));
|
||||||
assert.equal(
|
assert
|
||||||
findAll('.days .form-group input').length,
|
.dom('.days .form-group input')
|
||||||
1,
|
.exists({ count: 1 }, 'one input field is removed after deletion');
|
||||||
'one input field is removed after deletion',
|
assert
|
||||||
);
|
.dom('.days .form-group input')
|
||||||
assert.equal(
|
.hasValue('22:22', 'correct input field is deleted');
|
||||||
find('.days .form-group input').value,
|
|
||||||
'22:22',
|
|
||||||
'correct input field is deleted',
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,8 +14,6 @@ module('Integration | Component | create options', function (hooks) {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('shows validation errors if options are not unique (makeAPoll)', async function (assert) {
|
test('shows validation errors if options are not unique (makeAPoll)', async function (assert) {
|
||||||
assert.expect(5);
|
|
||||||
|
|
||||||
this.set('options', new TrackedSet());
|
this.set('options', new TrackedSet());
|
||||||
|
|
||||||
await render(hbs`
|
await render(hbs`
|
||||||
|
@ -66,7 +64,7 @@ module('Integration | Component | create options', function (hooks) {
|
||||||
/>
|
/>
|
||||||
`);
|
`);
|
||||||
|
|
||||||
assert.equal(findAll('.form-group.has-error').length, 0);
|
assert.dom('.form-group.has-error').doesNotExist();
|
||||||
|
|
||||||
await focus(findAll('input')[0]);
|
await focus(findAll('input')[0]);
|
||||||
await blur(findAll('input')[0]);
|
await blur(findAll('input')[0]);
|
||||||
|
|
|
@ -14,8 +14,11 @@ module('Integration | Mirage api mocking', function (hooks) {
|
||||||
encryptionKey,
|
encryptionKey,
|
||||||
title: 'foo',
|
title: 'foo',
|
||||||
});
|
});
|
||||||
assert.equal(JSON.parse(sjcl.decrypt(encryptionKey, poll.title)), 'foo');
|
assert.strictEqual(
|
||||||
assert.equal(
|
JSON.parse(sjcl.decrypt(encryptionKey, poll.title)),
|
||||||
|
'foo',
|
||||||
|
);
|
||||||
|
assert.strictEqual(
|
||||||
JSON.parse(sjcl.decrypt(encryptionKey, poll.description)),
|
JSON.parse(sjcl.decrypt(encryptionKey, poll.description)),
|
||||||
'bar',
|
'bar',
|
||||||
);
|
);
|
||||||
|
@ -27,6 +30,9 @@ module('Integration | Mirage api mocking', function (hooks) {
|
||||||
encryptionKey,
|
encryptionKey,
|
||||||
name: 'foo',
|
name: 'foo',
|
||||||
});
|
});
|
||||||
assert.equal(JSON.parse(sjcl.decrypt(encryptionKey, user.name)), 'foo');
|
assert.strictEqual(
|
||||||
|
JSON.parse(sjcl.decrypt(encryptionKey, user.name)),
|
||||||
|
'foo',
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue