Skip to content

Commit

Permalink
Test coverage and small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfalgout committed Nov 21, 2024
1 parent 88a5086 commit f584689
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/js/apps/forms/form/form_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export default App.extend({

this.listenTo(sidebarApp, 'close', () => {
sidebarApp.stop();
if (this.getState('isExpanded')) return;

this.setState('isActionSidebar', false);
});
},
Expand Down
1 change: 1 addition & 0 deletions src/js/apps/globals/app-frame_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default App.extend({
this.initFormsApp(FormsApp);

new Promise(resolve => {
/* istanbul ignore next: Branch only for testing */
_TEST_ ? resolve() : defer(resolve);
}).then(() => {
Backbone.history.loadUrl();
Expand Down
3 changes: 2 additions & 1 deletion src/js/apps/patients/patient/patient_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export default SubRouterApp.extend({
];
},

/* istanbul ignore next: error handling */
onFail({ currentRoute: { eventArgs: [patientId] } }, { response = {}, responseData = {} }) {
/* istanbul ignore else: other error scenarios handled elsewhere */
if (response.status === 410) {
if (!some(responseData.errors, error => {
return get(error, ['source', 'parameter']) === 'actionId';
Expand Down Expand Up @@ -80,6 +80,7 @@ export default SubRouterApp.extend({

onStop() {
delete this._list;
delete this.action;
},

startList(list) {
Expand Down
10 changes: 0 additions & 10 deletions src/js/apps/programs/program/program_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ export default SubRouterApp.extend({

this.showSidebar();

// Show/Empty program sidebar based on app sidebar
this.listenTo(Radio.channel('sidebar'), {
'show': this.emptySidebar,
'close': this.showSidebar,
});

this.startRoute(currentRoute);

this.showView();
Expand Down Expand Up @@ -118,10 +112,6 @@ export default SubRouterApp.extend({
this.showChildView('sidebar', sidebarView);
},

emptySidebar() {
this.getRegion('sidebar').empty();
},

onEdit() {
const programSidebar = this.getChildApp('programSidebar');
Radio.request('sidebar', 'start', programSidebar, { program: this.program });
Expand Down
2 changes: 1 addition & 1 deletion src/js/views/globals/sidebar/sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
<div class="flex">
<span data-menu-region></span>
<button class="button--icon js-close">{{fas "xmark"}}</button>
<button class="u-margin--l-8 button--icon js-close">{{fas "xmark"}}</button>
</div>
</div>
<div class="u-margin--t-16" data-content-region></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'scss/domain/patient-sidebar.scss';
import './patient-sidebar.scss';

const sidebarOptions = {
className: 'worklist-patient-sidebar flex',
className: 'worklist-patient-sidebar flex-region',
};

const SidebarWidgetsView = WidgetCollectionView.extend({
Expand Down
14 changes: 13 additions & 1 deletion test/integration/patients/patient/patient-flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,14 @@ context('patient flow page', function() {
.find('.js-select')
.click();

cy
.get('@firstRow')
.should('not.have.class', 'is-selected');

cy
.get('@firstRow')
.find('.js-select')
.click();

cy
.routeAction(fx => {
Expand Down Expand Up @@ -1593,7 +1601,7 @@ context('patient flow page', function() {

cy
.get('@firstRow')
.should('not.have.class', 'is-selected');
.should('have.class', 'is-selected');

cy
.get('[data-header-region]')
Expand Down Expand Up @@ -1624,6 +1632,10 @@ context('patient flow page', function() {
.find('.js-bulk-edit')
.should('not.exist');

cy
.get('@firstRow')
.should('not.have.class', 'is-selected');

cy
.get('[data-header-region]')
.find('[data-state-region]')
Expand Down
9 changes: 9 additions & 0 deletions test/integration/patients/sidebar/action-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,15 @@ context('action sidebar', function() {
.should('contain', 'Due Time cleared')
.should('contain', 'Form shared with Test Patient. Waiting for response.')
.should('contain', 'Form sharing (Nurse) cancelled');

cy
.get('.sidebar')
.find('.js-close')
.click();

cy
.get('.sidebar')
.should('not.exist');
});

specify('action attachments', function() {
Expand Down
20 changes: 20 additions & 0 deletions test/integration/patients/worklist/reduced-schedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,26 @@ context('reduced schedule page', function() {
.find('.schedule-list__day-list-row .js-select')
.should('not.exist');

cy
.get('@scheduleList')
.find('.schedule-list__list-row')
.first()
.find('.js-patient-sidebar-button')
.click()
.wait('@routePatient');

cy
.get('.worklist-patient-sidebar')
.should('contain', 'First Last');

cy
.get('.worklist-patient-sidebar .js-close')
.click();

cy
.get('.worklist-patient-sidebar')
.should('not.exist');

cy
.get('@scheduleList')
.find('.schedule-list__list-row')
Expand Down
14 changes: 11 additions & 3 deletions test/integration/patients/worklist/schedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ context('schedule page', function() {
},
},
{
id: '3',
attributes: {
name: 'Second Action',
details: null,
Expand All @@ -86,10 +87,12 @@ context('schedule page', function() {
relationships: {
patient: getRelationship(testPatient1),
form: getRelationship(),
flow: getRelationship(testFlow),
state: getRelationship(stateInProgress),
},
},
{
id: '4',
attributes: {
name: 'Third Action',
due_date: testDate(),
Expand All @@ -98,8 +101,7 @@ context('schedule page', function() {
relationships: {
patient: getRelationship(testPatient1),
form: getRelationship(),
flow: getRelationship(testFlow),
state: getRelationship(stateInProgress),
state: getRelationship(stateDone),
},
},
];
Expand Down Expand Up @@ -215,7 +217,13 @@ context('schedule page', function() {
.find('tr')
.eq(2)
.should('contain', '2:00 PM')
.should('contain', 'Third Action');
.should('contain', 'Third Action')
.click();

cy
.url()
.should('contain', 'patient/archive/1/action/4')
.go('back');

cy
.get('@actionList')
Expand Down

0 comments on commit f584689

Please sign in to comment.