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

prevent the application of user context filters on school events. #8008

Merged
merged 1 commit into from
Jul 25, 2024
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
36 changes: 36 additions & 0 deletions packages/frontend/tests/acceptance/dashboard/calendar-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,42 @@ module('Acceptance | Dashboard Calendar', function (hooks) {
assert.notOk(page.calendar.controls.userContextFilter.isPresent);
});

test('user context filters do not apply to school calendar', async function (assert) {
assert.expect(2);
this.user = await setupAuthentication({ school: this.school }, true);
const day = DateTime.fromObject({
month: 7,
day: 7,
year: 2007,
hour: 8,
minute: 8,
second: 8,
});
freezeDateAt(day.toJSDate());
this.server.create('schoolevent', {
school: 1,
startDate: day.toJSDate(),
endDate: day.plus({ hour: 1 }).toJSDate(),
offering: 1,
});
this.server.create('schoolevent', {
school: 1,
startDate: day.toJSDate(),
endDate: day.plus({ hour: 1 }).toJSDate(),
offering: 2,
});
await page.visit({ show: 'calendar' });
// switch to the school calendar and verify that events are present
await page.calendar.controls.mySchedule.toggle.secondLabel.click();
assert.strictEqual(page.calendar.calendar.weekly.events.length, 2);
// switch to the user calendar and apply a user context filter
await page.calendar.controls.mySchedule.toggle.firstLabel.click();
await page.calendar.controls.userContextFilter.learning.toggle();
// switch to the school calendar and verify that nothing has changed
await page.calendar.controls.mySchedule.toggle.secondLabel.click();
assert.strictEqual(page.calendar.calendar.weekly.events.length, 2);
});

test('test user context filters', async function (assert) {
assert.expect(11);
this.user = await setupAuthentication({ school: this.school }, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ export default class DashboardCalendarComponent extends Component {
'eventsWithSelectedCohorts',
'eventsWithSelectedCourses',
'eventsWithSelectedTerms',
'eventsWithSelectedUserContext',
];
if (this.args.mySchedule) {
eventTypes.push('eventsWithSelectedUserContext');
}
const allFilteredEvents = eventTypes.map((name) => {
return this[name];
});
Expand Down