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

311: Navigate to Document Detail page after creation #1240

Merged
merged 2 commits into from
Mar 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 2 additions & 7 deletions web-client/e2e/journey/petitionsClerkCreatesNewCase.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,8 @@ export default (test, fakeFile) => {
expect(test.getState('alertError')).toEqual(null);
expect(test.getState('validationErrors')).toEqual({});

// await test.runSequence('submitPetitionFromPaperSequence');

// expect(test.getState('alertError')).toEqual(null);
await test.runSequence('submitPetitionFromPaperSequence');

// expect(test.getState('alertSuccess')).toEqual({
// message: 'You can access your case at any time from the case list below.',
// title: 'Your petition has been successfully submitted.',
// });
expect(test.getState('currentPage')).toEqual('DocumentDetail');
});
};
19 changes: 19 additions & 0 deletions web-client/src/presenter/actions/setPetitionIdAction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import _ from 'lodash';

/**
* sets the docketNumber and petition documentId which is used for routing to the newly created case.
*
* @param {Object} providers the providers object
* @param {Object} providers.props the cerebral props object containing the props.caseDetail
*/
export const setPetitionIdAction = ({ props }) => {
const docketNumber = props.caseDetail.docketNumber;
const documentId = _.find(props.caseDetail.documents, {
documentType: 'Petition',
}).documentId;

return {
docketNumber,
documentId,
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ import { set } from 'cerebral/factories';
import { clearAlertsAction } from '../actions/clearAlertsAction';
import { computeFormDateAction } from '../actions/computeFormDateAction';
import { createCaseFromPaperAction } from '../actions/createCaseFromPaperAction';
import { getCreateCaseAlertSuccessAction } from '../actions/getCreateCaseAlertSuccessAction';
import { navigateToDashboardAction } from '../actions/navigateToDashboardAction';
import { setAlertErrorAction } from '../actions/setAlertErrorAction';
import { setAlertSuccessAction } from '../actions/setAlertSuccessAction';
import { setCaseAction } from '../actions/setCaseAction';
import { setFormSubmittingAction } from '../actions/setFormSubmittingAction';
import { setPetitionIdAction } from '../actions/setPetitionIdAction';
import { setValidationAlertErrorsAction } from '../actions/setValidationAlertErrorsAction';
import { setValidationErrorsAction } from '../actions/setValidationErrorsAction';
import { unsetFormSubmittingAction } from '../actions/unsetFormSubmittingAction';
import { validatePetitionFromPaperAction } from '../actions/validatePetitionFromPaperAction';
import { gotoDocumentDetailSequence } from '../sequences/gotoDocumentDetailSequence';

export const submitPetitionFromPaperSequence = [
clearAlertsAction,
Expand All @@ -32,10 +31,9 @@ export const submitPetitionFromPaperSequence = [
setFormSubmittingAction,
createCaseFromPaperAction,
setCaseAction,
getCreateCaseAlertSuccessAction,
setAlertSuccessAction,
setPetitionIdAction,
unsetFormSubmittingAction,
navigateToDashboardAction,
...gotoDocumentDetailSequence,
],
},
];