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

71 lines 1.41 kB
import React from 'react'; import { render } from '@testing-library/react'; import Suggestions from "../Suggestions"; const sampleData = [{ "id": 2, "value": "text2", "optionType": "default", "listItemProps": { "style": { "color": "red" } } }, { "id": 3, "value": "text3", "optionType": "default", "listItemProps": { "style": { "color": "blue" } } }, { "id": 4, "value": "text4", "optionType": "default" }, { "id": 5, "value": "text5", "optionType": "default" }, { "id": 6, "value": "text6", "optionType": "default" }, { "id": 7, "value": "text7", "optionType": "default" }, { "id": 8, "value": "text8", "optionType": "default" }, { "id": 9, "value": "text9", "optionType": "default" }, { "id": 10, "value": "text10", "optionType": "default" }]; describe('Suggestions', () => { test('rendering the defult props', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(Suggestions, { suggestions: [] })); expect(asFragment()).toMatchSnapshot(); }); test('rendering with limit props', () => { const { asFragment } = render( /*#__PURE__*/React.createElement(Suggestions, { selectedOptions: [1, 2, 3, 4], suggestions: sampleData, limit: 3, limitReachedMessage: "Limit Reached" })); expect(asFragment()).toMatchSnapshot(); }); });