Skip to content

Commit

Permalink
Tests added
Browse files Browse the repository at this point in the history
  • Loading branch information
lakshayman committed Feb 14, 2024
1 parent d130a51 commit 02a1dd6
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions tests/integration/components/profile-field-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,58 @@ module('Integration | Component | profile-field', function (hooks) {
assert.dom('[data-test-profile-field]').hasClass('profile-field-error');
assert.dom('[data-test-profile-field-error]').hasText(this.errorMessage);
});

test('disabled profile field renders when isDeveloper is true', async function (assert) {
this.setProperties({
label: 'First Name*',
icon_url: 'icons/user.svg',
isDeveloper: true,
});

await render(hbs`
<ProfileField
@label={{this.label}}
@icon_url={{this.icon_url}}
@isDeveloper={{this.isDeveloper}}
/>
`);

assert.dom('[data-test-profile-field-label]').hasText(this.label);
assert
.dom('[data-test-profile-field-icon]')
.exists()
.hasAttribute('src', this.icon_url);
assert
.dom('[data-test-profile-field-input]')
.hasProperty('disabled', true)
.exists();
assert.dom('[data-test-profile-field-error]').exists();
});

test('profile field renders when isDeveloper is false', async function (assert) {
this.setProperties({
label: 'First Name*',
icon_url: 'icons/user.svg',
isDeveloper: false,
});

await render(hbs`
<ProfileField
@label={{this.label}}
@icon_url={{this.icon_url}}
@isDeveloper={{this.isDeveloper}}
/>
`);

assert.dom('[data-test-profile-field-label]').hasText(this.label);
assert
.dom('[data-test-profile-field-icon]')
.exists()
.hasAttribute('src', this.icon_url);
assert
.dom('[data-test-profile-field-input]')
.hasProperty('disabled', false)
.exists();
assert.dom('[data-test-profile-field-error]').exists();
});
});

0 comments on commit 02a1dd6

Please sign in to comment.