Sha256: 0257041242725e15e3ffe892b7f4a057e09642fe4b1a4705f12745ce2d53924f

Contents?: true

Size: 1.23 KB

Versions: 808

Compression:

Stored size: 1.23 KB

Contents

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

import Select from './_select'

const testId = 'select1',
  kitClass = 'pb_select'

const options = [
  {
    value: '1',
    text: 'Burgers',
  },
  {
    value: '2',
    text: 'Pizza',
  },
  {
    value: '3',
    text: 'Tacos',
  },
]

test('returns namespaced class name', () => {
  render(
    <Select
        data={{ testid: testId }}
        label="Favorite Food"
        name="food"
        options={options}
    />
  )

  const kit = screen.getByTestId(testId)
  expect(kit).toHaveClass(kitClass)
})

test('returns dark class name', () => {
  render(
    <Select
        dark
        data={{ testid: testId }}
        label="Favorite Food"
        name="food"
        options={options}
    />
  )

  const kit = screen.getByTestId(testId)
  expect(kit).toHaveClass(`${kitClass} dark`)
})

test('returns multiple variant', () => {
  render(
    <Select
        data={{ testid: "selectMultiple" }}
        label="Favorite Food"
        multiple
        name="food"
        options={options}
    />
  )

  const kit = screen.getByTestId("selectMultiple");
  const selectElement = kit.querySelector('select');

  expect(selectElement).toHaveAttribute('multiple', '');
});

Version data entries

808 entries across 808 versions & 1 rubygems

Version Path
playbook_ui-14.14.0.pre.rc.4 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.13.0.pre.alpha.play1900progresspillwidth6122 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.13.0.pre.alpha.play1754pbtagprogressradio6121 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.13.0.pre.alpha.pbntr799collapsiblerowswithcustomclick6117 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.13.0.pre.alpha.PLAY1873rails86115 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.14.0.pre.rc.3 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.13.0.pre.alpha.PLAY1873rails86087 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.13.0.pre.alpha.PBNTR5596084 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.13.0.pre.alpha.play1851checkboxreacthook6083 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.14.0.pre.rc.2 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.14.0.pre.rc.1 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.13.0.pre.alpha.play1753updatepbcontenttags6065 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.13.0.pre.alpha.play1884progresspill6064 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.13.0.pre.alpha.play1753updatepbcontenttags6060 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.13.0.pre.alpha.PBNTR5596029 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.13.0.pre.alpha.play1834depupdatesass6024 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.14.0.pre.rc.0 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.13.0 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.12.0.pre.alpha.PLAY1888initializeOncereactdatepickerslowdown5956 app/pb_kits/playbook/pb_select/select.test.js
playbook_ui-14.13.0.pre.rc.10 app/pb_kits/playbook/pb_select/select.test.js