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

Adding DONE to task status options #499

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
56bda08
Adding UNASSIGNED and DONE to task status options
chandrareddy7 Oct 8, 2023
70971c6
Updating test name
chandrareddy7 Oct 8, 2023
cad584e
Removing UNASSIGNED status from task status options
chandrareddy7 Oct 8, 2023
53d935f
Updating tests in holder-test file
chandrareddy7 Oct 8, 2023
afd9f37
Updating tests in holder-test file
chandrareddy7 Oct 8, 2023
d25e635
Adding test to check if AVAILABLE is not displayed when dev is true
chandrareddy7 Oct 8, 2023
51d7cad
cancel OOO button enabled (#500)
PeeyushPrashant Oct 13, 2023
9d2c982
Feat/allow multiple extension requests (#496)
MayurLund Oct 14, 2023
0d93af1
Extension request should show reviewer's log if the request has been …
joyguptaa Oct 18, 2023
a6c862f
Adding UNASSIGNED and DONE to task status options
chandrareddy7 Oct 8, 2023
e31c3ea
Updating test name
chandrareddy7 Oct 8, 2023
f620715
Removing UNASSIGNED status from task status options
chandrareddy7 Oct 8, 2023
e82b4a2
Updating tests in holder-test file
chandrareddy7 Oct 8, 2023
67d6573
Updating tests in holder-test file
chandrareddy7 Oct 8, 2023
b116a97
Adding test to check if AVAILABLE is not displayed when dev is true
chandrareddy7 Oct 8, 2023
1d94049
Adding new task status DONE to task status options
chandrareddy7 Oct 26, 2023
f24d0e0
Merge branch 'Add-UNASSIGNED-and-DONE-in-task-status-options' of http…
chandrareddy7 Oct 26, 2023
202bfcc
Update holder-test.js
chandrareddy7 Oct 26, 2023
d84b4cc
Modifying task constants
chandrareddy7 Oct 27, 2023
2a94838
Merge branch 'Add-UNASSIGNED-and-DONE-in-task-status-options' of http…
chandrareddy7 Oct 27, 2023
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
25 changes: 19 additions & 6 deletions app/components/task/holder.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,25 @@
>
{{#each this.availabletaskStatusList as |taskStatus|}}
{{#if (not-eq taskStatus.key this.TASK_KEYS.ALL)}}
<option
value={{taskStatus.key}}
selected={{eq taskStatus.key this.status}}
>
{{taskStatus.displayLabel}}
</option>
{{#if @dev}}
{{#if (not (or (eq taskStatus.key this.TASK_KEYS.AVAILABLE) (eq taskStatus.key this.TASK_KEYS.COMPLETED)))}}
<option
value={{taskStatus.key}}
selected={{eq taskStatus.key this.status}}
>
{{taskStatus.displayLabel}}
</option>
{{/if}}
Comment on lines +44 to +52
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding conditions inside a loop to populate the task status, can we just have two separate availableTaskStatusList?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You meant to maintain two seperate lists in the constants file itself?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Something like that where we don't have to write extra logic to maintain the old flow.

{{else}}
{{#if (not (or (eq taskStatus.key this.TASK_KEYS.DONE)))}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add new logic under the old flow, won't it defeat the purpose of adding a feature flag?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have added new task status to constants file. So have to do this.
Can we do it in any other way?

<option
value={{taskStatus.key}}
selected={{eq taskStatus.key this.status}}
>
{{taskStatus.displayLabel}}
</option>
{{/if}}
{{/if}}
{{/if}}
{{/each}}
</select>
Expand Down
9 changes: 9 additions & 0 deletions app/constants/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const TASK_KEYS = {
REGRESSION_CHECK: 'REGRESSION_CHECK',
RELEASED: 'RELEASED',
VERIFIED: 'VERIFIED',
DONE: 'DONE',
};

const {
Expand All @@ -24,6 +25,7 @@ const {
BLOCKED,
SMOKE_TESTING,
COMPLETED,
DONE,
NEEDS_REVIEW,
IN_REVIEW,
APPROVED,
Expand Down Expand Up @@ -63,6 +65,10 @@ const TASK_STATUS_LIST = [
displayLabel: 'Completed',
key: COMPLETED,
},
{
displayLabel: 'Done',
key: DONE,
},
{
displayLabel: 'Needs Review',
key: NEEDS_REVIEW,
Expand Down Expand Up @@ -143,3 +149,6 @@ export const TASK_PERCENTAGE = {
};

export { TASK_KEYS, TASK_STATUS_LIST, TABS_TASK_STATUS_LIST };

export const oldTaskStatus = { AVAILABLE: 'AVAILABLE', COMPLETED: 'COMPLETED' };
export const newTaskStatus = { DONE: 'DONE' };
133 changes: 132 additions & 1 deletion tests/integration/components/tasks/holder-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { tasks, overDueTask } from 'website-my/tests/fixtures/tasks';
import { TASK_KEYS, TASK_STATUS_LIST } from 'website-my/constants/tasks';
import {
TASK_KEYS,
TASK_STATUS_LIST,
oldTaskStatus,
newTaskStatus,
} from 'website-my/constants/tasks';
import { find, render, waitUntil, fillIn, select } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

Expand Down Expand Up @@ -242,4 +247,130 @@ module('Integration | Component | Tasks Holder', function (hooks) {

assert.equal(onTaskUpdateCalled, 1, 'onTaskUpdate should be called once');
});

test('Check if AVAILABLE is not displayed when dev is true', async function (assert) {
this.set('task', tasksData[3]);
this.set('mock', () => {});
this.set('isLoading', false);
this.set('disabled', false);
this.set('defaultType', DEFAULT_TASK_TYPE);

await render(hbs`<Task::Holder
@task={{this.task}}
@onTaskChange={{this.mock}}
@onStausChange={{this.mock}}
@onTaskUpdate={{this.mock}}
@isLoading={{this.isLoading}}
@userSelectedTask={{this.defaultType}}
@disabled={{this.disabled}}
@dev={{true}}
/>`);

const taskStatusList = this.element.querySelector(
'[data-test-task-status-select]'
);

const displayedTaskStatus = [];
for (let i = 0; i < taskStatusList.options.length; i++) {
displayedTaskStatus.push(taskStatusList.options[i].value);
}
assert.ok(!displayedTaskStatus.includes('AVAILABLE'));
});

test('Check if old task status options are displayed when dev is false', async function (assert) {
this.set('task', tasksData[3]);
this.set('mock', () => {});
this.set('isLoading', false);
this.set('disabled', false);
this.set('defaultType', DEFAULT_TASK_TYPE);

await render(hbs`<Task::Holder
@task={{this.task}}
@onTaskChange={{this.mock}}
@onStausChange={{this.mock}}
@onTaskUpdate={{this.mock}}
@isLoading={{this.isLoading}}
@userSelectedTask={{this.defaultType}}
@disabled={{this.disabled}}
/>`);

const taskStatusList = this.element.querySelector(
'[data-test-task-status-select]'
);

const updatedTaskKeys = Object.keys(TASK_KEYS).filter(
(key) => !(key in newTaskStatus)
);

for (let i = 0; i < taskStatusList.options.length; i++) {
const optionValue = taskStatusList.options[i].value;
assert.ok(updatedTaskKeys.includes(optionValue));
}
});

test('Check if new task status options are displayed when dev is true', async function (assert) {
this.set('task', tasksData[3]);
this.set('mock', () => {});
this.set('isLoading', false);
this.set('disabled', false);
this.set('defaultType', DEFAULT_TASK_TYPE);

await render(hbs`<Task::Holder
@task={{this.task}}
@onTaskChange={{this.mock}}
@onStausChange={{this.mock}}
@onTaskUpdate={{this.mock}}
@isLoading={{this.isLoading}}
@userSelectedTask={{this.defaultType}}
@disabled={{this.disabled}}
@dev={{true}}
/>`);

const taskStatusList = this.element.querySelector(
'[data-test-task-status-select]'
);

const updatedTaskKeys = Object.keys(TASK_KEYS).filter(
(key) => !(key in oldTaskStatus)
);

for (let i = 0; i < taskStatusList.options.length; i++) {
const optionValue = taskStatusList.options[i].value;
assert.ok(updatedTaskKeys.includes(optionValue));
}
});

test('Verify task status update to DONE when dev is true', async function (assert) {
const testTask = tasksData[3];

testTask.status = TASK_KEYS.IN_PROGRESS;

let onTaskUpdateCalled = 0;

this.set('task', testTask);
this.set('onTaskUpdate', () => {
onTaskUpdateCalled++;
});
this.set('mock', () => {});
this.set('isLoading', false);
this.set('disabled', false);
this.set('defaultType', DEFAULT_TASK_TYPE);

await render(hbs`<Task::Holder
@task={{this.task}}
@onTaskUpdate={{onTaskUpdate}}
@onTaskChange={{this.mock}}
@userSelectedTask={{this.defaultType}}
@disabled={{this.disabled}}
@dev={{true}}
/>`);

assert
.dom('[data-test-task-status-select]')
.hasValue(TASK_KEYS.IN_PROGRESS);

await select('[data-test-task-status-select]', TASK_KEYS.DONE);

assert.equal(onTaskUpdateCalled, 1, 'onTaskUpdate should be called once');
});
});
Loading