-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7394 from stopfstedt/admin_calendar_toggle
hides user profile calendar behind toggle-button by default.
- Loading branch information
Showing
8 changed files
with
134 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
export default class UserProfileComponent extends Component { | ||
@service currentUser; | ||
@tracked showCalendar = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { setupIntl } from 'ember-intl/test-support'; | ||
import { render } from '@ember/test-helpers'; | ||
import Service from '@ember/service'; | ||
import { hbs } from 'ember-cli-htmlbars'; | ||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; | ||
import { component } from 'ilios/tests/pages/components/user-profile'; | ||
|
||
module('Integration | Component | user-profile', function (hooks) { | ||
setupRenderingTest(hooks); | ||
setupIntl(hooks, 'en-us'); | ||
setupMirage(hooks); | ||
|
||
hooks.beforeEach(async function () { | ||
const school = this.server.create('school'); | ||
const program = this.server.create('program', { school }); | ||
this.programYear = this.server.create('programYear', { program }); | ||
this.cohort = this.server.create('cohort', { programYear: this.programYear }); | ||
|
||
const user = this.server.create('user', { school }); | ||
const userModel = await this.owner.lookup('service:store').findRecord('user', user.id); | ||
class CurrentUserMock extends Service { | ||
async getModel() { | ||
return userModel; | ||
} | ||
getRolesInSchool() { | ||
return []; | ||
} | ||
} | ||
this.owner.register('service:currentUser', CurrentUserMock); | ||
}); | ||
|
||
test('user profile calendar', async function (assert) { | ||
const user = this.server.create('user'); | ||
const userModel = await this.owner.lookup('service:store').findRecord('user', user.id); | ||
this.set('user', userModel); | ||
|
||
await render(hbs`<UserProfile | ||
@user={{this.user}} | ||
@canUpdate={{false}} | ||
@canCreate={{false}} | ||
@isManagingBio={{false}} | ||
@setIsManagingBio={{(noop)}} | ||
@isManagingRoles={{false}} | ||
@setIsManagingRoles={{(noop)}} | ||
@isManagingCohorts={{false}} | ||
@setIsManagingCohorts={{(noop)}} | ||
@isManagingIcs={{false}} | ||
@setIsManagingIcs={{(noop)}} | ||
@isManagingSchools={{false}} | ||
@setIsManagingSchools={{(noop)}} | ||
@permissionsSchool={{null}} | ||
@permissionsYear={{null}} | ||
@setPermissionsSchool={{(noop)}} | ||
@setPermissionsYear={{(noop)}} | ||
/>`); | ||
|
||
assert.notOk(component.calendar.isVisible); | ||
assert.strictEqual(component.actions.calendarToggle.firstLabel.text, 'Hide Calendar'); | ||
assert.ok(component.actions.calendarToggle.firstButton.isChecked); | ||
assert.strictEqual(component.actions.calendarToggle.secondLabel.text, 'Show Calendar'); | ||
assert.notOk(component.actions.calendarToggle.secondButton.isChecked); | ||
await component.actions.calendarToggle.secondButton.click(); | ||
assert.ok(component.calendar.isVisible); | ||
await component.actions.calendarToggle.firstButton.click(); | ||
assert.notOk(component.calendar.isVisible); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { create } from 'ember-cli-page-object'; | ||
|
||
// @todo flesh this out. [ST 2023/09/08] | ||
const definition = { | ||
scope: '[data-test-user-profile-calendar]', | ||
}; | ||
|
||
export default definition; | ||
export const component = create(definition); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { create } from 'ember-cli-page-object'; | ||
|
||
import bio from 'ilios/tests/pages/components/user-profile-bio'; | ||
import calendar from 'ilios/tests/pages/components/user-profile-calendar'; | ||
import cohorts from 'ilios/tests/pages/components/user-profile-cohorts'; | ||
import ics from 'ilios/tests/pages/components/user-profile-ics'; | ||
import learnerGroups from 'ilios/tests/pages/components/user-profile/learner-groups'; | ||
import permissions from 'ilios/tests/pages/components/user-profile-permissions'; | ||
import roles from 'ilios/tests/pages/components/user-profile-roles'; | ||
import toggleButtons from 'ilios-common/page-objects/components/toggle-buttons'; | ||
|
||
// @todo flesh this out. [ST 2023/09/08] | ||
const definition = { | ||
scope: '[data-test-user-profile]', | ||
actions: { | ||
scope: '[data-test-user-profile-actions]', | ||
calendarToggle: toggleButtons, | ||
}, | ||
bio, | ||
calendar, | ||
cohorts, | ||
learnerGroups, | ||
ics, | ||
permissions, | ||
roles, | ||
}; | ||
|
||
export default definition; | ||
export const component = create(definition); |