Skip to content

Commit

Permalink
Merge pull request #93 from turingschool/feat/company-info-linking
Browse files Browse the repository at this point in the history
Feat/company info linking
  • Loading branch information
dcardona23 authored Feb 11, 2025
2 parents b0684de + 8dca849 commit e0ae19d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ Key Functionalities Include:
- View All Contacts:
Browse a comprehensive list of contacts with info like their name, company, and notes. Includes a search bar and ability to create a new contact.
- View a Contact:
Click on a contact to see detail info on a dedicated page, such as their name, company, email address, phone number, notes and any other contacts associated with the company. Click on the other contacts to view their contact page. Click the contact's email address to open their mail client with an email to the contact.
Click on a contact to see detail info on a dedicated page, such as their name, company, email address, phone number, notes and any other contacts associated with the company. Click on the other contacts to view their contact page. Click the contact's email address to open their mail client with an email to the contact. Click on the company name to view company name details.
- Add a new Contact
Click on the Add New + button to navigate to a form where a user inputs a new contact and their associated information.
- Search for a Contact
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/LoginSpec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('testing for Login page', () => {
});

it('checks for the elements on the page', () => {
cy.get('.turing-logo').should('be.visible')
cy.get('.turing-logo').should('be.visible')
.get('.login-form-wrap > .form-inputs > form > h1').should('be.visible')
.get('.login-form-wrap > .form-inputs > form > h1').should('contain', 'Please login')

Expand Down
21 changes: 19 additions & 2 deletions cypress/e2e/ShowContactSpec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ describe("Show a single contact page", () => {
{
statusCode: 200,
body: {
company: {
data: {
attributes: {
name: "Google",
website: "https://google.com",
street_address: "1600 Amphitheatre Parkway",
city: "Mountain View",
state: "CA",
zip_code: "94043",
notes: "Innovative tech company.",
},
},
},
contacts: {
data: [
{
Expand Down Expand Up @@ -115,9 +128,13 @@ describe("Show a single contact page", () => {
cy.get('[data-testid="contact-name"]').should("have.text", "John Smith");
});

it("Should display the company's name", () => {
it("Should display the company's name and navigate to the company on click", () => {
cy.wait("@get-contact-details");
cy.get('[data-testid="company-name"]').should("have.text", "Future Designs LLC");
cy.get('[data-testid="company-name"]').should('have.text', 'Future Designs LLC');
cy.get('[data-testid="company-link"]').click();
cy.get("h2").contains("Company Name:")
.next().should("have.text", "Google");
cy.url().should('include', '/companies/1/contacts');
});

it("Should display the contact's email and phone number", () => {
Expand Down
5 changes: 3 additions & 2 deletions src/components/contacts/ShowContact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ function ShowContact() {
</h1>
<h2
data-testid="company-name"
className="text-[3.5vh] font-bold text-cyan-500 p-0"
className="text-[3.5vh] font-bold text-cyan-500 hover:text-cyan-700 p-0 hover:underline"
>
{contact.attributes.company
? contact.attributes.company.name
?
<Link data-testid="company-link" to={`/companies/${contact.attributes.company_id}/contacts`}>{contact.attributes.company.name}</Link>
: "No Affiliated Companies" }
</h2>
<div className="m-5">
Expand Down

0 comments on commit e0ae19d

Please sign in to comment.