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

65 lines 1.78 kB
import React from 'react'; import { render } from '@testing-library/react'; import Switch from "../Switch"; describe('Switch - Snapshot', () => { test('Render with default props', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(Switch, null)); expect(asFragment()).toMatchSnapshot(); }); test('Render with isChecked=true', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(Switch, { isChecked: true })); expect(asFragment()).toMatchSnapshot(); }); test('Render with isDisabled=true', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(Switch, { isChecked: true, isDisabled: true })); expect(asFragment()).toMatchSnapshot(); }); test('Render with customId and testId', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(Switch, { customId: "switch-customId", testId: "switch-testId" })); expect(asFragment()).toMatchSnapshot(); }); test('Render with tag attributes', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(Switch, { tagAttributes: { 'data-custom-attr': 'true' } })); expect(asFragment()).toMatchSnapshot(); }); test('Render with a11y attributes', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(Switch, { a11yAttributes: { role: 'switch' } })); expect(asFragment()).toMatchSnapshot(); }); test('Render with customClass', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(Switch, { customClass: "my-switch" })); expect(asFragment()).toMatchSnapshot(); }); });