Sha256: 03097bb0b08f5e9bbcc6c540abc9e46e38147e5c8ed958050d594dabc636a04b
Contents?: true
Size: 912 Bytes
Versions: 158
Compression:
Stored size: 912 Bytes
Contents
import React from 'react' import { render, screen } from '../utilities/test-utils' import Avatar from './_avatar' const imageUrl = 'https://randomuser.me/api/portraits/men/44.jpg', testId = 'tjohnson', name = 'Terry Johnson', imageAlt = 'Terry Johnson Standing' test('loads the given image url and name', () => { render( <Avatar data={{ testid: testId }} imageAlt={imageAlt} imageUrl={imageUrl} name={name} /> ) const kit = screen.getByTestId(testId) const image = screen.getByAltText(imageAlt) const initials = name.split(/\s/)[0].substr(0, 1) + name.split(/\s/)[1].substr(0, 1) expect(kit).toHaveClass('pb_avatar_kit_size_md') expect(kit).toHaveAttribute('data-initials', initials) expect(image).toHaveAttribute('data-src', imageUrl) expect(image).toHaveAttribute('src', imageUrl) expect(image).toHaveAttribute('alt', imageAlt) })
Version data entries
158 entries across 158 versions & 1 rubygems