Fix remaining deprecations (#711)
* fix: Use of assign has been deprecated. Please use Object.assign or the spread operator instead. * fix @tagName argument of <LinkTo> is deprecated * clean-up deprecation workflow
This commit is contained in:
parent
2d5914ff63
commit
5146bbdf36
8 changed files with 38 additions and 58 deletions
|
@ -91,33 +91,26 @@
|
||||||
|
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
{{! template-lint-disable no-link-to-tagname no-unknown-arguments-for-builtin-components }}
|
<li class="nav-item">
|
||||||
{{!
|
<LinkTo
|
||||||
TODO: Refactor to current Bootstrap markup, which uses a regular
|
@route="poll.participation"
|
||||||
`<a></a>` element within a `<li class="nav-item"></li>`.
|
@model={{poll.id}}
|
||||||
}}
|
class="nav-link"
|
||||||
<LinkTo
|
data-test-link="participation"
|
||||||
@route="poll.participation"
|
>
|
||||||
@model={{poll}}
|
|
||||||
@tagName="li"
|
|
||||||
@activeClass="active"
|
|
||||||
class="participation nav-item"
|
|
||||||
>
|
|
||||||
<LinkTo @route="poll.participation" @model={{poll}} class="nav-link">
|
|
||||||
{{t "poll.tab-title.participation"}}
|
{{t "poll.tab-title.participation"}}
|
||||||
</LinkTo>
|
</LinkTo>
|
||||||
</LinkTo>
|
</li>
|
||||||
<LinkTo
|
<li class="nav-item">
|
||||||
@route="poll.evaluation"
|
<LinkTo
|
||||||
@model={{poll}}
|
@route="poll.evaluation"
|
||||||
@tagName="li"
|
@model={{poll.id}}
|
||||||
@activeClass="active"
|
class="nav-link"
|
||||||
class="evaluation nav-item"
|
data-test-link="evaluation"
|
||||||
>
|
>
|
||||||
<LinkTo @route="poll.evaluation" @model={{poll}} class="nav-link">
|
|
||||||
{{t "poll.tab-title.evaluation"}}
|
{{t "poll.tab-title.evaluation"}}
|
||||||
</LinkTo>
|
</LinkTo>
|
||||||
</LinkTo>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
|
|
@ -3,19 +3,12 @@
|
||||||
self.deprecationWorkflow = self.deprecationWorkflow || {};
|
self.deprecationWorkflow = self.deprecationWorkflow || {};
|
||||||
self.deprecationWorkflow.config = {
|
self.deprecationWorkflow.config = {
|
||||||
workflow: [
|
workflow: [
|
||||||
|
// @ember/string deprecation is thrown even if all deprecated behavior is
|
||||||
|
// fixed due to a bug in Ember itself. Details can be found in:
|
||||||
|
// https://github.com/emberjs/ember.js/issues/20377
|
||||||
{
|
{
|
||||||
handler: 'silence',
|
handler: 'silence',
|
||||||
matchId: 'deprecated-run-loop-and-computed-dot-access',
|
matchId: 'ember-string.add-package',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
handler: 'silence',
|
|
||||||
matchId: 'ember-cli-mirage-config-routes-only-export',
|
|
||||||
},
|
|
||||||
{ handler: 'silence', matchId: 'ember-modifier.function-based-options' },
|
|
||||||
{ handler: 'silence', matchId: 'ember-cli-mirage.miragejs.import' },
|
|
||||||
{ handler: 'silence', matchId: 'ember.link-to.tag-name' },
|
|
||||||
{ handler: 'throw', matchId: 'ember-cli-page-object.multiple' },
|
|
||||||
{ handler: 'silence', matchId: 'autotracking.mutation-after-consumption' },
|
|
||||||
{ handler: 'silence', matchId: 'ember-runtime.deprecate-copy-copyable' },
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -67,7 +67,7 @@ module('Acceptance | participate in a poll', function (hooks) {
|
||||||
'participants table shows correct answers for new participant',
|
'participants table shows correct answers for new participant',
|
||||||
);
|
);
|
||||||
|
|
||||||
await click('.nav .participation');
|
await click('.nav [data-test-link="participation"]');
|
||||||
assert.equal(currentRouteName(), 'poll.participation');
|
assert.equal(currentRouteName(), 'poll.participation');
|
||||||
assert.equal(find('.name input').value, '', 'input for name is cleared');
|
assert.equal(find('.name input').value, '', 'input for name is cleared');
|
||||||
assert.notOk(
|
assert.notOk(
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
import { findAll, currentRouteName, find, visit } from '@ember/test-helpers';
|
import {
|
||||||
|
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';
|
||||||
import { setupIntl, t } from 'ember-intl/test-support';
|
import { setupIntl, t } from 'ember-intl/test-support';
|
||||||
import switchTab from 'croodle/tests/helpers/switch-tab';
|
|
||||||
import PollEvaluationPage from 'croodle/tests/pages/poll/evaluation';
|
import PollEvaluationPage from 'croodle/tests/pages/poll/evaluation';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
module('Acceptance | view evaluation', function (hooks) {
|
module('Acceptance | view evaluation', function (hooks) {
|
||||||
|
@ -26,7 +30,7 @@ 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.equal(currentRouteName(), 'poll.participation');
|
||||||
|
|
||||||
await switchTab('evaluation');
|
await click('.nav [data-test-link="evaluation"]');
|
||||||
assert.equal(
|
assert.equal(
|
||||||
findAll('.tab-content .tab-pane .evaluation-summary').length,
|
findAll('.tab-content .tab-pane .evaluation-summary').length,
|
||||||
0,
|
0,
|
||||||
|
@ -440,12 +444,10 @@ module('Acceptance | view evaluation', function (hooks) {
|
||||||
options: [{ title: 'first option' }, { title: 'second option' }],
|
options: [{ title: 'first option' }, { title: 'second option' }],
|
||||||
pollType: 'MakeAPoll',
|
pollType: 'MakeAPoll',
|
||||||
};
|
};
|
||||||
let poll = this.server.create(
|
let poll = this.server.create('poll', {
|
||||||
'poll',
|
...pollData,
|
||||||
assign(pollData, {
|
users: usersData.map((_) => this.server.create('user', _)),
|
||||||
users: usersData.map((_) => this.server.create('user', _)),
|
});
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
await visit(`/poll/${poll.id}/evaluation?encryptionKey=${encryptionKey}`);
|
await visit(`/poll/${poll.id}/evaluation?encryptionKey=${encryptionKey}`);
|
||||||
assert.equal(currentRouteName(), 'poll.evaluation');
|
assert.equal(currentRouteName(), 'poll.evaluation');
|
||||||
|
@ -560,7 +562,7 @@ 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.equal(currentRouteName(), 'poll.participation');
|
||||||
|
|
||||||
await switchTab('evaluation');
|
await click('.nav [data-test-link="evaluation"]');
|
||||||
assert.equal(currentRouteName(), 'poll.evaluation');
|
assert.equal(currentRouteName(), 'poll.evaluation');
|
||||||
assert.equal(
|
assert.equal(
|
||||||
find('.tab-pane h2').textContent.trim(),
|
find('.tab-pane h2').textContent.trim(),
|
||||||
|
|
|
@ -8,7 +8,6 @@ import {
|
||||||
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';
|
||||||
import switchTab from 'croodle/tests/helpers/switch-tab';
|
|
||||||
import pageParticipation from 'croodle/tests/pages/poll/participation';
|
import pageParticipation from 'croodle/tests/pages/poll/participation';
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import { triggerCopySuccess } from 'ember-cli-clipboard/test-support';
|
import { triggerCopySuccess } from 'ember-cli-clipboard/test-support';
|
||||||
|
@ -169,7 +168,7 @@ module('Acceptance | view poll', function (hooks) {
|
||||||
.dom('[data-test-modal="choose-timezone"]')
|
.dom('[data-test-modal="choose-timezone"]')
|
||||||
.doesNotExist('modal is closed');
|
.doesNotExist('modal is closed');
|
||||||
|
|
||||||
await switchTab('evaluation');
|
await click('.nav [data-test-link="evaluation"]');
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
findAll('[data-test-best-option]').map((el) => el.textContent.trim()),
|
findAll('[data-test-best-option]').map((el) => el.textContent.trim()),
|
||||||
[
|
[
|
||||||
|
@ -244,7 +243,7 @@ module('Acceptance | view poll', function (hooks) {
|
||||||
.dom('[data-test-modal="choose-timezone"]')
|
.dom('[data-test-modal="choose-timezone"]')
|
||||||
.doesNotExist('modal is closed');
|
.doesNotExist('modal is closed');
|
||||||
|
|
||||||
await switchTab('evaluation');
|
await click('.nav [data-test-link="evaluation"]');
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
findAll('[data-test-best-option]').map((el) => el.textContent.trim()),
|
findAll('[data-test-best-option]').map((el) => el.textContent.trim()),
|
||||||
[
|
[
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
import { click } from '@ember/test-helpers';
|
|
||||||
|
|
||||||
export default function (tab) {
|
|
||||||
return click(`.nav-tabs .${tab} a`);
|
|
||||||
}
|
|
|
@ -10,7 +10,6 @@ import {
|
||||||
import { defaultsForCreate } from 'croodle/tests/pages/defaults';
|
import { defaultsForCreate } from 'croodle/tests/pages/defaults';
|
||||||
import { hasFocus } from 'croodle/tests/pages/helpers';
|
import { hasFocus } from 'croodle/tests/pages/helpers';
|
||||||
import { calendarSelect } from 'ember-power-calendar/test-support';
|
import { calendarSelect } from 'ember-power-calendar/test-support';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
import { isArray } from '@ember/array';
|
import { isArray } from '@ember/array';
|
||||||
import { assert } from '@ember/debug';
|
import { assert } from '@ember/debug';
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
|
@ -41,7 +40,7 @@ function selectDates(selector) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default create(
|
export default create(
|
||||||
assign({}, defaultsForCreate, {
|
Object.assign({}, defaultsForCreate, {
|
||||||
selectDates: selectDates('[data-test-form-element-for="days"]'),
|
selectDates: selectDates('[data-test-form-element-for="days"]'),
|
||||||
dateHasError: isVisible('.days.has-error'),
|
dateHasError: isVisible('.days.has-error'),
|
||||||
dateError: text('.days .help-block'),
|
dateError: text('.days .help-block'),
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import { attribute, collection, create, text } from 'ember-cli-page-object';
|
import { attribute, collection, create, text } from 'ember-cli-page-object';
|
||||||
import { definition as Poll } from 'croodle/tests/pages/poll';
|
import { definition as Poll } from 'croodle/tests/pages/poll';
|
||||||
import { defaultsForApplication } from 'croodle/tests/pages/defaults';
|
import { defaultsForApplication } from 'croodle/tests/pages/defaults';
|
||||||
import { assign } from '@ember/polyfills';
|
|
||||||
|
|
||||||
export default create(
|
export default create(
|
||||||
assign({}, defaultsForApplication, Poll, {
|
Object.assign({}, defaultsForApplication, Poll, {
|
||||||
options: collection(
|
options: collection(
|
||||||
'[data-test-table-of="participants"] thead tr:last-child th:not(:first-child)',
|
'[data-test-table-of="participants"] thead tr:last-child th:not(:first-child)',
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue