Skip to content

Commit

Permalink
chore: Add some test ids for use by cozy-contacts tests
Browse files Browse the repository at this point in the history
There wasn't any straightforward way to retrieve these elements.
  • Loading branch information
PolariTOON committed Feb 14, 2023
1 parent 903535f commit 9eb313a
Show file tree
Hide file tree
Showing 8 changed files with 816 additions and 798 deletions.
1 change: 1 addition & 0 deletions react/Avatar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const Avatar = ({
const IconToRender = Icon.isProperIcon(icon) ? <Icon icon={icon} /> : icon
return (
<div
data-testid="Avatar" // used by a test in cozy-contacts
className={cx(
styles['c-avatar'],
text ? styles['c-avatar--text'] : '',
Expand Down
5 changes: 4 additions & 1 deletion react/ContactsList/Contacts/ContactCozy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { TableCell } from '../../Table'
import styles from '../styles.styl'

const ContactCozy = ({ cozyUrl }) => (
<TableCell className={`${styles['contact-cozyurl']} u-ellipsis`}>
<TableCell
data-testid="ContactCozy" // used by a test in cozy-contacts
className={`${styles['contact-cozyurl']} u-ellipsis`}
>
{cozyUrl}
</TableCell>
)
Expand Down
5 changes: 4 additions & 1 deletion react/ContactsList/Contacts/ContactEmail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { TableCell } from '../../Table'
import styles from '../styles.styl'

const ContactEmail = ({ email }) => (
<TableCell className={`${styles['contact-email']} u-ellipsis`}>
<TableCell
data-testid="ContactEmail" // used by a test in cozy-contacts
className={`${styles['contact-email']} u-ellipsis`}
>
{email}
</TableCell>
)
Expand Down
1 change: 1 addition & 0 deletions react/ContactsList/Contacts/ContactIdentity.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const ContactIdentity = ({ contact }) => {

return (
<TableCell
data-testid="ContactIdentity" // used by a test in cozy-contacts
className={`${
styles['contact-identity']
} u-flex u-flex-items-center u-ellipsis`}
Expand Down
1 change: 1 addition & 0 deletions react/ContactsList/Contacts/ContactName.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const ContactName = ({ displayName, familyName }) => {

return (
<Typography
data-testid="ContactName" // used by a test in cozy-contacts
className="u-ml-1"
variant="body1"
noWrap
Expand Down
5 changes: 4 additions & 1 deletion react/ContactsList/Contacts/ContactPhone.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { TableCell } from '../../Table'
import styles from '../styles.styl'

const ContactPhone = ({ phone }) => (
<TableCell className={`${styles['contact-phone']} u-ellipsis`}>
<TableCell
data-testid="ContactPhone" // used by a test in cozy-contacts
className={`${styles['contact-phone']} u-ellipsis`}
>
{phone}
</TableCell>
)
Expand Down
6 changes: 6 additions & 0 deletions react/ContactsList/__snapshots__/ContactRow.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ exports[`ContactRow should match the contact snapshot 1`] = `
>
<div
className="styles__TableCell___yJCq7 styles__contact-identity___mL3IJ u-flex u-flex-items-center u-ellipsis"
data-testid="ContactIdentity"
>
<div
className="styles__c-avatar___PpDI- styles__c-avatar--text___2dvna"
data-testid="Avatar"
style={
Object {
"--circleSize": "32px",
Expand All @@ -28,6 +30,7 @@ exports[`ContactRow should match the contact snapshot 1`] = `
</div>
<p
className="MuiTypography-root u-ml-1 MuiTypography-body1 MuiTypography-colorTextPrimary MuiTypography-noWrap MuiTypography-gutterBottom MuiTypography-displayInline"
data-testid="ContactName"
>
<span
className=""
Expand All @@ -45,16 +48,19 @@ exports[`ContactRow should match the contact snapshot 1`] = `
</div>
<div
className="styles__TableCell___yJCq7 styles__contact-email___3n3q2 u-ellipsis"
data-testid="ContactEmail"
>
johndoe@localhost
</div>
<div
className="styles__TableCell___yJCq7 styles__contact-phone___1sA_m u-ellipsis"
data-testid="ContactPhone"
>
0123456789
</div>
<div
className="styles__TableCell___yJCq7 styles__contact-cozyurl___3kBp5 u-ellipsis"
data-testid="ContactCozy"
>
http://johndoe.mycozy.cloud
</div>
Expand Down
1,590 changes: 795 additions & 795 deletions react/__snapshots__/examples.spec.jsx.snap

Large diffs are not rendered by default.

0 comments on commit 9eb313a

Please sign in to comment.