UNPKG

@wonderflow/react-components

Version:

UI components from Wonderflow's Wanda design system

16 lines (15 loc) 1.6 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { fireEvent, render } from '@testing-library/react'; import { Tab } from './tab'; describe('<Tab>', () => { test(' it should render properly', () => { const { container } = render(_jsxs(Tab, { children: [_jsx(Tab.Panel, { value: "1", label: "Tab 1", children: "Panel 1" }), _jsx(Tab.Panel, { value: "2", label: "Tab mid long 2", children: "Panel 2" }), _jsx(Tab.Panel, { value: "3", label: "Tab short 3", children: "Panel 3" }), _jsx(Tab.Panel, { value: "4", label: "Tab veryy long 4", children: "Panel 4" }), _jsx(Tab.Panel, { value: "5", label: "Tab 5", children: "Panel 5" }), _jsx(Tab.Panel, { value: "6", label: "Tab 6", icon: "bell", children: "Panel 6" })] })); expect(container).not.toBeNull(); }); test(' it should render properly with props', async () => { const { container, getByLabelText, getByTestId } = render(_jsxs(Tab, { dimension: "big", value: "1", children: [_jsx(Tab.Panel, { value: "1", label: "Tab 1", children: "Panel 1" }), _jsx(Tab.Panel, { value: "2", label: "Tab mid long 2", children: "Panel 2" }), _jsx(Tab.Panel, { value: "3", label: "Tab short 3", children: "Panel 3" }), _jsx(Tab.Panel, { value: "4", label: "Tab veryy long 4", children: "Panel 4" }), _jsx(Tab.Panel, { value: "5", label: "Tab 5", children: "Panel 5" }), _jsx(Tab.Panel, { value: "6", label: "Tab 6", icon: "bell", children: "Panel 6" })] })); fireEvent.click(getByTestId('TabRoot')); fireEvent.click(getByLabelText('Tab 5')); expect(container).not.toBeNull(); }); });