Skip to content

Commit

Permalink
add links to email address and phone numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
fterra-encora committed Dec 16, 2024
1 parent 2314591 commit a8947d9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
20 changes: 15 additions & 5 deletions frontend/src/pages/client-details/LocationView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ const indexString = props.data.clientLocnCode;
</div>
<div :id="`location-${indexString}-email-section`" class="grouping-23" v-if="data.emailAddress">
<read-only-component label="Email address" :id="`location-${indexString}-emailAddress`">
<span class="body-compact-01">{{ data.emailAddress }}</span>
<a :href="`mailto:${data.emailAddress}`">
<span class="body-compact-01 colorless">{{ data.emailAddress }}</span>
</a>
</read-only-component>
</div>
<div
Expand All @@ -69,24 +71,32 @@ const indexString = props.data.clientLocnCode;
:id="`location-${indexString}-primaryPhoneNumber`"
v-if="data.businessPhone"
>
<span class="body-compact-01">{{ data.businessPhone }}</span>
<a :href="`tel:${data.businessPhone}`">
<span class="body-compact-01 colorless">{{ data.businessPhone }}</span>
</a>
</read-only-component>
<read-only-component
label="Secondary phone number"
:id="`location-${indexString}-secondaryPhoneNumber`"
v-if="data.cellPhone"
>
<span class="body-compact-01">{{ data.cellPhone }}</span>
<a :href="`tel:${data.cellPhone}`">
<span class="body-compact-01 colorless">{{ data.cellPhone }}</span>
</a>
</read-only-component>
<read-only-component label="Fax" :id="`location-${indexString}-fax`" v-if="data.faxNumber">
<span class="body-compact-01">{{ data.faxNumber }}</span>
<a :href="`tel:${data.faxNumber}`">
<span class="body-compact-01 colorless">{{ data.faxNumber }}</span>
</a>
</read-only-component>
<read-only-component
label="Other"
:id="`location-${indexString}-other`"
v-if="data.homePhone"
>
<span class="body-compact-01">{{ data.homePhone }}</span>
<a :href="`tel:${data.homePhone}`">
<span class="body-compact-01 colorless">{{ data.homePhone }}</span>
</a>
</read-only-component>
</div>
<div
Expand Down
22 changes: 16 additions & 6 deletions frontend/tests/components/pages/client-details/LocationView.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,16 @@ describe("<location-view />", () => {
.as("vueWrapper");
};

const testField = (selector: string, value: string) => {
const testField = (selector: string, value: string, linkPrefix?: string) => {
cy.get(selector).should("be.visible");
cy.get(selector).contains(value);
expect(value.length).to.be.greaterThan(0);

if (linkPrefix) {
cy.get(selector).within(() => {
cy.get("a").should("have.attr", "href", `${linkPrefix}${value}`);
});
}
};

const testFieldHidden = (selector: string) => {
Expand Down Expand Up @@ -67,15 +73,19 @@ describe("<location-view />", () => {
testField("#location-00-deliveryInformation", currentProps.data.addressThree);
});

const emailPrefix = "mailto:";

cy.get("#location-00-email-section").within(() => {
testField("#location-00-emailAddress", currentProps.data.emailAddress);
testField("#location-00-emailAddress", currentProps.data.emailAddress, emailPrefix);
});

const phonePrefix = "tel:";

cy.get("#location-00-phone-section").within(() => {
testField("#location-00-primaryPhoneNumber", currentProps.data.businessPhone);
testField("#location-00-secondaryPhoneNumber", currentProps.data.cellPhone);
testField("#location-00-fax", currentProps.data.faxNumber);
testField("#location-00-other", currentProps.data.homePhone);
testField("#location-00-primaryPhoneNumber", currentProps.data.businessPhone, phonePrefix);
testField("#location-00-secondaryPhoneNumber", currentProps.data.cellPhone, phonePrefix);
testField("#location-00-fax", currentProps.data.faxNumber, phonePrefix);
testField("#location-00-other", currentProps.data.homePhone, phonePrefix);
});

cy.get("#location-00-notes-section").within(() => {
Expand Down

0 comments on commit a8947d9

Please sign in to comment.