Sha256: f6b04a92f4edc3603552f114c2214bbaba305436032ecf8fab668d07ae953f1e

Contents?: true

Size: 1.98 KB

Versions: 460

Compression:

Stored size: 1.98 KB

Contents

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

import TextInput from './_text_input'

const testId = 'text-input1',
  kitClass = 'pb_text_input_kit'

test('returns namespaced class name', () => {
  render(
    <TextInput
        data={{ testid: testId }}
        label="First Name"
        placeholder="Enter first name"
    />
  )

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

test('returns additional class name', () => {
  render(
    <TextInput
        className="additional_class"
        data={{ testid: testId }}
        label="First Name"
        placeholder="Enter first name"
    />
  )

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

test('returns additional class name', () => {
  render(
    <TextInput
        dark
        data={{ testid: testId }}
        label="First Name"
        placeholder="Enter first name"
    />
  )

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

test('returns additional class name', () => {
  render(
    <TextInput
        data={{ testid: testId }}
        error="Please enter a valid email"
        label="First Name"
        placeholder="Enter first name"
    />
  )

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

test('returns additional class name', () => {
  render(
    <TextInput
        dark
        data={{ testid: testId }}
        error="Please enter a valid email"
        label="First Name"
        placeholder="Enter first name"
    />
  )

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

test('returns additional class name', () => {
  render(
    <TextInput
        data={{ testid: testId }}
        label="First Name"
        marginBottom="lg"
        placeholder="Enter first name"
    />
  )

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

Version data entries

460 entries across 460 versions & 1 rubygems

Version Path
playbook_ui-14.9.0.pre.alpha.PLAY16264952 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.9.0.pre.alpha.play1742globalheightfixes4926 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.9.0.pre.alpha.play1742globalheightfixes4925 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.10.0.pre.rc.14 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.10.0.pre.rc.13 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.9.0.pre.alpha.PBNTR746datepickerdefaultbug4903 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.9.0.pre.alpha.PBNTR746datepickerdefaultbug4901 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.9.0.pre.alpha.PBNTR746datepickerdefaultbug4898 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.9.0.pre.alpha.PBNTR746datepickerdefaultbug4891 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.9.0.pre.alpha.play1703errorstatealignment4889 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.10.0.pre.rc.12 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.10.0.pre.rc.11 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.9.0.pre.alpha.PBNTR738collapsiblewithintablekit4855 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.10.0.pre.rc.10 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.10.0.pre.rc.9 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.10.0.pre.rc.8 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.10.0.pre.rc.7 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.10.0.pre.rc.6 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.10.0.pre.rc.5 app/pb_kits/playbook/pb_text_input/text_input.test.js
playbook_ui-14.10.0.pre.rc.4 app/pb_kits/playbook/pb_text_input/text_input.test.js