Skip to content

Commit

Permalink
added feature flag in select option
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamsinghbundela committed Oct 30, 2023
1 parent 46c0e15 commit b03b29b
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 8 deletions.
28 changes: 21 additions & 7 deletions app/components/task/holder.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,27 @@
>
{{#each this.availabletaskStatusList as |taskStatus|}}
{{#if (not-eq taskStatus.key this.TASK_KEYS.ALL)}}
<option
data-test-dropdown-option={{taskStatus.displayLabel}}
value={{taskStatus.key}}
selected={{eq taskStatus.key this.status}}
>
{{taskStatus.displayLabel}}
</option>
{{#if @dev}}
{{#if (not-eq taskStatus.key this.TASK_KEYS.COMPLETED)}}
<option
data-test-dropdown-option={{taskStatus.displayLabel}}
value={{taskStatus.key}}
selected={{eq taskStatus.key this.status}}
>
{{taskStatus.displayLabel}}
</option>
{{/if}}
{{else}}
{{#if (not-eq taskStatus.key this.TASK_KEYS.DONE)}}
<option
data-test-dropdown-option={{taskStatus.displayLabel}}
value={{taskStatus.key}}
selected={{eq taskStatus.key this.status}}
>
{{taskStatus.displayLabel}}
</option>
{{/if}}
{{/if}}
{{/if}}
{{/each}}
</select>
Expand Down
39 changes: 38 additions & 1 deletion tests/integration/components/tasks/holder-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,41 @@ module('Integration | Component | Tasks Holder', function (hooks) {
@disabled={{this.disabled}}
/>`);

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

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

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

test('Verify values of task status upon api failures under feature flag', async function (assert) {
const testTask = tasksData[3];
testTask.status = TASK_KEYS.IN_PROGRESS;

this.set('task', testTask);
this.set('mock', () => {});
this.set('onTaskUpdate', (taskId, error) => {
error();
});
this.set('isLoading', false);
this.set('disabled', false);
this.set('defaultType', DEFAULT_TASK_TYPE);
this.set('dev', true);

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

assert
.dom('[data-test-task-status-select]')
.hasValue(TASK_KEYS.IN_PROGRESS);
Expand Down Expand Up @@ -243,12 +278,13 @@ module('Integration | Component | Tasks Holder', function (hooks) {
assert.equal(onTaskUpdateCalled, 1, 'onTaskUpdate should be called once');
});

test('Render Task holder and check whether it has select tag with option DONE', async function (assert) {
test('Render Task holder and check whether it has select tag with option DONE under feature flag', 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);
this.set('dev', true);

await render(hbs`<Task::Holder
@task={{this.task}}
Expand All @@ -258,6 +294,7 @@ module('Integration | Component | Tasks Holder', function (hooks) {
@isLoading={{this.isLoading}}
@userSelectedTask={{this.defaultType}}
@disabled={{this.disabled}}
@dev={{this.dev}}
/>`);

assert.dom('[data-test-task-status-select]').exists();
Expand Down

0 comments on commit b03b29b

Please sign in to comment.