generated from Real-Dev-Squad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix the upload profile image button (#614)
- Loading branch information
1 parent
3d3e172
commit d557315
Showing
6 changed files
with
115 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
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}} | ||
<Button @onClick={{this.handleShowEditProfilePictureModal}} | ||
@class='profile-edit-button ' | ||
@data-test-btn='edit'> | ||
<FaIcon @icon="edit" /> | ||
</Button> | ||
{{else}} | ||
<Button @onClick={{this.handleShowEditProfilePictureModal}} | ||
@class='edit-btn btn' | ||
@data-test-btn='edit'> | ||
Update Picture | ||
</Button> | ||
{{/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' | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters