Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { create, text } from 'ember-cli-page-object';
import { attribute, create } from 'ember-cli-page-object';
import weekGlance from '../week-glance';

const definition = {
scope: '[data-test-dashboard-week]',
weeklyLink: text('[data-test-weekly-link] a'),
weeklyLink: {
scope: '[data-test-weekly-link] a',
url: attribute('href'),
},
weekGlance,
};

Expand Down
5 changes: 4 additions & 1 deletion packages/ilios-common/addon/components/dashboard/week.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ export default class DashboardWeekComponent extends Component {
data-test-weekly-link
>
{{t "general.view"}}:
<LinkTo @route="weeklyevents" @query={{hash expanded=this.expanded week=this.week}}>
<LinkTo
@route="weeklyevents"
@query={{hash expanded=this.expanded week=this.week year=this.year}}
>
{{t "general.allWeeks"}}
</LinkTo>
</div>
Expand Down
3 changes: 3 additions & 0 deletions packages/ilios-common/addon/routes/weeklyevents.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export default class WeeklyeventsRoute extends Route {
week: {
replace: true,
},
year: {
replace: true,
},
};

beforeModel(transition) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ module('Integration | Component | dashboard/week', function (hooks) {

await render(<template><Week /></template>);
const expectedTitle = this.getTitle();
assert.strictEqual(component.weeklyLink, 'All Weeks');
assert.strictEqual(component.weeklyLink.text, 'All Weeks');
assert.strictEqual(component.weekGlance.title, expectedTitle);
assert.strictEqual(component.weekGlance.eventsByDate.length, 1);
assert.strictEqual(
Expand All @@ -118,7 +118,7 @@ module('Integration | Component | dashboard/week', function (hooks) {
this.setupEvents([]);
await render(<template><Week /></template>);
const expectedTitle = this.getTitle();
assert.strictEqual(component.weeklyLink, 'All Weeks');
assert.strictEqual(component.weeklyLink.text, 'All Weeks');
assert.strictEqual(component.weekGlance.title, expectedTitle);
assert.strictEqual(component.weekGlance.eventsByDate.length, 0);
});
Expand Down Expand Up @@ -234,4 +234,20 @@ module('Integration | Component | dashboard/week', function (hooks) {
'June 19-25 Week at a Glance',
);
});

test('link to weeklyevent without year', async function (assert) {
this.setupEvents([]);
const dt = DateTime.fromObject({ year: 2024, month: 12, day: 23 });
freezeDateAt(dt.toJSDate());
await render(<template><Week /></template>);
assert.strictEqual(component.weeklyLink.url, '/weeklyevents?expanded=51-52-1&week=52');
});

test('link to weeklyevent with year', async function (assert) {
this.setupEvents([]);
const dt = DateTime.fromObject({ year: 2024, month: 12, day: 30 });
freezeDateAt(dt.toJSDate());
await render(<template><Week /></template>);
assert.strictEqual(component.weeklyLink.url, '/weeklyevents?expanded=52-1-2&week=1&year=2025');
});
});