Update dependency prettier to v3 (#668)

* Update dependency prettier to v3

* upgrade eslint-plugin-prettier and run prettier on all files

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jeldrik Hanschke <admin@jhanschke.de>
This commit is contained in:
renovate[bot] 2023-10-17 10:44:45 +02:00 committed by GitHub
parent 337944e56c
commit 98ff62af80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 436 additions and 410 deletions

View file

@ -10,7 +10,7 @@ export default class BsForm extends BaseBsForm {
async validate(model) {
const isInvalid = Object.getOwnPropertyNames(
Object.getPrototypeOf(model)
Object.getPrototypeOf(model),
).any((potentialValidationKey) => {
// Validation getters must be named `propertyValidation` by our convention
if (!potentialValidationKey.endsWith('Validation')) {

View file

@ -39,7 +39,7 @@ export default class CreateOptionsDates extends Component {
const dateAdded = newDatesAsLuxonDateTime.find((newDateAsLuxonDateTime) => {
return !this.selectedDays.some(
(selectedDay) =>
selectedDay.toISODate() === newDateAsLuxonDateTime.toISODate()
selectedDay.toISODate() === newDateAsLuxonDateTime.toISODate(),
);
});
@ -48,7 +48,7 @@ export default class CreateOptionsDates extends Component {
[
...this.args.options.map(({ value }) => value),
dateAdded.toISODate(),
].sort()
].sort(),
);
return;
}
@ -59,7 +59,7 @@ export default class CreateOptionsDates extends Component {
const dateRemoved = this.selectedDays.find((selectedDay) => {
return !newDatesAsLuxonDateTime.some(
(newDateAsLuxonDateTime) =>
newDateAsLuxonDateTime.toISODate() === selectedDay.toISODate()
newDateAsLuxonDateTime.toISODate() === selectedDay.toISODate(),
);
});
@ -68,15 +68,15 @@ export default class CreateOptionsDates extends Component {
this.args.options
.filter(
({ value }) =>
DateTime.fromISO(value).toISODate() !== dateRemoved.toISODate()
DateTime.fromISO(value).toISODate() !== dateRemoved.toISODate(),
)
.map(({ value }) => value)
.map(({ value }) => value),
);
return;
}
throw new Error(
'No date has been added or removed. This cannot be the case. Something spooky is going on.'
'No date has been added or removed. This cannot be the case. Something spooky is going on.',
);
}

View file

@ -23,7 +23,7 @@ class FormDataOption {
const { isPartiallyFilled } = this;
if (isPartiallyFilled) {
return new IntlMessage(
'create.options-datetime.error.partiallyFilledTime'
'create.options-datetime.error.partiallyFilledTime',
);
}
@ -105,7 +105,7 @@ class FormData {
this.options.splice(
position + 1,
0,
new FormDataOption(this, { day, time: null })
new FormDataOption(this, { day, time: null }),
);
}
@ -132,7 +132,7 @@ class FormData {
const optionsForFirstDay = optionsGroupedByDay[firstDay];
const timesForFirstDayAreValid = optionsForFirstDay.every(
(option) => option.isValid
(option) => option.isValid,
);
if (!timesForFirstDayAreValid) {
return false;
@ -144,16 +144,16 @@ class FormData {
days
.map((day) =>
timesForFirstDay.map(
(time) => new FormDataOption(this, { day, time })
(time) => new FormDataOption(this, { day, time }),
),
)
)
.flat()
.flat(),
);
}
constructor(options) {
this.options = new TrackedArray(
options.map(({ day, time }) => new FormDataOption(this, { day, time }))
options.map(({ day, time }) => new FormDataOption(this, { day, time })),
);
}
}

View file

@ -61,7 +61,7 @@ class FormData {
@action
updateOptions(values) {
this.options = new TrackedArray(
values.map((value) => new FormDataOption(this, value))
values.map((value) => new FormDataOption(this, value)),
);
}
@ -82,7 +82,7 @@ class FormData {
options.length === 0 && defaultOptionCount > 0 ? ['', ''] : options;
this.options = new TrackedArray(
normalizedOptions.map(({ title }) => new FormDataOption(this, title))
normalizedOptions.map(({ title }) => new FormDataOption(this, title)),
);
}
}
@ -92,7 +92,7 @@ export default class CreateOptionsComponent extends Component {
formData = new FormData(
{ options: this.args.options },
{ defaultOptionCount: this.args.isMakeAPoll ? 2 : 0 }
{ defaultOptionCount: this.args.isMakeAPoll ? 2 : 0 },
);
@action

View file

@ -9,7 +9,7 @@ export default class PollEvaluationParticipantsTable extends Component {
for (const option of poll.options.toArray()) {
optionsPerDay.set(
option.day,
optionsPerDay.has(option.day) ? optionsPerDay.get(option.day) + 1 : 0
optionsPerDay.has(option.day) ? optionsPerDay.get(option.day) + 1 : 0,
);
}
@ -17,7 +17,7 @@ export default class PollEvaluationParticipantsTable extends Component {
Array.from(optionsPerDay.entries()).map(([dayString, count]) => [
DateTime.fromISO(dayString).toJSDate(),
count,
])
]),
);
}

View file

@ -21,7 +21,7 @@ export default class CreateOptionsDatetimeController extends Controller {
updateOptions(options) {
this.model.options = options
.map(({ day, time }) =>
time ? DateTime.fromISO(`${day}T${time}`).toISO() : day
time ? DateTime.fromISO(`${day}T${time}`).toISO() : day,
)
.sort()
.map((isoString) => {

View file

@ -25,7 +25,7 @@ export default class CreateOptionsController extends Controller {
@action
updateOptions(newOptions) {
this.model.options = newOptions.map(({ value }) =>
this.store.createFragment('option', { title: value })
this.store.createFragment('option', { title: value }),
);
}
}

View file

@ -100,7 +100,7 @@ export default class CreateSettings extends Controller {
) {
this.set(
'model.timezone',
Intl.DateTimeFormat().resolvedOptions().timeZone
Intl.DateTimeFormat().resolvedOptions().timeZone,
);
}

View file

@ -92,7 +92,7 @@ export default class PollController extends Controller {
// work-a-round for url not being updated
window.location.hash = window.location.hash.replace(
this.encryptionKey,
this.encryption.key
this.encryption.key,
);
this.set('encryptionKey', this.encryption.key);

View file

@ -28,11 +28,11 @@ export function scrollFirstInvalidElementIntoViewPort() {
// delaying to next runloop therefore
next(function () {
let invalidInput = document.querySelector(
'.form-control.is-invalid, .custom-control-input.is-invalid'
'.form-control.is-invalid, .custom-control-input.is-invalid',
);
assert(
'Atleast one form control must be marked as invalid if form submission was rejected as invalid',
invalidInput
invalidInput,
);
// focus first invalid control
@ -50,8 +50,8 @@ export function scrollFirstInvalidElementIntoViewPort() {
document.querySelector(
`label[for="${invalidInput.id.substr(
0,
invalidInput.id.indexOf('_')
)}"`
invalidInput.id.indexOf('_'),
)}"`,
) ||
document.querySelector(`label[for="${invalidInput.id}"]`) ||
// For polls with type `MakeAPoll` the option inputs do not have a label at all. In that case

View file

@ -12,7 +12,7 @@ export default {
intl.set(
'locale',
locale.includes('-') ? [locale, locale.split('-')[0]] : [locale]
locale.includes('-') ? [locale, locale.split('-')[0]] : [locale],
);
powerCalendar.set('local', locale);
},

View file

@ -53,7 +53,7 @@ export default class Option extends Fragment {
set time(value) {
assert(
'can not set a time if current value is not a valid date',
this.isDate
this.isDate,
);
// set time to undefined if value is false
@ -70,7 +70,7 @@ export default class Option extends Fragment {
'title',
this.datetime
.set({ hours: datetime.hour, minutes: datetime.minute })
.toISO()
.toISO(),
);
}
}

View file

@ -3,7 +3,7 @@ import { modifier } from 'ember-modifier';
export default modifier(function autofocus(
element,
params,
{ enabled = true }
{ enabled = true },
) {
if (!enabled) {
return;

View file

@ -11,7 +11,7 @@ class FormData {
if (!title) {
return new IntlMessage(
'create.meta.input.title.validations.valueMissing'
'create.meta.input.title.validations.valueMissing',
);
}

View file

@ -61,7 +61,7 @@ class FormData {
this.nameIsRequired = nameIsRequired;
this.namesTaken = namesTaken;
this.selections = new TrackedArray(
options.map(() => new FormDataSelections(selectionIsRequired))
options.map(() => new FormDataSelections(selectionIsRequired)),
);
}
}

View file

@ -3,7 +3,7 @@ import { isEmpty } from '@ember/utils';
import ApplicationSerializer from './application';
export default class PollSerializer extends ApplicationSerializer.extend(
EmbeddedRecordsMixin
EmbeddedRecordsMixin,
) {
attrs = {
users: {

View file

@ -36,7 +36,7 @@ module.exports = {
return Promise.all(
targets.map((target) => {
return copy(`${apiPath}/${target}`, `${outputPath}/${target}`);
})
}),
);
})
.then(() => {
@ -52,7 +52,7 @@ module.exports = {
}
resolve();
}
},
);
});
})

View file

@ -13,7 +13,7 @@ export default function (propertiesToEncrypt, model) {
assert('first argument must be an array', isArray(propertiesToEncrypt));
assert(
"model must have an encryptionKey property which isn't empty",
isPresent(model.encryptionKey)
isPresent(model.encryptionKey),
);
let passphrase = model.encryptionKey;

View file

@ -78,7 +78,7 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-ember": "^11.0.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-qunit": "^8.0.0",
"fs-extra": "^9.0.0",
"lerna-changelog": "^2.0.0",
@ -86,7 +86,7 @@
"miragejs": "^0.1.47",
"npm-run-all": "^4.1.5",
"open-iconic": "^1.1.1",
"prettier": "^2.6.2",
"prettier": "^3.0.0",
"qunit": "^2.19.1",
"qunit-dom": "^3.0.0",
"release-it": "^16.0.0",

View file

@ -11,14 +11,14 @@ module('Acceptance | build', function (hooks) {
// head is not available through `find()`, `assert.dom()` or `this.element.querySelector()`
// cause they are scoped to `#ember-testing-container`.
let buildInfoEl = document.head.querySelector(
'head meta[name="build-info"]'
'head meta[name="build-info"]',
);
assert.ok(buildInfoEl, 'tag exists');
let content = buildInfoEl.content;
assert.ok(
/^version=\d[\d.]+\d(-(alpha|beta|rc).\d)?(\+[\da-z]{8})?$/.test(content),
`${content} is valid version string`
`${content} is valid version string`,
);
});
@ -29,7 +29,7 @@ module('Acceptance | build', function (hooks) {
// and therefore don't have access to head
assert.ok(
document.head.querySelector('meta[http-equiv="Content-Security-Policy"]'),
'CSP meta tag exists'
'CSP meta tag exists',
);
// this only covers dynamically created elements not the ones defined in `app/index.html` cause
@ -37,9 +37,9 @@ module('Acceptance | build', function (hooks) {
['link', 'script', 'style'].forEach((type) => {
assert.notOk(
document.head.querySelector(
`${type} meta[http-equiv="Content-Security-Policy"]`
`${type} meta[http-equiv="Content-Security-Policy"]`,
),
'CSP meta tag does not have a silbing of type ${type}'
'CSP meta tag does not have a silbing of type ${type}',
);
});
});

File diff suppressed because it is too large Load diff

View file

@ -14,7 +14,7 @@ module('Acceptance | i18n', function (hooks) {
assert.equal(
find('.language-select').value,
'de',
'picks up locale in locale storage'
'picks up locale in locale storage',
);
await fillIn('.language-select', 'en');
@ -22,7 +22,7 @@ module('Acceptance | i18n', function (hooks) {
assert.equal(
window.localStorage.getItem('locale'),
'en',
'persisted in localeStorage'
'persisted in localeStorage',
);
});
});

View file

@ -101,7 +101,7 @@ module('Acceptance | legacy support', function (hooks) {
assert.equal(currentRouteName(), 'poll.participation');
assert.deepEqual(
findAll(
`[data-test-form-element^="option"] label:not(.custom-control-label)`
`[data-test-form-element^="option"] label:not(.custom-control-label)`,
).map((el) => el.textContent.trim()),
[
Intl.DateTimeFormat('en-US', {
@ -109,21 +109,21 @@ module('Acceptance | legacy support', function (hooks) {
timeStyle: 'short',
}).format(new Date('2015-12-24T17:00')),
Intl.DateTimeFormat('en-US', { timeStyle: 'short' }).format(
new Date('2015-12-24T19:00')
new Date('2015-12-24T19:00'),
),
Intl.DateTimeFormat('en-US', {
dateStyle: 'full',
timeStyle: 'short',
}).format(new Date('2015-12-31T22:59')),
]
],
);
assert.deepEqual(
Array.from(
find('[data-test-form-element^="option"]').querySelectorAll(
'.radio label'
)
'.radio label',
),
).map((el) => el.textContent.trim()),
[yesLabel, maybeLabel, noLabel]
[yesLabel, maybeLabel, noLabel],
);
await switchTab('evaluation');
@ -131,13 +131,13 @@ module('Acceptance | legacy support', function (hooks) {
let participant = PollEvaluationPage.participants.filterBy(
'name',
'Fritz Bauer'
'Fritz Bauer',
)[0];
assert.ok(participant, 'user exists in participants table');
assert.deepEqual(
participant.selections.map((_) => _.answer),
[yesLabel, noLabel, noLabel],
'participants table shows correct answers for new participant'
'participants table shows correct answers for new participant',
);
await switchTab('participation');
@ -148,13 +148,13 @@ module('Acceptance | legacy support', function (hooks) {
participant = PollEvaluationPage.participants.filterBy(
'name',
'Hermann Langbein'
'Hermann Langbein',
)[0];
assert.ok(participant, 'user exists in participants table');
assert.deepEqual(
participant.selections.map((_) => _.answer),
[yesLabel, maybeLabel, yesLabel],
'participants table shows correct answers for new participant'
'participants table shows correct answers for new participant',
);
});
@ -193,9 +193,9 @@ module('Acceptance | legacy support', function (hooks) {
assert.equal(currentRouteName(), 'poll.participation');
assert.deepEqual(
findAll(
`[data-test-form-element^="option"] label:not(.custom-control-label)`
`[data-test-form-element^="option"] label:not(.custom-control-label)`,
).map((el) => el.textContent.trim()),
['apple pie', 'pecan pie', 'plum pie']
['apple pie', 'pecan pie', 'plum pie'],
);
await switchTab('evaluation');
@ -203,13 +203,13 @@ module('Acceptance | legacy support', function (hooks) {
let participant = PollEvaluationPage.participants.filterBy(
'name',
'Paul Levi'
'Paul Levi',
)[0];
assert.ok(participant, 'user exists in participants table');
assert.deepEqual(
participant.selections.map((_) => _.answer),
['would be great!', 'no way', 'if I had to'],
'participants table shows correct answers for new participant'
'participants table shows correct answers for new participant',
);
await switchTab('participation');
@ -224,13 +224,13 @@ module('Acceptance | legacy support', function (hooks) {
participant = PollEvaluationPage.participants.filterBy(
'name',
'Hermann Langbein'
'Hermann Langbein',
)[0];
assert.ok(participant, 'user exists in participants table');
assert.deepEqual(
participant.selections.map((_) => _.answer),
["I don't care", 'would be awesome', "can't imagine anything better"],
'participants table shows correct answers for new participant'
'participants table shows correct answers for new participant',
);
});
});

View file

@ -41,7 +41,7 @@ module('Acceptance | participate in a poll', function (hooks) {
assert.equal(
currentRouteName(),
'poll.participation',
'poll is redirected to poll.participation'
'poll is redirected to poll.participation',
);
await pollParticipate('Max Meiner', ['yes', 'no']);
@ -49,22 +49,22 @@ module('Acceptance | participate in a poll', function (hooks) {
assert.equal(
currentURL().split('?')[1],
`encryptionKey=${encryptionKey}`,
'encryption key is part of query params'
'encryption key is part of query params',
);
assert.equal(
PollEvaluationPage.participants.length,
1,
'user is added to participants table'
'user is added to participants table',
);
let participant = PollEvaluationPage.participants.filterBy(
'name',
'Max Meiner'
'Max Meiner',
)[0];
assert.ok(participant, 'user exists in participants table');
assert.deepEqual(
participant.selections.map((_) => _.answer),
[yesLabel, noLabel],
'participants table shows correct answers for new participant'
'participants table shows correct answers for new participant',
);
await click('.nav .participation');
@ -74,7 +74,7 @@ module('Acceptance | participate in a poll', function (hooks) {
findAll('input[type="radio"]')
.toArray()
.some((el) => el.checked),
'radios are cleared'
'radios are cleared',
);
await pollParticipate('Peter Müller', ['yes', 'yes']);
@ -82,17 +82,17 @@ module('Acceptance | participate in a poll', function (hooks) {
assert.equal(
PollEvaluationPage.participants.length,
2,
'user is added to participants table'
'user is added to participants table',
);
participant = PollEvaluationPage.participants.filterBy(
'name',
'Peter Müller'
'Peter Müller',
)[0];
assert.ok(participant, 'user exists in participants table');
assert.deepEqual(
participant.selections.map((_) => _.answer),
[yesLabel, yesLabel],
'participants table shows correct answers for new participant'
'participants table shows correct answers for new participant',
);
});
@ -112,18 +112,18 @@ module('Acceptance | participate in a poll', function (hooks) {
assert.equal(
PollEvaluationPage.participants.length,
1,
'user is added to participants table'
'user is added to participants table',
);
let participant = PollEvaluationPage.participants.filterBy(
'name',
'Max Manus'
'Max Manus',
)[0];
assert.ok(participant, 'user exists in participants table');
assert.deepEqual(
participant.selections.map((_) => _.answer),
['answer 1', 'answer 2'],
'participants table shows correct answers for new participant'
'participants table shows correct answers for new participant',
);
});
@ -135,7 +135,7 @@ module('Acceptance | participate in a poll', function (hooks) {
});
await visit(
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`,
);
assert.equal(currentRouteName(), 'poll.participation');
@ -144,18 +144,18 @@ module('Acceptance | participate in a poll', function (hooks) {
assert.equal(
PollEvaluationPage.participants.length,
1,
'user is added to participants table'
'user is added to participants table',
);
let participant = PollEvaluationPage.participants.filterBy(
'name',
'Karl Käfer'
'Karl Käfer',
)[0];
assert.ok(participant, 'user exists in participants table');
assert.deepEqual(
participant.selections.map((_) => _.answer),
[yesLabel, ''],
'participants table shows correct answers for new participant'
'participants table shows correct answers for new participant',
);
});
@ -167,7 +167,7 @@ module('Acceptance | participate in a poll', function (hooks) {
});
await visit(
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`,
);
assert.equal(currentRouteName(), 'poll.participation');
@ -176,7 +176,7 @@ module('Acceptance | participate in a poll', function (hooks) {
assert.equal(
PollEvaluationPage.participants.length,
1,
'user is added to participants table'
'user is added to participants table',
);
let participant = PollEvaluationPage.participants.filterBy('name', '')[0];
@ -184,7 +184,7 @@ module('Acceptance | participate in a poll', function (hooks) {
assert.deepEqual(
participant.selections.map((_) => _.answer),
[yesLabel, noLabel],
'participants table shows correct answers for new participant'
'participants table shows correct answers for new participant',
);
});
@ -197,13 +197,13 @@ module('Acceptance | participate in a poll', function (hooks) {
this.server.post('/users', undefined, 503);
await visit(
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`,
);
assert.equal(currentRouteName(), 'poll.participation');
assert
.dom('[data-test-modal="saving-failed"] .modal-content')
.isNotVisible(
'failed saving notification is not shown before attempt to save'
'failed saving notification is not shown before attempt to save',
);
await pollParticipate('John Doe', ['yes', 'no']);
@ -217,24 +217,24 @@ module('Acceptance | participate in a poll', function (hooks) {
assert
.dom('[data-test-modal="saving-failed"] .modal-content')
.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.equal(
PollEvaluationPage.participants.length,
1,
'user is added to participants table'
'user is added to participants table',
);
let participant = PollEvaluationPage.participants.filterBy(
'name',
'John Doe'
'John Doe',
)[0];
assert.ok(participant, 'user exists in participants table');
assert.deepEqual(
participant.selections.map((_) => _.answer),
[yesLabel, noLabel],
'participants table shows correct answers for new participant'
'participants table shows correct answers for new participant',
);
});
@ -256,7 +256,7 @@ module('Acceptance | participate in a poll', function (hooks) {
});
await visit(
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`,
);
pollParticipate('John Doe', ['yes', 'no']);
@ -265,7 +265,7 @@ module('Acceptance | participate in a poll', function (hooks) {
});
assert.ok(
true,
'loading spinner shown cause otherwise there would have been a timeout'
'loading spinner shown cause otherwise there would have been a timeout',
);
// resolve promise for test to finish
@ -281,7 +281,7 @@ module('Acceptance | participate in a poll', function (hooks) {
});
await visit(
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`,
);
await click('button[type="submit"]');
@ -306,7 +306,7 @@ module('Acceptance | participate in a poll', function (hooks) {
assert.equal(
currentRouteName(),
'poll.participation',
'invalid form prevents a transition'
'invalid form prevents a transition',
);
});
@ -318,7 +318,7 @@ module('Acceptance | participate in a poll', function (hooks) {
});
await visit(
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`,
);
await click('button[type="submit"]');
@ -342,7 +342,7 @@ module('Acceptance | participate in a poll', function (hooks) {
assert.equal(
currentRouteName(),
'poll.participation',
'invalid form prevents a transition'
'invalid form prevents a transition',
);
});
@ -354,7 +354,7 @@ module('Acceptance | participate in a poll', function (hooks) {
});
await visit(
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`,
);
await click('button[type="submit"]');
@ -379,7 +379,7 @@ module('Acceptance | participate in a poll', function (hooks) {
assert.equal(
currentRouteName(),
'poll.participation',
'invalid form prevents a transition'
'invalid form prevents a transition',
);
});
@ -401,7 +401,7 @@ module('Acceptance | participate in a poll', function (hooks) {
});
await visit(
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`
`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`,
);
pollParticipate('John Doe', ['yes', 'no']);

View file

@ -30,7 +30,7 @@ module('Acceptance | view evaluation', function (hooks) {
assert.equal(
findAll('.tab-content .tab-pane .evaluation-summary').length,
0,
'evaluation summary is not present'
'evaluation summary is not present',
);
});
@ -102,77 +102,77 @@ module('Acceptance | view evaluation', function (hooks) {
assert.equal(
findAll('.tab-content .tab-pane .evaluation-summary').length,
1,
'evaluation summary is present'
'evaluation summary is present',
);
assert.equal(
find('.participants').textContent.trim(),
t('poll.evaluation.participants', { count: 2 }).toString(),
'shows number of participants'
'shows number of participants',
);
assert.equal(
find('.best-options strong').textContent.trim(),
'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(
find('.last-participation').textContent.trim(),
t('poll.evaluation.lastParticipation', {
ago: '3 months ago',
}).toString(),
'shows last participation date'
'shows last participation date',
);
assert.deepEqual(
findAll('table thead tr th').map((el) => el.textContent.trim()),
['', 'Saturday, December 12, 2015', 'Friday, January 1, 2016'],
'lists dates as table header of parcipants table'
'lists dates as table header of parcipants table',
);
assert
.dom('[data-test-participant="1-1"] [data-test-value-for="name"]')
.hasText(
'Maximilian',
'shows expected name of first participant in participants table'
'shows expected name of first participant in participants table',
);
assert
.dom('[data-test-participant="1-2"] [data-test-value-for="name"]')
.hasText(
'Peter',
'shows expected name of second participant in participants table'
'shows expected name of second participant in participants table',
);
assert
.dom('[data-test-participant="1-1"] [data-test-value-for="2015-12-12"]')
.hasText(
'Yes',
'shows expected selection for first option of first participant'
'shows expected selection for first option of first participant',
);
assert
.dom('[data-test-participant="1-1"] [data-test-value-for="2016-01-01"]')
.hasText(
'Yes',
'shows expected selection for second option of first participant'
'shows expected selection for second option of first participant',
);
assert
.dom('[data-test-participant="1-2"] [data-test-value-for="2015-12-12"]')
.hasText(
'No',
'shows expected selection for first option of second participant'
'shows expected selection for first option of second participant',
);
assert
.dom('[data-test-participant="1-2"] [data-test-value-for="2016-01-01"]')
.hasText(
'Yes',
'shows expected selection for second option of second participant'
'shows expected selection for second option of second participant',
);
assert.deepEqual(
findAll('[data-test-participant] [data-test-value-for="name"]').map(
(el) => el.textContent.trim()
(el) => el.textContent.trim(),
),
['Maximilian', 'Peter'],
'Participants are ordered as correctly in participants table'
'Participants are ordered as correctly in participants table',
);
});
@ -260,122 +260,122 @@ module('Acceptance | view evaluation', function (hooks) {
assert.equal(
findAll('.tab-content .tab-pane .evaluation-summary').length,
1,
'evaluation summary is present'
'evaluation summary is present',
);
assert.equal(
find('.participants').textContent.trim(),
t('poll.evaluation.participants', { count: 2 }).toString(),
'shows number of participants'
'shows number of participants',
);
assert.equal(
find('.best-options strong').textContent.trim(),
'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(
find('.last-participation').textContent.trim(),
t('poll.evaluation.lastParticipation', {
ago: '3 months ago',
}).toString(),
'shows last participation date'
'shows last participation date',
);
assert.deepEqual(
findAll('table thead tr:first-child th').map((el) =>
el.textContent.trim()
el.textContent.trim(),
),
['', 'Saturday, December 12, 2015', 'Friday, January 1, 2016'],
'lists days as first row in table header of parcipants table'
'lists days as first row in table header of parcipants table',
);
assert.deepEqual(
findAll('table thead tr:last-child th').map((el) =>
el.textContent.trim()
el.textContent.trim(),
),
['', '6:06 AM', '12:12 PM', '6:18 PM'],
'lists times as second row in table header of parcipants table'
'lists times as second row in table header of parcipants table',
);
assert
.dom('[data-test-participant="1-1"] [data-test-value-for="name"]')
.hasText(
'Maximilian',
'shows expected name of first participant in participants table'
'shows expected name of first participant in participants table',
);
assert
.dom('[data-test-participant="1-2"] [data-test-value-for="name"]')
.hasText(
'Peter',
'shows expected name of second participant in participants table'
'shows expected name of second participant in participants table',
);
assert
.dom(
`[data-test-participant="1-1"] [data-test-value-for="${DateTime.fromISO(
'2015-12-12T06:06'
).toISO()}"]`
'2015-12-12T06:06',
).toISO()}"]`,
)
.hasText(
'Yes',
'shows expected selection for first option of first participant'
'shows expected selection for first option of first participant',
);
assert
.dom(
`[data-test-participant="1-1"] [data-test-value-for="${DateTime.fromISO(
'2015-12-12T12:12'
).toISO()}"]`
'2015-12-12T12:12',
).toISO()}"]`,
)
.hasText(
'Yes',
'shows expected selection for second option of first participant'
'shows expected selection for second option of first participant',
);
assert
.dom(
`[data-test-participant="1-1"] [data-test-value-for="${DateTime.fromISO(
'2016-01-01T18:18'
).toISO()}"]`
'2016-01-01T18:18',
).toISO()}"]`,
)
.hasText(
'No',
'shows expected selection for third option of first participant'
'shows expected selection for third option of first participant',
);
assert
.dom(
`[data-test-participant="1-2"] [data-test-value-for="${DateTime.fromISO(
'2015-12-12T06:06'
).toISO()}"]`
'2015-12-12T06:06',
).toISO()}"]`,
)
.hasText(
'No',
'shows expected selection for first option of second participant'
'shows expected selection for first option of second participant',
);
assert
.dom(
`[data-test-participant="1-2"] [data-test-value-for="${DateTime.fromISO(
'2015-12-12T12:12'
).toISO()}"]`
'2015-12-12T12:12',
).toISO()}"]`,
)
.hasText(
'Yes',
'shows expected selection for second option of second participant'
'shows expected selection for second option of second participant',
);
assert
.dom(
`[data-test-participant="1-2"] [data-test-value-for="${DateTime.fromISO(
'2016-01-01T18:18'
).toISO()}"]`
'2016-01-01T18:18',
).toISO()}"]`,
)
.hasText(
'Yes',
'shows expected selection for third option of second participant'
'shows expected selection for third option of second participant',
);
assert.deepEqual(
findAll('[data-test-participant] [data-test-value-for="name"]').map(
(el) => el.textContent.trim()
(el) => el.textContent.trim(),
),
['Maximilian', 'Peter'],
'Participants are ordered as correctly in participants table'
'Participants are ordered as correctly in participants table',
);
});
@ -444,7 +444,7 @@ module('Acceptance | view evaluation', function (hooks) {
'poll',
assign(pollData, {
users: usersData.map((_) => this.server.create('user', _)),
})
}),
);
await visit(`/poll/${poll.id}/evaluation?encryptionKey=${encryptionKey}`);
@ -452,38 +452,38 @@ module('Acceptance | view evaluation', function (hooks) {
assert.equal(
findAll('.tab-content .tab-pane .evaluation-summary').length,
1,
'evaluation summary is present'
'evaluation summary is present',
);
assert.equal(
find('.participants').textContent.trim(),
t('poll.evaluation.participants', { count: 2 }).toString(),
'participants are counted correctly'
'participants are counted correctly',
);
assert.equal(
find('.best-options strong').textContent.trim(),
'second option',
'options are evaluated correctly'
'options are evaluated correctly',
);
assert.deepEqual(
PollEvaluationPage.options.map((_) => _.label),
['first option', 'second option'],
'dates are used as table headers'
'dates are used as table headers',
);
assert.deepEqual(
PollEvaluationPage.participants.map((_) => _.name),
usersData.map((_) => _.name),
'users are listed in participants table with their names'
'users are listed in participants table with their names',
);
usersData.forEach((user) => {
let participant = PollEvaluationPage.participants.filterBy(
'name',
user.name
user.name,
)[0];
assert.deepEqual(
participant.selections.map((_) => _.answer),
user.selections.map((_) => t(_.labelTranslation).toString()),
`answers are shown for user ${user.name} in participants table`
`answers are shown for user ${user.name} in participants table`,
);
});
@ -492,7 +492,7 @@ module('Acceptance | view evaluation', function (hooks) {
t('poll.evaluation.lastParticipation', {
ago: '3 days ago',
}).toString(),
'last participation is evaluated correctly'
'last participation is evaluated correctly',
);
});
@ -565,7 +565,7 @@ module('Acceptance | view evaluation', function (hooks) {
assert.equal(
find('.tab-pane h2').textContent.trim(),
t('poll.evaluation.label').toString(),
'headline is there'
'headline is there',
);
});
});

View file

@ -30,7 +30,7 @@ module('Acceptance | view poll', function (hooks) {
assert.equal(
pageParticipation.url,
window.location.href,
'share link is shown'
'share link is shown',
);
await triggerCopySuccess();
@ -64,9 +64,9 @@ module('Acceptance | view poll', function (hooks) {
await visit(`/poll/${poll.id}?encryptionKey=${encryptionKey}`);
assert.deepEqual(
findAll(
`[data-test-form-element^="option"] label:not(.custom-control-label)`
`[data-test-form-element^="option"] label:not(.custom-control-label)`,
).map((el) => el.textContent.trim()),
['Saturday, December 12, 2015', 'Friday, January 1, 2016']
['Saturday, December 12, 2015', 'Friday, January 1, 2016'],
);
});
@ -91,7 +91,7 @@ module('Acceptance | view poll', function (hooks) {
await visit(`/poll/${poll.id}?encryptionKey=${encryptionKey}`);
assert.deepEqual(
findAll(
`[data-test-form-element^="option"] label:not(.custom-control-label)`
`[data-test-form-element^="option"] label:not(.custom-control-label)`,
).map((el) => el.textContent.trim()),
[
// full date
@ -100,11 +100,11 @@ module('Acceptance | view poll', function (hooks) {
'1:13 PM',
// full date cause day changed
'Friday, January 1, 2016 at 11:11 AM',
]
],
);
assert.notOk(
pageParticipation.showsExpirationWarning,
'does not show an expiration warning if poll will not expire in next weeks'
'does not show an expiration warning if poll will not expire in next weeks',
);
});
@ -148,11 +148,11 @@ module('Acceptance | view poll', function (hooks) {
.exists('user is asked which timezone should be used');
await click(
'[data-test-modal="choose-timezone"] [data-test-button="use-local-timezone"]'
'[data-test-modal="choose-timezone"] [data-test-button="use-local-timezone"]',
);
assert.deepEqual(
findAll(
`[data-test-form-element^="option"] label:not(.custom-control-label)`
`[data-test-form-element^="option"] label:not(.custom-control-label)`,
).map((el) => el.textContent.trim()),
[
Intl.DateTimeFormat('en-US', {
@ -163,7 +163,7 @@ module('Acceptance | view poll', function (hooks) {
dateStyle: 'full',
timeStyle: 'short',
}).format(new Date('2016-01-01T11:11:00.000Z')),
]
],
);
assert
.dom('[data-test-modal="choose-timezone"]')
@ -177,7 +177,7 @@ module('Acceptance | view poll', function (hooks) {
dateStyle: 'full',
timeStyle: 'short',
}).format(new Date('2015-12-12T11:11:00.000Z')),
]
],
);
});
@ -221,11 +221,11 @@ module('Acceptance | view poll', function (hooks) {
.exists('user is asked which timezone should be used');
await click(
'[data-test-modal="choose-timezone"] [data-test-button="use-poll-timezone"]'
'[data-test-modal="choose-timezone"] [data-test-button="use-poll-timezone"]',
);
assert.deepEqual(
findAll(
`[data-test-form-element^="option"] label:not(.custom-control-label)`
`[data-test-form-element^="option"] label:not(.custom-control-label)`,
).map((el) => el.textContent.trim()),
[
Intl.DateTimeFormat('en-US', {
@ -238,7 +238,7 @@ module('Acceptance | view poll', function (hooks) {
dateStyle: 'full',
timeStyle: 'short',
}).format(new Date('2016-01-01T11:11:00.000Z')),
]
],
);
assert
.dom('[data-test-modal="choose-timezone"]')
@ -253,7 +253,7 @@ module('Acceptance | view poll', function (hooks) {
dateStyle: 'full',
timeStyle: 'short',
}).format(new Date('2015-12-12T11:11:00.000Z')),
]
],
);
});
@ -265,12 +265,12 @@ module('Acceptance | view poll', function (hooks) {
assert.equal(
currentURL(),
`/poll/${pollId}?encryptionKey=${encryptionKey}`,
'shows URL entered by user'
'shows URL entered by user',
);
assert.equal(
currentRouteName(),
'poll_error',
'shows error substate of poll route'
'shows error substate of poll route',
);
assert
.dom('[data-test-error-type]')
@ -285,12 +285,12 @@ module('Acceptance | view poll', function (hooks) {
assert.equal(
currentURL(),
`/poll/${poll.id}?encryptionKey=${encryptionKey}`,
'shows URL entered by user'
'shows URL entered by user',
);
assert.equal(
currentRouteName(),
'poll_error',
'shows error substate of poll route'
'shows error substate of poll route',
);
assert
.dom('[data-test-error-type]')
@ -308,12 +308,12 @@ module('Acceptance | view poll', function (hooks) {
assert.equal(
currentURL(),
`/poll/${pollId}?encryptionKey=${encryptionKey}`,
'shows URL entered by user'
'shows URL entered by user',
);
assert.equal(
currentRouteName(),
'poll_error',
'shows error substate of poll route'
'shows error substate of poll route',
);
assert
.dom('[data-test-error-type]')

View file

@ -12,7 +12,7 @@ function pollHasUser(assert, name, selections) {
assert.equal(
elBase.querySelector(`td:nth-child(${index + 2})`).textContent.trim(),
selection.toString(),
`selection ${index} is as expected`
`selection ${index} is as expected`,
);
});
}

View file

@ -15,13 +15,13 @@ export default async function (name, selections) {
`.participation .selections .form-group:nth-child(${
index + 1
}) input`,
selection
selection,
);
} else {
await click(
`.participation .selections .form-group:nth-child(${
index + 1
}) .${selection}.radio input`
}) .${selection}.radio input`,
);
}
}

View file

@ -30,7 +30,7 @@ module('Integration | Component | create options datetime', function (hooks) {
this.store.createRecord('poll', {
pollType: 'FindADate',
options: [{ title: '2015-01-01' }],
})
}),
);
});
await render(hbs`<CreateOptionsDatetime @dates={{this.poll.options}} />`);
@ -38,12 +38,12 @@ module('Integration | Component | create options datetime', function (hooks) {
assert.equal(
findAll('.days .form-group input').length,
1,
'there is one input field'
'there is one input field',
);
assert.equal(
find('.days .form-group input').value,
'',
'value is an empty string'
'value is an empty string',
);
});
@ -58,7 +58,7 @@ module('Integration | Component | create options datetime', function (hooks) {
this.store.createRecord('poll', {
pollType: 'FindADate',
options: [{ title: '2015-01-01T11:11:00.000Z' }],
})
}),
);
});
await render(hbs`<CreateOptionsDatetime @dates={{this.poll.options}} />`);
@ -66,12 +66,12 @@ module('Integration | Component | create options datetime', function (hooks) {
assert.equal(
findAll('.days .form-group input').length,
1,
'there is one input field'
'there is one input field',
);
assert.equal(
find('.days .form-group input').value,
DateTime.fromISO('2015-01-01T11:11:00.000Z').toFormat('HH:mm'),
'it has time in option as value'
'it has time in option as value',
);
});
@ -90,7 +90,7 @@ module('Integration | Component | create options datetime', function (hooks) {
{ title: DateTime.fromISO('2015-01-01T22:22').toISO() },
{ title: '2015-02-02' },
],
})
}),
);
});
await render(hbs`<CreateOptionsDatetime @dates={{this.poll.options}} />`);
@ -98,30 +98,30 @@ module('Integration | Component | create options datetime', function (hooks) {
assert.equal(
findAll('.days label').length,
3,
'every form-group has a label'
'every form-group has a label',
);
assert.equal(
findAll('.days label:not(.sr-only)').length,
2,
'there are two not hidden labels for two different dates'
'there are two not hidden labels for two different dates',
);
assert.notOk(
findAll('.days .form-group')[0]
.querySelector('label')
.classList.contains('sr-only'),
'the first label is shown'
'the first label is shown',
);
assert.ok(
findAll('.days .form-group')[1]
.querySelector('label')
.classList.contains('sr-only'),
'the repeated label on second form-group is hidden by sr-only class'
'the repeated label on second form-group is hidden by sr-only class',
);
assert.notOk(
findAll('.days .form-group')[2]
.querySelector('label')
.classList.contains('sr-only'),
'the new label on third form-group is shown'
'the new label on third form-group is shown',
);
});
@ -135,7 +135,7 @@ module('Integration | Component | create options datetime', function (hooks) {
'poll',
this.store.createRecord('poll', {
options: [{ title: '2015-01-01' }, { title: '2015-02-02' }],
})
}),
);
});
await render(hbs`<CreateOptionsDatetime @dates={{this.poll.options}} />`);
@ -143,25 +143,25 @@ module('Integration | Component | create options datetime', function (hooks) {
assert.equal(
findAll('.days .form-group input').length,
2,
'there are two input fields before'
'there are two input fields before',
);
await click(findAll('.days .form-group')[0].querySelector('.add'));
assert.equal(
findAll('.days .form-group input').length,
3,
'another input field is added'
'another input field is added',
);
assert.equal(
findAll('.days .form-group')[1].querySelector('label').textContent,
findAll('.days .form-group')[0].querySelector('label').textContent,
'new input has correct label'
'new input has correct label',
);
assert.ok(
findAll('.days .form-group')[1]
.querySelector('label')
.classList.contains('sr-only'),
"label ofnew input is hidden cause it's repeated"
"label ofnew input is hidden cause it's repeated",
);
});
@ -179,7 +179,7 @@ module('Integration | Component | create options datetime', function (hooks) {
{ title: DateTime.fromISO('2015-01-01T11:11').toISO() },
{ title: DateTime.fromISO('2015-01-01T22:22').toISO() },
],
})
}),
);
});
await render(hbs`<CreateOptionsDatetime @dates={{this.poll.options}} />`);
@ -187,23 +187,23 @@ module('Integration | Component | create options datetime', function (hooks) {
assert.equal(
findAll('.days input').length,
2,
'there are two input fields before'
'there are two input fields before',
);
assert.ok(
findAll('.delete').every((el) => el.disabled === false),
'options are deleteable'
'options are deleteable',
);
await click(findAll('.days .form-group')[0].querySelector('.delete'));
assert.equal(
findAll('.days .form-group input').length,
1,
'one input field is removed after deletion'
'one input field is removed after deletion',
);
assert.equal(
find('.days .form-group input').value,
'22:22',
'correct input field is deleted'
'correct input field is deleted',
);
});
});

View file

@ -56,7 +56,7 @@ module('Integration | Component | create options', function (hooks) {
assert
.dom('.form-group .invalid-feedback')
.doesNotExist(
'there is no validation error anymore after a unique value is entered'
'there is no validation error anymore after a unique value is entered',
);
assert
.dom('.form-group .is-invalid')

View file

@ -9,7 +9,7 @@ module('Integration | Component | inline-datepicker', function (hooks) {
test('it renders an ember-power-calendar', async function (assert) {
this.set('noop', () => {});
await render(
hbs`<InlineDatepicker @onCenterChange={{this.noop}} @onSelect={{this.noop}} />`
hbs`<InlineDatepicker @onCenterChange={{this.noop}} @onSelect={{this.noop}} />`,
);
assert.dom('.ember-power-calendar').exists();

View file

@ -16,5 +16,5 @@ module(
assert.equal(this.element.textContent.trim(), '1234');
});
}
},
);

View file

@ -17,7 +17,7 @@ module('Integration | Mirage api mocking', function (hooks) {
assert.equal(JSON.parse(sjcl.decrypt(encryptionKey, poll.title)), 'foo');
assert.equal(
JSON.parse(sjcl.decrypt(encryptionKey, poll.description)),
'bar'
'bar',
);
});

View file

@ -11,7 +11,7 @@ module('Integration | translations', function (hooks) {
intl.locales.forEach((locale) => {
assert.ok(
Object.keys(localesMeta).includes(locale),
`locales meta data is present for ${locale}`
`locales meta data is present for ${locale}`,
);
});
});

View file

@ -11,5 +11,5 @@ export default PageObject.create(
pollType: fillable('.poll-type select'),
pollTypeHasFocus: hasFocus('.poll-type select'),
visit: visitable('/create'),
})
}),
);

View file

@ -11,5 +11,5 @@ export default PageObject.create(
description: fillable('.description textarea'),
title: fillable('.title input'),
titleHasFocus: hasFocus('.title input'),
})
}),
);

View file

@ -20,5 +20,5 @@ export default PageObject.create(
inputHasFocus: hasFocus('input'),
},
})
}),
);

View file

@ -25,8 +25,8 @@ function selectDates(selector) {
dateOrDateTimes.every(
(dateOrDateTime) =>
dateOrDateTime instanceof Date ||
DateTime.isDateTime(dateOrDateTime)
)
DateTime.isDateTime(dateOrDateTime),
),
);
for (let i = 0; i < dateOrDateTimes.length; i++) {
@ -57,5 +57,5 @@ export default create(
inputHasFocus: hasFocus('input'),
},
})
}),
);

View file

@ -12,5 +12,5 @@ export default PageObject.create(
availableAnswersHasFocus: hasFocus('.answer-type select'),
save: defaultsForCreate.next,
visit: visitable('/create/settings'),
})
}),
);

View file

@ -11,7 +11,7 @@ export const definition = {
showsExpirationWarning: isVisible('.expiration-warning'),
url: text('.poll-link .link code'),
urlIsValid: urlMatches(
/^\/poll\/[a-zA-Z0-9]{10}\/participation\?encryptionKey=[a-zA-Z0-9]{40}$/
/^\/poll\/[a-zA-Z0-9]{10}\/participation\?encryptionKey=[a-zA-Z0-9]{40}$/,
),
};

View file

@ -9,7 +9,7 @@ export default create(
'[data-test-table-of="participants"] thead tr:last-child th:not(:first-child)',
{
label: text(''),
}
},
),
participants: collection(
'[data-test-table-of="participants"] [data-test-participant]',
@ -19,7 +19,7 @@ export default create(
answer: text(''),
option: attribute('data-test-value-for', ''),
}),
}
},
),
})
}),
);

View file

@ -18,5 +18,5 @@ export default PageObject.create(
title: text('h2.title'),
// use as .visit({ encryptionKey: ??? })
visit: visitable('/poll/participation'),
})
}),
);

View file

@ -11,9 +11,9 @@ document.addEventListener(
throw new Error(
'Content-Security-Policy violation detected: ' +
`Violated directive: ${violatedDirective}. ` +
`Blocked URI: ${blockedURI}`
`Blocked URI: ${blockedURI}`,
);
}
},
);
setApplication(Application.create(config.APP));

View file

@ -13,25 +13,25 @@ module('Unit | Controller | poll', function (hooks) {
});
assert.notOk(
controller.get('showExpirationWarning'),
'is false if expirationDate is undefined'
'is false if expirationDate is undefined',
);
controller.set(
'model.expirationDate',
DateTime.local().plus({ weeks: 1 }).toISO()
DateTime.local().plus({ weeks: 1 }).toISO(),
);
assert.ok(
controller.get('showExpirationWarning'),
'is true if expirationDate is less than 2 weeks in future'
'is true if expirationDate is less than 2 weeks in future',
);
controller.set(
'model.expirationDate',
DateTime.local().plus({ months: 1 }).toISO()
DateTime.local().plus({ months: 1 }).toISO(),
);
assert.notOk(
controller.get('showExpirationWarning'),
'is false if expirationDate is more than 2 weeks in future'
'is false if expirationDate is more than 2 weeks in future',
);
});
});

View file

@ -12,12 +12,12 @@ module('Unit | Model | option', function (hooks) {
let option = run(() =>
this.owner.lookup('service:store').createRecord('option', {
title: '2015-01-01',
})
}),
);
assert.equal(
option.get('day'),
'2015-01-01',
'returns ISO 8601 day string if title is ISO 8601 day string'
'returns ISO 8601 day string if title is ISO 8601 day string',
);
run(() => {
@ -26,7 +26,7 @@ module('Unit | Model | option', function (hooks) {
assert.equal(
option.get('day'),
DateTime.fromISO('2015-01-01T11:11:00.000Z').toISODate(),
'returns ISO 8601 day string if title is ISO 8601 datetime string'
'returns ISO 8601 day string if title is ISO 8601 datetime string',
);
run(() => {
@ -35,7 +35,7 @@ module('Unit | Model | option', function (hooks) {
assert.equal(
option.get('day'),
undefined,
'returns undefined if title is not a valid ISO 8601 string'
'returns undefined if title is not a valid ISO 8601 string',
);
run(() => {
@ -44,7 +44,7 @@ module('Unit | Model | option', function (hooks) {
assert.equal(
option.get('day'),
undefined,
'returns undefined if title is null'
'returns undefined if title is null',
);
});
@ -52,7 +52,7 @@ module('Unit | Model | option', function (hooks) {
let option = run(() =>
this.owner.lookup('service:store').createRecord('option', {
title: '2015-01-01T11:11:00.000Z',
})
}),
);
assert.ok(option.get('hasTime'));
run(() => {
@ -69,12 +69,12 @@ module('Unit | Model | option', function (hooks) {
let option = run(() =>
this.owner.lookup('service:store').createRecord('option', {
title: '2015-01-01T11:11:00.000Z',
})
}),
);
assert.equal(
option.get('time'),
DateTime.fromISO('2015-01-01T11:11:00.000Z').toFormat('HH:mm'),
'returns time if title is ISO 8601 datetime string'
'returns time if title is ISO 8601 datetime string',
);
run(() => {
@ -83,7 +83,7 @@ module('Unit | Model | option', function (hooks) {
assert.equal(
option.get('time'),
undefined,
'returns undefined if title is ISO 8601 day string'
'returns undefined if title is ISO 8601 day string',
);
run(() => {
@ -92,7 +92,7 @@ module('Unit | Model | option', function (hooks) {
assert.equal(
option.get('time'),
undefined,
'returns undefined if title is not an ISO 8601 date string'
'returns undefined if title is not an ISO 8601 date string',
);
});
@ -100,7 +100,7 @@ module('Unit | Model | option', function (hooks) {
let option = run(() =>
this.owner.lookup('service:store').createRecord('option', {
title: '2015-01-01',
})
}),
);
run(() => {
@ -109,7 +109,7 @@ module('Unit | Model | option', function (hooks) {
assert.equal(
option.get('title'),
DateTime.fromISO('2015-01-01T11:00').toISO(),
'sets title according to time'
'sets title according to time',
);
run(() => {
@ -118,7 +118,7 @@ module('Unit | Model | option', function (hooks) {
assert.equal(
option.get('title'),
'2015-01-01',
'removes time from option if value is false'
'removes time from option if value is false',
);
const before = option.get('title');
@ -128,7 +128,7 @@ module('Unit | Model | option', function (hooks) {
assert.equal(
option.get('title'),
before,
'does not set title if time is invalid'
'does not set title if time is invalid',
);
run(() => {

View file

@ -1763,6 +1763,18 @@
dependencies:
"@octokit/openapi-types" "^18.0.0"
"@pkgr/utils@^2.3.1":
version "2.4.2"
resolved "https://registry.yarnpkg.com/@pkgr/utils/-/utils-2.4.2.tgz#9e638bbe9a6a6f165580dc943f138fd3309a2cbc"
integrity sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==
dependencies:
cross-spawn "^7.0.3"
fast-glob "^3.3.0"
is-glob "^4.0.3"
open "^9.1.0"
picocolors "^1.0.0"
tslib "^2.6.0"
"@pnpm/config.env-replace@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz#ab29da53df41e8948a00f2433f085f54de8b3a4c"
@ -6780,12 +6792,13 @@ eslint-plugin-node@^11.1.0:
resolve "^1.10.1"
semver "^6.1.0"
eslint-plugin-prettier@^4.0.0:
version "4.2.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b"
integrity sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==
eslint-plugin-prettier@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz#a3b399f04378f79f066379f544e42d6b73f11515"
integrity sha512-m3u5RnR56asrwV/lDC4GHorlW75DsFfmUcjfCYylTUs85dBRnB7VM6xG8eCMJdeDRnppzmxZVf1GEPJvl1JmNg==
dependencies:
prettier-linter-helpers "^1.0.0"
synckit "^0.8.5"
eslint-plugin-qunit@^8.0.0:
version "8.0.1"
@ -11047,7 +11060,7 @@ open-iconic@^1.1.1:
resolved "https://registry.yarnpkg.com/open-iconic/-/open-iconic-1.1.1.tgz#9dcfc8c7cd3c61cdb4a236b1a347894c97adc0c6"
integrity sha512-OQNnNMDxg4q+Kl4+8FT9l+7ZUS2fhDe39inzT1J/lQTmSmrOLI3Fkm/QHu0ro83mIfAhgM+F3ZpuHw8vomHCmQ==
open@9.1.0:
open@9.1.0, open@^9.1.0:
version "9.1.0"
resolved "https://registry.yarnpkg.com/open/-/open-9.1.0.tgz#684934359c90ad25742f5a26151970ff8c6c80b6"
integrity sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==
@ -11652,11 +11665,16 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"
prettier@^2.5.1, prettier@^2.6.2:
prettier@^2.5.1:
version "2.8.8"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da"
integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==
prettier@^3.0.0:
version "3.0.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643"
integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==
pretty-ms@^3.1.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/pretty-ms/-/pretty-ms-3.2.0.tgz#87a8feaf27fc18414d75441467d411d6e6098a25"
@ -13442,6 +13460,14 @@ sync-disk-cache@^2.0.0:
rimraf "^3.0.0"
username-sync "^1.0.2"
synckit@^0.8.5:
version "0.8.5"
resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.8.5.tgz#b7f4358f9bb559437f9f167eb6bc46b3c9818fa3"
integrity sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==
dependencies:
"@pkgr/utils" "^2.3.1"
tslib "^2.5.0"
tabbable@^5.3.3:
version "5.3.3"
resolved "https://registry.yarnpkg.com/tabbable/-/tabbable-5.3.3.tgz#aac0ff88c73b22d6c3c5a50b1586310006b47fbf"
@ -13809,7 +13835,7 @@ tslib@^1.9.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.4.1:
tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.4.1, tslib@^2.5.0, tslib@^2.6.0:
version "2.6.2"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==