Skip to content

Commit

Permalink
chore: enhance resource address visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
pfferrari committed Jan 14, 2025
1 parent ef4f045 commit b19b217
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const presetAddresses = {
withNotes: {
type: 'addresses',
id: 'ccZYuDJVXW',
company: '',
company: 'Rebellion',
first_name: 'Luke',
last_name: 'Skywalker',
full_name: 'Luke Skywalker',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,18 @@ describe('ResourceAddress', () => {
expect(queryByTestId('ResourceAddress-noAddress')).not.toBeInTheDocument()
})

test('Should render fullName', async () => {
test('Should render firstLastName', async () => {
const { getByTestId } = setup()
expect(getByTestId('ResourceAddress-fullName')).toContainHTML(
expect(getByTestId('ResourceAddress-firstLastName')).toContainHTML(
'Luke Skywalker'
)
})

test('Should render company', async () => {
const { getByTestId } = setup()
expect(getByTestId('ResourceAddress-company')).toContainHTML('Rebellion')
})

test('Should render address', async () => {
const { getByTestId } = setup()
expect(getByTestId('ResourceAddress-address')).toContainHTML(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,27 @@ export const ResourceAddress = withSkeletonTemplate<ResourceAddressProps>(
)}
{stateAddress != null ? (
<>
<Text
tag='div'
data-testid='ResourceAddress-fullName'
weight={title == null ? 'bold' : undefined}
variant={title != null ? 'info' : undefined}
>
{stateAddress.full_name}
</Text>
{stateAddress.first_name != null &&
stateAddress.last_name != null && (
<Text
tag='div'
data-testid='ResourceAddress-firstLastName'
weight={title == null ? 'bold' : undefined}
variant={title != null ? 'info' : undefined}
>
{stateAddress.first_name} {stateAddress.last_name}
</Text>
)}
{stateAddress.company != null && (
<Text
tag='div'
data-testid='ResourceAddress-company'
weight={title == null ? 'bold' : undefined}
variant={title != null ? 'info' : undefined}
>
{stateAddress.company}
</Text>
)}
<Text
tag='div'
variant='info'
Expand Down

0 comments on commit b19b217

Please sign in to comment.