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

47 lines 1.32 kB
import React from 'react'; import { render, cleanup } from "@testing-library/react"; import { setGlobalId } from "../../Provider/IdProvider"; import AdvancedMultiSelect from "../AdvancedMultiSelect"; beforeEach(() => { setGlobalId(0); }); afterEach(() => { cleanup(); }); describe('AdvancedMultiSelect', () => { test('rendering the defult props', () => { const mockOnChange = jest.fn(); const { asFragment } = render( /*#__PURE__*/React.createElement(AdvancedMultiSelect, null)); expect(asFragment()).toMatchSnapshot(); }); const options = [{ id: 1, text: 'Apple' }, { id: 2, text: 'Orange' }, 'string test']; test('rendering the options array with objects and string', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(AdvancedMultiSelect, { isPopupOpen: true, isPopupReady: true, options: options })); expect(asFragment()).toMatchSnapshot(); }); test('rendering the options array with only objects using allowValueFallback', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(AdvancedMultiSelect, { isPopupOpen: true, isPopupReady: true, options: options, allowValueFallback: false })); expect(asFragment()).toMatchSnapshot(); }); });