diff --git a/app/templates/profile.hbs b/app/templates/profile.hbs index 6fd68d70..ec8ec72c 100644 --- a/app/templates/profile.hbs +++ b/app/templates/profile.hbs @@ -12,20 +12,11 @@ alt='user profile' /> {{/if}} - - {{#if this.isDev}} - {{else}} - - {{/if}}
{{#if (get @model 'isDeveloper')}} diff --git a/tests/integration/components/profile-test.js b/tests/integration/components/profile-test.js deleted file mode 100644 index 303a90b8..00000000 --- a/tests/integration/components/profile-test.js +++ /dev/null @@ -1,57 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, settled, click } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | profile-component', function (hooks) { - setupRenderingTest(hooks); - - test('button appearance based on isDev property', async function (assert) { - this.set('handleShowEditProfilePictureModal', () => { - this.set('showEditProfilePictureModal', true); - }); - - this.set('isDev', true); - - await render(hbs` - {{#if this.isDev}} - - {{else}} - - {{/if}} - `); - - assert.dom('[data-test-btn="edit"]').exists(); - assert.dom('[data-test-btn="edit"]').hasClass('profile-edit-button'); - - await click('[data-test-btn="edit"]'); - - assert.ok( - this.showEditProfilePictureModal, - 'Modal should be shown after clicking the button' - ); - - this.set('isDev', false); - - await settled(); - - assert.dom('[data-test-btn="edit"]').exists(); - assert.dom('[data-test-btn="edit"]').hasClass('edit-btn'); - assert.dom('[data-test-btn="edit"]').hasText('Update Picture'); - - await click('[data-test-btn="edit"]'); - - assert.ok( - this.showEditProfilePictureModal, - 'Modal should be shown after clicking the button' - ); - }); -}); diff --git a/tests/unit/components/profile-edit-button-test.js b/tests/unit/components/profile-edit-button-test.js new file mode 100644 index 00000000..dba5b241 --- /dev/null +++ b/tests/unit/components/profile-edit-button-test.js @@ -0,0 +1,22 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import { hbs } from 'ember-cli-htmlbars'; + +module('Unit | Component | profile-edit-button', function (hooks) { + setupRenderingTest(hooks); + + test('profile-edit-button renders and triggers action on click', async function (assert) { + this.set('mockAction', () => { + assert.ok(true, 'Action was called'); + }); + + await render( + hbs`` + ); + + assert.dom('[data-test-btn="edit"]').exists('Edit button is rendered'); + }); +}); diff --git a/tests/unit/routes/profile-test.js b/tests/unit/routes/profile-test.js index a1f4db1c..b6b51b9c 100644 --- a/tests/unit/routes/profile-test.js +++ b/tests/unit/routes/profile-test.js @@ -20,16 +20,4 @@ module('Unit | Route | profile', function (hooks) { assert.dom('[data-test-modal="image-upload"]').exists(); assert.dom('[data-test-btn="browse"]').exists(); }); - test('button appearance based on dev query param', async (assert) => { - await visit('/profile?dev=true'); - - assert.dom('[data-test-btn="edit"]').exists(); - assert.dom('[data-test-btn="edit"]').hasClass('profile-edit-button'); - - await visit('/profile?dev=false'); - - assert.dom('[data-test-btn="edit"]').exists(); - assert.dom('[data-test-btn="edit"]').hasClass('edit-btn'); - assert.dom('[data-test-btn="edit"]').hasText('Update Picture'); - }); });