Sha256: 233b9730138b465d67ed98671cb11a352da212aeccf9d9e93a21b58728f8689f
Contents?: true
Size: 787 Bytes
Versions: 37
Compression:
Stored size: 787 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' test('loads the given image url and name', () => { render( <Avatar data={{ testid: testId }} imageUrl={imageUrl} name={name} /> ) const kit = screen.getByTestId(testId) const image = screen.getByAltText(name) const initials = name.split(/\s/)[0].substr(0, 1) + name.split(/\s/)[1].substr(0, 1) expect(kit).toHaveClass('pb_avatar_kit_md') expect(kit).toHaveAttribute('data-initials', initials) expect(image).toHaveAttribute('data-src', imageUrl) expect(image).toHaveAttribute('src', imageUrl) })
Version data entries
37 entries across 37 versions & 1 rubygems