Skip to content

Commit

Permalink
fix: Standardise case for email labels and flow name (#1115)
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr authored Aug 19, 2022
1 parent 575bf24 commit e4689de
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 26 deletions.
12 changes: 6 additions & 6 deletions api.planx.uk/saveAndReturn/resumeApplication.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe("buildContentFromSessions function", () => {
},
}];

const result = `Service: Apply For A Lawful Development Certificate
const result = `Service: Apply for a lawful development certificate
Address: 1 High Street
Project type: New office premises
Expiry Date: 29 May 2022
Expand Down Expand Up @@ -103,15 +103,15 @@ describe("buildContentFromSessions function", () => {
slug: "apply-for-a-lawful-development-certificate"
},
}];
const result = `Service: Apply For A Lawful Development Certificate
const result = `Service: Apply for a lawful development certificate
Address: 1 High Street
Project type: New office premises
Expiry Date: 29 May 2022
Link: example.com/team/apply-for-a-lawful-development-certificate/preview?sessionId=123\n\nService: Apply For A Lawful Development Certificate
Link: example.com/team/apply-for-a-lawful-development-certificate/preview?sessionId=123\n\nService: Apply for a lawful development certificate
Address: 2 High Street
Project type: New office premises
Expiry Date: 29 May 2022
Link: example.com/team/apply-for-a-lawful-development-certificate/preview?sessionId=456\n\nService: Apply For A Lawful Development Certificate
Link: example.com/team/apply-for-a-lawful-development-certificate/preview?sessionId=456\n\nService: Apply for a lawful development certificate
Address: 3 High Street
Project type: New office premises
Expiry Date: 29 May 2022
Expand All @@ -136,7 +136,7 @@ describe("buildContentFromSessions function", () => {
},
}];

const result = `Service: Apply For A Lawful Development Certificate
const result = `Service: Apply for a lawful development certificate
Address: Address not submitted
Project type: New office premises
Expiry Date: 29 May 2022
Expand All @@ -163,7 +163,7 @@ describe("buildContentFromSessions function", () => {
},
}];

const result = `Service: Apply For A Lawful Development Certificate
const result = `Service: Apply for a lawful development certificate
Address: 1 High Street
Project type: Project type not submitted
Expiry Date: 29 May 2022
Expand Down
5 changes: 1 addition & 4 deletions api.planx.uk/saveAndReturn/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ const sendEmail = async (template, emailAddress, config) => {
* @param {string} slug
* @returns {string}
*/
const convertSlugToName = (slug) => {
const capitalise = (word) => word[0].toUpperCase() + word.substring(1);
return slug.split("-").map(capitalise).join(" ");
};
const convertSlugToName = (slug) => slug[0].toUpperCase() + slug.substring(1).replaceAll("-", " ");

/**
* Build the magic link which will be sent to users via email to continue their application
Expand Down
2 changes: 1 addition & 1 deletion api.planx.uk/saveAndReturn/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { convertSlugToName, getResumeLink } = require("./utils");
describe("convertSlugToName util function", () => {
it("should return the correct value", () => {
const testData = [
["open-systems-lab", "Open Systems Lab"],
["open-systems-lab", "Open systems lab"],
["lambeth", "Lambeth"],
];

Expand Down
4 changes: 3 additions & 1 deletion editor.planx.uk/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ const useStyles = makeStyles((theme) => ({
alignItems: "center",
},
serviceTitle: {
textTransform: "capitalize",
fontSize: "1.25em",
fontWeight: 700,
paddingLeft: theme.spacing(2),
paddingBottom: theme.spacing(1),
"&::first-letter": {
textTransform: "capitalize",
},
},
}));

Expand Down
24 changes: 12 additions & 12 deletions editor.planx.uk/src/pages/Preview/SaveAndReturn.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ describe("Save and Return component", () => {

expect(getState().saveToEmail).toBeUndefined();

userEvent.type(screen.getByLabelText("Email Address"), "[email protected]");
userEvent.type(screen.getByLabelText("Email address"), "[email protected]");
userEvent.type(
screen.getByLabelText("Confirm Email Address"),
screen.getByLabelText("Confirm email address"),
"[email protected]"
);
userEvent.click(screen.getByTestId("continue-button"));
Expand Down Expand Up @@ -82,9 +82,9 @@ describe("Save and Return component", () => {
expect(sessionId).toBeDefined();
});

userEvent.type(screen.getByLabelText("Email Address"), "[email protected]");
userEvent.type(screen.getByLabelText("Email address"), "[email protected]");
userEvent.type(
screen.getByLabelText("Confirm Email Address"),
screen.getByLabelText("Confirm email address"),
"[email protected]"
);

Expand Down Expand Up @@ -124,11 +124,11 @@ describe("ConfirmEmail component", () => {
render(<ConfirmEmail handleSubmit={handleSubmit}></ConfirmEmail>);

userEvent.type(
screen.getByLabelText("Email Address"),
screen.getByLabelText("Email address"),
"[email protected]"
);
userEvent.type(
screen.getByLabelText("Confirm Email Address"),
screen.getByLabelText("Confirm email address"),
"[email protected]"
);
userEvent.click(screen.getByTestId("continue-button"));
Expand All @@ -147,8 +147,8 @@ describe("ConfirmEmail component", () => {

render(<ConfirmEmail handleSubmit={handleSubmit}></ConfirmEmail>);

const emailInput = screen.getByLabelText("Email Address");
const confirmEmailInput = screen.getByLabelText("Confirm Email Address");
const emailInput = screen.getByLabelText("Email address");
const confirmEmailInput = screen.getByLabelText("Confirm email address");

userEvent.type(emailInput, "not an email");
userEvent.type(confirmEmailInput, "not an email");
Expand All @@ -166,8 +166,8 @@ describe("ConfirmEmail component", () => {

render(<ConfirmEmail handleSubmit={handleSubmit}></ConfirmEmail>);

const emailInput = screen.getByLabelText("Email Address");
const confirmEmailInput = screen.getByLabelText("Confirm Email Address");
const emailInput = screen.getByLabelText("Email address");
const confirmEmailInput = screen.getByLabelText("Confirm email address");

expect(emailInput).toHaveValue("");
expect(confirmEmailInput).toHaveValue("");
Expand Down Expand Up @@ -217,11 +217,11 @@ describe("ConfirmEmail component", () => {
render(<ConfirmEmail handleSubmit={handleSubmit}></ConfirmEmail>);

userEvent.type(
screen.getByLabelText("Email Address"),
screen.getByLabelText("Email address"),
"[email protected]"
);
userEvent.type(
screen.getByLabelText("Confirm Email Address"),
screen.getByLabelText("Confirm email address"),
"[email protected]"
);
userEvent.click(screen.getByTestId("continue-button"));
Expand Down
4 changes: 2 additions & 2 deletions editor.planx.uk/src/pages/Preview/SaveAndReturn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const ConfirmEmail: React.FC<{
description="We will use this to save your application so you can come back to it later. We will also email you updates about your application."
></QuestionHeader>
<InputRow>
<InputLabel label={"Email Address"} htmlFor={"email"}>
<InputLabel label={"Email address"} htmlFor={"email"}>
<Input
bordered
errorMessage={
Expand All @@ -58,7 +58,7 @@ export const ConfirmEmail: React.FC<{
</InputLabel>
</InputRow>
<InputRow>
<InputLabel label={"Confirm Email Address"} htmlFor={"confirmEmail"}>
<InputLabel label={"Confirm email address"} htmlFor={"confirmEmail"}>
<Input
bordered
errorMessage={
Expand Down

0 comments on commit e4689de

Please sign in to comment.