From 62c70c8ac38ee0ec3d0c595c790a01d970d86e56 Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Fri, 19 Jul 2024 09:33:51 -0700 Subject: [PATCH] use kebap-cased relationship key instead of deprecated camelCase key. rm some kruft in component test while at it. --- .../school-competencies-list-item.js | 2 +- .../school-competencies-list-item-test.js | 43 ++++++++++++++++++- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/packages/frontend/app/components/school-competencies-list-item.js b/packages/frontend/app/components/school-competencies-list-item.js index af5a6cebbd..371c36e251 100644 --- a/packages/frontend/app/components/school-competencies-list-item.js +++ b/packages/frontend/app/components/school-competencies-list-item.js @@ -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() { diff --git a/packages/frontend/tests/integration/components/school-competencies-list-item-test.js b/packages/frontend/tests/integration/components/school-competencies-list-item-test.js index da36a17309..1a86d8b36f 100644 --- a/packages/frontend/tests/integration/components/school-competencies-list-item-test.js +++ b/packages/frontend/tests/integration/components/school-competencies-list-item-test.js @@ -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); @@ -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``); + 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``); + 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!'); + }); });