Sha256: fed47712ffe4f87a12108d014fefa49e8771b86e447d40c719fdd5705de2f6af

Contents?: true

Size: 1.55 KB

Versions: 138

Compression:

Stored size: 1.55 KB

Contents

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

const testId = "phoneNumberInput"

test('should be disabled', () => {
  const props = {
    disabled: true,
    id: testId,
  }

  render(<PhoneNumberInput {...props} />)
  const kit = screen.getByRole("textbox")
  expect(kit).toBeDisabled()
})

test('should be enabled by default', () => {
  const props = {
    id: testId,
  }

  render(<PhoneNumberInput {...props} />)
  const kit = screen.getByRole("textbox")
  expect(kit).not.toBeDisabled()
})

test('should have label', () => {
  const label = 'Phone Number'
  const props = {
    id: testId,
    label,
  }

  render(<PhoneNumberInput {...props} />)
  const kit = screen.getByText(label)
  expect(kit).toBeInTheDocument()
})

test('should pass data prop', () => {
  const props = {
    data: { testid: testId },
    id: testId,
  }

  render(<PhoneNumberInput {...props} />)
  const kit = screen.getByTestId(testId)
  expect(kit).toBeInTheDocument()
})

test('should pass className prop', () => {
  const className = 'custom-class-name'
  const props = {
    className,
    data: { testid: testId },
    id: testId,
  }

  render(<PhoneNumberInput {...props} />)
  const kit = screen.getByTestId(testId)
  expect(kit).toHaveClass(className)
})

test('should pass value prop', () => {
  const value = '1234567890'
  const props = {
    id: testId,
    value,
  }

  render(<PhoneNumberInput {...props} />)
  const kit = screen.getByRole("textbox")
  expect(kit).toHaveDisplayValue(value)
})

Version data entries

138 entries across 138 versions & 1 rubygems

Version Path
playbook_ui-12.26.1.pre.alpha.railsmultilevelimprovements842 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.1.pre.alpha.railsmultilevelimprovements837 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.1.pre.alpha.railsmultilevelimprovements835 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.1.pre.alpha.play716popoverkitcloseonclickissue833 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.1.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown831 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.1 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.0.pre.alpha.multiselectfixes825 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown822 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.0.pre.alpha.multiselectfixes821 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown818 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown817 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown815 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown813 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.0.pre.alpha.alphafix812 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.0.pre.alpha.alphafix810 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.0.pre.alpha.railsmultilevelimprovements805 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.0.pre.alpha.multiselectfixes798 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.0.pre.alpha.multiselectfixes797 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.0.pre.alpha.multiselectfixes796 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js
playbook_ui-12.26.0.pre.alpha.multiselectfixes795 app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js