Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed buttons to mark oneself as idle or active #432

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions app/components/user-status-modal.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
<Input name='untilDate' type='date' min={{if this.fromDate this.fromDate this.disableDatesPrior}}
value={{this.untilDate}} {{on "change" this.updateValue}} data-test-date-picker-until />
<label class="modal__inputs--description" data-test-label-reason>Reason</label>
{{else if (eq @newStatus this.USER_STATES.IDLE)}}
<label class="modal__inputs--description" data-test-label-missing-skills>What skills are you willing to
learn</label>
{{/if}}

<textarea name='reason' class="modal__text-area" value={{this.reason}} {{on "input" this.handleInput}}
Expand Down
4 changes: 0 additions & 4 deletions app/components/user-status.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
and ask for doubts in the team chat on Discord.
</p>
<p data-test-details>If you are not a developer, please contact Ankush for next steps.</p>
<button class="buttons__active" type="button" {disabled={{@isStatusUpdating}} {{on "click" (fn
this.changeStatus "ACTIVE" )}} data-test-active-button>
<span>Change your status to Active</span>
</button>
</div>
{{else}}
<h2 data-test-status>{{currentStatus.message}}</h2>
Expand Down
21 changes: 4 additions & 17 deletions app/components/user-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,25 @@ export default class UserStatusComponent extends Component {
{
status: USER_STATES.ACTIVE,
message: 'You are Active',
otherAvailableStatus: [
this.ALL_FEASIBLE_STATUS.IDLE,
this.ALL_FEASIBLE_STATUS.OOO,
],
otherAvailableStatus: [this.ALL_FEASIBLE_STATUS.OOO],
},
{
status: USER_STATES.IDLE,
message: 'You are Idle',
otherAvailableStatus: [
this.ALL_FEASIBLE_STATUS.ACTIVE,
this.ALL_FEASIBLE_STATUS.OOO,
],
otherAvailableStatus: [this.ALL_FEASIBLE_STATUS.OOO],
},
{
status: USER_STATES.OOO,
message: 'You are OOO',
otherAvailableStatus: [
this.ALL_FEASIBLE_STATUS.ACTIVE,
this.ALL_FEASIBLE_STATUS.IDLE,
],
otherAvailableStatus: [],
},
{
status: USER_STATES.ONBOARDING,
},
{
status: USER_STATES.DNE,
message: `Your Status doesn't exist`,
otherAvailableStatus: [
this.ALL_FEASIBLE_STATUS.ACTIVE,
this.ALL_FEASIBLE_STATUS.IDLE,
this.ALL_FEASIBLE_STATUS.OOO,
],
otherAvailableStatus: [this.ALL_FEASIBLE_STATUS.OOO],
},
];

Expand Down
37 changes: 0 additions & 37 deletions tests/integration/components/user-status-modal-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,43 +88,6 @@ module('Integration | Component | user-status-modal', function (hooks) {
await click('.modal__submit');
});

test('payload contains relevant data when status is changed to IDLE', async function (assert) {
this.setProperties({
newStatus: 'IDLE',
showUserStateModal: true,
toggleUserStateModal: () => {
this.set('showUserStateModal', !this.showUserStateModal);
},
updateStatus: (statusPayLoad) => {
const {
currentStatus: { state, from, message, updatedAt },
} = statusPayLoad;
assert.equal(state, 'IDLE', 'new state present in the payload');
assert.equal(
message,
'Rust and GoLang',
'message present in the payload'
);
assert.ok(typeof from === 'number', 'from is a numeric timestamp');
assert.ok(
typeof updatedAt === 'number',
'updatedAt is a numeric timestamp'
);
},
});

await render(hbs`
<UserStatusModal
@showUserStateModal={{this.showUserStateModal}}
@newStatus={{this.newStatus}}
@toggleUserStateModal={{this.toggleUserStateModal}}
@updateStatus={{this.updateStatus}}
/>`);
await fillIn('[data-test-textarea-reason]', 'Rust and GoLang');
await click('.modal__submit');
});

test('modal is closed on click of close button', async function (assert) {
this.setProperties({
newStatus: 'ACTIVE',
Expand Down
69 changes: 69 additions & 0 deletions tests/integration/components/user-status-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
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', function (hooks) {
setupRenderingTest(hooks);

test('show relevant data when status changed to ONBOARDING', async function (assert) {
manish591 marked this conversation as resolved.
Show resolved Hide resolved
this.setProperties({
changeStatus: () => {},
updateStatus: () => {},
status: 'ONBOARDING',
isStatusUpdating: false,
});

await render(hbs`
<UserStatus
@status={{this.status}}
@changeStatus={{this.changeStatus}}
@isStatusUpdating={{this.isStatusUpdating}}
@updateStatus={{this.updateStatus}}
/>
`);

assert.dom('[data-test-onboarding-details]').exists();
assert.dom('[data-test-status]').hasText('You are undergoing onboarding');
});

test('show relevant data when status changed to IDLE', async function (assert) {
manish591 marked this conversation as resolved.
Show resolved Hide resolved
this.setProperties({
changeStatus: () => {},
updateStatus: () => {},
status: 'IDLE',
isStatusUpdating: false,
});

await render(hbs`
<UserStatus
@status={{this.status}}
@changeStatus={{this.changeStatus}}
@isStatusUpdating={{this.isStatusUpdating}}
@updateStatus={{this.updateStatus}}
/>
`);

assert.dom('[data-test-status]').hasText(`You are Idle`);
manish591 marked this conversation as resolved.
Show resolved Hide resolved
});

test('show relevant data when status changed to OOO', async function (assert) {
manish591 marked this conversation as resolved.
Show resolved Hide resolved
this.setProperties({
status: 'OOO',
isStatusUpdating: false,
changeStatus: () => {},
updateStatus: () => {},
});

await render(hbs`
<UserStatus
@status={{this.status}}
@changeStatus={{this.changeStatus}}
@isStatusUpdating={{this.isStatusUpdating}}
@updateStatus={{this.updateStatus}}
/>
`);

assert.dom('[data-test-status]').hasText(`You are OOO`);
heyrandhir marked this conversation as resolved.
Show resolved Hide resolved
});
});