Skip to content

Commit

Permalink
Changed RESET and RE-OPEN workflow based on role. (#1223)
Browse files Browse the repository at this point in the history
  • Loading branch information
katiemcgoff authored and thorwolpert committed Feb 1, 2019
1 parent 2a5f53a commit 03a7a35
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 7 deletions.
45 changes: 40 additions & 5 deletions client/src/components/application/Examine/CompName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -411,19 +411,54 @@
this.$store.commit('currentCondition', null);
},
reOpen() {
// set current state to DRAFT
this.$store.commit('currentState', 'DRAFT');
/* Workflow:
If EXAMINER:
- move to INPROGRESS
If EDITOR (ADMIN):
- move to INPROGRESS with edit screen open
- upon save/cancel, move to DRAFT
*/
if (this.userIsAnExaminer) {
this.$store.commit('currentState', 'INPROGRESS');
}
else {
this.$store.commit('currentState', 'INPROGRESS');

// initialize user in edit mode, with previous state set so NR gets set back to draft
// when user is done changing name, adding comment, etc.
this.$store.state.previousStateCd = 'DRAFT';
this.$store.state.is_editing = true;
}

// set reset flag so name data is managed between Namex and NRO correctly
this.$store.commit('hasBeenReset', true);

// update request in database
this.$store.dispatch('updateRequest');
},
reset() {
// set current state to DRAFT and clear furnished flag
this.$store.commit('currentState', 'DRAFT');
/* Workflow:
If EXAMINER:
- move to INPROGRESS
If EDITOR (ADMIN):
- move to INPROGRESS with edit screen open
- upon save/cancel, move to DRAFT
*/
if (this.userIsAnExaminer) {
this.$store.commit('currentState', 'INPROGRESS');
}
else {
this.$store.commit('currentState', 'INPROGRESS');

// initialize user in edit mode, with previous state set so NR gets set back to draft
// when user is done changing name, adding comment, etc.
this.$store.state.previousStateCd = 'DRAFT';
this.$store.state.is_editing = true;
}

this.$store.commit('furnished', 'N');

// update request in database
// update request in database and NRO
this.$store.dispatch('updateRequest');
},
claimNR() {
Expand Down
41 changes: 39 additions & 2 deletions client/test/unit/specs/CompName.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ describe('CompName.vue', () => {
click('#examine-reset-button');

setTimeout(() => {
expect(instance.$store.state.currentState).toEqual("DRAFT");
expect(instance.$store.state.currentState).toEqual("INPROGRESS");
}, 10)
});

Expand All @@ -620,6 +620,24 @@ describe('CompName.vue', () => {
}, 10);
});

describe('For Editors', () => {
beforeEach((done) => {
sessionStorage.setItem('USER_ROLES', ['names_editor']);
vm.$store.commit('setLoginValues');
setTimeout(() => {
done();
}, 100)
});

it('NR is opened to edit screen', () => {
click('#examine-reset-button');

setTimeout(() => {
expect(instance.$store.state.is_editing).toEqual(true);
}, 10);

});
});
}); // end RESET

describe('Re-Open', ()=> {
Expand All @@ -637,7 +655,7 @@ describe('CompName.vue', () => {
click('#examine-re-open-button');

setTimeout(() => {
expect(instance.$store.state.currentState).toEqual("DRAFT");
expect(instance.$store.state.currentState).toEqual("INPROGRESS");
}, 10)
});

Expand All @@ -653,6 +671,25 @@ describe('CompName.vue', () => {
}, 10);
});

describe('For Editors', () => {
beforeEach((done) => {
sessionStorage.setItem('USER_ROLES', ['names_editor']);
vm.$store.commit('setLoginValues');
setTimeout(() => {
done();
}, 100)
});

it('NR is opened to edit screen', () => {
click('#examine-re-open-button');

setTimeout(() => {
expect(instance.$store.state.is_editing).toEqual(true);
}, 10);

});
});

}); // end RE-OPEN
});

Expand Down

0 comments on commit 03a7a35

Please sign in to comment.