UNPKG

@zohodesk/components

Version:

Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development

114 lines 3.44 kB
import React from 'react'; import { render } from '@testing-library/react'; import InputFieldLine from "../InputFieldLine"; describe('InputFieldLine', () => { test('rendering the defult props', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(InputFieldLine, null)); expect(asFragment()).toMatchSnapshot(); }); test('Should be render with title', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(InputFieldLine, { title: "InputFieldLine Test Title" })); expect(asFragment()).toMatchSnapshot(); }); test('Should be render isActive is true', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(InputFieldLine, { isActive: true })); expect(asFragment()).toMatchSnapshot(); }); test('Should be render isDisabled is true', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(InputFieldLine, { isDisabled: true })); expect(asFragment()).toMatchSnapshot(); }); test('Should be render isReadOnly is true', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(InputFieldLine, { isReadOnly: true })); expect(asFragment()).toMatchSnapshot(); }); test('Should be render hasPadding is true', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(InputFieldLine, { hasPadding: true })); expect(asFragment()).toMatchSnapshot(); }); test('Should be render hasEffect is false', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(InputFieldLine, { hasEffect: false })); expect(asFragment()).toMatchSnapshot(); }); const size = ['medium', 'xmedium']; test.each(size)('Should render size - %s', size => { const { asFragment } = render( /*#__PURE__*/React.createElement(InputFieldLine, { hasPadding: true, size: size })); expect(asFragment()).toMatchSnapshot(); }); const border = ['bottom', 'all', 'none']; test.each(border)('Should render border - %s', border => { const { asFragment } = render( /*#__PURE__*/React.createElement(InputFieldLine, { border: border })); expect(asFragment()).toMatchSnapshot(); }); const borderColor = ['default', 'dark', 'error', 'transparent']; test.each(borderColor)('Should render borderColor - %s', borderColor => { const { asFragment } = render( /*#__PURE__*/React.createElement(InputFieldLine, { borderColor: borderColor })); expect(asFragment()).toMatchSnapshot(); }); test('Should render customProps', () => { const customProps = { 'data-test': 'inputFieldLine-test' }; const { asFragment } = render( /*#__PURE__*/React.createElement(InputFieldLine, { customProps: customProps })); expect(asFragment()).toMatchSnapshot(); }); test('Should render customClass', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(InputFieldLine, { customClass: "inputFieldLine-custom-class" })); expect(asFragment()).toMatchSnapshot(); }); test('Should render dataId', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(InputFieldLine, { dataId: "inputFieldLine-test-id" })); expect(asFragment()).toMatchSnapshot(); }); });