diff --git a/app/components/user-status.hbs b/app/components/user-status.hbs index 345ef6fc..1fa37eaa 100644 --- a/app/components/user-status.hbs +++ b/app/components/user-status.hbs @@ -3,21 +3,21 @@ {{else}} -
+
{{#each this.currentUserStatus as |currentStatus|}} {{#if (eq @status currentStatus.status)}} {{#if (eq currentStatus.status "ONBOARDING")}}

You are undergoing onboarding

-

+

If you are a Developer, please complete your submission for Lift Simulation, and ask for doubts in the team chat on Discord.

-

If you are not a developer, please contact Ankush for next steps.

+

If you are not a developer, please contact Ankush for next steps.

{{else}} @@ -27,12 +27,12 @@ {{/each}}
-
+
{{#each this.currentUserStatus as |currentStatus|}} {{#if (eq @status currentStatus.status)}} {{#each currentStatus.otherAvailableStatus as |otherPossibleStatus|}} - {{/each}} {{/if}} diff --git a/tests/integration/components/user-status-test.js b/tests/integration/components/user-status-test.js new file mode 100644 index 00000000..be6371e8 --- /dev/null +++ b/tests/integration/components/user-status-test.js @@ -0,0 +1,150 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import { hbs } from 'ember-cli-htmlbars'; + +module('Integration | Component | user-status-modal', function (hooks) { + setupRenderingTest(hooks); + + test('status is "DNE"', async function (assert) { + this.setProperties({ + status: 'DNE', + isStatusUpdating: false, + }); + await render(hbs` + + `); + + assert.dom('[data-test-heading]').exists(); + assert.dom('[data-test-status]').hasText("Your Status doesn't exist"); + + assert.dom('[data-test-btn-div]').exists(); + assert.dom('[data-test-btn="ACTIVE"]').exists(); + assert + .dom('[data-test-btn-label="ACTIVE"]') + .hasText('Change your status to Active'); + + assert.dom('[data-test-btn="IDLE"]').exists(); + assert + .dom('[data-test-btn-label="IDLE"]') + .hasText('Change your status to Idle'); + + assert.dom('[data-test-btn="OOO"]').exists(); + assert + .dom('[data-test-btn-label="OOO"]') + .hasText('Change your status to OOO'); + }); + + test('status is "ONBOARDING"', async function (assert) { + this.setProperties({ + status: 'ONBOARDING', + isStatusUpdating: false, + }); + await render(hbs` + + `); + + assert.dom('[data-test-heading]').exists(); + assert.dom('[data-test-onboarding-details]').exists(); + assert.dom('[data-test-status]').hasText('You are undergoing onboarding'); + assert + .dom('[data-test-details-p1]') + .hasText( + 'If you are a Developer, please complete your submission for Lift Simulation, and ask for doubts in the team chat on Discord.' + ); + assert + .dom('[data-test-details-p2]') + .hasText( + 'If you are not a developer, please contact Ankush for next steps.' + ); + assert.dom('[data-test-active-button]').exists(); + assert + .dom('[data-test-btn-label="ACTIVE"]') + .hasText('Change your status to Active'); + }); + + test('status is "ACTIVE"', async function (assert) { + this.setProperties({ + status: 'ACTIVE', + isStatusUpdating: false, + }); + await render(hbs` + + `); + assert.dom('[data-test-heading]').exists(); + assert.dom('[data-test-status]').hasText('You are Active'); + + assert.dom('[data-test-btn-div]').exists(); + assert.dom('[data-test-btn="IDLE"]').exists(); + assert + .dom('[data-test-btn-label="IDLE"]') + .hasText('Change your status to Idle'); + + assert.dom('[data-test-btn="OOO"]').exists(); + assert + .dom('[data-test-btn-label="OOO"]') + .hasText('Change your status to OOO'); + }); + + test('status is "IDLE"', async function (assert) { + this.setProperties({ + status: 'IDLE', + isStatusUpdating: false, + }); + await render(hbs` + + `); + assert.dom('[data-test-heading]').exists(); + assert.dom('[data-test-status]').hasText('You are Idle'); + + assert.dom('[data-test-btn-div]').exists(); + assert.dom('[data-test-btn="ACTIVE"]').exists(); + assert + .dom('[data-test-btn-label="ACTIVE"]') + .hasText('Change your status to Active'); + + assert.dom('[data-test-btn="OOO"]').exists(); + assert + .dom('[data-test-btn-label="OOO"]') + .hasText('Change your status to OOO'); + }); + + test('status is "OOO"', async function (assert) { + this.setProperties({ + status: 'OOO', + isStatusUpdating: false, + }); + await render(hbs` + + `); + + assert.dom('[data-test-heading]').exists(); + assert.dom('[data-test-status]').hasText('You are OOO'); + + assert.dom('[data-test-btn-div]').exists(); + assert.dom('[data-test-btn="ACTIVE"]').exists(); + assert + .dom('[data-test-btn-label="ACTIVE"]') + .hasText('Change your status to Active'); + + assert.dom('[data-test-btn="IDLE"]').exists(); + assert + .dom('[data-test-btn-label="IDLE"]') + .hasText('Change your status to Idle'); + }); +});