From 56bda08a4c853c98aa946b74e99101c85c122444 Mon Sep 17 00:00:00 2001 From: Chandra Reddy <77037622+chandrareddy7@users.noreply.github.com> Date: Sun, 8 Oct 2023 11:06:10 +0530 Subject: [PATCH 01/18] Adding UNASSIGNED and DONE to task status options --- app/components/task/holder.hbs | 25 ++- app/constants/tasks.js | 15 ++ .../components/tasks/holder-test.js | 142 +++++++++++++++++- 3 files changed, 175 insertions(+), 7 deletions(-) diff --git a/app/components/task/holder.hbs b/app/components/task/holder.hbs index 3fd9d2f5..9677b690 100644 --- a/app/components/task/holder.hbs +++ b/app/components/task/holder.hbs @@ -32,12 +32,25 @@ > {{#each this.availabletaskStatusList as |taskStatus|}} {{#if (not-eq taskStatus.key this.TASK_KEYS.ALL)}} - + {{#if @dev}} + {{#if (not (or (eq taskStatus.key this.TASK_KEYS.AVAILABLE) (eq taskStatus.key this.TASK_KEYS.COMPLETED)))}} + + {{/if}} + {{else}} + {{#if (not (or (eq taskStatus.key this.TASK_KEYS.UNASSIGNED) (eq taskStatus.key this.TASK_KEYS.DONE)))}} + + {{/if}} + {{/if}} {{/if}} {{/each}} diff --git a/app/constants/tasks.js b/app/constants/tasks.js index 3947ee71..450c4dfe 100644 --- a/app/constants/tasks.js +++ b/app/constants/tasks.js @@ -2,6 +2,7 @@ const TASK_KEYS = { ALL: 'ALL', AVAILABLE: 'AVAILABLE', ASSIGNED: 'ASSIGNED', + UNASSIGNED: 'UNASSIGNED', IN_PROGRESS: 'IN_PROGRESS', BLOCKED: 'BLOCKED', SMOKE_TESTING: 'SMOKE_TESTING', @@ -14,16 +15,19 @@ const TASK_KEYS = { REGRESSION_CHECK: 'REGRESSION_CHECK', RELEASED: 'RELEASED', VERIFIED: 'VERIFIED', + DONE: 'DONE', }; const { ALL, AVAILABLE, ASSIGNED, + UNASSIGNED, IN_PROGRESS, BLOCKED, SMOKE_TESTING, COMPLETED, + DONE, NEEDS_REVIEW, IN_REVIEW, APPROVED, @@ -47,6 +51,10 @@ const TASK_STATUS_LIST = [ displayLabel: 'Assigned', key: ASSIGNED, }, + { + displayLabel: 'Unassigned', + key: UNASSIGNED, + }, { displayLabel: 'In Progress', key: IN_PROGRESS, @@ -63,6 +71,10 @@ const TASK_STATUS_LIST = [ displayLabel: 'Completed', key: COMPLETED, }, + { + displayLabel: 'Done', + key: DONE, + }, { displayLabel: 'Needs Review', key: NEEDS_REVIEW, @@ -143,3 +155,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 = { UNASSIGNED: 'UNASSIGNED', DONE: 'DONE' }; diff --git a/tests/integration/components/tasks/holder-test.js b/tests/integration/components/tasks/holder-test.js index 77ad27c0..5fa7b338 100644 --- a/tests/integration/components/tasks/holder-test.js +++ b/tests/integration/components/tasks/holder-test.js @@ -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'; @@ -242,4 +247,139 @@ module('Integration | Component | Tasks Holder', function (hooks) { assert.equal(onTaskUpdateCalled, 1, 'onTaskUpdate should be called once'); }); + + test('Check if UNASSIGNED and DONE is not in task status options 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``); + + await waitUntil(() => find('[data-test-task-status-select]')); + + 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 UNASSIGNED and DONE is in task status options 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``); + + await waitUntil(() => find('[data-test-task-status-select]')); + + 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 UNASSIGNED 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``); + + assert + .dom('[data-test-task-status-select]') + .hasValue(TASK_KEYS.IN_PROGRESS); + + await select('[data-test-task-status-select]', TASK_KEYS.UNASSIGNED); + + assert.equal(onTaskUpdateCalled, 1, 'onTaskUpdate should be called once'); + }); + + 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``); + + 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'); + }); }); From 70971c6720a6ed9211f4c42ea7cd46343be14fc9 Mon Sep 17 00:00:00 2001 From: Chandra Reddy <77037622+chandrareddy7@users.noreply.github.com> Date: Sun, 8 Oct 2023 12:15:37 +0530 Subject: [PATCH 02/18] Updating test name --- tests/integration/components/tasks/holder-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/components/tasks/holder-test.js b/tests/integration/components/tasks/holder-test.js index 5fa7b338..30aaa86e 100644 --- a/tests/integration/components/tasks/holder-test.js +++ b/tests/integration/components/tasks/holder-test.js @@ -248,7 +248,7 @@ module('Integration | Component | Tasks Holder', function (hooks) { assert.equal(onTaskUpdateCalled, 1, 'onTaskUpdate should be called once'); }); - test('Check if UNASSIGNED and DONE is not in task status options when dev is false', async function (assert) { + 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); @@ -281,7 +281,7 @@ module('Integration | Component | Tasks Holder', function (hooks) { } }); - test('Check if UNASSIGNED and DONE is in task status options when dev is true', async function (assert) { + 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); From cad584e31cf885f87fce00a4b814e192c119042d Mon Sep 17 00:00:00 2001 From: Chandra Reddy <77037622+chandrareddy7@users.noreply.github.com> Date: Sun, 8 Oct 2023 17:23:18 +0530 Subject: [PATCH 03/18] Removing UNASSIGNED status from task status options --- app/components/task/holder.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/task/holder.hbs b/app/components/task/holder.hbs index 9677b690..bf43872c 100644 --- a/app/components/task/holder.hbs +++ b/app/components/task/holder.hbs @@ -33,7 +33,7 @@ {{#each this.availabletaskStatusList as |taskStatus|}} {{#if (not-eq taskStatus.key this.TASK_KEYS.ALL)}} {{#if @dev}} - {{#if (not (or (eq taskStatus.key this.TASK_KEYS.AVAILABLE) (eq taskStatus.key this.TASK_KEYS.COMPLETED)))}} + {{#if (not (or (eq taskStatus.key this.TASK_KEYS.AVAILABLE) (eq taskStatus.key this.TASK_KEYS.COMPLETED) (eq taskStatus.key this.TASK_KEYS.UNASSIGNED)))}}