UNPKG

@zohodesk/dot

Version:

In this Library, we Provide Some Basic Components to Build Your Application

79 lines 1.94 kB
import React from 'react'; import { render } from '@testing-library/react'; import RadioField from "../RadioField"; const options = [{ text: 'Chennai', value: '1' }, { text: 'Mumbai', value: '2', tooltip: 'Disabled Option', disabled: true }, { text: 'Delhi', value: '3', infoTooltip: 'Capital of India' }, { text: 'Kolkata', value: '4' }]; let optionsWithsecondaryText = [{ text: 'Chennai', value: '1', secondaryText: 'Tamil Nadu Capital' }, { text: 'Mumbai', value: '2', secondaryText: 'Maharashtra Capital', tooltip: 'Disabled Option', disabled: true }, { text: 'Delhi', value: '3', secondaryText: 'Capital of India', infoTooltip: 'Capital of India' }]; describe('RadioField', () => { test('rendering the defult props', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(RadioField, { options: [] })); expect(asFragment()).toMatchSnapshot(); }); test('rendering with options', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(RadioField, { options: options })); expect(asFragment()).toMatchSnapshot(); }); test('rendering options with isBoxStyle', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(RadioField, { options: options, isBoxStyle: true })); expect(asFragment()).toMatchSnapshot(); }); test('rendering with secondaryTextOptions', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(RadioField, { options: optionsWithsecondaryText })); expect(asFragment()).toMatchSnapshot(); }); test('rendering with secondaryTextOptions & isBoxStyle', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(RadioField, { options: optionsWithsecondaryText, isBoxStyle: true })); expect(asFragment()).toMatchSnapshot(); }); });