Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

normalize date display format for material list #7882

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/frontend/tests/acceptance/dashboard/materials-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ module('Acceptance | Dashboard Materials', function (hooks) {
assert.strictEqual(page.materials.table.rows[0].instructors, '');
assert.strictEqual(
page.materials.table.rows[0].firstOfferingDate,
this.tomorrow.toFormat('M/d/y'),
this.tomorrow.toFormat('MM/dd/y'),
);
assert.ok(page.materials.table.rows[1].status.isPresent);
assert.notOk(page.materials.table.rows[1].status.isChecked);
Expand All @@ -229,7 +229,7 @@ module('Acceptance | Dashboard Materials', function (hooks) {
);
assert.strictEqual(
page.materials.table.rows[1].firstOfferingDate,
this.tomorrow.toFormat('M/d/y'),
this.tomorrow.toFormat('MM/dd/y'),
);
assert.ok(page.materials.table.rows[2].status.isPresent);
assert.ok(page.materials.table.rows[2].status.isChecked);
Expand All @@ -245,7 +245,7 @@ module('Acceptance | Dashboard Materials', function (hooks) {
);
assert.strictEqual(
page.materials.table.rows[2].firstOfferingDate,
this.tomorrow.toFormat('M/d/y'),
this.tomorrow.toFormat('MM/dd/y'),
);

assert.notOk(page.materials.table.rows[3].status.isPresent);
Expand All @@ -259,7 +259,7 @@ module('Acceptance | Dashboard Materials', function (hooks) {
);
assert.strictEqual(
page.materials.table.rows[3].firstOfferingDate,
this.today.toFormat('M/d/y'),
this.today.toFormat('MM/dd/y'),
);

assert.ok(page.materials.table.rows[4].status.isPresent);
Expand All @@ -271,7 +271,7 @@ module('Acceptance | Dashboard Materials', function (hooks) {
assert.strictEqual(page.materials.table.rows[4].instructors, '');
assert.strictEqual(
page.materials.table.rows[4].firstOfferingDate,
this.today.toFormat('M/d/y'),
this.today.toFormat('MM/dd/y'),
);
assert.ok(page.materials.table.rows[5].status.isPresent);
assert.notOk(page.materials.table.rows[5].status.isChecked);
Expand All @@ -289,7 +289,7 @@ module('Acceptance | Dashboard Materials', function (hooks) {
);
assert.strictEqual(
page.materials.table.rows[5].firstOfferingDate,
this.today.toFormat('M/d/y'),
this.today.toFormat('MM/dd/y'),
);
await a11yAudit();
assert.ok(true, 'no a11y errors found!');
Expand Down Expand Up @@ -385,7 +385,7 @@ module('Acceptance | Dashboard Materials', function (hooks) {
assert.ok(page.materials.table.headers.firstOfferingDate.isSortedAscending);
assert.strictEqual(
page.materials.table.rows[0].firstOfferingDate,
this.today.toFormat('M/d/y'),
this.today.toFormat('MM/dd/y'),
);
await page.materials.table.headers.firstOfferingDate.click();
assert.ok(page.materials.table.headers.firstOfferingDate.isSortedDescending);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
</td>
<td colspan="4" data-test-date>
{{#if @lm.firstOfferingDate}}
{{format-date @lm.firstOfferingDate}}
{{format-date @lm.firstOfferingDate day="2-digit" month="2-digit" year="numeric"}}
{{else}}
{{t "general.none"}}
{{/if}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ module('Integration | Component | dashboard/material-list-item', function (hooks
assert.strictEqual(
component.firstOfferingDate,
this.intl.formatDate(today.toJSDate(), {
month: 'numeric',
day: 'numeric',
month: '2-digit',
day: '2-digit',
year: 'numeric',
}),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ module('Integration | Component | dashboard/materials', function (hooks) {
assert.ok(component.table.rows[0].pdfLink.isVisible);
assert.strictEqual(component.table.rows[0].pdfLink.url, 'http://myhost.com/url1?inline');
assert.strictEqual(component.table.rows[0].instructors, 'Instructor1name, Instructor2name');
assert.strictEqual(component.table.rows[0].firstOfferingDate, this.today.toFormat('M/d/yyyy'));
assert.strictEqual(
component.table.rows[0].firstOfferingDate,
this.today.toFormat('MM/dd/yyyy'),
);
assert.strictEqual(component.table.rows[1].sessionTitle, 'session2title');
assert.strictEqual(component.table.rows[1].courseTitle, 'course 1');
assert.strictEqual(component.table.rows[1].title, 'Web Link title2');
Expand All @@ -206,14 +209,17 @@ module('Integration | Component | dashboard/materials', function (hooks) {
assert.strictEqual(component.table.rows[1].instructors, 'Instructor1name, Instructor2name');
assert.strictEqual(
component.table.rows[1].firstOfferingDate,
this.tomorrow.toFormat('M/d/yyyy'),
this.tomorrow.toFormat('MM/dd/yyyy'),
);
assert.strictEqual(component.table.rows[2].sessionTitle, 'session3title');
assert.strictEqual(component.table.rows[2].courseTitle, 'course 2');
assert.strictEqual(component.table.rows[2].title, 'Citation title3 citationtext');
assert.ok(component.table.rows[2].isCitation);
assert.strictEqual(component.table.rows[2].instructors, '');
assert.strictEqual(component.table.rows[2].firstOfferingDate, this.today.toFormat('M/d/yyyy'));
assert.strictEqual(
component.table.rows[2].firstOfferingDate,
this.today.toFormat('MM/dd/yyyy'),
);
assert.strictEqual(component.table.rows[3].sessionTitle, 'session4title');
assert.strictEqual(component.table.rows[3].courseTitle, 'course 0');
assert.strictEqual(component.table.rows[3].title, 'File title4');
Expand All @@ -223,7 +229,7 @@ module('Integration | Component | dashboard/materials', function (hooks) {
assert.strictEqual(component.table.rows[3].instructors, 'Instructor3name, Instructor4name');
assert.strictEqual(
component.table.rows[3].firstOfferingDate,
this.tomorrow.toFormat('M/d/yyyy'),
this.tomorrow.toFormat('MM/dd/yyyy'),
);
assert.strictEqual(component.table.rows[4].sessionTitle, 'session5title');
assert.strictEqual(component.table.rows[4].courseTitle, 'course 4');
Expand All @@ -235,7 +241,7 @@ module('Integration | Component | dashboard/materials', function (hooks) {
assert.strictEqual(component.table.rows[4].instructors, '');
assert.strictEqual(
component.table.rows[4].firstOfferingDate,
this.tomorrow.toFormat('M/d/yyyy'),
this.tomorrow.toFormat('MM/dd/yyyy'),
);
await a11yAudit(this.element);
assert.ok(true, 'no a11y errors found!');
Expand Down Expand Up @@ -579,12 +585,15 @@ module('Integration | Component | dashboard/materials', function (hooks) {
assert.notOk(component.table.headers.title.isSortedOn);
assert.ok(component.table.headers.firstOfferingDate.isSortedOn);
assert.ok(component.table.headers.firstOfferingDate.isSortedAscending);
assert.strictEqual(component.table.rows[0].firstOfferingDate, this.today.toFormat('M/d/yyyy'));
assert.strictEqual(
component.table.rows[0].firstOfferingDate,
this.today.toFormat('MM/dd/yyyy'),
);
await component.table.headers.firstOfferingDate.click();
assert.ok(component.table.headers.firstOfferingDate.isSortedDescending);
assert.strictEqual(
component.table.rows[0].firstOfferingDate,
this.nextWeek.toFormat('M/d/yyyy'),
this.nextWeek.toFormat('MM/dd/yyyy'),
);
});
});