Skip to content

Commit

Permalink
Merge pull request #7986 from stopfstedt/school-management-competenci…
Browse files Browse the repository at this point in the history
…es-pcrs

use kebap-cased relationship key instead of deprecated camelCase key.
  • Loading branch information
dartajax authored Jul 19, 2024
2 parents e91866b + 62c70c8 commit 7bcff3d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class SchoolCompetenciesListItemComponent extends Component {

@cached
get allPcrsesData() {
return new TrackedAsyncData(this.store.findAll('aamcPcrs'));
return new TrackedAsyncData(this.store.findAll('aamc-pcrs'));
}

get allPcrses() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ module('Integration | Component | school-competencies-list-item', function (hook
const competency = this.server.create('competency', {
parent: domain,
});
this.pcrsModel1 = await this.owner.lookup('service:store').findRecord('aamc-pcrs', pcrs1.id);
this.pcrsModel2 = await this.owner.lookup('service:store').findRecord('aamc-pcrs', pcrs2.id);
this.competencyModel = await this.owner
.lookup('service:store')
.findRecord('competency', competency.id);
Expand Down Expand Up @@ -63,4 +61,45 @@ module('Integration | Component | school-competencies-list-item', function (hook
await a11yAudit(this.element);
assert.ok(true, 'no a11y errors found!');
});

test('manage - no pre-selected PCRS', async function (assert) {
this.set('competency', this.competencyModel);
await render(hbs`<SchoolCompetenciesListItem
@competency={{this.competency}}
@isDomain={{false}}
@canUpdate={{true}}
/>`);
assert.strictEqual(component.title.text, 'competency 1');
assert.strictEqual(component.pcrs.items.length, 1);
assert.strictEqual(component.pcrs.items[0].text, 'Click to edit');
assert.notOk(component.mapper.isVisible);
await component.pcrs.items[0].edit();
assert.ok(component.mapper.isVisible);
assert.strictEqual(component.mapper.pcrs.length, 2);
assert.notOk(component.mapper.pcrs[0].isChecked);
assert.notOk(component.mapper.pcrs[1].isChecked);
await a11yAudit(this.element);
assert.ok(true, 'no a11y errors found!');
});

test('manage - pre-selected PCRS', async function (assert) {
this.set('competency', this.domainModel);
await render(hbs`<SchoolCompetenciesListItem
@competency={{this.competency}}
@isDomain={{false}}
@canUpdate={{true}}
/>`);
assert.strictEqual(component.title.text, 'competency 0');
assert.strictEqual(component.pcrs.items.length, 2);
assert.strictEqual(component.pcrs.items[0].text, '1 Zylinder');
assert.strictEqual(component.pcrs.items[1].text, '2 Alfons');
assert.notOk(component.mapper.isVisible);
await component.pcrs.items[0].edit();
assert.ok(component.mapper.isVisible);
assert.strictEqual(component.mapper.pcrs.length, 2);
assert.ok(component.mapper.pcrs[0].isChecked);
assert.ok(component.mapper.pcrs[1].isChecked);
await a11yAudit(this.element);
assert.ok(true, 'no a11y errors found!');
});
});

0 comments on commit 7bcff3d

Please sign in to comment.