Skip to content

Commit

Permalink
Merge pull request #7997 from stopfstedt/have-big-chat
Browse files Browse the repository at this point in the history
add competency domain info to course objective parent objective selector component
  • Loading branch information
dartajax committed Jul 30, 2024
2 parents ec5bcc1 + 64756f7 commit fcbc7e7
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const definition = {
value: value(),
}),
competencies: collection('.parent-picker [data-test-competency]', {
title: text('.competency-title'),
title: text('[data-test-competency-title]'),
selected: hasClass('selected'),
notSelected: notHasClass('selected'),
objectives: collection('ul li', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@
>
<h4
class="competency-title"
data-test-competency-title
>
{{competency.title}}
{{#if competency.parent}}
<span class="domain-title">
({{competency.parent.title}})
</span>
{{/if}}
</h4>
<ul>
{{#each (sort-by "title" competency.objectives) as |objective|}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,20 @@ export default class CourseObjectiveListComponent extends Component {
const objectiveObjects = await map(objectives.slice(), async (objective) => {
let competencyId = 0;
let competencyTitle = intl.t('general.noAssociatedCompetency');
let competencyParent = null;
const competency = await objective.competency;
if (competency) {
competencyId = competency.id;
competencyTitle = competency.title;
competencyParent = await competency.parent;
}
return {
id: objective.id,
title: objective.title,
active: objective.active,
competencyId,
competencyTitle,
competencyParent,
cohortId: cohort.id,
};
});
Expand All @@ -102,6 +105,7 @@ export default class CourseObjectiveListComponent extends Component {
id: obj.competencyId,
title: obj.competencyTitle,
objectives: [],
parent: obj.competencyParent,
};
set.push(existing);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
.competency-title {
margin: 0.5rem 0 0 0.5rem;
padding: 0;

.domain-title {
@include m.ilios-heading-h5;
}
}

&.selected {
border-left: 10px solid c.$orange;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,58 @@ module('Integration | Component | course/manage-objective-parents', function (ho
assert.ok(true, 'no a11y errors found!');
});

test('parent domain title is shown next to competency title, if applicable', async function (assert) {
const programYearObjective1 = this.server.create('program-year-objective');
const programYearObjective2 = this.server.create('program-year-objective');
const domain = this.server.create('competency', { title: 'domain' });
const domainModel = await this.owner
.lookup('service:store')
.findRecord('competency', domain.id);
const cohortObjectives = [
{
title: 'cohort 0',
id: 1,
competencies: [
{
title: 'competency 0',
parent: domainModel,
objectives: [
{
id: programYearObjective1.id,
title: programYearObjective1.title,
active: programYearObjective1.active,
},
],
},
{
title: 'competency 1',
objectives: [
{
id: programYearObjective2.id,
title: programYearObjective2.title,
active: programYearObjective2.active,
},
],
},
],
},
];
this.set('cohortObjectives', cohortObjectives);
await render(hbs`<Course::ManageObjectiveParents
@cohortObjectives={{this.cohortObjectives}}
@selected={{(array)}}
@add={{(noop)}}
@remove={{(noop)}}
@removeFromCohort={{(noop)}}
/>
`);
assert.strictEqual(component.competencies.length, 2);
assert.strictEqual(component.competencies[0].title, 'competency 0 (domain)');
assert.strictEqual(component.competencies[1].title, 'competency 1');
await a11yAudit(this.element);
assert.ok(true, 'no a11y errors found!');
});

test('inactive parents are hidden unless they are selected', async function (assert) {
const activeProgramYearObjective = this.server.create('program-year-objective');
const inactiveProgramYearObjective = this.server.create('program-year-objective', {
Expand Down

0 comments on commit fcbc7e7

Please sign in to comment.