From 97fc9e7a051eacfcf9b46d93e232d5afd6e908bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Po=C5=9Bpiech?= Date: Fri, 14 Jun 2024 15:02:38 +0200 Subject: [PATCH 1/9] moved Semantic SelectField tests to RTL --- packages/uniforms-mui/__tests__/index.ts | 2 +- .../__tests__/SelectField.tsx | 145 +++--------------- packages/uniforms-semantic/__tests__/index.ts | 2 +- packages/uniforms/__suites__/SelectField.tsx | 49 ++++++ 4 files changed, 69 insertions(+), 129 deletions(-) diff --git a/packages/uniforms-mui/__tests__/index.ts b/packages/uniforms-mui/__tests__/index.ts index cfcb5c366..07c27deb1 100644 --- a/packages/uniforms-mui/__tests__/index.ts +++ b/packages/uniforms-mui/__tests__/index.ts @@ -55,7 +55,7 @@ describe('@RTL MUI', () => { suites.testQuickForm(theme.QuickForm); suites.testRadioField(theme.RadioField); // FIXME: MUI select does not work with new RTL test implementation - // suites.testSelectField(theme.SelectField); + // suites.testSelectField(theme.SelectField, { showInlineError: true }); suites.testSubmitField(theme.SubmitField); suites.testTextField(theme.TextField); suites.testValidatedForm(theme.ValidatedForm); diff --git a/packages/uniforms-semantic/__tests__/SelectField.tsx b/packages/uniforms-semantic/__tests__/SelectField.tsx index 4b4a2bd01..a27852d92 100644 --- a/packages/uniforms-semantic/__tests__/SelectField.tsx +++ b/packages/uniforms-semantic/__tests__/SelectField.tsx @@ -1,135 +1,26 @@ +import { fireEvent, screen } from '@testing-library/react'; import React from 'react'; import { SelectField } from 'uniforms-semantic'; - -import createContext from './_createContext'; -import mount from './_mount'; - -test(' - renders a label', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); - - expect(wrapper.find('label')).toHaveLength(1); - expect(wrapper.find('label').prop('children')).toBe('y'); - expect(wrapper.find('label').prop('htmlFor')).toBe( - wrapper.find('select').prop('id'), - ); -}); +import { renderWithZod } from 'uniforms/__suites__'; +import { z } from 'zod'; test(' - disabled items (options) based on predicate', () => { - const element = ( - - ); - const wrapper = mount(element, createContext({ x: { type: String } })); - - expect(wrapper.find('select')).toHaveLength(1); - expect(wrapper.find('option[value="a"]').at(0).prop('disabled')).toBe(true); - expect(wrapper.find('option[value="b"]').at(0).prop('disabled')).toBe(false); -}); - -test(' - renders a select which correctly reacts on change (first value)', () => { - const onChange = jest.fn(); - - const element = ; - const wrapper = mount( - element, - createContext( - { - x: { type: Array }, - 'x.$': { type: String, allowedValues: ['a', 'b'] }, - }, - { onChange }, - ), - ); - - expect(wrapper.find('select')).toHaveLength(1); - expect( - wrapper.find('select').simulate('change', { target: { value: 'a' } }), - ).toBeTruthy(); - expect(onChange).toHaveBeenLastCalledWith('x', ['a']); -}); - -test(' - renders a select which correctly reacts on change (next value)', () => { - const onChange = jest.fn(); - - const element = ; - const wrapper = mount( - element, - createContext( - { - x: { type: Array }, - 'x.$': { type: String, allowedValues: ['a', 'b'] }, - }, - { onChange }, + renderWithZod({ + element: ( + ), - ); - - expect(wrapper.find('select')).toHaveLength(1); - expect( - wrapper.find('select').simulate('change', { target: { value: 'a' } }), - ).toBeTruthy(); - expect(onChange).toHaveBeenLastCalledWith('x', ['a', 'b']); -}); - -test(' - renders correct error text (specified)', () => { - const error = new Error(); - const element = ( - - ); - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); - - expect(wrapper.find('.ui.red.label').length).toBe(1); - expect(wrapper.find('.ui.red.label').text()).toBe('Error'); -}); - -test(' - renders correct error text (showInlineError=false)', () => { - const error = new Error(); - const element = ( - - ); - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); - - expect(wrapper.find('.ui.red.label').length).toBe(0); -}); - -test(' - disabled items (checkboxes) based on predicate', () => { - const allowedValues = ['a', 'b']; + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - const element = ( - - ); - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues } }), - ); + fireEvent.click(screen.getByTestId('select')); - expect(wrapper.find('input')).toHaveLength(2); - expect(wrapper.find('input').at(0).prop('disabled')).toBe(true); - expect(wrapper.find('input').at(1).prop('disabled')).toBe(false); + expect(screen.getByText('A')).toBeDisabled(); + expect(screen.getByText('B')).toBeEnabled(); }); diff --git a/packages/uniforms-semantic/__tests__/index.ts b/packages/uniforms-semantic/__tests__/index.ts index a9bfe2b9b..0fecfd978 100644 --- a/packages/uniforms-semantic/__tests__/index.ts +++ b/packages/uniforms-semantic/__tests__/index.ts @@ -53,7 +53,7 @@ describe('@RTL Semantic', () => { suites.testNumField(theme.NumField); suites.testQuickForm(theme.QuickForm); suites.testRadioField(theme.RadioField); - suites.testSelectField(theme.SelectField); + suites.testSelectField(theme.SelectField, { showInlineError: true }); suites.testSubmitField(theme.SubmitField); suites.testTextField(theme.TextField, { testWrapClassName: true, diff --git a/packages/uniforms/__suites__/SelectField.tsx b/packages/uniforms/__suites__/SelectField.tsx index 7cb413876..36d7a539e 100644 --- a/packages/uniforms/__suites__/SelectField.tsx +++ b/packages/uniforms/__suites__/SelectField.tsx @@ -9,6 +9,7 @@ export function testSelectField( SelectField: ComponentType, options?: { theme?: 'antd'; + showInlineError?: boolean; getCheckboxInlineOption?: (screen: Screen) => Element | null; }, ) { @@ -20,6 +21,14 @@ export function testSelectField( expect(screen.getByTestId('select-field')).toBeInTheDocument(); }); + test(' - renders a label', () => { + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); + expect(screen.getByText('y')).toBeInTheDocument(); + }); + test(' - renders a select with correct disabled state', () => { renderWithZod({ element: , @@ -617,4 +626,44 @@ export function testSelectField( expect(checkboxes?.[0]).toBeDisabled(); expect(checkboxes?.[1]).not.toBeDisabled(); }); + + skipTestIf(!options?.showInlineError)( + ' - renders correct error text (specified)', + () => { + const error = new Error(); + renderWithZod({ + element: ( + <> + + + ), + schema: z.object({ x: z.enum(['a', 'b']) }), + }); + + expect(screen.getByText('Error')).toBeInTheDocument(); + }, + ); + + skipTestIf(!options?.showInlineError)( + ' - renders correct error text (showInlineError=false)', + () => { + const error = new Error(); + renderWithZod({ + element: ( + <> + + + ), + schema: z.object({ x: z.enum(['a', 'b']) }), + }); + + expect(screen.queryByText('Error')).not.toBeInTheDocument(); + }, + ); } From 77cba96f024b5c2b35c18c0756d1b7e85bfbafa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Po=C5=9Bpiech?= Date: Sun, 16 Jun 2024 18:00:17 +0200 Subject: [PATCH 2/9] moved MUI SelectField tests to RTL --- .../uniforms-mui/__tests__/SelectField.tsx | 911 +++++++----------- 1 file changed, 354 insertions(+), 557 deletions(-) diff --git a/packages/uniforms-mui/__tests__/SelectField.tsx b/packages/uniforms-mui/__tests__/SelectField.tsx index 17ef22d85..d1944b7f5 100644 --- a/packages/uniforms-mui/__tests__/SelectField.tsx +++ b/packages/uniforms-mui/__tests__/SelectField.tsx @@ -1,727 +1,524 @@ -import Checkbox from '@mui/material/Checkbox'; -import FormControl from '@mui/material/FormControl'; -import FormControlLabel from '@mui/material/FormControlLabel'; -import FormHelperText from '@mui/material/FormHelperText'; -import FormLabel from '@mui/material/FormLabel'; -import Radio from '@mui/material/Radio'; -import RadioGroup from '@mui/material/RadioGroup'; -import Select from '@mui/material/Select'; -import Switch from '@mui/material/Switch'; -import TextField from '@mui/material/TextField'; +import { fireEvent, screen, within } from '@testing-library/react'; import React from 'react'; import { SelectField } from 'uniforms-mui'; - -import createContext from './_createContext'; -import mount from './_mount'; +import { renderWithZod } from 'uniforms/__suites__'; +import { z } from 'zod'; test(' - renders a Select', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); - - expect(wrapper.find(Select)).toHaveLength(1); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); + expect(screen.getByTestId('select-field')).toBeInTheDocument(); }); test(' - renders a Select with correct disabled state', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(Select)).toHaveLength(1); - expect(wrapper.find(FormControl).prop('disabled')).toBe(true); + expect( + screen.getByTestId('select-field').classList.contains('Mui-disabled'), + ).toBeTruthy(); }); test(' - renders a Select with correct required state', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(Select)).toHaveLength(1); - expect(wrapper.find(TextField).prop('required')).toBe(true); + expect(screen.getByLabelText('X *')).toBeInTheDocument(); }); test(' - renders a Select with correct id (inherited)', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(Select)).toHaveLength(1); - // FIXME: inputProps is nullable. - expect(wrapper.find(Select).prop('inputProps')!.id).toBeTruthy(); + const select = screen.getByTestId('select-field').querySelector('[id]'); + expect(select?.getAttribute('id')).toBeTruthy(); }); test(' - renders a Select with correct id (specified)', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(Select)).toHaveLength(1); - // FIXME: inputProps is nullable. - expect(wrapper.find(Select).prop('inputProps')!.id).toBe('y'); + const select = screen.getByTestId('select-field').querySelector('[id]'); + expect(select?.getAttribute('id')).toBe('y'); }); test(' - renders a Select with correct name', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(Select)).toHaveLength(1); - // FIXME: inputProps is nullable. - expect(wrapper.find(Select).prop('inputProps')!.name).toBe('x'); + const select = screen.getByTestId('select-field'); + const elementWithAttribute = select.querySelector('[name="x"]') || select; + expect(elementWithAttribute?.getAttribute('name')).toBe('x'); }); test(' - renders a Select with correct options', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + const selectOptions = ['a', 'b'] as const; + renderWithZod({ + element: , + schema: z.object({ x: z.enum(selectOptions) }), + }); + + fireEvent.mouseDown(screen.getByRole('button')); + const listbox = within(screen.getByRole('listbox')); - expect(wrapper.find(Select)).toHaveLength(1); - expect(wrapper.find('option')).toHaveLength(3); - [ - ['', 'X'], - ['a', 'a'], - ['b', 'b'], - ].forEach(([value, text], index) => { - const option = wrapper.find('option').at(index); - expect(option.prop('value')).toBe(value); - expect(option.text()).toBe(text); + selectOptions.forEach(option => { + expect(listbox.getByRole('option', { name: option })).not.toBeNull(); }); }); test(' - renders a Select with correct options (transform)', () => { - const element = ( - - ); - const wrapper = mount(element, createContext({ x: { type: String } })); - - expect(wrapper.find(Select)).toHaveLength(1); - expect(wrapper.find('option')).toHaveLength(3); - [ - ['', 'X'], - ['a', 'A'], - ['b', 'B'], - ].forEach(([value, text], index) => { - const option = wrapper.find('option').at(index); - expect(option.prop('value')).toBe(value); - expect(option.text()).toBe(text); + const selectOptions = ['a', 'b'] as const; + renderWithZod({ + element: ( + + ), + schema: z.object({ x: z.string() }), + }); + + fireEvent.mouseDown(screen.getByRole('button')); + const listbox = within(screen.getByRole('listbox')); + + selectOptions.forEach(option => { + expect(listbox.getByRole('option', { name: option })).toBeInTheDocument(); }); }); test(' - renders a Select with correct placeholder (implicit)', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); - - expect(wrapper.find(Select).prop('value')).toBe(''); - expect(wrapper.find('option')).toHaveLength(3); - [ - ['', 'y'], - ['a', 'a'], - ['b', 'b'], - ].forEach(([value, text], index) => { - const option = wrapper.find('option').at(index); - expect(option.prop('value')).toBe(value); - expect(option.text()).toBe(text); + renderWithZod({ + element: ( + + ), + schema: z.object({ x: z.string() }), }); + expect(screen.getByText('y')).toBeInTheDocument(); }); test(' - renders a Select with correct value (default)', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(Select)).toHaveLength(1); - expect(wrapper.find(Select).prop('value')).toBe(''); + expect(screen.getByText('a')).toBeInTheDocument(); + expect(screen.queryByText('b')).not.toBeInTheDocument(); }); test(' - renders a Select with correct value (model)', () => { - const element = ; - const wrapper = mount( - element, - createContext( - { x: { type: String, allowedValues: ['a', 'b'] } }, - { model: { x: 'b' } }, - ), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + model: { x: 'b' }, + }); - expect(wrapper.find(Select)).toHaveLength(1); - expect(wrapper.find(Select).prop('value')).toBe('b'); + expect(screen.getByText('b')).toBeInTheDocument(); + expect(screen.queryByText('a')).not.toBeInTheDocument(); }); test(' - renders a Select with correct value (specified)', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + model: { x: 'b' }, + }); - expect(wrapper.find(Select)).toHaveLength(1); - expect(wrapper.find(Select).prop('value')).toBe('b'); + expect(screen.getByText('b')).toBeInTheDocument(); + expect(screen.queryByText('a')).not.toBeInTheDocument(); }); test(' - renders a Select which correctly reacts on change', () => { const onChange = jest.fn(); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - const element = ; - const wrapper = mount( - element, - createContext( - { x: { type: String, allowedValues: ['a', 'b'] } }, - { onChange }, - ), - ); - - expect(wrapper.find(Select)).toHaveLength(1); - // @ts-expect-error Provide a valid EventTarget. - wrapper.find(TextField).props().onChange!({ target: { value: 'b' } }); - expect(onChange).toHaveBeenLastCalledWith('x', 'b'); -}); - -test(' - renders a Select which correctly reacts on change (empty)', () => { - const onChange = jest.fn(); - - const element = ; - const wrapper = mount( - element, - createContext( - { x: { type: String, allowedValues: ['a', 'b'] } }, - { onChange }, - ), - ); + fireEvent.mouseDown(screen.getByRole('button')); + const listbox = within(screen.getByRole('listbox')); + fireEvent.click(listbox.getByText(/b/i)); - expect(wrapper.find(Select)).toHaveLength(1); - // @ts-expect-error Provide a valid EventTarget. - wrapper.find(TextField).props().onChange!({ target: { value: '' } }); - expect(onChange).toHaveBeenLastCalledWith('x', undefined); + expect(onChange).toHaveBeenCalledWith('b'); }); test(' - renders a Select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + model: { x: 'b' }, + }); - const element = ; - const wrapper = mount( - element, - createContext( - { x: { type: String, allowedValues: ['a', 'b'] } }, - { model: { x: 'b' }, onChange }, - ), - ); + fireEvent.mouseDown(screen.getByRole('button')); + const listbox = within(screen.getByRole('listbox')); + + fireEvent.click(listbox.getByText(/b/i)); - expect(wrapper.find(Select)).toHaveLength(1); - // @ts-expect-error Provide a valid EventTarget. - wrapper.find(TextField).props().onChange!({ target: { value: 'b' } }); - expect(onChange).toHaveBeenLastCalledWith('x', 'b'); + expect(onChange).toBeCalledTimes(0); }); test(' - renders a label', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(Select)).toHaveLength(1); - expect(wrapper.find(TextField).prop('label')).toBe('y'); + expect(screen.getByLabelText('y')).toBeInTheDocument(); }); test(' - renders a SelectField with correct error text (showInlineError=true)', () => { const error = new Error(); - const element = ( - - ); - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: ( + + ), + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(FormHelperText).text()).toBe('Error'); + expect(screen.getByText('Error')).toBeInTheDocument(); }); test(' - renders a SelectField with correct error text (showInlineError=false)', () => { const error = new Error(); - const element = ( - - ); - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); - - expect(wrapper.find(FormHelperText)).toHaveLength(0); + renderWithZod({ + element: ( + + ), + schema: z.object({ x: z.enum(['a', 'b']) }), + }); + + expect(screen.queryByText('Error')).not.toBeInTheDocument(); }); test(' - works with special characters', () => { - mount( - , - createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), - ); -}); - -test(' - disabled items (options) based on predicate', () => { - const element = ( - - ); - const wrapper = mount( - element, - createContext({ - x: { type: Array }, - 'x.$': { type: String }, - }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['ă', 'ś']) }), + }); + + fireEvent.mouseDown(screen.getByRole('button')); + const listbox = within(screen.getByRole('listbox')); - expect(wrapper.find(Select)).toHaveLength(1); - expect(wrapper.find('option').at(0).prop('disabled')).toBe(true); - expect(wrapper.find('option').at(1).prop('disabled')).toBe(false); + expect(listbox.getByText('ă')).toBeInTheDocument(); + expect(listbox.getByText('ś')).toBeInTheDocument(); }); -test(' - renders with correct classnames', () => { - const wrapper = mount( - , - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); - expect(wrapper.find(TextField).props()).toHaveProperty( - 'className', - 'select-class', - ); -}); - -test(' - renders a multiselect with correct value (default)', () => { - const element = ; - const wrapper = mount( - element, - createContext({ - x: { type: Array, allowedValues: ['a', 'b'] }, - 'x.$': { type: String }, - }), - ); - - expect(wrapper.find(Select)).toHaveLength(1); - expect(wrapper.find(Select).prop('value')).toStrictEqual([]); -}); - -test(' - renders a multiselect with correct value (model)', () => { - const element = ; - const wrapper = mount( - element, - createContext( - { - x: { type: Array, allowedValues: ['a', 'b'] }, - 'x.$': { type: String }, - }, - { model: { x: ['b'] } }, +test(' - disabled items (options)', () => { + renderWithZod({ + element: ( + ), - ); + schema: z.object({ x: z.enum(['a', 'b']) }), + }); + + fireEvent.mouseDown(screen.getByRole('button')); + const listbox = within(screen.getByRole('listbox')); - expect(wrapper.find(Select)).toHaveLength(1); - expect(wrapper.find(Select).prop('value')).toStrictEqual(['b']); + expect(listbox.getByText('A')).toHaveClass('Mui-disabled'); + expect(listbox.getByText('B')).not.toHaveClass('Mui-disabled'); }); -test(' - renders a multiselect with correct value (specified)', () => { - const element = ; - const wrapper = mount( - element, - createContext({ - x: { type: Array, allowedValues: ['a', 'b'] }, - 'x.$': { type: String }, - }), - ); +test(' - renders with correct classnames', () => { + const { container } = renderWithZod({ + element: ( + + ), + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(Select)).toHaveLength(1); - expect(wrapper.find(Select).prop('value')).toStrictEqual(['b']); + expect(container.getElementsByClassName('select-class').length).toBe(1); }); test(' - renders a set of Radio buttons', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(Radio)).toHaveLength(2); + expect(screen.getByRole('radiogroup')).toBeInTheDocument(); }); test(' - renders a set of Radio buttons with correct disabled state', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(Radio)).toHaveLength(2); - expect(wrapper.find(Radio).at(0).prop('disabled')).toBe(true); - expect(wrapper.find(Radio).at(1).prop('disabled')).toBe(true); + expect(screen.getByLabelText('a')).toBeDisabled(); + expect(screen.getByLabelText('b')).toBeDisabled(); }); test(' - renders a set of Radio buttons with correct id (inherited)', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(Radio)).toHaveLength(2); - expect(wrapper.find(Radio).at(0).prop('id')).toBeTruthy(); - expect(wrapper.find(Radio).at(1).prop('id')).toBeTruthy(); + expect(screen.getByLabelText('a')).toHaveAttribute('id'); + expect(screen.getByLabelText('b')).toHaveAttribute('id'); }); test(' - renders a set of Radio buttons with correct id (specified)', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(Radio)).toHaveLength(2); - expect(wrapper.find(Radio).at(0).prop('id')).toBe('y-YQ'); - expect(wrapper.find(Radio).at(1).prop('id')).toBe('y-Yg'); + expect(screen.getByLabelText('a')).toHaveAttribute('id', 'y-YQ'); + expect(screen.getByLabelText('b')).toHaveAttribute('id', 'y-Yg'); }); test(' - renders a set of Radio buttons with correct name', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(Radio)).toHaveLength(2); - expect(wrapper.find(Radio).at(0).find('input').prop('name')).toBe('x'); - expect(wrapper.find(Radio).at(1).find('input').prop('name')).toBe('x'); + expect(screen.getByLabelText('a')).toHaveAttribute('name', 'x'); + expect(screen.getByLabelText('b')).toHaveAttribute('name', 'x'); }); test(' - renders a set of Radio buttons with correct options', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find('label')).toHaveLength(2); - expect(wrapper.find(FormControlLabel).at(0).prop('label')).toBe('a'); - expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('b'); + expect(screen.getByLabelText('a')).toBeInTheDocument(); + expect(screen.getByLabelText('b')).toBeInTheDocument(); }); test(' - renders a set of Radio buttons with correct options (transform)', () => { - const element = ( - - ); - const wrapper = mount(element, createContext({ x: { type: String } })); - - expect(wrapper.find('label')).toHaveLength(2); - expect(wrapper.find(FormControlLabel).at(0).prop('label')).toBe('A'); - expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('B'); + renderWithZod({ + element: ( + + ), + schema: z.object({ x: z.string() }), + }); + + expect(screen.getByLabelText('A')).toBeInTheDocument(); + expect(screen.getByLabelText('B')).toBeInTheDocument(); }); test(' - renders a set of Radio buttons with correct value (default)', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(Radio)).toHaveLength(2); - expect(wrapper.find(Radio).at(0).find('input').prop('checked')).toBe(false); - expect(wrapper.find(Radio).at(1).find('input').prop('checked')).toBe(false); + expect(screen.getByLabelText('a')).toBeChecked(); + expect(screen.getByLabelText('b')).not.toBeChecked(); }); test(' - renders a set of Radio buttons with correct value (model)', () => { - const element = ; - const wrapper = mount( - element, - createContext( - { x: { type: String, allowedValues: ['a', 'b'] } }, - { model: { x: 'b' } }, - ), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + model: { x: 'b' }, + }); - expect(wrapper.find(Radio)).toHaveLength(2); - expect(wrapper.find(Radio).at(0).find('input').prop('checked')).toBe(false); - expect(wrapper.find(Radio).at(1).find('input').prop('checked')).toBe(true); + expect(screen.getByLabelText('a')).not.toBeChecked(); + expect(screen.getByLabelText('b')).toBeChecked(); }); test(' - renders a set of Radio buttons with correct value (specified)', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(Radio)).toHaveLength(2); - expect(wrapper.find(Radio).at(0).find('input').prop('checked')).toBe(false); - expect(wrapper.find(Radio).at(1).find('input').prop('checked')).toBe(true); + expect(screen.getByLabelText('a')).not.toBeChecked(); + expect(screen.getByLabelText('b')).toBeChecked(); }); test(' - renders a set of Radio buttons which correctly reacts on change', () => { const onChange = jest.fn(); - const element = ; - const wrapper = mount( - element, - createContext( - { x: { type: String, allowedValues: ['a', 'b'] } }, - { onChange }, - ), - ); - - expect(wrapper.find(Radio)).toHaveLength(2); - // @ts-expect-error Provide a valid value. - wrapper.find(RadioGroup).props().onChange!({ target: { value: 'b' } }); - expect(onChange).toHaveBeenLastCalledWith('x', 'b'); -}); - -test(' - renders a set of Checkboxes which correctly reacts on change (array check)', () => { - const onChange = jest.fn(); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - const element = ; - const wrapper = mount( - element, - createContext( - { - x: { type: Array }, - 'x.$': { type: String, allowedValues: ['a', 'b'] }, - }, - { onChange }, - ), - ); + fireEvent.click(screen.getByLabelText('b')); - expect(wrapper.find(Checkbox)).toHaveLength(2); - wrapper.find(Checkbox).at(1).find('input').simulate('change'); - expect(onChange).toHaveBeenLastCalledWith('x', ['b']); + expect(onChange).toHaveBeenCalledWith('b'); }); test(' - renders a set of Checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); - const element = ; - const wrapper = mount( - element, - createContext( - { - x: { type: Array }, - 'x.$': { type: String, allowedValues: ['a', 'b'] }, - }, - { onChange }, - ), - ); - expect(wrapper.find(Checkbox)).toHaveLength(2); - wrapper.find(Checkbox).at(1).find('input').simulate('change'); - expect(onChange).toHaveBeenLastCalledWith('x', []); -}); - -test(' - renders a set of Checkboxes with correct labels', () => { - const onChange = jest.fn(); - const element = ; - const wrapper = mount( - element, - createContext( - { - x: { type: Array }, - 'x.$': { type: String, allowedValues: ['a', 'b'] }, - }, - { onChange }, + renderWithZod({ + element: ( + ), - ); - - expect(wrapper.find(Checkbox)).toHaveLength(2); - expect(wrapper.find(FormControlLabel).at(0).text()).toBe('a'); - expect(wrapper.find(FormControlLabel).at(1).text()).toBe('b'); -}); + schema: z.object({ + x: z.string().uniforms({ + fieldType: Array, + options: [ + { label: 'A', value: 'a' }, + { label: 'B', value: 'b' }, + ], + }), + }), + }); -test(' - renders a set of Checkboxes which correct labels (transform)', () => { - const onChange = jest.fn(); - const element = ( - - ); - const wrapper = mount( - element, - createContext( - { - x: { type: Array }, - 'x.$': { type: String }, - }, - { onChange }, - ), - ); + fireEvent.click(screen.getByLabelText('B')); - expect(wrapper.find(Checkbox)).toHaveLength(2); - expect(wrapper.find(FormControlLabel).at(0).text()).toBe('A'); - expect(wrapper.find(FormControlLabel).at(1).text()).toBe('B'); + expect(onChange).toHaveBeenLastCalledWith([]); }); -test(' - renders a set of Radio buttons which correctly reacts on change (same value)', () => { - const onChange = jest.fn(); - - const element = ; - const wrapper = mount( - element, - createContext( - { x: { type: String, allowedValues: ['a', 'b'] } }, - { model: { x: 'b' }, onChange }, - ), - ); - - expect(wrapper.find(Radio)).toHaveLength(2); - - // @ts-expect-error Provide a valid value. - wrapper.find(RadioGroup).props().onChange!({ target: { value: 'a' } }); +test(' - renders a set of Checkboxes with correct labels', () => { + renderWithZod({ + element: , + schema: z.object({ + x: z.string().uniforms({ + fieldType: Array, + options: [ + { label: 'A', value: 'a' }, + { label: 'B', value: 'b' }, + ], + }), + }), + }); - expect(onChange).toHaveBeenLastCalledWith('x', 'a'); + expect(screen.getByLabelText('A')).toBeInTheDocument(); + expect(screen.getByLabelText('B')).toBeInTheDocument(); }); test(' - renders a label', () => { - const element = ; - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); - expect(wrapper.find(FormLabel).text()).toBe('y *'); + expect(screen.getByText('y')).toBeInTheDocument(); }); test(' - renders a SelectField with correct error text (showInlineError=true)', () => { const error = new Error(); - const element = ( - - ); - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); - - expect(wrapper.find(FormHelperText).text()).toBe('Error'); + renderWithZod({ + element: ( + + ), + schema: z.object({ x: z.enum(['a', 'b']) }), + }); + + expect(screen.getByText('Error')).toBeInTheDocument(); }); test(' - renders a SelectField with correct error text (showInlineError=false)', () => { const error = new Error(); - const element = ( - - ); - const wrapper = mount( - element, - createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), - ); - - expect(wrapper.find(FormHelperText)).toHaveLength(0); + renderWithZod({ + element: ( + + ), + schema: z.object({ x: z.enum(['a', 'b']) }), + }); + + expect(screen.queryByText('Error')).not.toBeInTheDocument(); }); test(' - renders Checkbox with appearance=checkbox', () => { - const element = ; - const wrapper = mount( - element, - createContext({ - x: { type: Array }, - 'x.$': { type: String, allowedValues: ['a', 'b'] }, + const { container } = renderWithZod({ + element: , + schema: z.object({ + x: z.string().uniforms({ + fieldType: Array, + options: [ + { label: 'A', value: 'a' }, + { label: 'B', value: 'b' }, + ], + }), }), - ); + }); - expect(wrapper.find(Checkbox)).toHaveLength(2); - expect(wrapper.find(Switch)).toHaveLength(0); + expect(container.getElementsByClassName('MuiCheckbox-root').length).toBe(2); }); test(' - renders Switch with appearance=switch', () => { - const element = ; - const wrapper = mount( - element, - createContext({ - x: { type: Array }, - 'x.$': { type: String, allowedValues: ['a', 'b'] }, + const { container } = renderWithZod({ + element: , + schema: z.object({ + x: z.string().uniforms({ + fieldType: Array, + options: [ + { label: 'A', value: 'a' }, + { label: 'B', value: 'b' }, + ], + }), }), - ); - - expect(wrapper.find(Checkbox)).toHaveLength(0); - expect(wrapper.find(Switch)).toHaveLength(2); -}); + }); -test(' - works with special characters', () => { - mount( - , - createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), - ); + expect(container.getElementsByClassName('MuiSwitch-root').length).toBe(2); }); test(' - disabled items (checkboxes) based on predicate', () => { - const element = ( - - ); - const wrapper = mount( - element, - createContext({ - x: { type: Array }, - 'x.$': { type: String }, + renderWithZod({ + element: ( + + ), + schema: z.object({ + x: z.string().array(), }), - ); + }); - expect(wrapper.find(Checkbox)).toHaveLength(2); - expect(wrapper.find(FormControlLabel).at(0).prop('disabled')).toBe(true); - expect(wrapper.find(FormControlLabel).at(1).prop('disabled')).toBe(false); + expect(screen.getByLabelText('A')).toBeDisabled(); + expect(screen.getByLabelText('B')).not.toBeDisabled(); }); From 07869ece32c8918f1f7553a73fe785d6ae838b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Po=C5=9Bpiech?= Date: Sun, 16 Jun 2024 18:13:46 +0200 Subject: [PATCH 3/9] moved AntD SelectField tests to RTL --- .../uniforms-antd/__tests__/SelectField.tsx | 64 ++++++++++--------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/packages/uniforms-antd/__tests__/SelectField.tsx b/packages/uniforms-antd/__tests__/SelectField.tsx index 51064b090..8e0ea6f25 100644 --- a/packages/uniforms-antd/__tests__/SelectField.tsx +++ b/packages/uniforms-antd/__tests__/SelectField.tsx @@ -1,44 +1,48 @@ -import Select from 'antd/lib/select'; +import { fireEvent, screen } from '@testing-library/react'; import React from 'react'; import { SelectField } from 'uniforms-antd'; - -import createContext from './_createContext'; -import mount from './_mount'; +import { renderWithZod } from 'uniforms/__suites__'; +import { z } from 'zod'; test(' - renders a select which correctly reacts on change (array)', () => { const onChange = jest.fn(); - const element = ; - const wrapper = mount( - element, - createContext( - { - x: { type: Array }, - 'x.$': { type: String, allowedValues: ['a', 'b'] }, - }, - { onChange }, - ), - ); + renderWithZod({ + element: , + schema: z.object({ + x: z.string().uniforms({ + fieldType: Array, + options: [ + { label: 'A', value: 'a' }, + { label: 'B', value: 'b' }, + ], + }), + }), + onChange, + }); + + fireEvent.mouseDown(screen.getByRole('combobox')); + fireEvent.click(screen.getByText('B')); - expect(wrapper.find(Select)).toHaveLength(1); - // FIXME: Provide a valid option. - expect( - wrapper.find(Select).prop('onChange')!(['b'], null as any), - ).toBeFalsy(); expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); test(' - renders a select (undefined values)', () => { - const element = ; - const wrapper = mount( - element, - createContext({ - x: { type: Array }, - 'x.$': { type: String, allowedValues: ['a', 'b'] }, + const { container } = renderWithZod({ + element: , + schema: z.object({ + x: z.string().uniforms({ + fieldType: Array, + options: [ + { label: 'A', value: 'a' }, + { label: 'B', value: 'b' }, + ], + }), }), - ); + }); - expect(wrapper.find(Select)).toHaveLength(1); - expect(wrapper.find(Select).prop('value')).not.toContain(undefined); - expect(wrapper.find(Select).prop('value')).toContain('a'); + expect( + container.getElementsByClassName('ant-select-selection-item-content') + .length, + ).toBe(1); }); From fffdea59280cf197612c5bb0d12be259e93bf224 Mon Sep 17 00:00:00 2001 From: Konrad Bosak Date: Fri, 19 Jul 2024 13:04:16 +0200 Subject: [PATCH 4/9] Enable mui SelectField suite tests (#1355) Co-authored-by: Konrad Bosak --- .../uniforms-mui/__tests__/SelectField.tsx | 143 -------- packages/uniforms-mui/__tests__/index.ts | 5 +- packages/uniforms/__suites__/SelectField.tsx | 339 ++++++++++-------- 3 files changed, 200 insertions(+), 287 deletions(-) diff --git a/packages/uniforms-mui/__tests__/SelectField.tsx b/packages/uniforms-mui/__tests__/SelectField.tsx index d1944b7f5..b9cc43034 100644 --- a/packages/uniforms-mui/__tests__/SelectField.tsx +++ b/packages/uniforms-mui/__tests__/SelectField.tsx @@ -4,14 +4,6 @@ import { SelectField } from 'uniforms-mui'; import { renderWithZod } from 'uniforms/__suites__'; import { z } from 'zod'; -test(' - renders a Select', () => { - renderWithZod({ - element: , - schema: z.object({ x: z.enum(['a', 'b']) }), - }); - expect(screen.getByTestId('select-field')).toBeInTheDocument(); -}); - test(' - renders a Select with correct disabled state', () => { renderWithZod({ element: , @@ -32,37 +24,6 @@ test(' - renders a Select with correct required state', () => { expect(screen.getByLabelText('X *')).toBeInTheDocument(); }); -test(' - renders a Select with correct id (inherited)', () => { - renderWithZod({ - element: , - schema: z.object({ x: z.enum(['a', 'b']) }), - }); - - const select = screen.getByTestId('select-field').querySelector('[id]'); - expect(select?.getAttribute('id')).toBeTruthy(); -}); - -test(' - renders a Select with correct id (specified)', () => { - renderWithZod({ - element: , - schema: z.object({ x: z.enum(['a', 'b']) }), - }); - - const select = screen.getByTestId('select-field').querySelector('[id]'); - expect(select?.getAttribute('id')).toBe('y'); -}); - -test(' - renders a Select with correct name', () => { - renderWithZod({ - element: , - schema: z.object({ x: z.enum(['a', 'b']) }), - }); - - const select = screen.getByTestId('select-field'); - const elementWithAttribute = select.querySelector('[name="x"]') || select; - expect(elementWithAttribute?.getAttribute('name')).toBe('x'); -}); - test(' - renders a Select with correct options', () => { const selectOptions = ['a', 'b'] as const; renderWithZod({ @@ -171,49 +132,6 @@ test(' - renders a Select which correctly reacts on change (same va expect(onChange).toBeCalledTimes(0); }); -test(' - renders a label', () => { - renderWithZod({ - element: , - schema: z.object({ x: z.enum(['a', 'b']) }), - }); - - expect(screen.getByLabelText('y')).toBeInTheDocument(); -}); - -test(' - renders a SelectField with correct error text (showInlineError=true)', () => { - const error = new Error(); - renderWithZod({ - element: ( - - ), - schema: z.object({ x: z.enum(['a', 'b']) }), - }); - - expect(screen.getByText('Error')).toBeInTheDocument(); -}); - -test(' - renders a SelectField with correct error text (showInlineError=false)', () => { - const error = new Error(); - renderWithZod({ - element: ( - - ), - schema: z.object({ x: z.enum(['a', 'b']) }), - }); - - expect(screen.queryByText('Error')).not.toBeInTheDocument(); -}); - test(' - works with special characters', () => { renderWithZod({ element: , @@ -308,35 +226,6 @@ test(' - renders a set of Radio buttons with correct nam expect(screen.getByLabelText('b')).toHaveAttribute('name', 'x'); }); -test(' - renders a set of Radio buttons with correct options', () => { - renderWithZod({ - element: , - schema: z.object({ x: z.enum(['a', 'b']) }), - }); - - expect(screen.getByLabelText('a')).toBeInTheDocument(); - expect(screen.getByLabelText('b')).toBeInTheDocument(); -}); - -test(' - renders a set of Radio buttons with correct options (transform)', () => { - renderWithZod({ - element: ( - - ), - schema: z.object({ x: z.string() }), - }); - - expect(screen.getByLabelText('A')).toBeInTheDocument(); - expect(screen.getByLabelText('B')).toBeInTheDocument(); -}); - test(' - renders a set of Radio buttons with correct value (default)', () => { renderWithZod({ element: , @@ -381,29 +270,6 @@ test(' - renders a set of Radio buttons which correctly expect(onChange).toHaveBeenCalledWith('b'); }); -test(' - renders a set of Checkboxes which correctly reacts on change (array uncheck)', () => { - const onChange = jest.fn(); - - renderWithZod({ - element: ( - - ), - schema: z.object({ - x: z.string().uniforms({ - fieldType: Array, - options: [ - { label: 'A', value: 'a' }, - { label: 'B', value: 'b' }, - ], - }), - }), - }); - - fireEvent.click(screen.getByLabelText('B')); - - expect(onChange).toHaveBeenLastCalledWith([]); -}); - test(' - renders a set of Checkboxes with correct labels', () => { renderWithZod({ element: , @@ -422,15 +288,6 @@ test(' - renders a set of Checkboxes with correct labels expect(screen.getByLabelText('B')).toBeInTheDocument(); }); -test(' - renders a label', () => { - renderWithZod({ - element: , - schema: z.object({ x: z.enum(['a', 'b']) }), - }); - - expect(screen.getByText('y')).toBeInTheDocument(); -}); - test(' - renders a SelectField with correct error text (showInlineError=true)', () => { const error = new Error(); renderWithZod({ diff --git a/packages/uniforms-mui/__tests__/index.ts b/packages/uniforms-mui/__tests__/index.ts index 07c27deb1..c33083cad 100644 --- a/packages/uniforms-mui/__tests__/index.ts +++ b/packages/uniforms-mui/__tests__/index.ts @@ -55,7 +55,10 @@ describe('@RTL MUI', () => { suites.testQuickForm(theme.QuickForm); suites.testRadioField(theme.RadioField); // FIXME: MUI select does not work with new RTL test implementation - // suites.testSelectField(theme.SelectField, { showInlineError: true }); + suites.testSelectField(theme.SelectField, { + showInlineError: true, + theme: 'mui', + }); suites.testSubmitField(theme.SubmitField); suites.testTextField(theme.TextField); suites.testValidatedForm(theme.ValidatedForm); diff --git a/packages/uniforms/__suites__/SelectField.tsx b/packages/uniforms/__suites__/SelectField.tsx index 36d7a539e..de5220189 100644 --- a/packages/uniforms/__suites__/SelectField.tsx +++ b/packages/uniforms/__suites__/SelectField.tsx @@ -8,11 +8,14 @@ import { skipTestIf } from './skipTestIf'; export function testSelectField( SelectField: ComponentType, options?: { - theme?: 'antd'; + theme?: 'antd' | 'mui'; showInlineError?: boolean; getCheckboxInlineOption?: (screen: Screen) => Element | null; + reverseCheckboxOrder?: false; }, ) { + const isTheme = (themes: string[]) => themes.includes(options?.theme ?? ''); + test(' - renders a select', () => { renderWithZod({ element: , @@ -29,14 +32,17 @@ export function testSelectField( expect(screen.getByText('y')).toBeInTheDocument(); }); - test(' - renders a select with correct disabled state', () => { - renderWithZod({ - element: , - schema: z.object({ x: z.enum(['a', 'b']) }), - }); - const select = screen.getByRole('combobox'); - expect(select).toBeDisabled(); - }); + skipTestIf(isTheme(['mui', 'antd']))( + ' - renders a select with correct disabled state', + () => { + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); + const select = screen.getByRole('combobox'); + expect(select).toBeDisabled(); + }, + ); test(' - renders a select with correct readOnly state', () => { const onChange = jest.fn(); @@ -56,7 +62,7 @@ export function testSelectField( expect(onChange).not.toHaveBeenCalled(); }); - skipTestIf(options?.theme === 'antd')( + skipTestIf(isTheme(['mui', 'antd']))( ' - ignores selection with readOnly state ', () => { const onChange = jest.fn(); @@ -77,7 +83,7 @@ export function testSelectField( }, ); - skipTestIf(options?.theme === 'antd')( + skipTestIf(isTheme(['mui', 'antd']))( ' - (multiple) renders a select which correctly reacts on change (uncheck) by value', () => { const onChange = jest.fn(); @@ -91,7 +97,7 @@ export function testSelectField( }, ); - skipTestIf(options?.theme === 'antd')( + skipTestIf(isTheme(['mui', 'antd']))( ' - (multiple) renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { const onChange = jest.fn(); @@ -105,7 +111,7 @@ export function testSelectField( }, ); - skipTestIf(options?.theme === 'antd')( + skipTestIf(isTheme(['mui', 'antd']))( ' - (multiple) renders a select which correctly reacts on change (checked) by selectedIndex', () => { const onChange = jest.fn(); @@ -119,7 +125,7 @@ export function testSelectField( }, ); - skipTestIf(options?.theme === 'antd')( + skipTestIf(isTheme(['mui', 'antd']))( ' - renders a select which correctly reacts on change (uncheck) by value', () => { const onChange = jest.fn(); @@ -133,7 +139,7 @@ export function testSelectField( }, ); - skipTestIf(options?.theme === 'antd')( + skipTestIf(isTheme(['mui', 'antd']))( ' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { const onChange = jest.fn(); @@ -175,41 +181,47 @@ export function testSelectField( expect(elementWithAttribute?.getAttribute('name')).toBe('x'); }); - test(' - renders a select with correct options', () => { - const selectOptions = ['a', 'b'] as const; - renderWithZod({ - element: , - schema: z.object({ x: z.enum(selectOptions) }), - }); - const combobox = screen.getByRole('combobox'); - fireEvent.mouseDown(combobox); - selectOptions.forEach(option => { - expect(screen.getByRole('option', { name: option })).not.toBeNull(); - }); - }); + skipTestIf(isTheme(['mui']))( + ' - renders a select with correct options', + () => { + const selectOptions = ['a', 'b'] as const; + renderWithZod({ + element: , + schema: z.object({ x: z.enum(selectOptions) }), + }); + const combobox = screen.getByRole('combobox'); + fireEvent.mouseDown(combobox); + selectOptions.forEach(option => { + expect(screen.getByRole('option', { name: option })).not.toBeNull(); + }); + }, + ); - test(' - renders a select with correct options (transform)', () => { - const selectOptions = ['a', 'b'] as const; - renderWithZod({ - element: ( - - ), - schema: z.object({ x: z.enum(selectOptions) }), - }); - const combobox = screen.getByRole('combobox'); - fireEvent.mouseDown(combobox); - selectOptions.forEach(option => { - expect( - screen.getByRole('option', { name: option.toUpperCase() }), - ).toBeInTheDocument(); - }); - }); + skipTestIf(isTheme(['mui']))( + ' - renders a select with correct options (transform)', + () => { + const selectOptions = ['a', 'b'] as const; + renderWithZod({ + element: ( + + ), + schema: z.object({ x: z.enum(selectOptions) }), + }); + const combobox = screen.getByRole('combobox'); + fireEvent.mouseDown(combobox); + selectOptions.forEach(option => { + expect( + screen.getByRole('option', { name: option.toUpperCase() }), + ).toBeInTheDocument(); + }); + }, + ); test(' - renders a select with correct placeholder (fallback)', () => { renderWithZod({ @@ -219,7 +231,7 @@ export function testSelectField( expect(screen.getByText('y')).toBeInTheDocument(); }); - skipTestIf(options?.theme === 'antd')( + skipTestIf(isTheme(['antd', 'mui']))( ' - renders a select with correct placeholder (implicit)', () => { renderWithZod({ @@ -230,59 +242,71 @@ export function testSelectField( }, ); - test(' - renders a select with correct value (default)', () => { - renderWithZod({ - element: , - schema: z.object({ x: z.enum(['a', 'b']) }), - }); - const select = screen.getByRole('combobox'); - if (options?.theme === 'antd') { - expect(screen.getByText('a')).toBeInTheDocument(); - expect(screen.queryByText('b')).not.toBeInTheDocument(); - } else { - expect(select).toHaveValue('a'); - } - }); + skipTestIf(isTheme(['antd', 'mui']))( + ' - renders a select with correct value (default)', + () => { + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); + const select = screen.getByRole('combobox'); + if (options?.theme === 'antd') { + expect(screen.getByText('a')).toBeInTheDocument(); + expect(screen.queryByText('b')).not.toBeInTheDocument(); + } else { + expect(select).toHaveValue('a'); + } + }, + ); - test(' - renders a select with missing value (model)', () => { - renderWithZod({ - element: , - schema: z.object({ x: z.enum(['a', 'b']) }), - }); - const select = screen.getByRole('combobox'); - expect(select).toHaveValue(''); - }); + skipTestIf(isTheme(['antd', 'mui']))( + ' - renders a select with missing value (model)', + () => { + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); + const select = screen.getByRole('combobox'); + expect(select).toHaveValue(''); + }, + ); - test(' - renders a select with correct value (model)', () => { - renderWithZod({ - element: , - schema: z.object({ x: z.enum(['a', 'b']) }), - model: { x: 'b' }, - }); - const select = screen.getByRole('combobox'); - if (options?.theme === 'antd') { - expect(screen.getByText('b')).toBeInTheDocument(); - expect(screen.queryByText('a')).not.toBeInTheDocument(); - } else { - expect(select).toHaveValue('b'); - } - }); + skipTestIf(isTheme(['antd', 'mui']))( + ' - renders a select with correct value (model)', + () => { + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + model: { x: 'b' }, + }); + const select = screen.getByRole('combobox'); + if (options?.theme === 'antd') { + expect(screen.getByText('b')).toBeInTheDocument(); + expect(screen.queryByText('a')).not.toBeInTheDocument(); + } else { + expect(select).toHaveValue('b'); + } + }, + ); - test(' - renders a select with correct value (specified)', () => { - renderWithZod({ - element: , - schema: z.object({ x: z.enum(['a', 'b']) }), - }); - const select = screen.getByRole('combobox'); - if (options?.theme === 'antd') { - expect(screen.getByText('b')).toBeInTheDocument(); - expect(screen.queryByText('a')).not.toBeInTheDocument(); - } else { - expect(select).toHaveValue('b'); - } - }); + skipTestIf(isTheme(['antd', 'mui']))( + ' - renders a select with correct value (specified)', + () => { + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['a', 'b']) }), + }); + const select = screen.getByRole('combobox'); + if (options?.theme === 'antd') { + expect(screen.getByText('b')).toBeInTheDocument(); + expect(screen.queryByText('a')).not.toBeInTheDocument(); + } else { + expect(select).toHaveValue('b'); + } + }, + ); - skipTestIf(options?.theme === 'antd')( + skipTestIf(isTheme(['antd', 'mui']))( ' - renders a select which correctly reacts on change', () => { const onChange = jest.fn(); @@ -296,7 +320,7 @@ export function testSelectField( }, ); - skipTestIf(options?.theme === 'antd')( + skipTestIf(isTheme(['antd', 'mui']))( ' - renders a select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); @@ -310,7 +334,7 @@ export function testSelectField( }, ); - skipTestIf(options?.theme === 'antd')( + skipTestIf(isTheme(['antd', 'mui']))( ' - renders a select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); @@ -344,18 +368,21 @@ export function testSelectField( expect(field).toHaveAttribute('data-y', 'y'); }); - test(' - works with special characters', () => { - renderWithZod({ - element: , - schema: z.object({ x: z.enum(['ă', 'ś']) }), - }); - const combobox = screen.getByRole('combobox'); - fireEvent.mouseDown(combobox); - expect(screen.getAllByText('ă')[0]).toBeInTheDocument(); - expect(screen.getAllByText('ś')[0]).toBeInTheDocument(); - }); + skipTestIf(isTheme(['mui']))( + ' - works with special characters', + () => { + renderWithZod({ + element: , + schema: z.object({ x: z.enum(['ă', 'ś']) }), + }); + const combobox = screen.getByRole('combobox'); + fireEvent.mouseDown(combobox); + expect(screen.getAllByText('ă')[0]).toBeInTheDocument(); + expect(screen.getAllByText('ś')[0]).toBeInTheDocument(); + }, + ); - skipTestIf(options?.theme === 'antd')( + skipTestIf(isTheme(['antd', 'mui']))( ' - disabled items (options)', () => { renderWithZod({ @@ -380,7 +407,11 @@ export function testSelectField( element: , schema: z.object({ x: z.enum(['a', 'b']) }), }); - expect(screen.getAllByRole(/checkbox|radio/)).toHaveLength(2); + expect( + screen + .getAllByRole(/checkbox|radio/) + .filter(element => element instanceof HTMLInputElement), + ).toHaveLength(2); }); test(' - renders a set of checkboxes with correct disabled state', () => { @@ -388,7 +419,9 @@ export function testSelectField( element: , schema: z.object({ x: z.enum(['a', 'b']) }), }); - const checkboxes = screen.getAllByRole(/checkbox|radio/); + const checkboxes = screen + .getAllByRole(/checkbox|radio/) + .filter(element => element instanceof HTMLInputElement); expect(checkboxes?.[0]).toBeDisabled(); expect(checkboxes?.[1]).toBeDisabled(); }); @@ -415,7 +448,7 @@ export function testSelectField( }, ); - skipTestIf(options?.theme === 'antd')( + skipTestIf(isTheme(['antd']))( ' - renders a set of checkboxes with correct id (inherited)', () => { renderWithZod({ @@ -427,14 +460,16 @@ export function testSelectField( }, ); - skipTestIf(options?.theme === 'antd')( + skipTestIf(isTheme(['antd']))( ' - renders a set of checkboxes with correct id (specified)', () => { renderWithZod({ element: , schema: z.object({ x: z.enum(['a', 'b']) }), }); - const checkboxes = screen.getAllByRole(/checkbox|radio/); + const checkboxes = screen + .getAllByRole(/checkbox|radio/) + .filter(element => element instanceof HTMLInputElement); expect(checkboxes?.[0]).toHaveAttribute('id', 'y-YQ'); expect(checkboxes?.[1]).toHaveAttribute('id', 'y-Yg'); }, @@ -445,7 +480,9 @@ export function testSelectField( element: , schema: z.object({ x: z.enum(['a', 'b']) }), }); - const checkboxes = screen.getAllByRole(/checkbox|radio/); + const checkboxes = screen + .getAllByRole(/checkbox|radio/) + .filter(element => element instanceof HTMLInputElement); expect(checkboxes?.[0]).toHaveAttribute('name', 'x'); expect(checkboxes?.[1]).toHaveAttribute('name', 'x'); }); @@ -482,7 +519,9 @@ export function testSelectField( element: , schema: z.object({ x: z.enum(['a', 'b']) }), }); - const checkboxes = screen.getAllByRole(/checkbox|radio/); + const checkboxes = screen + .getAllByRole(/checkbox|radio/) + .filter(element => element instanceof HTMLInputElement); expect(checkboxes?.[0]).toBeChecked(); expect(checkboxes?.[1]).not.toBeChecked(); }); @@ -493,7 +532,9 @@ export function testSelectField( schema: z.object({ x: z.enum(['a', 'b']) }), model: { x: 'b' }, }); - const checkboxes = screen.getAllByRole(/checkbox|radio/); + const checkboxes = screen + .getAllByRole(/checkbox|radio/) + .filter(element => element instanceof HTMLInputElement); expect(checkboxes?.[0]).not.toBeChecked(); expect(checkboxes?.[1]).toBeChecked(); }); @@ -503,7 +544,9 @@ export function testSelectField( element: , schema: z.object({ x: z.enum(['a', 'b']) }), }); - const checkboxes = screen.getAllByRole(/checkbox|radio/); + const checkboxes = screen + .getAllByRole(/checkbox|radio/) + .filter(element => element instanceof HTMLInputElement); expect(checkboxes?.[0]).not.toBeChecked(); expect(checkboxes?.[1]).toBeChecked(); }); @@ -514,7 +557,10 @@ export function testSelectField( element: , schema: z.object({ x: z.enum(['a', 'b']) }), }); - const checkboxes = screen.getAllByRole(/checkbox|radio/); + const checkboxes = screen + .getAllByRole(/checkbox|radio/) + .filter(element => element instanceof HTMLInputElement); + fireEvent.click(checkboxes?.[1]); expect(onChange).toHaveBeenCalledWith('b'); }); @@ -579,25 +625,29 @@ export function testSelectField( expect(screen.getByText('y')).toBeInTheDocument(); }); - test(' - renders a wrapper with unknown props', () => { - renderWithZod({ - element: ( - - ), - schema: z.object({ x: z.enum(['a', 'b']) }), - }); - const field = screen.getByTestId('select-field'); - expect(field).toHaveAttribute('data-x', 'x'); - expect(field).toHaveAttribute('data-z', 'z'); - expect(field).toHaveAttribute('data-y', 'y'); - }); + // TODO: Fix me - MUI renders multiple checkboxes and wrappers with the same id + skipTestIf(isTheme(['mui']))( + ' - renders a wrapper with unknown props', + () => { + renderWithZod({ + element: ( + + ), + schema: z.object({ x: z.enum(['a', 'b']) }), + }); + const field = screen.getByTestId('select-field'); + expect(field).toHaveAttribute('data-x', 'x'); + expect(field).toHaveAttribute('data-z', 'z'); + expect(field).toHaveAttribute('data-y', 'y'); + }, + ); test(' - works with special characters', () => { renderWithZod({ @@ -622,7 +672,10 @@ export function testSelectField( ), schema: z.object({ x: z.enum(['a', 'b']) }), }); - const checkboxes = screen.getAllByRole(/checkbox|radio/); + const checkboxes = screen + .getAllByRole(/checkbox|radio/) + .filter(element => element instanceof HTMLInputElement); + expect(checkboxes?.[0]).toBeDisabled(); expect(checkboxes?.[1]).not.toBeDisabled(); }); @@ -650,7 +703,7 @@ export function testSelectField( }, ); - skipTestIf(!options?.showInlineError)( + skipTestIf(options?.showInlineError !== false)( ' - renders correct error text (showInlineError=false)', () => { const error = new Error(); From 7c66df6b8b3a1de58e9662e86e36b48b26d1bd6c Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Thu, 25 Jul 2024 11:33:29 +0200 Subject: [PATCH 5/9] remove_enzyme from project --- package-lock.json | 85 ++++++++++++++----- package.json | 1 - packages/uniforms-antd/__tests__/_mount.tsx | 14 --- .../uniforms-bootstrap4/__tests__/_mount.tsx | 14 --- .../uniforms-bootstrap5/__tests__/_mount.tsx | 14 --- packages/uniforms-mui/__tests__/_mount.tsx | 14 --- .../uniforms-semantic/__tests__/_mount.tsx | 14 --- packages/uniforms/__tests__/_mount.tsx | 14 --- 8 files changed, 63 insertions(+), 107 deletions(-) delete mode 100644 packages/uniforms-antd/__tests__/_mount.tsx delete mode 100644 packages/uniforms-bootstrap4/__tests__/_mount.tsx delete mode 100644 packages/uniforms-bootstrap5/__tests__/_mount.tsx delete mode 100644 packages/uniforms-mui/__tests__/_mount.tsx delete mode 100644 packages/uniforms-semantic/__tests__/_mount.tsx delete mode 100644 packages/uniforms/__tests__/_mount.tsx diff --git a/package-lock.json b/package-lock.json index a8c273b0b..0be5c3001 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,6 @@ "classnames": "^2.0.0", "core-js": "3.8.3", "csstype": "3.0.10", - "enzyme": "3.11.0", "eslint-config-vazco": "6.2.0", "eslint-import-resolver-alias": "1.1.2", "eslint-import-resolver-typescript": "2.3.0", @@ -10131,6 +10130,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/array.prototype.filter/-/array.prototype.filter-1.0.0.tgz", "integrity": "sha512-TfO1gz+tLm+Bswq0FBOXPqAchtCr2Rn48T8dLJoRFl8NoEosjZmzptmuo1X8aZBzZcqsR1W8U761tjACJtngTQ==", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", @@ -10149,6 +10149,7 @@ "version": "1.2.4", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz", "integrity": "sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg==", + "peer": true, "dependencies": { "call-bind": "^1.0.0", "define-properties": "^1.1.3", @@ -13172,7 +13173,8 @@ "node_modules/discontinuous-range": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz", - "integrity": "sha1-44Mx8IRLukm5qctxx3FYWqsbxlo=" + "integrity": "sha1-44Mx8IRLukm5qctxx3FYWqsbxlo=", + "peer": true }, "node_modules/dns-equal": { "version": "1.0.0", @@ -13492,6 +13494,7 @@ "version": "3.11.0", "resolved": "https://registry.npmjs.org/enzyme/-/enzyme-3.11.0.tgz", "integrity": "sha512-Dw8/Gs4vRjxY6/6i9wU0V+utmQO9kvh9XLnz3LIudviOnVYDEe2ec+0k+NQoMamn1VrjKgCUOWj5jG/5M5M0Qw==", + "peer": true, "dependencies": { "array.prototype.flat": "^1.2.3", "cheerio": "^1.0.0-rc.3", @@ -13579,7 +13582,8 @@ "node_modules/es-array-method-boxes-properly": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", - "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==" + "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", + "peer": true }, "node_modules/es-get-iterator": { "version": "1.1.3", @@ -15964,6 +15968,7 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/html-element-map/-/html-element-map-1.3.1.tgz", "integrity": "sha512-6XMlxrAFX4UEEGxctfFnmrFaaZFNf9i5fNuV5wZ3WWQ4FVaNP1aX1LkX9j2mfEx1NpjeE/rL3nmgEn23GdFmrg==", + "peer": true, "dependencies": { "array.prototype.filter": "^1.0.0", "call-bind": "^1.0.2" @@ -17029,7 +17034,8 @@ "node_modules/is-subset": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-subset/-/is-subset-0.1.1.tgz", - "integrity": "sha1-ilkRfZMt4d4A8kX83TnOQ/HpOaY=" + "integrity": "sha1-ilkRfZMt4d4A8kX83TnOQ/HpOaY=", + "peer": true }, "node_modules/is-symbol": { "version": "1.0.4", @@ -19177,12 +19183,14 @@ "node_modules/lodash.escape": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-4.0.1.tgz", - "integrity": "sha1-yQRGkMIeBClL6qUXcS/e0fqI3pg=" + "integrity": "sha1-yQRGkMIeBClL6qUXcS/e0fqI3pg=", + "peer": true }, "node_modules/lodash.flattendeep": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", - "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=" + "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", + "peer": true }, "node_modules/lodash.flow": { "version": "3.5.0", @@ -19192,7 +19200,8 @@ "node_modules/lodash.isequal": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=" + "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", + "peer": true }, "node_modules/lodash.ismatch": { "version": "4.4.0", @@ -20167,7 +20176,8 @@ "node_modules/moo": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.1.tgz", - "integrity": "sha512-I1mnb5xn4fO80BH9BLcF0yLypy2UKl+Cb01Fu0hJRkJjlCRtxZMWkTdAtDd5ZqCOxtCkhmRwyI57vWT+1iZ67w==" + "integrity": "sha512-I1mnb5xn4fO80BH9BLcF0yLypy2UKl+Cb01Fu0hJRkJjlCRtxZMWkTdAtDd5ZqCOxtCkhmRwyI57vWT+1iZ67w==", + "peer": true }, "node_modules/mrmime": { "version": "1.0.0", @@ -20285,6 +20295,7 @@ "version": "2.20.1", "resolved": "https://registry.npmjs.org/nearley/-/nearley-2.20.1.tgz", "integrity": "sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==", + "peer": true, "dependencies": { "commander": "^2.19.0", "moo": "^0.5.0", @@ -20305,7 +20316,8 @@ "node_modules/nearley/node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "peer": true }, "node_modules/negotiator": { "version": "0.6.3", @@ -20878,6 +20890,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.4.tgz", "integrity": "sha512-h4LWKWE+wKQGhtMjZEBud7uLGhqyLwj8fpHOarZhD2uY3C9cRtk57VQ89ke3moByLXMedqs3XCHzyb4AmA2DjA==", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", @@ -21577,7 +21590,8 @@ "node_modules/performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "peer": true }, "node_modules/picocolors": { "version": "1.0.0", @@ -22962,6 +22976,7 @@ "version": "3.4.1", "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", + "peer": true, "dependencies": { "performance-now": "^2.1.0" } @@ -22969,12 +22984,14 @@ "node_modules/railroad-diagrams": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz", - "integrity": "sha1-635iZ1SN3t+4mcG5Dlc3RVnN234=" + "integrity": "sha1-635iZ1SN3t+4mcG5Dlc3RVnN234=", + "peer": true }, "node_modules/randexp": { "version": "0.4.6", "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.4.6.tgz", "integrity": "sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==", + "peer": true, "dependencies": { "discontinuous-range": "1.0.0", "ret": "~0.1.10" @@ -24937,6 +24954,7 @@ "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "peer": true, "engines": { "node": ">=0.12" } @@ -24981,6 +24999,7 @@ "version": "2.2.3", "resolved": "https://registry.npmjs.org/rst-selector-parser/-/rst-selector-parser-2.2.3.tgz", "integrity": "sha1-gbIw6i/MYGbInjRy3nlChdmwPZE=", + "peer": true, "dependencies": { "lodash.flattendeep": "^4.4.0", "nearley": "^2.7.10" @@ -25999,6 +26018,7 @@ "version": "1.2.4", "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.4.tgz", "integrity": "sha512-hWCk/iqf7lp0/AgTF7/ddO1IWtSNPASjlzCicV5irAVdE1grjsneK26YG6xACMBEdCvO8fUST0UzDMh/2Qy+9Q==", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", @@ -35923,6 +35943,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/array.prototype.filter/-/array.prototype.filter-1.0.0.tgz", "integrity": "sha512-TfO1gz+tLm+Bswq0FBOXPqAchtCr2Rn48T8dLJoRFl8NoEosjZmzptmuo1X8aZBzZcqsR1W8U761tjACJtngTQ==", + "peer": true, "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", @@ -35935,6 +35956,7 @@ "version": "1.2.4", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz", "integrity": "sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg==", + "peer": true, "requires": { "call-bind": "^1.0.0", "define-properties": "^1.1.3", @@ -38116,7 +38138,8 @@ "discontinuous-range": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz", - "integrity": "sha1-44Mx8IRLukm5qctxx3FYWqsbxlo=" + "integrity": "sha1-44Mx8IRLukm5qctxx3FYWqsbxlo=", + "peer": true }, "dns-equal": { "version": "1.0.0", @@ -38372,6 +38395,7 @@ "version": "3.11.0", "resolved": "https://registry.npmjs.org/enzyme/-/enzyme-3.11.0.tgz", "integrity": "sha512-Dw8/Gs4vRjxY6/6i9wU0V+utmQO9kvh9XLnz3LIudviOnVYDEe2ec+0k+NQoMamn1VrjKgCUOWj5jG/5M5M0Qw==", + "peer": true, "requires": { "array.prototype.flat": "^1.2.3", "cheerio": "^1.0.0-rc.3", @@ -38447,7 +38471,8 @@ "es-array-method-boxes-properly": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", - "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==" + "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", + "peer": true }, "es-get-iterator": { "version": "1.1.3", @@ -40237,6 +40262,7 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/html-element-map/-/html-element-map-1.3.1.tgz", "integrity": "sha512-6XMlxrAFX4UEEGxctfFnmrFaaZFNf9i5fNuV5wZ3WWQ4FVaNP1aX1LkX9j2mfEx1NpjeE/rL3nmgEn23GdFmrg==", + "peer": true, "requires": { "array.prototype.filter": "^1.0.0", "call-bind": "^1.0.2" @@ -40960,7 +40986,8 @@ "is-subset": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-subset/-/is-subset-0.1.1.tgz", - "integrity": "sha1-ilkRfZMt4d4A8kX83TnOQ/HpOaY=" + "integrity": "sha1-ilkRfZMt4d4A8kX83TnOQ/HpOaY=", + "peer": true }, "is-symbol": { "version": "1.0.4", @@ -42532,12 +42559,14 @@ "lodash.escape": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-4.0.1.tgz", - "integrity": "sha1-yQRGkMIeBClL6qUXcS/e0fqI3pg=" + "integrity": "sha1-yQRGkMIeBClL6qUXcS/e0fqI3pg=", + "peer": true }, "lodash.flattendeep": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", - "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=" + "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", + "peer": true }, "lodash.flow": { "version": "3.5.0", @@ -42547,7 +42576,8 @@ "lodash.isequal": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=" + "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", + "peer": true }, "lodash.ismatch": { "version": "4.4.0", @@ -43265,7 +43295,8 @@ "moo": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.1.tgz", - "integrity": "sha512-I1mnb5xn4fO80BH9BLcF0yLypy2UKl+Cb01Fu0hJRkJjlCRtxZMWkTdAtDd5ZqCOxtCkhmRwyI57vWT+1iZ67w==" + "integrity": "sha512-I1mnb5xn4fO80BH9BLcF0yLypy2UKl+Cb01Fu0hJRkJjlCRtxZMWkTdAtDd5ZqCOxtCkhmRwyI57vWT+1iZ67w==", + "peer": true }, "mrmime": { "version": "1.0.0", @@ -43355,6 +43386,7 @@ "version": "2.20.1", "resolved": "https://registry.npmjs.org/nearley/-/nearley-2.20.1.tgz", "integrity": "sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==", + "peer": true, "requires": { "commander": "^2.19.0", "moo": "^0.5.0", @@ -43365,7 +43397,8 @@ "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "peer": true } } }, @@ -43802,6 +43835,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.4.tgz", "integrity": "sha512-h4LWKWE+wKQGhtMjZEBud7uLGhqyLwj8fpHOarZhD2uY3C9cRtk57VQ89ke3moByLXMedqs3XCHzyb4AmA2DjA==", + "peer": true, "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", @@ -44304,7 +44338,8 @@ "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "peer": true }, "picocolors": { "version": "1.0.0", @@ -45226,6 +45261,7 @@ "version": "3.4.1", "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", + "peer": true, "requires": { "performance-now": "^2.1.0" } @@ -45233,12 +45269,14 @@ "railroad-diagrams": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz", - "integrity": "sha1-635iZ1SN3t+4mcG5Dlc3RVnN234=" + "integrity": "sha1-635iZ1SN3t+4mcG5Dlc3RVnN234=", + "peer": true }, "randexp": { "version": "0.4.6", "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.4.6.tgz", "integrity": "sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==", + "peer": true, "requires": { "discontinuous-range": "1.0.0", "ret": "~0.1.10" @@ -46688,7 +46726,8 @@ "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", - "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==" + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "peer": true }, "retry": { "version": "0.12.0", @@ -46717,6 +46756,7 @@ "version": "2.2.3", "resolved": "https://registry.npmjs.org/rst-selector-parser/-/rst-selector-parser-2.2.3.tgz", "integrity": "sha1-gbIw6i/MYGbInjRy3nlChdmwPZE=", + "peer": true, "requires": { "lodash.flattendeep": "^4.4.0", "nearley": "^2.7.10" @@ -47514,6 +47554,7 @@ "version": "1.2.4", "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.4.tgz", "integrity": "sha512-hWCk/iqf7lp0/AgTF7/ddO1IWtSNPASjlzCicV5irAVdE1grjsneK26YG6xACMBEdCvO8fUST0UzDMh/2Qy+9Q==", + "peer": true, "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", diff --git a/package.json b/package.json index 780610477..ab031f9bc 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,6 @@ "classnames": "^2.0.0", "core-js": "3.8.3", "csstype": "3.0.10", - "enzyme": "3.11.0", "eslint-config-vazco": "6.2.0", "eslint-import-resolver-alias": "1.1.2", "eslint-import-resolver-typescript": "2.3.0", diff --git a/packages/uniforms-antd/__tests__/_mount.tsx b/packages/uniforms-antd/__tests__/_mount.tsx deleted file mode 100644 index d586e42dd..000000000 --- a/packages/uniforms-antd/__tests__/_mount.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { mount as enzyme } from 'enzyme'; -import { context } from 'uniforms'; - -function mount(node: any, options: any) { - if (options === undefined) { - return enzyme(node); - } - return enzyme(node, { - wrappingComponent: context.Provider, - wrappingComponentProps: { value: options.context }, - }); -} - -export default mount as typeof enzyme; diff --git a/packages/uniforms-bootstrap4/__tests__/_mount.tsx b/packages/uniforms-bootstrap4/__tests__/_mount.tsx deleted file mode 100644 index d586e42dd..000000000 --- a/packages/uniforms-bootstrap4/__tests__/_mount.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { mount as enzyme } from 'enzyme'; -import { context } from 'uniforms'; - -function mount(node: any, options: any) { - if (options === undefined) { - return enzyme(node); - } - return enzyme(node, { - wrappingComponent: context.Provider, - wrappingComponentProps: { value: options.context }, - }); -} - -export default mount as typeof enzyme; diff --git a/packages/uniforms-bootstrap5/__tests__/_mount.tsx b/packages/uniforms-bootstrap5/__tests__/_mount.tsx deleted file mode 100644 index d586e42dd..000000000 --- a/packages/uniforms-bootstrap5/__tests__/_mount.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { mount as enzyme } from 'enzyme'; -import { context } from 'uniforms'; - -function mount(node: any, options: any) { - if (options === undefined) { - return enzyme(node); - } - return enzyme(node, { - wrappingComponent: context.Provider, - wrappingComponentProps: { value: options.context }, - }); -} - -export default mount as typeof enzyme; diff --git a/packages/uniforms-mui/__tests__/_mount.tsx b/packages/uniforms-mui/__tests__/_mount.tsx deleted file mode 100644 index d586e42dd..000000000 --- a/packages/uniforms-mui/__tests__/_mount.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { mount as enzyme } from 'enzyme'; -import { context } from 'uniforms'; - -function mount(node: any, options: any) { - if (options === undefined) { - return enzyme(node); - } - return enzyme(node, { - wrappingComponent: context.Provider, - wrappingComponentProps: { value: options.context }, - }); -} - -export default mount as typeof enzyme; diff --git a/packages/uniforms-semantic/__tests__/_mount.tsx b/packages/uniforms-semantic/__tests__/_mount.tsx deleted file mode 100644 index d586e42dd..000000000 --- a/packages/uniforms-semantic/__tests__/_mount.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { mount as enzyme } from 'enzyme'; -import { context } from 'uniforms'; - -function mount(node: any, options: any) { - if (options === undefined) { - return enzyme(node); - } - return enzyme(node, { - wrappingComponent: context.Provider, - wrappingComponentProps: { value: options.context }, - }); -} - -export default mount as typeof enzyme; diff --git a/packages/uniforms/__tests__/_mount.tsx b/packages/uniforms/__tests__/_mount.tsx deleted file mode 100644 index d586e42dd..000000000 --- a/packages/uniforms/__tests__/_mount.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { mount as enzyme } from 'enzyme'; -import { context } from 'uniforms'; - -function mount(node: any, options: any) { - if (options === undefined) { - return enzyme(node); - } - return enzyme(node, { - wrappingComponent: context.Provider, - wrappingComponentProps: { value: options.context }, - }); -} - -export default mount as typeof enzyme; From dc65c08ffe4fea3eac4fc152ad30a2251eaeff2f Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Thu, 25 Jul 2024 11:55:34 +0200 Subject: [PATCH 6/9] delete script for setup enzyme --- package-lock.json | 510 ++--------------------------------------- package.json | 1 - scripts/setupEnzyme.ts | 18 -- 3 files changed, 19 insertions(+), 510 deletions(-) delete mode 100644 scripts/setupEnzyme.ts diff --git a/package-lock.json b/package-lock.json index 0be5c3001..b6d5e570a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,6 @@ "@types/react-dom": "17.0.11", "@types/simpl-schema": "1.12.2", "@types/warning": "3.0.0", - "@wojtekmaj/enzyme-adapter-react-17": "0.6.0", "ajv": "8.0.5", "antd": "4.10.3", "classnames": "^2.0.0", @@ -9625,41 +9624,6 @@ "@xtuc/long": "4.2.2" } }, - "node_modules/@wojtekmaj/enzyme-adapter-react-17": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@wojtekmaj/enzyme-adapter-react-17/-/enzyme-adapter-react-17-0.6.0.tgz", - "integrity": "sha512-2lRGjZDNTaUyIHLEKqkbGIKK0I4vLgXOcwt90ddsOAGalrZGKmnHnFQzFoO9V84hF+fMYHkpRqka4JGCnvkoow==", - "dependencies": { - "@wojtekmaj/enzyme-adapter-utils": "^0.1.0", - "enzyme-shallow-equal": "^1.0.0", - "has": "^1.0.0", - "object.assign": "^4.1.0", - "object.values": "^1.1.0", - "prop-types": "^15.7.0", - "react-is": "^17.0.0", - "react-test-renderer": "^17.0.0" - }, - "peerDependencies": { - "enzyme": "^3.0.0", - "react": "^17.0.0-0", - "react-dom": "^17.0.0-0" - } - }, - "node_modules/@wojtekmaj/enzyme-adapter-utils": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@wojtekmaj/enzyme-adapter-utils/-/enzyme-adapter-utils-0.1.1.tgz", - "integrity": "sha512-bNPWtN/d8huKOkC6j1E3EkSamnRrHHT7YuR6f9JppAQqtoAm3v4/vERe4J14jQKmHLCyEBHXrlgb7H6l817hVg==", - "dependencies": { - "function.prototype.name": "^1.1.0", - "has": "^1.0.0", - "object.assign": "^4.1.0", - "object.fromentries": "^2.0.0", - "prop-types": "^15.7.0" - }, - "peerDependencies": { - "react": "^17.0.0-0" - } - }, "node_modules/@xtuc/ieee754": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", @@ -10126,25 +10090,6 @@ "node": ">=8" } }, - "node_modules/array.prototype.filter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array.prototype.filter/-/array.prototype.filter-1.0.0.tgz", - "integrity": "sha512-TfO1gz+tLm+Bswq0FBOXPqAchtCr2Rn48T8dLJoRFl8NoEosjZmzptmuo1X8aZBzZcqsR1W8U761tjACJtngTQ==", - "peer": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0", - "es-array-method-boxes-properly": "^1.0.0", - "is-string": "^1.0.5" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/array.prototype.flat": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz", @@ -13170,12 +13115,6 @@ "node": ">=8" } }, - "node_modules/discontinuous-range": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz", - "integrity": "sha1-44Mx8IRLukm5qctxx3FYWqsbxlo=", - "peer": true - }, "node_modules/dns-equal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", @@ -13490,51 +13429,6 @@ "node": ">=4" } }, - "node_modules/enzyme": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/enzyme/-/enzyme-3.11.0.tgz", - "integrity": "sha512-Dw8/Gs4vRjxY6/6i9wU0V+utmQO9kvh9XLnz3LIudviOnVYDEe2ec+0k+NQoMamn1VrjKgCUOWj5jG/5M5M0Qw==", - "peer": true, - "dependencies": { - "array.prototype.flat": "^1.2.3", - "cheerio": "^1.0.0-rc.3", - "enzyme-shallow-equal": "^1.0.1", - "function.prototype.name": "^1.1.2", - "has": "^1.0.3", - "html-element-map": "^1.2.0", - "is-boolean-object": "^1.0.1", - "is-callable": "^1.1.5", - "is-number-object": "^1.0.4", - "is-regex": "^1.0.5", - "is-string": "^1.0.5", - "is-subset": "^0.1.1", - "lodash.escape": "^4.0.1", - "lodash.isequal": "^4.5.0", - "object-inspect": "^1.7.0", - "object-is": "^1.0.2", - "object.assign": "^4.1.0", - "object.entries": "^1.1.1", - "object.values": "^1.1.1", - "raf": "^3.4.1", - "rst-selector-parser": "^2.2.3", - "string.prototype.trim": "^1.2.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/enzyme-shallow-equal": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/enzyme-shallow-equal/-/enzyme-shallow-equal-1.0.4.tgz", - "integrity": "sha512-MttIwB8kKxypwHvRynuC3ahyNc+cFbR8mjVIltnmzQ0uKGqmsfO4bfBuLxb0beLNPhjblUEYvEbsg+VSygvF1Q==", - "dependencies": { - "has": "^1.0.3", - "object-is": "^1.1.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/err-code": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", @@ -13552,6 +13446,7 @@ "version": "1.18.6", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.6.tgz", "integrity": "sha512-kAeIT4cku5eNLNuUKhlmtuk1/TRZvQoYccn6TO0cSVdf1kzB0T7+dYuVK9MWM7l+/53W2Q8M7N2c6MQvhXFcUQ==", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", @@ -13579,12 +13474,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/es-array-method-boxes-properly": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", - "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", - "peer": true - }, "node_modules/es-get-iterator": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz", @@ -13618,6 +13507,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "peer": true, "dependencies": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", @@ -15153,23 +15043,6 @@ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, - "node_modules/function.prototype.name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.4.tgz", - "integrity": "sha512-iqy1pIotY/RmhdFZygSSlW0wko2yxkSCKqsuv4pr8QESohpYyG/Z7B/XXvPRKTJS//960rgguE5mSRUsDdaJrQ==", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.2", - "functions-have-names": "^1.2.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", @@ -15321,6 +15194,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "get-intrinsic": "^1.1.1" @@ -15964,19 +15838,6 @@ "util-deprecate": "~1.0.1" } }, - "node_modules/html-element-map": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/html-element-map/-/html-element-map-1.3.1.tgz", - "integrity": "sha512-6XMlxrAFX4UEEGxctfFnmrFaaZFNf9i5fNuV5wZ3WWQ4FVaNP1aX1LkX9j2mfEx1NpjeE/rL3nmgEn23GdFmrg==", - "peer": true, - "dependencies": { - "array.prototype.filter": "^1.0.0", - "call-bind": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/html-encoding-sniffer": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz", @@ -16863,6 +16724,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", + "peer": true, "engines": { "node": ">= 0.4" }, @@ -17031,12 +16893,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-subset": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-subset/-/is-subset-0.1.1.tgz", - "integrity": "sha1-ilkRfZMt4d4A8kX83TnOQ/HpOaY=", - "peer": true - }, "node_modules/is-symbol": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", @@ -19180,29 +19036,11 @@ "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" }, - "node_modules/lodash.escape": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-4.0.1.tgz", - "integrity": "sha1-yQRGkMIeBClL6qUXcS/e0fqI3pg=", - "peer": true - }, - "node_modules/lodash.flattendeep": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", - "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", - "peer": true - }, "node_modules/lodash.flow": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/lodash.flow/-/lodash.flow-3.5.0.tgz", "integrity": "sha512-ff3BX/tSioo+XojX4MOsOMhJw0nZoUEF011LX8g8d3gvjVbxd89cCio4BCXronjxcTUIJUoqKEUA+n4CqvvRPw==" }, - "node_modules/lodash.isequal": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", - "peer": true - }, "node_modules/lodash.ismatch": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz", @@ -20173,12 +20011,6 @@ "node": ">=12" } }, - "node_modules/moo": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.1.tgz", - "integrity": "sha512-I1mnb5xn4fO80BH9BLcF0yLypy2UKl+Cb01Fu0hJRkJjlCRtxZMWkTdAtDd5ZqCOxtCkhmRwyI57vWT+1iZ67w==", - "peer": true - }, "node_modules/mrmime": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.0.tgz", @@ -20291,34 +20123,6 @@ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=" }, - "node_modules/nearley": { - "version": "2.20.1", - "resolved": "https://registry.npmjs.org/nearley/-/nearley-2.20.1.tgz", - "integrity": "sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==", - "peer": true, - "dependencies": { - "commander": "^2.19.0", - "moo": "^0.5.0", - "railroad-diagrams": "^1.0.0", - "randexp": "0.4.6" - }, - "bin": { - "nearley-railroad": "bin/nearley-railroad.js", - "nearley-test": "bin/nearley-test.js", - "nearley-unparse": "bin/nearley-unparse.js", - "nearleyc": "bin/nearleyc.js" - }, - "funding": { - "type": "individual", - "url": "https://nearley.js.org/#give-to-nearley" - } - }, - "node_modules/nearley/node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "peer": true - }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -20904,6 +20708,7 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.4.tgz", "integrity": "sha512-EsFBshs5RUUpQEY1D4q/m59kMfz4YJvxuNCJcv/jWwOJr34EaVnG11ZrZa0UHB3wnzV1wx8m58T4hQL8IuNXlQ==", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", @@ -20921,6 +20726,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.4.tgz", "integrity": "sha512-TnGo7j4XSnKQoK3MfvkzqKCi0nVe/D9I9IjwTNYdb/fxYHpjrluHVOgw0AF6jrRFGMPHdfuidR09tIDiIvnaSg==", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", @@ -21587,12 +21393,6 @@ "node": ">=8" } }, - "node_modules/performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "peer": true - }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -22972,34 +22772,6 @@ "node": ">=8" } }, - "node_modules/raf": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", - "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", - "peer": true, - "dependencies": { - "performance-now": "^2.1.0" - } - }, - "node_modules/railroad-diagrams": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz", - "integrity": "sha1-635iZ1SN3t+4mcG5Dlc3RVnN234=", - "peer": true - }, - "node_modules/randexp": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.4.6.tgz", - "integrity": "sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==", - "peer": true, - "dependencies": { - "discontinuous-range": "1.0.0", - "ret": "~0.1.10" - }, - "engines": { - "node": ">=0.12" - } - }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -24950,15 +24722,6 @@ "node": ">=8" } }, - "node_modules/ret": { - "version": "0.1.15", - "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", - "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", - "peer": true, - "engines": { - "node": ">=0.12" - } - }, "node_modules/retry": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", @@ -24995,16 +24758,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/rst-selector-parser": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/rst-selector-parser/-/rst-selector-parser-2.2.3.tgz", - "integrity": "sha1-gbIw6i/MYGbInjRy3nlChdmwPZE=", - "peer": true, - "dependencies": { - "lodash.flattendeep": "^4.4.0", - "nearley": "^2.7.10" - } - }, "node_modules/rtl-detect": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/rtl-detect/-/rtl-detect-1.0.4.tgz", @@ -26014,27 +25767,11 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/string.prototype.trim": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.4.tgz", - "integrity": "sha512-hWCk/iqf7lp0/AgTF7/ddO1IWtSNPASjlzCicV5irAVdE1grjsneK26YG6xACMBEdCvO8fUST0UzDMh/2Qy+9Q==", - "peer": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/string.prototype.trimend": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3" @@ -26047,6 +25784,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "peer": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3" @@ -27148,6 +26886,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "peer": true, "dependencies": { "function-bind": "^1.1.1", "has-bigints": "^1.0.1", @@ -35551,33 +35290,6 @@ "@xtuc/long": "4.2.2" } }, - "@wojtekmaj/enzyme-adapter-react-17": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@wojtekmaj/enzyme-adapter-react-17/-/enzyme-adapter-react-17-0.6.0.tgz", - "integrity": "sha512-2lRGjZDNTaUyIHLEKqkbGIKK0I4vLgXOcwt90ddsOAGalrZGKmnHnFQzFoO9V84hF+fMYHkpRqka4JGCnvkoow==", - "requires": { - "@wojtekmaj/enzyme-adapter-utils": "^0.1.0", - "enzyme-shallow-equal": "^1.0.0", - "has": "^1.0.0", - "object.assign": "^4.1.0", - "object.values": "^1.1.0", - "prop-types": "^15.7.0", - "react-is": "^17.0.0", - "react-test-renderer": "^17.0.0" - } - }, - "@wojtekmaj/enzyme-adapter-utils": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@wojtekmaj/enzyme-adapter-utils/-/enzyme-adapter-utils-0.1.1.tgz", - "integrity": "sha512-bNPWtN/d8huKOkC6j1E3EkSamnRrHHT7YuR6f9JppAQqtoAm3v4/vERe4J14jQKmHLCyEBHXrlgb7H6l817hVg==", - "requires": { - "function.prototype.name": "^1.1.0", - "has": "^1.0.0", - "object.assign": "^4.1.0", - "object.fromentries": "^2.0.0", - "prop-types": "^15.7.0" - } - }, "@xtuc/ieee754": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", @@ -35939,19 +35651,6 @@ "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==" }, - "array.prototype.filter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array.prototype.filter/-/array.prototype.filter-1.0.0.tgz", - "integrity": "sha512-TfO1gz+tLm+Bswq0FBOXPqAchtCr2Rn48T8dLJoRFl8NoEosjZmzptmuo1X8aZBzZcqsR1W8U761tjACJtngTQ==", - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0", - "es-array-method-boxes-properly": "^1.0.0", - "is-string": "^1.0.5" - } - }, "array.prototype.flat": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz", @@ -38135,12 +37834,6 @@ "path-type": "^4.0.0" } }, - "discontinuous-range": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz", - "integrity": "sha1-44Mx8IRLukm5qctxx3FYWqsbxlo=", - "peer": true - }, "dns-equal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", @@ -38391,45 +38084,6 @@ "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==" }, - "enzyme": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/enzyme/-/enzyme-3.11.0.tgz", - "integrity": "sha512-Dw8/Gs4vRjxY6/6i9wU0V+utmQO9kvh9XLnz3LIudviOnVYDEe2ec+0k+NQoMamn1VrjKgCUOWj5jG/5M5M0Qw==", - "peer": true, - "requires": { - "array.prototype.flat": "^1.2.3", - "cheerio": "^1.0.0-rc.3", - "enzyme-shallow-equal": "^1.0.1", - "function.prototype.name": "^1.1.2", - "has": "^1.0.3", - "html-element-map": "^1.2.0", - "is-boolean-object": "^1.0.1", - "is-callable": "^1.1.5", - "is-number-object": "^1.0.4", - "is-regex": "^1.0.5", - "is-string": "^1.0.5", - "is-subset": "^0.1.1", - "lodash.escape": "^4.0.1", - "lodash.isequal": "^4.5.0", - "object-inspect": "^1.7.0", - "object-is": "^1.0.2", - "object.assign": "^4.1.0", - "object.entries": "^1.1.1", - "object.values": "^1.1.1", - "raf": "^3.4.1", - "rst-selector-parser": "^2.2.3", - "string.prototype.trim": "^1.2.1" - } - }, - "enzyme-shallow-equal": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/enzyme-shallow-equal/-/enzyme-shallow-equal-1.0.4.tgz", - "integrity": "sha512-MttIwB8kKxypwHvRynuC3ahyNc+cFbR8mjVIltnmzQ0uKGqmsfO4bfBuLxb0beLNPhjblUEYvEbsg+VSygvF1Q==", - "requires": { - "has": "^1.0.3", - "object-is": "^1.1.2" - } - }, "err-code": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", @@ -38447,6 +38101,7 @@ "version": "1.18.6", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.6.tgz", "integrity": "sha512-kAeIT4cku5eNLNuUKhlmtuk1/TRZvQoYccn6TO0cSVdf1kzB0T7+dYuVK9MWM7l+/53W2Q8M7N2c6MQvhXFcUQ==", + "peer": true, "requires": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", @@ -38468,12 +38123,6 @@ "unbox-primitive": "^1.0.1" } }, - "es-array-method-boxes-properly": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", - "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", - "peer": true - }, "es-get-iterator": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz", @@ -38506,6 +38155,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "peer": true, "requires": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", @@ -39640,17 +39290,6 @@ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, - "function.prototype.name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.4.tgz", - "integrity": "sha512-iqy1pIotY/RmhdFZygSSlW0wko2yxkSCKqsuv4pr8QESohpYyG/Z7B/XXvPRKTJS//960rgguE5mSRUsDdaJrQ==", - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.2", - "functions-have-names": "^1.2.2" - } - }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", @@ -39762,6 +39401,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "peer": true, "requires": { "call-bind": "^1.0.2", "get-intrinsic": "^1.1.1" @@ -40258,16 +39898,6 @@ } } }, - "html-element-map": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/html-element-map/-/html-element-map-1.3.1.tgz", - "integrity": "sha512-6XMlxrAFX4UEEGxctfFnmrFaaZFNf9i5fNuV5wZ3WWQ4FVaNP1aX1LkX9j2mfEx1NpjeE/rL3nmgEn23GdFmrg==", - "peer": true, - "requires": { - "array.prototype.filter": "^1.0.0", - "call-bind": "^1.0.2" - } - }, "html-encoding-sniffer": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz", @@ -40880,7 +40510,8 @@ "is-negative-zero": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", - "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==" + "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", + "peer": true }, "is-npm": { "version": "5.0.0", @@ -40983,12 +40614,6 @@ "has-tostringtag": "^1.0.0" } }, - "is-subset": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-subset/-/is-subset-0.1.1.tgz", - "integrity": "sha1-ilkRfZMt4d4A8kX83TnOQ/HpOaY=", - "peer": true - }, "is-symbol": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", @@ -42556,29 +42181,11 @@ "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" }, - "lodash.escape": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-4.0.1.tgz", - "integrity": "sha1-yQRGkMIeBClL6qUXcS/e0fqI3pg=", - "peer": true - }, - "lodash.flattendeep": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", - "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", - "peer": true - }, "lodash.flow": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/lodash.flow/-/lodash.flow-3.5.0.tgz", "integrity": "sha512-ff3BX/tSioo+XojX4MOsOMhJw0nZoUEF011LX8g8d3gvjVbxd89cCio4BCXronjxcTUIJUoqKEUA+n4CqvvRPw==" }, - "lodash.isequal": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", - "peer": true - }, "lodash.ismatch": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz", @@ -43292,12 +42899,6 @@ } } }, - "moo": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.1.tgz", - "integrity": "sha512-I1mnb5xn4fO80BH9BLcF0yLypy2UKl+Cb01Fu0hJRkJjlCRtxZMWkTdAtDd5ZqCOxtCkhmRwyI57vWT+1iZ67w==", - "peer": true - }, "mrmime": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.0.tgz", @@ -43382,26 +42983,6 @@ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=" }, - "nearley": { - "version": "2.20.1", - "resolved": "https://registry.npmjs.org/nearley/-/nearley-2.20.1.tgz", - "integrity": "sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==", - "peer": true, - "requires": { - "commander": "^2.19.0", - "moo": "^0.5.0", - "railroad-diagrams": "^1.0.0", - "randexp": "0.4.6" - }, - "dependencies": { - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "peer": true - } - } - }, "negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -43846,6 +43427,7 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.4.tgz", "integrity": "sha512-EsFBshs5RUUpQEY1D4q/m59kMfz4YJvxuNCJcv/jWwOJr34EaVnG11ZrZa0UHB3wnzV1wx8m58T4hQL8IuNXlQ==", + "peer": true, "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", @@ -43857,6 +43439,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.4.tgz", "integrity": "sha512-TnGo7j4XSnKQoK3MfvkzqKCi0nVe/D9I9IjwTNYdb/fxYHpjrluHVOgw0AF6jrRFGMPHdfuidR09tIDiIvnaSg==", + "peer": true, "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", @@ -44335,12 +43918,6 @@ "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "peer": true - }, "picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -45257,31 +44834,6 @@ "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==" }, - "raf": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", - "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", - "peer": true, - "requires": { - "performance-now": "^2.1.0" - } - }, - "railroad-diagrams": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz", - "integrity": "sha1-635iZ1SN3t+4mcG5Dlc3RVnN234=", - "peer": true - }, - "randexp": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.4.6.tgz", - "integrity": "sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==", - "peer": true, - "requires": { - "discontinuous-range": "1.0.0", - "ret": "~0.1.10" - } - }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -46723,12 +46275,6 @@ "signal-exit": "^3.0.2" } }, - "ret": { - "version": "0.1.15", - "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", - "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", - "peer": true - }, "retry": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", @@ -46752,16 +46298,6 @@ "glob": "^7.1.3" } }, - "rst-selector-parser": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/rst-selector-parser/-/rst-selector-parser-2.2.3.tgz", - "integrity": "sha1-gbIw6i/MYGbInjRy3nlChdmwPZE=", - "peer": true, - "requires": { - "lodash.flattendeep": "^4.4.0", - "nearley": "^2.7.10" - } - }, "rtl-detect": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/rtl-detect/-/rtl-detect-1.0.4.tgz", @@ -47550,21 +47086,11 @@ "side-channel": "^1.0.4" } }, - "string.prototype.trim": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.4.tgz", - "integrity": "sha512-hWCk/iqf7lp0/AgTF7/ddO1IWtSNPASjlzCicV5irAVdE1grjsneK26YG6xACMBEdCvO8fUST0UzDMh/2Qy+9Q==", - "peer": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.2" - } - }, "string.prototype.trimend": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "peer": true, "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.3" @@ -47574,6 +47100,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "peer": true, "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.3" @@ -48355,6 +47882,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "peer": true, "requires": { "function-bind": "^1.1.1", "has-bigints": "^1.0.1", diff --git a/package.json b/package.json index ab031f9bc..795c981a1 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ "@types/react-dom": "17.0.11", "@types/simpl-schema": "1.12.2", "@types/warning": "3.0.0", - "@wojtekmaj/enzyme-adapter-react-17": "0.6.0", "ajv": "8.0.5", "antd": "4.10.3", "classnames": "^2.0.0", diff --git a/scripts/setupEnzyme.ts b/scripts/setupEnzyme.ts deleted file mode 100644 index e225eb3e2..000000000 --- a/scripts/setupEnzyme.ts +++ /dev/null @@ -1,18 +0,0 @@ -import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; -import Enzyme from 'enzyme'; - -Object.defineProperty(window, 'matchMedia', { - writable: true, - value: jest.fn().mockImplementation(query => ({ - matches: false, - media: query, - onchange: null, - addEventListener: () => {}, - addListener: () => {}, - dispatchEvent: () => {}, - removeEventListener: () => {}, - removeListener: () => {}, - })), -}); - -Enzyme.configure({ adapter: new Adapter() }); From f84de0f228d5f1d404e0b8f0b7543bf228f96e86 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Thu, 25 Jul 2024 12:10:06 +0200 Subject: [PATCH 7/9] fix jest setup --- jest.config.js | 2 +- package-lock.json | 35 ----------------------------------- package.json | 1 - 3 files changed, 1 insertion(+), 37 deletions(-) diff --git a/jest.config.js b/jest.config.js index d0a3d7bb2..20ab7dbf9 100644 --- a/jest.config.js +++ b/jest.config.js @@ -7,7 +7,7 @@ module.exports = { '^uniforms([^/]*)(.*)$': '/packages/uniforms$1/src$2', }, preset: 'ts-jest', - setupFiles: ['./scripts/setupEnzyme.ts', './scripts/setupFilterWarnings.ts'], + setupFiles: ['./scripts/setupFilterWarnings.ts'], setupFilesAfterEnv: ['./scripts/setupMatchers.ts'], testEnvironment: 'jsdom', testPathIgnorePatterns: ['/node_modules/', '/_[^/]*$', '\\.d\\.ts$'], diff --git a/package-lock.json b/package-lock.json index b6d5e570a..73293f88a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,6 @@ "@testing-library/react": "12.1.5", "@testing-library/user-event": "14.4.3", "@types/classnames": "2.2.11", - "@types/enzyme": "3.10.8", "@types/invariant": "2.2.34", "@types/jest": "26.0.20", "@types/lodash": "4.14.168", @@ -8863,14 +8862,6 @@ "@types/node": "*" } }, - "node_modules/@types/cheerio": { - "version": "0.22.30", - "resolved": "https://registry.npmjs.org/@types/cheerio/-/cheerio-0.22.30.tgz", - "integrity": "sha512-t7ZVArWZlq3dFa9Yt33qFBQIK4CQd1Q3UJp0V+UhP6vgLWLM6Qug7vZuRSGXg45zXeB1Fm5X2vmBkEX58LV2Tw==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/classnames": { "version": "2.2.11", "resolved": "https://registry.npmjs.org/@types/classnames/-/classnames-2.2.11.tgz", @@ -8893,15 +8884,6 @@ "@types/node": "*" } }, - "node_modules/@types/enzyme": { - "version": "3.10.8", - "resolved": "https://registry.npmjs.org/@types/enzyme/-/enzyme-3.10.8.tgz", - "integrity": "sha512-vlOuzqsTHxog6PV79+tvOHFb6hq4QZKMq1lLD9MaWD1oec2lHTKndn76XOpSwCA0oFTaIbKVPrgM3k78Jjd16g==", - "dependencies": { - "@types/cheerio": "*", - "@types/react": "*" - } - }, "node_modules/@types/eslint": { "version": "8.4.1", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.1.tgz", @@ -34607,14 +34589,6 @@ "@types/node": "*" } }, - "@types/cheerio": { - "version": "0.22.30", - "resolved": "https://registry.npmjs.org/@types/cheerio/-/cheerio-0.22.30.tgz", - "integrity": "sha512-t7ZVArWZlq3dFa9Yt33qFBQIK4CQd1Q3UJp0V+UhP6vgLWLM6Qug7vZuRSGXg45zXeB1Fm5X2vmBkEX58LV2Tw==", - "requires": { - "@types/node": "*" - } - }, "@types/classnames": { "version": "2.2.11", "resolved": "https://registry.npmjs.org/@types/classnames/-/classnames-2.2.11.tgz", @@ -34637,15 +34611,6 @@ "@types/node": "*" } }, - "@types/enzyme": { - "version": "3.10.8", - "resolved": "https://registry.npmjs.org/@types/enzyme/-/enzyme-3.10.8.tgz", - "integrity": "sha512-vlOuzqsTHxog6PV79+tvOHFb6hq4QZKMq1lLD9MaWD1oec2lHTKndn76XOpSwCA0oFTaIbKVPrgM3k78Jjd16g==", - "requires": { - "@types/cheerio": "*", - "@types/react": "*" - } - }, "@types/eslint": { "version": "8.4.1", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.1.tgz", diff --git a/package.json b/package.json index 795c981a1..4dc13d978 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "@testing-library/react": "12.1.5", "@testing-library/user-event": "14.4.3", "@types/classnames": "2.2.11", - "@types/enzyme": "3.10.8", "@types/invariant": "2.2.34", "@types/jest": "26.0.20", "@types/lodash": "4.14.168", From 9806b6d5fd6e740dfb33b8aff8e49859ca5ec158 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Thu, 25 Jul 2024 12:19:50 +0200 Subject: [PATCH 8/9] add setupRTS script and use it on jest config --- jest.config.js | 2 +- scripts/setupRTS.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 scripts/setupRTS.ts diff --git a/jest.config.js b/jest.config.js index 20ab7dbf9..1a8b6b069 100644 --- a/jest.config.js +++ b/jest.config.js @@ -7,7 +7,7 @@ module.exports = { '^uniforms([^/]*)(.*)$': '/packages/uniforms$1/src$2', }, preset: 'ts-jest', - setupFiles: ['./scripts/setupFilterWarnings.ts'], + setupFiles: ['./scripts/setupRTS.ts', './scripts/setupFilterWarnings.ts'], setupFilesAfterEnv: ['./scripts/setupMatchers.ts'], testEnvironment: 'jsdom', testPathIgnorePatterns: ['/node_modules/', '/_[^/]*$', '\\.d\\.ts$'], diff --git a/scripts/setupRTS.ts b/scripts/setupRTS.ts new file mode 100644 index 000000000..8d24f05e8 --- /dev/null +++ b/scripts/setupRTS.ts @@ -0,0 +1,13 @@ +Object.defineProperty(window, 'matchMedia', { + writable: true, + value: jest.fn().mockImplementation(query => ({ + matches: false, + media: query, + onchange: null, + addEventListener: () => {}, + addListener: () => {}, + dispatchEvent: () => {}, + removeEventListener: () => {}, + removeListener: () => {}, + })), +}); From 6f55f05d3d7e2b9881b6cb7b171eeb40b2900ed4 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Fri, 26 Jul 2024 08:27:33 +0200 Subject: [PATCH 9/9] change setupRTS to setupJest --- jest.config.js | 2 +- scripts/{setupRTS.ts => setupJest.ts} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename scripts/{setupRTS.ts => setupJest.ts} (100%) diff --git a/jest.config.js b/jest.config.js index 1a8b6b069..1a4766048 100644 --- a/jest.config.js +++ b/jest.config.js @@ -7,7 +7,7 @@ module.exports = { '^uniforms([^/]*)(.*)$': '/packages/uniforms$1/src$2', }, preset: 'ts-jest', - setupFiles: ['./scripts/setupRTS.ts', './scripts/setupFilterWarnings.ts'], + setupFiles: ['./scripts/setupJest.ts', './scripts/setupFilterWarnings.ts'], setupFilesAfterEnv: ['./scripts/setupMatchers.ts'], testEnvironment: 'jsdom', testPathIgnorePatterns: ['/node_modules/', '/_[^/]*$', '\\.d\\.ts$'], diff --git a/scripts/setupRTS.ts b/scripts/setupJest.ts similarity index 100% rename from scripts/setupRTS.ts rename to scripts/setupJest.ts