-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PLAY-194] Contact Kit Update: Extension Variant (#1966)
* Contact Kit Extension Variant * Implement Contact Kit Jest Tests * Update test with new contact type * Return extension data without storing in variable Co-authored-by: Stephen Marshall <smarshall1980@gmail.com> * Adjust formatted contact value control flow * Remove Raise Parameter Co-authored-by: Stephen Marshall <smarshall1980@gmail.com>
- Loading branch information
1 parent
6a3f653
commit eb5349c
Showing
6 changed files
with
111 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import React from 'react' | ||
import { render, screen } from '../utilities/test-utils' | ||
import Contact from './_contact' | ||
|
||
test('returns namespaced class name', () => { | ||
render( | ||
<Contact | ||
contactDetail="Cell" | ||
contactType="cell" | ||
contactValue="349-185-9988" | ||
data={{ testid: 'class-name-test' }} | ||
/> | ||
) | ||
|
||
const kit = screen.getByTestId('class-name-test') | ||
expect(kit).toHaveClass('pb_contact_kit') | ||
}) | ||
|
||
test('returns correct icon', () => { | ||
render( | ||
<> | ||
<Contact | ||
contactDetail="Cell" | ||
contactType="cell" | ||
contactValue="349-185-9988" | ||
data={{ testid: 'test-cell' }} | ||
/> | ||
<Contact | ||
contactDetail="Home" | ||
contactValue="5555555555" | ||
data={{ testid: 'test-home' }} | ||
/> | ||
<Contact | ||
contactDetail="Work" | ||
contactType="work" | ||
contactValue="3245627482" | ||
data={{ testid: 'test-work' }} | ||
/> | ||
<Contact | ||
contactDetail="Work-Cell" | ||
contactType="work-cell" | ||
contactValue="3245627482" | ||
data={{ testid: 'test-work-cell' }} | ||
/> | ||
<Contact | ||
contactDetail="Email" | ||
contactType="email" | ||
contactValue="your.email@powerhrg.com" | ||
data={{ testid: 'test-email' }} | ||
/> | ||
<Contact | ||
contactDetail="Wrong-Phone" | ||
contactType="wrong-phone" | ||
contactValue="3245627482" | ||
data={{ testid: 'test-wrong-phone' }} | ||
/> | ||
<Contact | ||
contactDetail="Wrong-Type" | ||
contactType="wrong-type" | ||
contactValue="3245627482" | ||
data={{ testid: 'test-wrong-type' }} | ||
/> | ||
<Contact | ||
contactDetail="Ext" | ||
contactType='extension' | ||
contactValue="1234" | ||
data={{ testid: 'test-extension' }} | ||
/> | ||
<Contact | ||
contactDetail="" | ||
contactType="" | ||
contactValue="3245627482" | ||
data={{ testid: 'test-empty' }} | ||
/> | ||
</> | ||
) | ||
|
||
expect(screen.getByTestId('test-cell').querySelector('.pb_icon_kit')).toHaveClass('fa-mobile') | ||
expect(screen.getByTestId('test-home').querySelector('.pb_icon_kit')).toHaveClass('fa-phone') | ||
expect(screen.getByTestId('test-work').querySelector('.pb_icon_kit')).toHaveClass('fa-phone-office') | ||
expect(screen.getByTestId('test-work-cell').querySelector('.pb_icon_kit')).toHaveClass('fa-phone-laptop') | ||
expect(screen.getByTestId('test-email').querySelector('.pb_icon_kit')).toHaveClass('fa-envelope') | ||
expect(screen.getByTestId('test-wrong-phone').querySelector('.pb_icon_kit')).toHaveClass('fa-phone-slash') | ||
expect(screen.getByTestId('test-wrong-type').querySelector('.pb_icon_kit')).toHaveClass('fa-phone') | ||
expect(screen.getByTestId('test-extension').querySelector('.pb_icon_kit')).toHaveClass('fa-phone-plus') | ||
expect(screen.getByTestId('test-empty').querySelector('.pb_icon_kit')).toHaveClass('fa-phone') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters