github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/tests/integration/components/policy-editor-test.js (about) 1 import { module, test } from 'qunit'; 2 import { setupRenderingTest } from 'ember-qunit'; 3 import { render } from '@ember/test-helpers'; 4 import { hbs } from 'ember-cli-htmlbars'; 5 import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit'; 6 7 module('Integration | Component | policy-editor', function (hooks) { 8 setupRenderingTest(hooks); 9 10 test('it renders', async function (assert) { 11 assert.expect(1); 12 await render(hbs`<PolicyEditor />`); 13 await componentA11yAudit(this.element, assert); 14 }); 15 16 test('Only has editable name if new', async function (assert) { 17 const newMockPolicy = { 18 isNew: true, 19 name: 'New Policy', 20 }; 21 22 const oldMockPolicy = { 23 isNew: false, 24 name: 'Old Policy', 25 }; 26 27 this.set('newMockPolicy', newMockPolicy); 28 this.set('oldMockPolicy', oldMockPolicy); 29 30 await render(hbs`<PolicyEditor @policy={{this.newMockPolicy}} />`); 31 assert.dom('[data-test-policy-name-input]').exists(); 32 await render(hbs`<PolicyEditor @policy={{this.oldMockPolicy}} />`); 33 assert.dom('[data-test-policy-name-input]').doesNotExist(); 34 }); 35 });