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.1.0.pre.alpha.PLAY15063612 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.1.0.pre.alpha.PLAY15063610 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.1.0.pre.alpha.PBNTR417addcolorsupdatedefaultcolor3608 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.1.0.pre.alpha.PBNTR449rtepreviewerrails3605 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.1.0.pre.alpha.PA1477timestampkit3601 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.1.0.pre.alpha.PBNTR462starratingdefaultvalue3600 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.1.0.pre.alpha.pbntr373enablekitsforradio3595 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.1.0.pre.alpha.pbntr373enablekitsforradio3593 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.2.0 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.1.0.pre.alpha.PBNTR462starratingdefaultvalue3582 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.1.0.pre.alpha.PBNTR462starratingdefaultvalue3579 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.1.0.pre.alpha.PBNTR455ganttchartPOC3569 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.1.0.pre.alpha.fixaction3547 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.1.0.pre.alpha.PA1477timestampkit3536 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.0.0.pre.alpha.testthemeexport3533 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.0.0.pre.alpha.updateviewcomponentgem3527 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.0.0.pre.alpha.PLAY15063526 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.0.0.pre.alpha.PLAY15063525 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.0.0.pre.alpha.PLAY15063524 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js
playbook_ui-14.0.0.pre.alpha.PLAY15063523 app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js