import React from 'react' import { render, screen } from '../utilities/test-utils' import { Passphrase } from 'playbook-ui' const testId = 'text-input1', kitClass = 'pb_passphrase' /* See these resources for more testing info: - https://github.com/testing-library/jest-dom#usage for useage and examples - https://jestjs.io/docs/en/using-matchers */ test('returns namespaced class name', () => { render( ) const kit = screen.getByTestId(testId) expect(kit).toHaveClass(kitClass) }) test('returns additional class name', () => { render( ) const kit = screen.getByTestId(testId) expect(kit).toHaveClass(`${kitClass} additional_class`) }) test('returns dark class name', () => { render( ) const kit = screen.getByTestId(testId) expect(kit).toHaveClass(`${kitClass} dark`) }) test('passes input props to input element', () => { render( ) const kit = screen.getByTestId(testId) const input = kit.getElementsByTagName('input')[0] expect(input).toHaveAttribute('name', 'test-name') expect(input).toHaveAttribute('id', 'test-input-id') expect(input).toBeDisabled() }) test('popover target shows when tips are given', () => { render( ) const kit = screen.getByTestId(testId) expect(kit.querySelector('[class^=pb_popover_reference_wrapper]')).toBeDefined() }) test('popover target does not show when tips are not given', () => { render( ) const kit = screen.getByTestId(testId) expect(kit.querySelector('[class^=pb_popover_reference_wrapper]')).toBeNull() })