Sha256: d793ce1d2e429f9a2d32c53ac21c2f9df3a08baa246f171b73f6686b825c5440

Contents?: true

Size: 1.78 KB

Versions: 594

Compression:

Stored size: 1.78 KB

Contents

import React from 'react'
import { render, screen } from '../utilities/test-utils'

import MultipleUsersStacked from './_multiple_users_stacked'

const testId = 'multipleUsersStacked'
const className = 'custom-class-name'
const nameUser1 = 'Patrick Welch'
const nameUser2 = 'Lucille Sanchez'
const imageUser1 = 'https://randomuser.me/api/portraits/men/9.jpg'
const imageUser2 = 'https://randomuser.me/api/portraits/women/6.jpg'

const MultipleUsersStackedDefault = () => {
    return (
        <MultipleUsersStacked
            aria={{ label: testId }}
            className={className}
            data={{ testid: testId }}
            users={[
                {
                    name: nameUser1,
                    imageUrl: imageUser1,
                    imageAlt: nameUser1,
                },
                {
                    name: nameUser2,
                    imageUrl: imageUser2,
                    imageAlt: nameUser2,
                },
            ]}
        />
    )
}

test('should render alt names and images', () => {
    render(<MultipleUsersStackedDefault />)
    
    const image1 = screen.getByAltText(nameUser1)
    const image2 = screen.getByAltText(nameUser2)

    expect(image1).toHaveAttribute('src', imageUser1)
    expect(image2).toHaveAttribute('src', imageUser2)
})

test('should pass data prop', () => {
    render(<MultipleUsersStackedDefault />)
    const kit = screen.getByTestId(testId)
    expect(kit).toBeInTheDocument()
})

test('should pass className prop', () => {
    render(<MultipleUsersStackedDefault />)
    const kit = screen.getByTestId(testId)
    expect(kit).toHaveClass(className)
})

test('should pass aria prop', () => {
    render(<MultipleUsersStackedDefault />)
    const kit = screen.getByTestId(testId)
    expect(kit).toHaveAttribute('aria-label', testId)
})

Version data entries

594 entries across 594 versions & 1 rubygems

Version Path
playbook_ui-14.4.0.pre.rc.15 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.4.0.pre.rc.14 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.3.2.pre.alpha.PBNTR417addcolorsupdatedefaultcolor3791 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.4.0.pre.rc.13 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.3.2.pre.alpha.PBNTR515typeaheadmarginbottomredux3785 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.3.2.pre.alpha.revert3614PBNTR455ganttchartPOC3783 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.4.0.pre.rc.12 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.3.2.pre.alpha.play1472newicons3773 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.4.0.pre.rc.11 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.3.2.pre.alpha.PBNTR490multilevelselect3771 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.4.0.pre.rc.10 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.3.2.pre.alpha.PBNTR490multilevelselect3766 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.4.0.pre.rc.9 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.4.0.pre.rc.8 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.3.2.pre.alpha.PBNTR480radiocustomchildrenprop3759 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.3.2.pre.alpha.PBNTR515typeaheadmarginbottomredux3756 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.4.0.pre.rc.7 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.3.2 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.4.0.pre.rc.6 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.3.1.pre.alpha.PBNTR515typeaheadmarginbottomredux3750 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js