From 32080eac2a66df859c179496fc88c02aa179dbbc Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Fri, 22 Jul 2022 14:54:12 +0200 Subject: [PATCH 01/27] rewrite AutoForm --- packages/uniforms/__tests__/AutoForm.tsx | 300 ++++++++++++++++------- scripts/test.ts | 16 ++ 2 files changed, 228 insertions(+), 88 deletions(-) create mode 100644 scripts/test.ts diff --git a/packages/uniforms/__tests__/AutoForm.tsx b/packages/uniforms/__tests__/AutoForm.tsx index c550aaef6..1f9d3a7c7 100644 --- a/packages/uniforms/__tests__/AutoForm.tsx +++ b/packages/uniforms/__tests__/AutoForm.tsx @@ -1,104 +1,138 @@ +import { fireEvent, screen } from '@testing-library/react'; import React from 'react'; import SimpleSchema from 'simpl-schema'; import { AutoForm, connectField } from 'uniforms'; import { SimpleSchema2Bridge } from 'uniforms-bridge-simple-schema-2'; -import mount from './_mount'; - -describe('AutoForm', () => { - const onChangeModel = jest.fn(); - const validator = jest.fn(); - const onChange = jest.fn(); - const onSubmit = jest.fn(); - const model = { a: '1' }; - const schema = new SimpleSchema2Bridge( - new SimpleSchema({ - a: { type: String, defaultValue: '' }, - b: { type: String, defaultValue: '' }, - c: { type: String, defaultValue: '' }, - }), - ); - jest.spyOn(schema.schema, 'validator').mockImplementation(() => validator); - - beforeEach(() => { - onChange.mockClear(); - onChangeModel.mockClear(); - onSubmit.mockClear(); - validator.mockClear(); - }); - - describe('when changed', () => { - it('updates', () => { - // FIXME: AutoForm is not a valid Component. - const wrapper = mount( - , +import { render } from '../__suites__'; + +describe('', () => { + describe('when changes', () => { + test('updates', () => { + const schema = new SimpleSchema2Bridge( + new SimpleSchema({ + a: { type: String, defaultValue: '' }, + b: { type: String, defaultValue: '' }, + c: { type: String, defaultValue: '' }, + }), + ); + const onChange = jest.fn(); + render( + , + { schema: { type: SimpleSchema2Bridge } }, + { onChange }, ); - - wrapper.instance().getContext().onChange('a', '2'); - - expect(onChange).toHaveBeenCalledTimes(1); - expect(onChange).toHaveBeenLastCalledWith('a', '2'); }); - it('validates', () => { + // todo no way to test in rts cause of AutoField not rendering inputs, and in rts we don't have access to instance + test.skip('validates', () => { // FIXME: AutoForm is not a valid Component. - const wrapper = mount( - , + const schema = new SimpleSchema2Bridge( + new SimpleSchema({ + a: { type: String, defaultValue: '' }, + b: { type: String, defaultValue: '' }, + c: { type: String, defaultValue: '' }, + }), + ); + const onChange = jest.fn(); + const validator = jest.fn(); + render( + , + { schema: { type: SimpleSchema2Bridge } }, ); - wrapper.instance().submit(); + const element = screen.getByTestId('autoForm'); + fireEvent.submit(element); expect(validator).toHaveBeenCalledTimes(1); expect(validator).toHaveBeenLastCalledWith({}); - wrapper.instance().getContext().onChange('a', '1'); + fireEvent.change(element, onChange({ a: '1' })); expect(validator).toHaveBeenCalledTimes(2); expect(validator).toHaveBeenLastCalledWith({ a: '1' }); }); - it('calls `onChangeModel`', () => { + test('calls `onChangeModel`', () => { // FIXME: AutoForm is not a valid Component. - const wrapper = mount( - , + const schema = new SimpleSchema2Bridge( + new SimpleSchema({ + a: { type: String, defaultValue: '' }, + b: { type: String, defaultValue: '' }, + c: { type: String, defaultValue: '' }, + }), + ); + const onChangeModel = jest.fn(); + render( + , + { schema: { type: SimpleSchema2Bridge } }, ); - wrapper.instance().getContext().onChange('a', '2'); + const element = screen.getByTestId('autoForm'); + fireEvent.change(element, onChangeModel({ a: '2' })); expect(onChangeModel).toHaveBeenCalledTimes(1); expect(onChangeModel).toHaveBeenLastCalledWith({ a: '2' }); }); - it('updates `changed` and `changedMap`', () => { + test.skip('updates `changed` and `changedMap`', () => { + // todo no way to test in rts cause we don't have access to instance and state of component + // (https://testing-library.com/docs/react-testing-library/intro/#the-problem) // FIXME: AutoForm is not a valid Component. - const wrapper = mount(); + const schema = new SimpleSchema2Bridge( + new SimpleSchema({ + a: { type: String, defaultValue: '' }, + b: { type: String, defaultValue: '' }, + c: { type: String, defaultValue: '' }, + }), + ); + const onChange = jest.fn(); + render( + , + { schema: { type: SimpleSchema2Bridge } }, + ); + + const element = screen.getByTestId('autoForm'); - const context1 = wrapper.instance().getContext(); - expect(context1).toHaveProperty('changed', false); - expect(context1).toHaveProperty('changedMap', {}); + expect(element).toHaveProperty('changed', false); + expect(element).toHaveProperty('changedMap', {}); - wrapper.instance().getContext().onChange('a', '2'); + fireEvent.change(element, onChange({ a: '1' })); - const context2 = wrapper.instance().getContext(); - expect(context2).toHaveProperty('changed', true); - expect(context2).toHaveProperty('changedMap.a'); - expect(context2.changedMap.a).toBeTruthy(); + expect(element).toHaveProperty('changed', true); + expect(element).toHaveProperty('changedMap.a'); + // expect(element.changedMap.a).toBeTruthy(); }); }); - - describe('when rendered', () => { - it('calls `onChange` before render', () => { + describe('when render', () => { + test('calls `onChange` before render', () => { const field = () => null; const Field = connectField(field); + const schema = new SimpleSchema2Bridge( + new SimpleSchema({ + a: { type: String, defaultValue: '' }, + b: { type: String, defaultValue: '' }, + c: { type: String, defaultValue: '' }, + }), + ); + const model = { a: '1' }; + const onChange = jest.fn(); + // FIXME: AutoForm is not a valid Component. - mount( + render( , + { schema: { type: SimpleSchema2Bridge } }, ); expect(onChange).toHaveBeenCalledTimes(2); @@ -106,70 +140,160 @@ describe('AutoForm', () => { expect(onChange.mock.calls[1]).toEqual(expect.arrayContaining(['c', ''])); }); - it('skips `onSubmit` until rendered (`autosave` = true)', async () => { + test.skip('skips `onSubmit` until rendered (`autosave` = true)', async () => { + // todo no way to test in rts cause we don't have access to instance and state of component // FIXME: AutoForm is not a valid Component. - const wrapper = mount( - , + const schema = new SimpleSchema2Bridge( + new SimpleSchema({ + a: { type: String, defaultValue: '' }, + b: { type: String, defaultValue: '' }, + c: { type: String, defaultValue: '' }, + }), + ); + const onSubmit = jest.fn(); + const onChange = jest.fn(); + const validator = jest.fn(); + render( + , + { + schema: { type: SimpleSchema2Bridge }, + }, ); expect(onSubmit).not.toBeCalled(); - wrapper.instance().getContext().onChange('a', 1); + + const element = screen.getByTestId('autoForm'); await new Promise(resolve => setTimeout(resolve)); + fireEvent.change(element, onChange({ a: '1' })); + expect(onSubmit).toHaveBeenCalledTimes(1); expect(onSubmit).toHaveBeenLastCalledWith({ a: 1 }); expect(validator).toHaveBeenCalledTimes(1); expect(validator).toHaveBeenLastCalledWith({ a: 1 }); }); }); - describe('when reset', () => { - it('reset `model`', () => { + test.skip('reset `model`', () => { + // todo no way to test in rts cause we don't have access to instance and state of component // FIXME: AutoForm is not a valid Component. - const wrapper = mount( - , + const schema = new SimpleSchema2Bridge( + new SimpleSchema({ + a: { type: String, defaultValue: '' }, + b: { type: String, defaultValue: '' }, + c: { type: String, defaultValue: '' }, + }), + ); + const model = { a: '1' }; + render( + , + { + schema: { type: SimpleSchema2Bridge }, + }, ); - wrapper.instance().reset(); - expect(wrapper.instance().getContext().model).toEqual(model); + // expect(wrapper.instance().getContext().model).toEqual(model); }); - it('resets state `changedMap`', () => { + test.skip('resets state `changedMap`', () => { + // todo no way to test in rts cause we don't have access to instance and state of component // FIXME: AutoForm is not a valid Component. - const wrapper = mount( - , + const schema = new SimpleSchema2Bridge( + new SimpleSchema({ + a: { type: String, defaultValue: '' }, + b: { type: String, defaultValue: '' }, + c: { type: String, defaultValue: '' }, + }), + ); + const model = { a: '1' }; + const onSubmit = jest.fn(); + render( + , + { + schema: { type: SimpleSchema2Bridge }, + }, ); - wrapper.instance().reset(); - expect(wrapper.instance().getContext().changedMap).toEqual({}); + // expect(wrapper.instance().getContext().changedMap).toEqual({}); }); - it('resets state `changed`', () => { + test.skip('resets state `changed`', () => { + // todo no way to test in rts cause we don't have access to instance and state of component // FIXME: AutoForm is not a valid Component. - const wrapper = mount( - , + const schema = new SimpleSchema2Bridge( + new SimpleSchema({ + a: { type: String, defaultValue: '' }, + b: { type: String, defaultValue: '' }, + c: { type: String, defaultValue: '' }, + }), + ); + const model = { a: '1' }; + const onSubmit = jest.fn(); + render( + , + { + schema: { type: SimpleSchema2Bridge }, + }, ); - wrapper.instance().reset(); - expect(wrapper.instance().getContext().changed).toEqual(false); + // expect(wrapper.instance().getContext().changed).toEqual(false); }); }); - - describe('when updated', () => { - it('updates', () => { + describe('when update', () => { + test.skip(', updates', () => { + // todo no way to test in rts cause AutoForm not render input in core // FIXME: AutoForm is not a valid Component. - const wrapper = mount(); + const schema = new SimpleSchema2Bridge( + new SimpleSchema({ + a: { type: String, defaultValue: '' }, + b: { type: String, defaultValue: '' }, + c: { type: String, defaultValue: '' }, + }), + ); + render(, { + schema: { type: SimpleSchema2Bridge }, + }); - wrapper.setProps({ model: {} }); - expect(wrapper.instance().props.model).toEqual({}); + // expect(wrapper.instance().props.model).toEqual({}); }); - it('validates', () => { + test.skip(', validates', () => { + // todo no way to test in rts cause AutoForm not render input in core // FIXME: AutoForm is not a valid Component. - const wrapper = mount(); + const schema = new SimpleSchema2Bridge( + new SimpleSchema({ + a: { type: String, defaultValue: '' }, + b: { type: String, defaultValue: '' }, + c: { type: String, defaultValue: '' }, + }), + ); + const validator = jest.fn(); + render(, { + schema: { type: SimpleSchema2Bridge }, + }); - wrapper.setProps({ model, validate: 'onChange' }); expect(validator).toHaveBeenCalledTimes(1); }); }); diff --git a/scripts/test.ts b/scripts/test.ts new file mode 100644 index 000000000..114985ea4 --- /dev/null +++ b/scripts/test.ts @@ -0,0 +1,16 @@ +const Environment = require('jest-environment-jsdom-global'); +/** + * A custom environment to set the TextEncoder + */ +module.exports = class CustomTestEnvironment extends Environment { + constructor( + { globalConfig, projectConfig }: { globalConfig: any; projectConfig: any }, + context: any, + ) { + super({ globalConfig, projectConfig }, context); + if (typeof this.global.TextEncoder === 'undefined') { + const { TextEncoder } = require('util'); + this.global.TextEncoder = TextEncoder; + } + } +}; From f161089b47db30952d86ddf7b7b150adf384fa4c Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Fri, 22 Jul 2022 15:01:33 +0200 Subject: [PATCH 02/27] change it to test in ts files for consistency --- packages/uniforms/__tests__/Bridge.ts | 4 +- packages/uniforms/__tests__/changedKeys.ts | 28 +-- packages/uniforms/__tests__/filterDOMProps.ts | 10 +- packages/uniforms/__tests__/joinName.ts | 170 +++++++++--------- packages/uniforms/__tests__/randomIds.ts | 8 +- 5 files changed, 110 insertions(+), 110 deletions(-) diff --git a/packages/uniforms/__tests__/Bridge.ts b/packages/uniforms/__tests__/Bridge.ts index 9c0b654f9..98cec0f90 100644 --- a/packages/uniforms/__tests__/Bridge.ts +++ b/packages/uniforms/__tests__/Bridge.ts @@ -4,7 +4,7 @@ describe('Bridge', () => { class CustomBridge extends Bridge {} const customBridgeInstance = new CustomBridge(); - it('cannot be instantiated', () => { + test('cannot be instantiated', () => { // @ts-expect-error expect(() => new Bridge()).toThrow(); }); @@ -23,7 +23,7 @@ describe('Bridge', () => { ] as const ).forEach(method => { describe(`#${method}`, () => { - it('throws an unimplemented error', () => { + test('throws an unimplemented error', () => { // @ts-expect-error expect(() => customBridgeInstance[method]()).toThrow(); }); diff --git a/packages/uniforms/__tests__/changedKeys.ts b/packages/uniforms/__tests__/changedKeys.ts index 80e2612fa..9a4042e11 100644 --- a/packages/uniforms/__tests__/changedKeys.ts +++ b/packages/uniforms/__tests__/changedKeys.ts @@ -1,30 +1,30 @@ import { changedKeys } from 'uniforms'; describe('changedKeys', () => { - it('is a function', () => { + test('is a function', () => { expect(changedKeys).toBeInstanceOf(Function); }); describe('(==)', () => { - it('works with arrays', () => { + test('works with arrays', () => { expect(changedKeys('a', [], [])).toEqual([]); expect(changedKeys('a', [1], [1])).toEqual([]); expect(changedKeys('a', [1, 2], [1, 2])).toEqual([]); }); - it('works with dates', () => { + test('works with dates', () => { expect(changedKeys('a', new Date(10), new Date(10))).toEqual([]); expect(changedKeys('a', new Date(20), new Date(20))).toEqual([]); expect(changedKeys('a', new Date(30), new Date(30))).toEqual([]); }); - it('works with objects', () => { + test('works with objects', () => { expect(changedKeys('a', {}, {})).toEqual([]); expect(changedKeys('a', { a: 1 }, { a: 1 })).toEqual([]); expect(changedKeys('a', { a: 1, b: 2 }, { a: 1, b: 2 })).toEqual([]); }); - it('works with primitives', () => { + test('works with primitives', () => { expect(changedKeys('a', 1, 1)).toEqual([]); expect(changedKeys('a', null, null)).toEqual([]); expect(changedKeys('a', true, true)).toEqual([]); @@ -33,19 +33,19 @@ describe('changedKeys', () => { }); describe('(++)', () => { - it('works with arrays', () => { + test('works with arrays', () => { expect(changedKeys('a', [], [1])).toEqual(['a', 'a.0']); expect(changedKeys('a', [1], [1, 2])).toEqual(['a', 'a.1']); expect(changedKeys('a', [1, 2], [1, 2, 3])).toEqual(['a', 'a.2']); }); - it('works with dates', () => { + test('works with dates', () => { expect(changedKeys('a', new Date(10), new Date(20))).toEqual(['a']); expect(changedKeys('a', new Date(20), new Date(30))).toEqual(['a']); expect(changedKeys('a', new Date(30), new Date(40))).toEqual(['a']); }); - it('works with objects', () => { + test('works with objects', () => { expect(changedKeys('a', {}, { a: 1 })).toEqual(['a', 'a.a']); expect(changedKeys('a', { a: 1 }, { a: 1, b: 2 })).toEqual(['a', 'a.b']); expect(changedKeys('a', { a: 1, b: 2 }, { a: 1, b: 2, c: 3 })).toEqual([ @@ -54,7 +54,7 @@ describe('changedKeys', () => { ]); }); - it('works with primitives', () => { + test('works with primitives', () => { expect(changedKeys('a', 1, 2)).toEqual(['a']); expect(changedKeys('a', null, true)).toEqual(['a']); expect(changedKeys('a', true, null)).toEqual(['a']); @@ -63,21 +63,21 @@ describe('changedKeys', () => { }); describe('(--)', () => { - it('works with arrays', () => { + test('works with arrays', () => { expect(changedKeys('a', [1])).toEqual(['a', 'a.0']); expect(changedKeys('a', [1], [])).toEqual(['a', 'a.0']); expect(changedKeys('a', [1, 2], [1])).toEqual(['a', 'a.1']); expect(changedKeys('a', [1, 2, 3], [1, 2])).toEqual(['a', 'a.2']); }); - it('works with dates', () => { + test('works with dates', () => { expect(changedKeys('a', new Date(20))).toEqual(['a']); expect(changedKeys('a', new Date(20), new Date(10))).toEqual(['a']); expect(changedKeys('a', new Date(30), new Date(20))).toEqual(['a']); expect(changedKeys('a', new Date(40), new Date(30))).toEqual(['a']); }); - it('works with objects', () => { + test('works with objects', () => { expect(changedKeys('a', { a: 1 })).toEqual(['a', 'a.a']); expect(changedKeys('a', { a: 1 }, {})).toEqual(['a', 'a.a']); expect(changedKeys('a', { a: 1, b: 2 }, { a: 1 })).toEqual(['a', 'a.b']); @@ -87,7 +87,7 @@ describe('changedKeys', () => { ]); }); - it('works with primitives', () => { + test('works with primitives', () => { expect(changedKeys('a', 2)).toEqual(['a']); expect(changedKeys('a', 2, 1)).toEqual(['a']); expect(changedKeys('a', true, null)).toEqual(['a']); @@ -96,7 +96,7 @@ describe('changedKeys', () => { }); }); - it('works with changing value types', () => { + test('works with changing value types', () => { expect(changedKeys('a', '1', 1)).toEqual(['a']); expect(changedKeys('a', 1, '1')).toEqual(['a']); expect(changedKeys('a', 'true', true)).toEqual(['a']); diff --git a/packages/uniforms/__tests__/filterDOMProps.ts b/packages/uniforms/__tests__/filterDOMProps.ts index 33ac5980e..9fd9a6161 100644 --- a/packages/uniforms/__tests__/filterDOMProps.ts +++ b/packages/uniforms/__tests__/filterDOMProps.ts @@ -1,29 +1,29 @@ import { filterDOMProps } from 'uniforms'; describe('joinName', () => { - it('is a function', () => { + test('is a function', () => { expect(filterDOMProps).toBeInstanceOf(Function); }); - it('removes props', () => { + test('removes props', () => { expect(filterDOMProps({ value: 999999 })).toEqual({}); expect(filterDOMProps({ changed: true })).toEqual({}); }); - it('removes registered props', () => { + test('removes registered props', () => { // @ts-expect-error: Do not register its type not to pollute it. filterDOMProps.register('__special__'); expect(filterDOMProps({ __special__: true })).toEqual({}); }); - it('ignores double registers', () => { + test('ignores double registers', () => { const { length } = filterDOMProps.registered; filterDOMProps.register('value'); expect(filterDOMProps.registered).toHaveLength(length); }); - it('omits rest', () => { + test('omits rest', () => { expect(filterDOMProps({ a: 1 })).toEqual({ a: 1 }); expect(filterDOMProps({ b: 2 })).toEqual({ b: 2 }); }); diff --git a/packages/uniforms/__tests__/joinName.ts b/packages/uniforms/__tests__/joinName.ts index 0da4c9c1d..1a520682f 100644 --- a/packages/uniforms/__tests__/joinName.ts +++ b/packages/uniforms/__tests__/joinName.ts @@ -1,6 +1,6 @@ import { joinName } from 'uniforms'; -function test(parts: unknown[], array: string[], string: string) { +function testFn(parts: unknown[], array: string[], string: string) { // Serialization (join). expect(joinName(...parts)).toBe(string); @@ -15,121 +15,121 @@ function test(parts: unknown[], array: string[], string: string) { } describe('joinName', () => { - it('is a function', () => { + test('is a function', () => { expect(joinName).toBeInstanceOf(Function); }); - it('works with empty name', () => { - test([], [], ''); + test('works with empty name', () => { + testFn([], [], ''); }); - it('works with arrays', () => { - test([['a']], ['a'], 'a'); - test([[['a']]], ['a'], 'a'); - test([[[['a']]]], ['a'], 'a'); + test('works with arrays', () => { + testFn([['a']], ['a'], 'a'); + testFn([[['a']]], ['a'], 'a'); + testFn([[[['a']]]], ['a'], 'a'); - test([[], 'a'], ['a'], 'a'); - test(['a', []], ['a'], 'a'); + testFn([[], 'a'], ['a'], 'a'); + testFn(['a', []], ['a'], 'a'); - test([['a'], 'b'], ['a', 'b'], 'a.b'); - test(['a', ['b']], ['a', 'b'], 'a.b'); + testFn([['a'], 'b'], ['a', 'b'], 'a.b'); + testFn(['a', ['b']], ['a', 'b'], 'a.b'); - test([['a', 'b'], 'c'], ['a', 'b', 'c'], 'a.b.c'); - test(['a', ['b', 'c']], ['a', 'b', 'c'], 'a.b.c'); + testFn([['a', 'b'], 'c'], ['a', 'b', 'c'], 'a.b.c'); + testFn(['a', ['b', 'c']], ['a', 'b', 'c'], 'a.b.c'); - test(['a', ['b', 'c'], 'd'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); + testFn(['a', ['b', 'c'], 'd'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); }); - it('works with empty strings', () => { - test(['', 'a', 'b'], ['a', 'b'], 'a.b'); - test(['a', '', 'b'], ['a', 'b'], 'a.b'); - test(['a', 'b', ''], ['a', 'b'], 'a.b'); + test('works with empty strings', () => { + testFn(['', 'a', 'b'], ['a', 'b'], 'a.b'); + testFn(['a', '', 'b'], ['a', 'b'], 'a.b'); + testFn(['a', 'b', ''], ['a', 'b'], 'a.b'); }); - it('works with falsy values', () => { - test(['a', null, 'b'], ['a', 'b'], 'a.b'); - test(['a', false, 'b'], ['a', 'b'], 'a.b'); - test(['a', undefined, 'b'], ['a', 'b'], 'a.b'); + test('works with falsy values', () => { + testFn(['a', null, 'b'], ['a', 'b'], 'a.b'); + testFn(['a', false, 'b'], ['a', 'b'], 'a.b'); + testFn(['a', undefined, 'b'], ['a', 'b'], 'a.b'); }); - it('works with numbers', () => { - test([0, 'a', 'b'], ['0', 'a', 'b'], '0.a.b'); - test(['a', 0, 'b'], ['a', '0', 'b'], 'a.0.b'); - test(['a', 'b', 0], ['a', 'b', '0'], 'a.b.0'); - test([1, 'a', 'b'], ['1', 'a', 'b'], '1.a.b'); - test(['a', 1, 'b'], ['a', '1', 'b'], 'a.1.b'); - test(['a', 'b', 1], ['a', 'b', '1'], 'a.b.1'); + test('works with numbers', () => { + testFn([0, 'a', 'b'], ['0', 'a', 'b'], '0.a.b'); + testFn(['a', 0, 'b'], ['a', '0', 'b'], 'a.0.b'); + testFn(['a', 'b', 0], ['a', 'b', '0'], 'a.b.0'); + testFn([1, 'a', 'b'], ['1', 'a', 'b'], '1.a.b'); + testFn(['a', 1, 'b'], ['a', '1', 'b'], 'a.1.b'); + testFn(['a', 'b', 1], ['a', 'b', '1'], 'a.b.1'); }); - it('works with partials', () => { - test(['a', 'b.c.d'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); - test(['a.b', 'c.d'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); - test(['a.b.c', 'd'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); + test('works with partials', () => { + testFn(['a', 'b.c.d'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); + testFn(['a.b', 'c.d'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); + testFn(['a.b.c', 'd'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); }); - it('works with subscripts', () => { - test(['a["b"]'], ['a', 'b'], 'a.b'); - test(['a["b"].c'], ['a', 'b', 'c'], 'a.b.c'); - test(['a["b"].c["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); - test(['a["b"]["c.d"]'], ['a', 'b', '["c.d"]'], 'a.b["c.d"]'); - test(['a["b"]["c.d"].e'], ['a', 'b', '["c.d"]', 'e'], 'a.b["c.d"].e'); - test(['a["b"]["c.d"]["e"]'], ['a', 'b', '["c.d"]', 'e'], 'a.b["c.d"].e'); - test(['a["b"].["c.d"]'], ['a', 'b', '["c.d"]'], 'a.b["c.d"]'); - test(['a["b"].["c.d"].e'], ['a', 'b', '["c.d"]', 'e'], 'a.b["c.d"].e'); - test(['a["b"].["c.d"]["e"]'], ['a', 'b', '["c.d"]', 'e'], 'a.b["c.d"].e'); - - test(['["a"]'], ['a'], 'a'); - test(['["a"].b'], ['a', 'b'], 'a.b'); - test(['["a"]["b.c"]'], ['a', '["b.c"]'], 'a["b.c"]'); - test(['["a"]["b.c"].d'], ['a', '["b.c"]', 'd'], 'a["b.c"].d'); - test(['["a"]["b.c"]["d"]'], ['a', '["b.c"]', 'd'], 'a["b.c"].d'); - test(['["a"].["b.c"]'], ['a', '["b.c"]'], 'a["b.c"]'); - test(['["a"].["b.c"].d'], ['a', '["b.c"]', 'd'], 'a["b.c"].d'); - test(['["a"].["b.c"]["d"]'], ['a', '["b.c"]', 'd'], 'a["b.c"].d'); - - test(['[""]'], ['[""]'], '[""]'); - test(['["."]'], ['["."]'], '["."]'); - test(['[".."]'], ['[".."]'], '[".."]'); - test(['["..."]'], ['["..."]'], '["..."]'); - test(['["[\'\']"]'], ['["[\'\']"]'], '["[\'\']"]'); - test(['["[\\"\\"]"]'], ['["[\\"\\"]"]'], '["[\\"\\"]"]'); + test('works with subscripts', () => { + testFn(['a["b"]'], ['a', 'b'], 'a.b'); + testFn(['a["b"].c'], ['a', 'b', 'c'], 'a.b.c'); + testFn(['a["b"].c["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); + testFn(['a["b"]["c.d"]'], ['a', 'b', '["c.d"]'], 'a.b["c.d"]'); + testFn(['a["b"]["c.d"].e'], ['a', 'b', '["c.d"]', 'e'], 'a.b["c.d"].e'); + testFn(['a["b"]["c.d"]["e"]'], ['a', 'b', '["c.d"]', 'e'], 'a.b["c.d"].e'); + testFn(['a["b"].["c.d"]'], ['a', 'b', '["c.d"]'], 'a.b["c.d"]'); + testFn(['a["b"].["c.d"].e'], ['a', 'b', '["c.d"]', 'e'], 'a.b["c.d"].e'); + testFn(['a["b"].["c.d"]["e"]'], ['a', 'b', '["c.d"]', 'e'], 'a.b["c.d"].e'); + + testFn(['["a"]'], ['a'], 'a'); + testFn(['["a"].b'], ['a', 'b'], 'a.b'); + testFn(['["a"]["b.c"]'], ['a', '["b.c"]'], 'a["b.c"]'); + testFn(['["a"]["b.c"].d'], ['a', '["b.c"]', 'd'], 'a["b.c"].d'); + testFn(['["a"]["b.c"]["d"]'], ['a', '["b.c"]', 'd'], 'a["b.c"].d'); + testFn(['["a"].["b.c"]'], ['a', '["b.c"]'], 'a["b.c"]'); + testFn(['["a"].["b.c"].d'], ['a', '["b.c"]', 'd'], 'a["b.c"].d'); + testFn(['["a"].["b.c"]["d"]'], ['a', '["b.c"]', 'd'], 'a["b.c"].d'); + + testFn(['[""]'], ['[""]'], '[""]'); + testFn(['["."]'], ['["."]'], '["."]'); + testFn(['[".."]'], ['[".."]'], '[".."]'); + testFn(['["..."]'], ['["..."]'], '["..."]'); + testFn(['["[\'\']"]'], ['["[\'\']"]'], '["[\'\']"]'); + testFn(['["[\\"\\"]"]'], ['["[\\"\\"]"]'], '["[\\"\\"]"]'); }); - it('handles incorrect cases _somehow_', () => { + test('handles incorrect cases _somehow_', () => { // Boolean `true`. - test([true], ['true'], 'true'); - test([true, 'a'], ['true', 'a'], 'true.a'); - test(['a', true], ['a', 'true'], 'a.true'); + testFn([true], ['true'], 'true'); + testFn([true, 'a'], ['true', 'a'], 'true.a'); + testFn(['a', true], ['a', 'true'], 'a.true'); // Dots before subscripts. - test(['a["b"].c.["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); - test(['a.["b"].c["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); - test(['a.["b"].c.["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); + testFn(['a["b"].c.["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); + testFn(['a.["b"].c["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); + testFn(['a.["b"].c.["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); // Only dots. - test(['.'], ['["."]'], '["."]'); - test(['..'], ['[".."]'], '[".."]'); - test(['...'], ['["..."]'], '["..."]'); + testFn(['.'], ['["."]'], '["."]'); + testFn(['..'], ['[".."]'], '[".."]'); + testFn(['...'], ['["..."]'], '["..."]'); // Leading and trailing dots. - test(['a.'], ['["a."]'], '["a."]'); - test(['.a'], ['[""]', 'a'], '[""].a'); - test(['["a"].'], ['a'], 'a'); - test(['.["a"]'], ['a'], 'a'); + testFn(['a.'], ['["a."]'], '["a."]'); + testFn(['.a'], ['[""]', 'a'], '[""].a'); + testFn(['["a"].'], ['a'], 'a'); + testFn(['.["a"]'], ['a'], 'a'); // Unescaped brackets. - test(['['], ['["["]'], '["["]'); - test(["['"], ['["[\'"]'], '["[\'"]'); - test(["[''"], ['["[\'\'"]'], '["[\'\'"]'); - test(["['']"], ['["[\'\']"]'], '["[\'\']"]'); - test(['["'], ['["[\\""]'], '["[\\""]'); - test(['[""'], ['["[\\"\\""]'], '["[\\"\\""]'); + testFn(['['], ['["["]'], '["["]'); + testFn(["['"], ['["[\'"]'], '["[\'"]'); + testFn(["[''"], ['["[\'\'"]'], '["[\'\'"]'); + testFn(["['']"], ['["[\'\']"]'], '["[\'\']"]'); + testFn(['["'], ['["[\\""]'], '["[\\""]'); + testFn(['[""'], ['["[\\"\\""]'], '["[\\"\\""]'); // Incorrect escape. - test(['["a\\"]'], ['["[\\"a\\\\"]"]'], '["[\\"a\\\\"]"]'); - test(['[\\""]'], ['["[\\\\"\\"]"]'], '["[\\\\"\\"]"]'); - test(['[\\"a"]'], ['["[\\\\"a\\"]"]'], '["[\\\\"a\\"]"]'); - test(['["\\"]'], ['["[\\"\\\\"]"]'], '["[\\"\\\\"]"]'); - test(['["\\"\\"]'], ['["[\\"\\\\"\\\\"]"]'], '["[\\"\\\\"\\\\"]"]'); + testFn(['["a\\"]'], ['["[\\"a\\\\"]"]'], '["[\\"a\\\\"]"]'); + testFn(['[\\""]'], ['["[\\\\"\\"]"]'], '["[\\\\"\\"]"]'); + testFn(['[\\"a"]'], ['["[\\\\"a\\"]"]'], '["[\\\\"a\\"]"]'); + testFn(['["\\"]'], ['["[\\"\\\\"]"]'], '["[\\"\\\\"]"]'); + testFn(['["\\"\\"]'], ['["[\\"\\\\"\\\\"]"]'], '["[\\"\\\\"\\\\"]"]'); }); }); diff --git a/packages/uniforms/__tests__/randomIds.ts b/packages/uniforms/__tests__/randomIds.ts index 1243f9d40..a025110b8 100644 --- a/packages/uniforms/__tests__/randomIds.ts +++ b/packages/uniforms/__tests__/randomIds.ts @@ -1,20 +1,20 @@ import { randomIds } from 'uniforms'; describe('randomIds', () => { - it('is a function', () => { + test('is a function', () => { expect(randomIds).toBeInstanceOf(Function); }); - it('returns a function', () => { + test('returns a function', () => { expect(randomIds()).toBeInstanceOf(Function); }); - it('accepts custom prefix', () => { + test('accepts custom prefix', () => { const generator = randomIds('my-id-generator'); expect(generator()).toMatch(/^my-id-generator/); }); - it('generate random id', () => { + test('generate random id', () => { const amount = 100; const generator = randomIds(); From ef6139e05c3c906e21e41ad154474837e0f2dee0 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Fri, 22 Jul 2022 15:10:35 +0200 Subject: [PATCH 03/27] delete dry in AutoForm tests --- packages/uniforms/__tests__/AutoForm.tsx | 114 ++++------------------- 1 file changed, 20 insertions(+), 94 deletions(-) diff --git a/packages/uniforms/__tests__/AutoForm.tsx b/packages/uniforms/__tests__/AutoForm.tsx index 1f9d3a7c7..511a917b8 100644 --- a/packages/uniforms/__tests__/AutoForm.tsx +++ b/packages/uniforms/__tests__/AutoForm.tsx @@ -6,17 +6,29 @@ import { SimpleSchema2Bridge } from 'uniforms-bridge-simple-schema-2'; import { render } from '../__suites__'; +const schema = new SimpleSchema2Bridge( + new SimpleSchema({ + a: { type: String, defaultValue: '' }, + b: { type: String, defaultValue: '' }, + c: { type: String, defaultValue: '' }, + }), +); +const model = { a: '1' }; +const onChange = jest.fn(); +const onChangeModel = jest.fn(); +const onSubmit = jest.fn(); +const validator = jest.fn(); + +beforeEach(() => { + onChange.mockClear(); + onChangeModel.mockClear(); + onSubmit.mockClear(); + validator.mockClear(); +}); + describe('', () => { describe('when changes', () => { test('updates', () => { - const schema = new SimpleSchema2Bridge( - new SimpleSchema({ - a: { type: String, defaultValue: '' }, - b: { type: String, defaultValue: '' }, - c: { type: String, defaultValue: '' }, - }), - ); - const onChange = jest.fn(); render( , { schema: { type: SimpleSchema2Bridge } }, @@ -27,15 +39,6 @@ describe('', () => { // todo no way to test in rts cause of AutoField not rendering inputs, and in rts we don't have access to instance test.skip('validates', () => { // FIXME: AutoForm is not a valid Component. - const schema = new SimpleSchema2Bridge( - new SimpleSchema({ - a: { type: String, defaultValue: '' }, - b: { type: String, defaultValue: '' }, - c: { type: String, defaultValue: '' }, - }), - ); - const onChange = jest.fn(); - const validator = jest.fn(); render( , { schema: { type: SimpleSchema2Bridge } }, @@ -55,14 +58,6 @@ describe('', () => { test('calls `onChangeModel`', () => { // FIXME: AutoForm is not a valid Component. - const schema = new SimpleSchema2Bridge( - new SimpleSchema({ - a: { type: String, defaultValue: '' }, - b: { type: String, defaultValue: '' }, - c: { type: String, defaultValue: '' }, - }), - ); - const onChangeModel = jest.fn(); render( ', () => { // todo no way to test in rts cause we don't have access to instance and state of component // (https://testing-library.com/docs/react-testing-library/intro/#the-problem) // FIXME: AutoForm is not a valid Component. - const schema = new SimpleSchema2Bridge( - new SimpleSchema({ - a: { type: String, defaultValue: '' }, - b: { type: String, defaultValue: '' }, - c: { type: String, defaultValue: '' }, - }), - ); - const onChange = jest.fn(); render( , { schema: { type: SimpleSchema2Bridge } }, @@ -113,16 +100,6 @@ describe('', () => { const field = () => null; const Field = connectField(field); - const schema = new SimpleSchema2Bridge( - new SimpleSchema({ - a: { type: String, defaultValue: '' }, - b: { type: String, defaultValue: '' }, - c: { type: String, defaultValue: '' }, - }), - ); - const model = { a: '1' }; - const onChange = jest.fn(); - // FIXME: AutoForm is not a valid Component. render( ', () => { test.skip('skips `onSubmit` until rendered (`autosave` = true)', async () => { // todo no way to test in rts cause we don't have access to instance and state of component // FIXME: AutoForm is not a valid Component. - const schema = new SimpleSchema2Bridge( - new SimpleSchema({ - a: { type: String, defaultValue: '' }, - b: { type: String, defaultValue: '' }, - c: { type: String, defaultValue: '' }, - }), - ); - const onSubmit = jest.fn(); - const onChange = jest.fn(); - const validator = jest.fn(); render( ', () => { test.skip('reset `model`', () => { // todo no way to test in rts cause we don't have access to instance and state of component // FIXME: AutoForm is not a valid Component. - const schema = new SimpleSchema2Bridge( - new SimpleSchema({ - a: { type: String, defaultValue: '' }, - b: { type: String, defaultValue: '' }, - c: { type: String, defaultValue: '' }, - }), - ); - const model = { a: '1' }; render( ', () => { test.skip('resets state `changedMap`', () => { // todo no way to test in rts cause we don't have access to instance and state of component // FIXME: AutoForm is not a valid Component. - const schema = new SimpleSchema2Bridge( - new SimpleSchema({ - a: { type: String, defaultValue: '' }, - b: { type: String, defaultValue: '' }, - c: { type: String, defaultValue: '' }, - }), - ); - const model = { a: '1' }; - const onSubmit = jest.fn(); render( ', () => { test.skip('resets state `changed`', () => { // todo no way to test in rts cause we don't have access to instance and state of component // FIXME: AutoForm is not a valid Component. - const schema = new SimpleSchema2Bridge( - new SimpleSchema({ - a: { type: String, defaultValue: '' }, - b: { type: String, defaultValue: '' }, - c: { type: String, defaultValue: '' }, - }), - ); - const model = { a: '1' }; - const onSubmit = jest.fn(); render( ', () => { test.skip(', updates', () => { // todo no way to test in rts cause AutoForm not render input in core // FIXME: AutoForm is not a valid Component. - const schema = new SimpleSchema2Bridge( - new SimpleSchema({ - a: { type: String, defaultValue: '' }, - b: { type: String, defaultValue: '' }, - c: { type: String, defaultValue: '' }, - }), - ); render(, { schema: { type: SimpleSchema2Bridge }, }); @@ -282,14 +216,6 @@ describe('', () => { test.skip(', validates', () => { // todo no way to test in rts cause AutoForm not render input in core // FIXME: AutoForm is not a valid Component. - const schema = new SimpleSchema2Bridge( - new SimpleSchema({ - a: { type: String, defaultValue: '' }, - b: { type: String, defaultValue: '' }, - c: { type: String, defaultValue: '' }, - }), - ); - const validator = jest.fn(); render(, { schema: { type: SimpleSchema2Bridge }, }); From 89564a77ce17081accbc09c7b2d6fcbace57c8cc Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Fri, 22 Jul 2022 16:16:12 +0200 Subject: [PATCH 04/27] rewrite useField --- packages/uniforms/__tests__/useField.tsx | 112 ++++++++++++----------- 1 file changed, 58 insertions(+), 54 deletions(-) diff --git a/packages/uniforms/__tests__/useField.tsx b/packages/uniforms/__tests__/useField.tsx index 2bb068a67..a0741273a 100644 --- a/packages/uniforms/__tests__/useField.tsx +++ b/packages/uniforms/__tests__/useField.tsx @@ -1,93 +1,96 @@ +import { fireEvent, screen } from '@testing-library/react'; import React, { ReactNode } from 'react'; import { AutoForm, BaseForm, connectField, useField } from 'uniforms'; import { JSONSchemaBridge } from 'uniforms-bridge-json-schema'; +import { SimpleSchema2Bridge } from 'uniforms-bridge-simple-schema-2'; -import mount from './_mount'; +import { render } from '../__suites__'; -describe('useField', () => { - const bridge = new JSONSchemaBridge( - { - type: 'object', - properties: { - a: { type: 'string' }, - b: { type: 'object', properties: { c: { type: 'string' } } }, - d: { type: 'number', default: 4 }, - }, +const bridge = new JSONSchemaBridge( + { + type: 'object', + properties: { + a: { type: 'string' }, + b: { type: 'object', properties: { c: { type: 'string' } } }, + d: { type: 'number', default: 4 }, }, - () => {}, - ); + }, + () => {}, +); + +function Test(rawProps: { + children?: ReactNode; + name: string; + options?: Parameters[2]; +}) { + const [props] = useField(rawProps.name, rawProps, rawProps.options); + return <>{props.children}; +} - function Test(rawProps: { - children?: ReactNode; - name: string; - options?: Parameters[2]; - }) { - const [props] = useField(rawProps.name, rawProps, rawProps.options); - return <>{props.children}; - } +const TestComponent = connectField((props: Record) => { + return ( + { + props.onChange(event.target.value); + }} + /> + ); +}); - it('is a function', () => { +describe('useField', () => { + test('is a function', () => { expect(useField).toBeInstanceOf(Function); }); describe('when called with initialValue', () => { - const TestComponent = connectField((props: Record) => { - return ( - { - props.onChange(event.target.value); - }} - /> - ); - }); - - it('applies default value', () => { - const wrapper = mount( - + test('applies default value', () => { + render( + , + { schema: { type: SimpleSchema2Bridge } }, ); - expect(wrapper.find('input').prop('value')).toBe(4); + const element = screen.getByTestId('autoForm').children[0]; - expect( - wrapper - .find('input') - .simulate('change', { target: { value: undefined } }), - ).toBeTruthy(); + expect(element).toHaveAttribute('value', '4'); + + fireEvent.change(element, { target: { value: undefined } }); + expect(element.getAttribute('value')).toBeTruthy(); }); - it('does not apply default value after first change', () => { - const wrapper = mount( - + test.skip('does not apply default value after first change', () => { + render( + , + { schema: { type: SimpleSchema2Bridge } }, ); - expect( - wrapper - .find('input') - .simulate('change', { target: { value: undefined } }), - ).toBeTruthy(); + const element = screen.getByTestId('autoForm').children[0]; + fireEvent.change(element, { target: { value: undefined } }); + + expect(element).toBeTruthy(); - expect(wrapper.find('input').prop('value')).toBe(''); + expect(element).toHaveAttribute('value', ''); }); }); describe('when called with `absoluteName`', () => { - it('works on top-level', () => { - mount( + test('works on top-level', () => { + render( , + { schema: { type: SimpleSchema2Bridge } }, ); }); - it('works nested', () => { - mount( + test('works nested', () => { + render( @@ -95,6 +98,7 @@ describe('useField', () => { , + { schema: { type: SimpleSchema2Bridge } }, ); }); }); From 0e9390d6eec300eed7e8214d6acb446c545fac70 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Fri, 5 Aug 2022 14:51:48 +0200 Subject: [PATCH 05/27] rewrite test from enzyme to rts for the useField component --- packages/uniforms/__tests__/useField.tsx | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/packages/uniforms/__tests__/useField.tsx b/packages/uniforms/__tests__/useField.tsx index a0741273a..5da103822 100644 --- a/packages/uniforms/__tests__/useField.tsx +++ b/packages/uniforms/__tests__/useField.tsx @@ -51,29 +51,24 @@ describe('useField', () => { , { schema: { type: SimpleSchema2Bridge } }, ); + const input = screen.getByRole('textbox'); - const element = screen.getByTestId('autoForm').children[0]; - - expect(element).toHaveAttribute('value', '4'); - - fireEvent.change(element, { target: { value: undefined } }); - expect(element.getAttribute('value')).toBeTruthy(); + expect(input).toHaveAttribute('value', '4'); }); - test.skip('does not apply default value after first change', () => { - render( - + test('does not apply default value after first change', () => { + const { getByRole } = render( + , { schema: { type: SimpleSchema2Bridge } }, ); - const element = screen.getByTestId('autoForm').children[0]; - fireEvent.change(element, { target: { value: undefined } }); + const input = getByRole('textbox'); - expect(element).toBeTruthy(); + fireEvent.change(input, { target: { value: null } }); - expect(element).toHaveAttribute('value', ''); + expect(input).toHaveAttribute('value', ''); }); }); From 5e8ea223b5a99ab83bba55042146663c9179fda0 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Tue, 18 Oct 2022 15:52:22 +0200 Subject: [PATCH 06/27] wip --- packages/uniforms/__tests__/AutoForm.tsx | 175 ++++--- packages/uniforms/__tests__/ValidatedForm.tsx | 468 +++++++++++++++--- packages/uniforms/__tests__/useField.tsx | 4 +- 3 files changed, 494 insertions(+), 153 deletions(-) diff --git a/packages/uniforms/__tests__/AutoForm.tsx b/packages/uniforms/__tests__/AutoForm.tsx index 511a917b8..acf770fd2 100644 --- a/packages/uniforms/__tests__/AutoForm.tsx +++ b/packages/uniforms/__tests__/AutoForm.tsx @@ -1,7 +1,7 @@ import { fireEvent, screen } from '@testing-library/react'; import React from 'react'; import SimpleSchema from 'simpl-schema'; -import { AutoForm, connectField } from 'uniforms'; +import { AutoForm, connectField, context } from 'uniforms'; import { SimpleSchema2Bridge } from 'uniforms-bridge-simple-schema-2'; import { render } from '../__suites__'; @@ -19,6 +19,8 @@ const onChangeModel = jest.fn(); const onSubmit = jest.fn(); const validator = jest.fn(); +jest.spyOn(schema.schema, 'validator').mockImplementation(() => validator); + beforeEach(() => { onChange.mockClear(); onChangeModel.mockClear(); @@ -30,65 +32,76 @@ describe('', () => { describe('when changes', () => { test('updates', () => { render( - , + // TODO: delete ts-expect-error error if this issue is resolved https://github.com/vazco/uniforms/issues/1165 + // @ts-expect-error + , { schema: { type: SimpleSchema2Bridge } }, { onChange }, ); }); - - // todo no way to test in rts cause of AutoField not rendering inputs, and in rts we don't have access to instance + // todo no way to test in rts cause we don't have access to validator function call test.skip('validates', () => { // FIXME: AutoForm is not a valid Component. render( - , - { schema: { type: SimpleSchema2Bridge } }, + , + { + schema: { type: SimpleSchema2Bridge }, + }, ); - const element = screen.getByTestId('autoForm'); - fireEvent.submit(element); + const form = screen.getByRole('form'); + fireEvent.submit(form); expect(validator).toHaveBeenCalledTimes(1); expect(validator).toHaveBeenLastCalledWith({}); - fireEvent.change(element, onChange({ a: '1' })); + // fireEvent.change(form, onChange({ a: '2' })); expect(validator).toHaveBeenCalledTimes(2); - expect(validator).toHaveBeenLastCalledWith({ a: '1' }); + expect(validator).toHaveBeenLastCalledWith({ a: '2' }); }); test('calls `onChangeModel`', () => { // FIXME: AutoForm is not a valid Component. render( , { schema: { type: SimpleSchema2Bridge } }, ); - const element = screen.getByTestId('autoForm'); + const element = screen.getByRole('form'); fireEvent.change(element, onChangeModel({ a: '2' })); expect(onChangeModel).toHaveBeenCalledTimes(1); expect(onChangeModel).toHaveBeenLastCalledWith({ a: '2' }); }); - + // todo no way to test in rts cause we don't have access to call onChange test.skip('updates `changed` and `changedMap`', () => { - // todo no way to test in rts cause we don't have access to instance and state of component - // (https://testing-library.com/docs/react-testing-library/intro/#the-problem) // FIXME: AutoForm is not a valid Component. render( - , - { schema: { type: SimpleSchema2Bridge } }, + // TODO: delete ts-expect-error if this issue is resolved https://github.com/vazco/uniforms/issues/1165 + // @ts-expect-error + , + { + schema: { type: SimpleSchema2Bridge }, + }, ); - const element = screen.getByTestId('autoForm'); - - expect(element).toHaveProperty('changed', false); - expect(element).toHaveProperty('changedMap', {}); + const element = screen.getByRole('form'); - fireEvent.change(element, onChange({ a: '1' })); + expect(element).toBe('false'); + expect(element).toBe('{}'); expect(element).toHaveProperty('changed', true); expect(element).toHaveProperty('changedMap.a'); @@ -103,7 +116,6 @@ describe('', () => { // FIXME: AutoForm is not a valid Component. render( ', () => { expect(onChange.mock.calls[0]).toEqual(expect.arrayContaining(['b', ''])); expect(onChange.mock.calls[1]).toEqual(expect.arrayContaining(['c', ''])); }); - + // todo no way to test in rts cause we don't have access to onChange and validator function call test.skip('skips `onSubmit` until rendered (`autosave` = true)', async () => { - // todo no way to test in rts cause we don't have access to instance and state of component // FIXME: AutoForm is not a valid Component. render( ', () => { expect(onSubmit).not.toBeCalled(); - const element = screen.getByTestId('autoForm'); + const element = screen.getByRole('form'); await new Promise(resolve => setTimeout(resolve)); @@ -146,65 +159,88 @@ describe('', () => { expect(validator).toHaveBeenLastCalledWith({ a: 1 }); }); }); + describe('when reset', () => { - test.skip('reset `model`', () => { - // todo no way to test in rts cause we don't have access to instance and state of component + test('reset `model`', () => { // FIXME: AutoForm is not a valid Component. - render( - , - { - schema: { type: SimpleSchema2Bridge }, - }, + const Component = () => ( + + + {context => ( + <> + {context && context.model ? ( +

{JSON.stringify(context.model)}

+ ) : null} + + )} +
+
); + const { rerender } = render(, { + schema: { type: SimpleSchema2Bridge }, + }); - // expect(wrapper.instance().getContext().model).toEqual(model); + rerender(); + const renderedModel = JSON.parse(screen.getByTestId('model').innerHTML); + + expect(renderedModel).toEqual(model); }); - test.skip('resets state `changedMap`', () => { - // todo no way to test in rts cause we don't have access to instance and state of component + test('resets state `changedMap`', () => { // FIXME: AutoForm is not a valid Component. - render( - , - { - schema: { type: SimpleSchema2Bridge }, - }, + const Component = () => ( + + + {context => ( + <> + {context && context.changedMap ? ( +

+ {JSON.stringify(context.changedMap)} +

+ ) : null} + + )} +
+
); + const { rerender } = render(, { + schema: { type: SimpleSchema2Bridge }, + }); - // expect(wrapper.instance().getContext().changedMap).toEqual({}); + rerender(); + const changedMap = JSON.parse(screen.getByTestId('changedMap').innerHTML); + + expect(changedMap).toEqual({}); }); - test.skip('resets state `changed`', () => { - // todo no way to test in rts cause we don't have access to instance and state of component + test('resets state `changed`', () => { // FIXME: AutoForm is not a valid Component. - render( - , - { - schema: { type: SimpleSchema2Bridge }, - }, + const Component = () => ( + + + {context => ( + <> + {context ? ( +

{JSON.stringify(context.changed)}

+ ) : null} + + )} +
+
); + const { rerender } = render(, { + schema: { type: SimpleSchema2Bridge }, + }); + + rerender(); + const changed = JSON.parse(screen.getByTestId('changed').innerHTML); - // expect(wrapper.instance().getContext().changed).toEqual(false); + expect(changed).toEqual(false); }); }); describe('when update', () => { + // todo no way to test in rts cause we don't have access to props test.skip(', updates', () => { - // todo no way to test in rts cause AutoForm not render input in core // FIXME: AutoForm is not a valid Component. render(, { schema: { type: SimpleSchema2Bridge }, @@ -214,12 +250,13 @@ describe('', () => { }); test.skip(', validates', () => { - // todo no way to test in rts cause AutoForm not render input in core + // todo no way to test in rts cause we don't have access to setProps // FIXME: AutoForm is not a valid Component. render(, { schema: { type: SimpleSchema2Bridge }, }); + // element.setProps({ model, validate: 'onChange' }); expect(validator).toHaveBeenCalledTimes(1); }); }); diff --git a/packages/uniforms/__tests__/ValidatedForm.tsx b/packages/uniforms/__tests__/ValidatedForm.tsx index d3b21bdf6..a08c1c445 100644 --- a/packages/uniforms/__tests__/ValidatedForm.tsx +++ b/packages/uniforms/__tests__/ValidatedForm.tsx @@ -1,8 +1,10 @@ +import { fireEvent, screen } from '@testing-library/react'; import React from 'react'; import SimpleSchema from 'simpl-schema'; -import { ValidatedForm } from 'uniforms'; +import { ValidatedForm, context } from 'uniforms'; import { SimpleSchema2Bridge } from 'uniforms-bridge-simple-schema-2'; +import { render } from '../__suites__'; import mount from './_mount'; describe('ValidatedForm', () => { @@ -12,7 +14,7 @@ describe('ValidatedForm', () => { const validator = jest.fn(); const validatorForSchema = jest.fn(() => validator); - const error = new Error(); + const error = new Error('test error message'); const model = { a: 1 }; const schema = new SimpleSchema2Bridge( new SimpleSchema({ @@ -23,184 +25,486 @@ describe('ValidatedForm', () => { ); jest.spyOn(schema.schema, 'validator').mockImplementation(validatorForSchema); - beforeEach(() => { - onChange.mockClear(); - onSubmit.mockClear(); - onValidate.mockClear(); - validator.mockClear(); - validatorForSchema.mockClear(); - }); + beforeEach(() => jest.clearAllMocks()); describe('on validation', () => { // FIXME: ValidatedForm is not a valid Component. - let wrapper = mount(); - let form = wrapper.instance(); - beforeEach(() => { - wrapper = mount( - , + test('validates (when `.validate` is called)', () => { + render( + , + { + schema: { type: SimpleSchema2Bridge }, + }, ); - form = wrapper.instance(); - }); - - it('validates (when `.validate` is called)', () => { - form.validate(); + const form = screen.getByRole('form'); + fireEvent.submit(form); expect(validator).toHaveBeenCalledTimes(1); }); - it('correctly calls `validator`', () => { - form.validate(); + test('correctly calls `validator`', () => { + render( + , + { + schema: { type: SimpleSchema2Bridge }, + }, + ); + const form = screen.getByRole('form'); + fireEvent.submit(form); expect(validator).toHaveBeenCalledTimes(1); expect(validator).toHaveBeenLastCalledWith(model); }); + test('updates error state with errors from `validator`', async () => { + render( + , + { + schema: { type: SimpleSchema2Bridge }, + }, + ); + const form = screen.getByRole('form'); - it('updates error state with errors from `validator`', async () => { validator.mockImplementationOnce(() => { throw error; }); - form.validate(); + fireEvent.submit(form); await new Promise(resolve => process.nextTick(resolve)); - expect(wrapper.instance().getContext().error).toBe(error); + expect(onValidate).toHaveBeenLastCalledWith(model, error); }); - it('correctly calls `onValidate` when validation succeeds', () => { - form.validate(); + test('correctly calls `onValidate` when validation succeeds', () => { + render( + , + { + schema: { type: SimpleSchema2Bridge }, + }, + ); + const form = screen.getByRole('form'); + + fireEvent.submit(form); expect(onValidate).toHaveBeenCalledTimes(1); expect(onValidate).toHaveBeenLastCalledWith(model, null); }); - it('correctly calls `onValidate` when validation fails ', () => { + test('correctly calls `onValidate` when validation fails ', () => { + render( + , + { + schema: { type: SimpleSchema2Bridge }, + }, + ); + const form = screen.getByRole('form'); + validator.mockImplementationOnce(() => { throw error; }); - form.validate(); + fireEvent.submit(form); expect(onValidate).toHaveBeenCalledTimes(1); expect(onValidate).toHaveBeenLastCalledWith(model, error); }); - it('updates error state with async errors from `onValidate`', async () => { + test('updates error state with async errors from `onValidate`', async () => { + render( + + + {context => ( + <> + {context && context.error ? ( +

{context.error.message}

+ ) : null} + + )} +
+
, + { + schema: { type: SimpleSchema2Bridge }, + }, + ); + const form = screen.getByRole('form'); + onValidate.mockImplementationOnce(() => error); - form.validate(); + fireEvent.submit(form); + const errorElement = screen.getByTestId('error'); - expect(wrapper.instance().getContext().error).toBe(error); + expect(errorElement.innerHTML).toBe('test error message'); }); + test('leaves error state alone when `onValidate` suppress `validator` errors', async () => { + render( + + + {context => ( + <> + {context ? ( +

+ {JSON.stringify({ error: context.error })} +

+ ) : null} + + )} +
+
, + { + schema: { type: SimpleSchema2Bridge }, + }, + ); + const form = screen.getByRole('form'); + const errorContext = JSON.parse(screen.getByTestId('error').innerHTML); - it('leaves error state alone when `onValidate` suppress `validator` errors', async () => { validator.mockImplementationOnce(() => { throw error; }); onValidate.mockImplementationOnce(() => null); - form.validate(); + fireEvent.submit(form); expect(validator).toHaveBeenCalled(); expect(onValidate).toHaveBeenCalled(); - expect(wrapper.instance().getContext()).not.toHaveProperty( - 'uniforms.error', - error, - ); + expect(errorContext.error).toBe(null); }); + test('has `validating` context variable, default `false`', () => { + render( + + + {context => ( + <> + {context ? ( +

+ {JSON.stringify(context.validating)} +

+ ) : null} + + )} +
+
, + { + schema: { type: SimpleSchema2Bridge }, + }, + ); + + const validatingContext = JSON.parse( + screen.getByTestId('validating').innerHTML, + ); - it('has `validating` context variable, default `false`', () => { - expect(wrapper.instance().getContext().validating).toBe(false); + expect(validatingContext).toBe(false); }); - it('uses `modelTransform`s `validate` mode', () => { + test('uses `modelTransform`s `validate` mode', () => { const transformedModel = { b: 1 }; const modelTransform = (mode: string, model: Record) => mode === 'validate' ? transformedModel : model; - wrapper.setProps({ modelTransform }); - form.validate(); + render( + , + { + schema: { type: SimpleSchema2Bridge }, + }, + ); + const form = screen.getByRole('form'); + fireEvent.submit(form); expect(validator).toHaveBeenLastCalledWith(transformedModel); expect(onValidate).toHaveBeenLastCalledWith(transformedModel, null); }); }); describe('when submitted', () => { - // FIXME: ValidatedForm is not a valid Component. - let wrapper = mount( - , - ); - - beforeEach(() => { - wrapper = mount( + test('calls `onSubmit` when validation succeeds', async () => { + render( + // FIXME: ValidatedForm is not a valid Component. , + { + schema: { type: SimpleSchema2Bridge }, + }, ); - }); - it('calls `onSubmit` when validation succeeds', async () => { - wrapper.find('form').simulate('submit'); + const form = screen.getByRole('form'); + fireEvent.submit(form); await new Promise(resolve => process.nextTick(resolve)); expect(onSubmit).toHaveBeenCalledTimes(1); }); - it('skips `onSubmit` when validation fails', async () => { + test('skips `onSubmit` when validation fails', async () => { + render( + // FIXME: ValidatedForm is not a valid Component. + , + { + schema: { type: SimpleSchema2Bridge }, + }, + ); + validator.mockImplementationOnce(() => { throw error; }); - wrapper.find('form').simulate('submit'); + // TODO: add role form to form html element + const form = screen.getByRole('form'); + fireEvent.submit(form); await new Promise(resolve => process.nextTick(resolve)); expect(onSubmit).not.toBeCalled(); }); - it('sets submitted to true, when form is submitted and validation succeeds', () => { - const instance = wrapper.instance(); - expect(instance.getContext().submitted).toBe(false); - wrapper.find('form').simulate('submit'); - expect(instance.getContext().submitted).toBe(true); + test('sets submitted to true, when form is submitted and validation succeeds', () => { + render( + // FIXME: ValidatedForm is not a valid Component. + + + {context => ( + <> + {context ? ( +

+ {JSON.stringify(context.submitted)} +

+ ) : null} + + )} +
+
, + { + schema: { type: SimpleSchema2Bridge }, + }, + ); + const form = screen.getByRole('form'); + const getSubmittedContext = () => + JSON.parse(screen.getByTestId('submitted').innerHTML); + let submittedContext = getSubmittedContext(); + + expect(submittedContext).toBe(false); + + fireEvent.submit(form); + submittedContext = getSubmittedContext(); + + expect(submittedContext).toBe(true); }); - it('sets submitted to true, when form is submitted and validation fails', () => { + test('sets submitted to true, when form is submitted and validation fails', () => { + render( + // FIXME: ValidatedForm is not a valid Component. + + + {context => ( + <> + {context ? ( +

+ {JSON.stringify(context.submitted)} +

+ ) : null} + + )} +
+
, + { + schema: { type: SimpleSchema2Bridge }, + }, + ); + validator.mockImplementationOnce(() => { throw error; }); - const instance = wrapper.instance(); - expect(instance.getContext().submitted).toBe(false); - wrapper.find('form').simulate('submit'); - expect(instance.getContext().submitted).toBe(true); + + const form = screen.getByRole('form'); + const getSubmittedContext = () => + JSON.parse(screen.getByTestId('submitted').innerHTML); + let submittedContext = getSubmittedContext(); + + expect(submittedContext).toBe(false); + + fireEvent.submit(form); + submittedContext = getSubmittedContext(); + + expect(submittedContext).toBe(true); }); - it('updates error state with async errors from `onSubmit`', async () => { + test('updates error state with async errors from `onSubmit`', async () => { + render( + // FIXME: ValidatedForm is not a valid Component. + + + {context => ( + <> + {context && context.error ? ( +

{context.error.message}

+ ) : null} + + )} +
+
, + { + schema: { type: SimpleSchema2Bridge }, + }, + ); + onSubmit.mockImplementationOnce(() => Promise.reject(error)); - wrapper.find('form').simulate('submit'); + const form = screen.getByRole('form'); + + fireEvent.submit(form); await new Promise(resolve => process.nextTick(resolve)); + const errorMessage = screen.getByTestId('error').innerHTML; expect(onSubmit).toHaveBeenCalled(); - expect(wrapper.instance().getContext().error).toBe(error); + expect(errorMessage).toBe('test error message'); }); - it('works if unmounts on submit', async () => { - onSubmit.mockImplementationOnce(() => wrapper.unmount()); - wrapper.find('form').simulate('submit'); + test('works if unmounts on submit', async () => { + const { unmount } = render( + // FIXME: ValidatedForm is not a valid Component. + , + { + schema: { type: SimpleSchema2Bridge }, + }, + ); + // TODO: add role form to form html element + const form = screen.getByRole('form'); + onSubmit.mockImplementationOnce(() => unmount()); + fireEvent.submit(form); await new Promise(resolve => process.nextTick(resolve)); }); }); describe('on change', () => { describe('in `onChange` mode', () => { - it('validates', () => { + test.skip('validates', () => { // FIXME: ValidatedForm is not a valid Component. - const wrapper = mount( - , + render( + , + { + schema: { type: SimpleSchema2Bridge }, + }, ); - wrapper.instance().getContext().onChange('key', 'value'); - + const form = screen.getByRole('form'); + fireEvent.change(form, onChange({ a: 2 })); expect(validator).toHaveBeenCalledTimes(1); }); }); diff --git a/packages/uniforms/__tests__/useField.tsx b/packages/uniforms/__tests__/useField.tsx index 5da103822..9466d4a54 100644 --- a/packages/uniforms/__tests__/useField.tsx +++ b/packages/uniforms/__tests__/useField.tsx @@ -46,7 +46,7 @@ describe('useField', () => { describe('when called with initialValue', () => { test('applies default value', () => { render( - + , { schema: { type: SimpleSchema2Bridge } }, @@ -58,7 +58,7 @@ describe('useField', () => { test('does not apply default value after first change', () => { const { getByRole } = render( - + , { schema: { type: SimpleSchema2Bridge } }, From 7734125fa4433994665f5a17ec0732e13f1c2d42 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Sun, 27 Nov 2022 12:58:34 +0100 Subject: [PATCH 07/27] rewrite almost all validateForm to rts --- packages/uniforms/__tests__/ValidatedForm.tsx | 588 ++++++++++-------- 1 file changed, 342 insertions(+), 246 deletions(-) diff --git a/packages/uniforms/__tests__/ValidatedForm.tsx b/packages/uniforms/__tests__/ValidatedForm.tsx index a08c1c445..705483616 100644 --- a/packages/uniforms/__tests__/ValidatedForm.tsx +++ b/packages/uniforms/__tests__/ValidatedForm.tsx @@ -3,9 +3,9 @@ import React from 'react'; import SimpleSchema from 'simpl-schema'; import { ValidatedForm, context } from 'uniforms'; import { SimpleSchema2Bridge } from 'uniforms-bridge-simple-schema-2'; +import { AutoField } from 'uniforms-unstyled'; import { render } from '../__suites__'; -import mount from './_mount'; describe('ValidatedForm', () => { const onChange = jest.fn(); @@ -477,7 +477,6 @@ describe('ValidatedForm', () => { schema: { type: SimpleSchema2Bridge }, }, ); - // TODO: add role form to form html element const form = screen.getByRole('form'); onSubmit.mockImplementationOnce(() => unmount()); fireEvent.submit(form); @@ -487,332 +486,429 @@ describe('ValidatedForm', () => { describe('on change', () => { describe('in `onChange` mode', () => { - test.skip('validates', () => { + test('validates', () => { // FIXME: ValidatedForm is not a valid Component. render( , + > + + , { schema: { type: SimpleSchema2Bridge }, }, ); - const form = screen.getByRole('form'); - fireEvent.change(form, onChange({ a: 2 })); + const input = screen.getByLabelText('A'); + fireEvent.change(input, { target: { value: 'test' } }); expect(validator).toHaveBeenCalledTimes(1); }); }); describe('in `onSubmit` mode', () => { - it('does not validate', () => { + test('does not validate', () => { // FIXME: ValidatedForm is not a valid Component. - const wrapper = mount( - , + render( + + + , + { + schema: { type: SimpleSchema2Bridge }, + }, ); - wrapper.instance().getContext().onChange('key', 'value'); + const input = screen.getByLabelText('A'); + fireEvent.change(input, { target: { value: 'test' } }); expect(validator).not.toHaveBeenCalled(); }); }); describe('in `onChangeAfterSubmit` mode', () => { - // FIXME: ValidatedForm is not a valid Component. - let wrapper = mount( - , - ); - - beforeEach(() => { - wrapper = mount( + test('does not validates before submit', () => { + render( + // FIXME: ValidatedForm is not a valid Component. , + > + + , + { + schema: { type: SimpleSchema2Bridge }, + }, ); - }); + const input = screen.getByLabelText('A'); + fireEvent.change(input, { target: { value: 'test' } }); - it('does not validates before submit', () => { - wrapper.instance().getContext().onChange('key', 'value'); expect(validator).not.toHaveBeenCalled(); }); - it('validates after submit', async () => { - wrapper.find('form').simulate('submit'); + test('validates after submit', async () => { + render( + // FIXME: ValidatedForm is not a valid Component. + + + , + { + schema: { type: SimpleSchema2Bridge }, + }, + ); + + const form = screen.getByRole('form'); + fireEvent.submit(form); await new Promise(resolve => process.nextTick(resolve)); validator.mockClear(); - wrapper.instance().getContext().onChange('key', 'value'); + const input = screen.getByLabelText('A'); + fireEvent.change(input, { target: { value: 'test' } }); + expect(validator).toHaveBeenCalledTimes(1); }); }); }); describe('on reset', () => { - it('removes `error`', () => { - // FIXME: ValidatedForm is not a valid Component. - const wrapper = mount( - , - ); + test('removes `error`', async () => { + const Component = () => { + // @ts-expect-error + let formRef; + + return ( + // FIXME: ValidatedForm is not a valid Component. + (formRef = ref)} + model={model} + onSubmit={onSubmit} + schema={schema} + > + + {context => ( + <> + {context ? ( +

{context.error?.message}

+ ) : null} + + )} +
+ {/* @ts-expect-error */} + +
+ ); + }; + + render(, { + schema: { type: SimpleSchema2Bridge }, + }); validator.mockImplementationOnce(() => { - throw new Error(); + throw error; }); - wrapper.find('form').simulate('submit'); - expect(wrapper.instance().getContext().error).toBeTruthy(); - wrapper.instance().reset(); - expect(wrapper.instance().getContext().error).toBeNull(); + const form = screen.getByRole('form'); + const resetButton = screen.getByText('Reset'); + + fireEvent.submit(form); + await new Promise(resolve => process.nextTick(resolve)); + const errorMessage = screen.getByTestId('error').innerHTML; + + expect(errorMessage).toBe('test error message'); + + fireEvent.click(resetButton); + await new Promise(resolve => process.nextTick(resolve)); + const errorMessage2 = screen.getByTestId('error').innerHTML; + expect(errorMessage2).toBe(''); }); }); describe('when props are changed', () => { const anotherModel = { x: 2 }; - describe('in `onChange` mode', () => { - // FIXME: ValidatedForm is not a valid Component. - let wrapper = mount( - , - ); - - beforeEach(() => { - wrapper = mount( - , - ); - }); + // FIXME: ValidatedForm is not a valid Component. + const Component = (props: any) => ( + + ); - it('does not revalidate arbitrarily', () => { - wrapper.setProps({ anything: 'anything' }); - expect(validator).not.toBeCalled(); + test('does not revalidate arbitrarily', () => { + const { rerender } = render(, { + schema: { type: SimpleSchema2Bridge }, }); + rerender(); + expect(validator).not.toBeCalled(); + }); - it('revalidates if `model` changes', () => { - wrapper.setProps({ model: anotherModel }); - expect(validator).toHaveBeenCalledTimes(1); + test('revalidates if `model` changes', () => { + const { rerender } = render(, { + schema: { type: SimpleSchema2Bridge }, }); + rerender(); + expect(validator).toHaveBeenCalledTimes(1); + }); - it('revalidates if `validator` changes', () => { - wrapper.setProps({ validator: {} }); - expect(validator).toHaveBeenCalledTimes(1); + test('revalidates if `validator` changes', () => { + const { rerender } = render(, { + schema: { type: SimpleSchema2Bridge }, }); + rerender(); + expect(validator).toHaveBeenCalledTimes(1); + }); - it('revalidate if `schema` changes', () => { - wrapper.setProps({ schema: new SimpleSchema2Bridge(schema.schema) }); - expect(validator).toHaveBeenCalledTimes(1); + test('revalidate if `schema` changes', () => { + const anotherSchema = new SimpleSchema2Bridge(schema.schema); + const { rerender } = render(, { + schema: { type: SimpleSchema2Bridge }, }); + rerender(); + expect(validator).toHaveBeenCalledTimes(1); }); + }); - describe('in `onSubmit` mode', () => { - // FIXME: ValidatedForm is not a valid Component. - let wrapper = mount( - , - ); - - beforeEach(() => { - wrapper = mount( - , - ); - }); + describe('in `onSubmit` mode', () => { + // FIXME: ValidatedForm is not a valid Component. + const Component = (props: any) => ( + + ); - it('does not revalidate when `model` changes', () => { - wrapper.setProps({ model: {} }); - expect(validator).not.toBeCalled(); + test('does not revalidate when `model` changes', () => { + const { rerender } = render(, { + schema: { type: SimpleSchema2Bridge }, }); + rerender(); + expect(validator).not.toBeCalled(); + }); - it('does not revalidate when validator `options` change', () => { - wrapper.setProps({ validator: {} }); - expect(validator).not.toBeCalled(); + test('does not revalidate when validator `options` change', () => { + const { rerender } = render(, { + schema: { type: SimpleSchema2Bridge }, }); + rerender(); + expect(validator).not.toBeCalled(); + }); - it('does not revalidate when `schema` changes', () => { - wrapper.setProps({ schema: new SimpleSchema2Bridge(schema.schema) }); - expect(validator).not.toBeCalled(); + test('does not revalidate when `schema` changes', () => { + const anotherSchema = new SimpleSchema2Bridge(schema.schema); + const { rerender } = render(, { + schema: { type: SimpleSchema2Bridge }, }); + rerender(); + expect(validator).not.toBeCalled(); }); + }); - describe('in any mode', () => { - // FIXME: ValidatedForm is not a valid Component. - let wrapper = mount( - , - ); + describe('in any mode', () => { + // FIXME: ValidatedForm is not a valid Component. + const Component = (props: any) => ( + + + + ); - beforeEach(() => { - wrapper = mount( - , - ); + test('reuses the validator between validations', () => { + render(, { + schema: { type: SimpleSchema2Bridge }, }); - - it('reuses the validator between validations', () => { - ['1', '2', '3'].forEach(value => { - wrapper.instance().getContext().onChange('key', value); - wrapper.find('form').simulate('submit'); - }); - - expect(validatorForSchema).toHaveBeenCalledTimes(1); + ['1', '2', '3'].forEach(value => { + const form = screen.getByRole('form'); + const input = screen.getByLabelText('A'); + fireEvent.change(input, { target: { value } }); + fireEvent.submit(form); }); - it('uses the new validator settings if `validator` changes', () => { - const validatorA = Symbol(); - const validatorB = Symbol(); - - wrapper.setProps({ validator: validatorA }); - expect(validatorForSchema).toHaveBeenCalledTimes(2); - expect(validatorForSchema).toHaveBeenNthCalledWith(2, validatorA); - - wrapper.setProps({ validator: validatorB }); - expect(validatorForSchema).toHaveBeenCalledTimes(3); - expect(validatorForSchema).toHaveBeenNthCalledWith(3, validatorB); + expect(validatorForSchema).toHaveBeenCalledTimes(1); + }); - wrapper.setProps({ validator: validatorA }); - expect(validatorForSchema).toHaveBeenCalledTimes(4); - expect(validatorForSchema).toHaveBeenNthCalledWith(4, validatorA); + test('uses the new validator settings if `validator` changes', () => { + const validatorA = Symbol(); + const validatorB = Symbol(); + const { rerender } = render(, { + schema: { type: SimpleSchema2Bridge }, }); - it('uses the new validator if `schema` changes', () => { - const alternativeValidator = jest.fn(); - const alternativeSchema = new SimpleSchema2Bridge(schema.schema); - jest - .spyOn(alternativeSchema, 'getValidator') - .mockImplementation(() => alternativeValidator); + rerender(); + expect(validatorForSchema).toHaveBeenCalledTimes(2); + expect(validatorForSchema).toHaveBeenNthCalledWith(2, validatorA); - wrapper.setProps({ schema: alternativeSchema }); - wrapper.find('form').simulate('submit'); + rerender(); + expect(validatorForSchema).toHaveBeenCalledTimes(3); + expect(validatorForSchema).toHaveBeenNthCalledWith(3, validatorB); - expect(validator).not.toBeCalled(); - expect(alternativeValidator).toHaveBeenCalledTimes(1); - }); + rerender(); + expect(validatorForSchema).toHaveBeenCalledTimes(4); + expect(validatorForSchema).toHaveBeenNthCalledWith(4, validatorA); }); - }); - - describe('validation flow', () => { - const variantGroups = [ - { - 'fail-async': () => Promise.resolve(error), - 'fail-sync': () => error, - 'good-async': () => Promise.resolve(null), - 'good-async-silent': () => Promise.resolve(), - 'good-sync': () => null, - 'good-sync-silent': () => {}, - }, - { - 'fail-async': () => Promise.resolve(error), - 'fail-sync': () => error, - 'good-async': () => Promise.resolve(null), - 'good-async-silent': () => Promise.resolve(), - 'good-sync': () => null, - 'good-sync-silent': () => {}, - 'pass-async': (_: string, error: any) => Promise.resolve(error), - 'pass-sync': (_: string, error: any) => error, - }, - { - 'fail-async': () => - new Promise((_, reject) => setTimeout(() => reject(error))), - 'good-async': () => - new Promise(resolve => setTimeout(() => resolve('ok'))), - 'good-sync': () => 'ok', - }, - ] as const; - - function cartesian(xs: X[], ys: Y[]) { - return xs.reduce<[X, Y][]>( - (xys, x) => ys.reduce((xys, y) => [...xys, [x, y]], xys), - [], - ); - } - - function keys(x: X) { - return Object.keys(x) as (keyof X)[]; - } - - const cases = cartesian( - [true, false] as [true, false], - cartesian( - keys(variantGroups[0]), - cartesian(keys(variantGroups[1]), keys(variantGroups[2])), - ), - ); - const alternativeSchema = new SimpleSchema2Bridge(schema.schema); - alternativeSchema.getValidator = () => validator; - - function flatPair4([a, [b, [c, d]]]: [A, [B, [C, D]]]) { - return [a, b, c, d] as const; - } - - it.each(cases.map(flatPair4))('works for %p/%p/%p/%p', async (...modes) => { - const [hasError, validatorMode, onValidateMode, onSubmitMode] = modes; - // FIXME: ValidatedForm is not a valid Component. - const wrapper = mount( - , - ); - - const asyncSubmission = onSubmitMode.includes('async'); - const asyncValidation = - validatorMode.includes('async') || onValidateMode.includes('async'); - const hasValidationError = - hasError || - (validatorMode.includes('good') - ? onValidateMode.includes('fail') - : !onValidateMode.includes('good')); - const hasSubmissionError = - hasValidationError || onSubmitMode.includes('fail'); - - for (let run = 1; run <= 3; ++run) { - validator.mockImplementationOnce(variantGroups[0][validatorMode]); - onValidate.mockImplementationOnce(variantGroups[1][onValidateMode]); - onSubmit.mockImplementationOnce(variantGroups[2][onSubmitMode]); - - const result = wrapper.instance().submit(); - expect(validator).toHaveBeenCalledTimes(run); - - if (asyncValidation) { - expect(wrapper.instance().getContext().validating).toBe(true); - await new Promise(resolve => process.nextTick(resolve)); - expect(wrapper.instance().getContext().validating).toBe(false); - } + test('uses the new validator if `schema` changes', () => { + const alternativeValidator = jest.fn(); + const alternativeSchema = new SimpleSchema2Bridge(schema.schema); + jest + .spyOn(alternativeSchema, 'getValidator') + .mockImplementation(() => alternativeValidator); + const { rerender } = render(, { + schema: { type: SimpleSchema2Bridge }, + }); - await new Promise(resolve => process.nextTick(resolve)); + rerender(); + const form = screen.getByRole('form'); + fireEvent.submit(form); - expect(onValidate).toHaveBeenCalledTimes(run); - - if (hasValidationError) { - expect(onSubmit).toHaveBeenCalledTimes(0); - expect(wrapper.instance().getContext().error).toBe(error); - } else { - expect(onSubmit).toHaveBeenCalledTimes(run); - expect(wrapper.instance().getContext().error).toBe(null); - - if (asyncSubmission) { - expect(wrapper.instance().getContext().submitting).toBe(true); - await new Promise(resolve => setTimeout(resolve)); - expect(wrapper.instance().getContext().submitting).toBe(false); - } - } - - await new Promise(resolve => setTimeout(resolve)); - - if (hasSubmissionError) { - expect(wrapper.instance().getContext().error).toBe(error); - await expect(result).rejects.toEqual(error); - } else { - expect(wrapper.instance().getContext().error).toBe(null); - const submissionResult = asyncSubmission ? 'ok' : undefined; - await expect(result).resolves.toEqual(submissionResult); - } - } + expect(validator).not.toBeCalled(); + expect(alternativeValidator).toHaveBeenCalledTimes(1); }); }); }); + +// describe('validation flow', () => { +// const variantGroups = [ +// { +// 'fail-async': () => Promise.resolve(error), +// 'fail-sync': () => error, +// 'good-async': () => Promise.resolve(null), +// 'good-async-silent': () => Promise.resolve(), +// 'good-sync': () => null, +// 'good-sync-silent': () => {}, +// }, +// { +// 'fail-async': () => Promise.resolve(error), +// 'fail-sync': () => error, +// 'good-async': () => Promise.resolve(null), +// 'good-async-silent': () => Promise.resolve(), +// 'good-sync': () => null, +// 'good-sync-silent': () => {}, +// 'pass-async': (_: string, error: any) => Promise.resolve(error), +// 'pass-sync': (_: string, error: any) => error, +// }, +// { +// 'fail-async': () => +// new Promise((_, reject) => setTimeout(() => reject(error))), +// 'good-async': () => +// new Promise(resolve => setTimeout(() => resolve('ok'))), +// 'good-sync': () => 'ok', +// }, +// ] as const; +// +// function cartesian(xs: X[], ys: Y[]) { +// return xs.reduce<[X, Y][]>( +// (xys, x) => ys.reduce((xys, y) => [...xys, [x, y]], xys), +// [], +// ); +// } +// +// function keys(x: X) { +// return Object.keys(x) as (keyof X)[]; +// } +// +// const cases = cartesian( +// [true, false] as [true, false], +// cartesian( +// keys(variantGroups[0]), +// cartesian(keys(variantGroups[1]), keys(variantGroups[2])), +// ), +// ); +// +// const alternativeSchema = new SimpleSchema2Bridge(schema.schema); +// alternativeSchema.getValidator = () => validator; +// +// function flatPair4([a, [b, [c, d]]]: [A, [B, [C, D]]]) { +// return [a, b, c, d] as const; +// } +// +// it.each(cases.map(flatPair4))('works for %p/%p/%p/%p', async (...modes) => { +// const [hasError, validatorMode, onValidateMode, onSubmitMode] = modes; +// // FIXME: ValidatedForm is not a valid Component. +// const wrapper = mount( +// , +// ); +// +// const asyncSubmission = onSubmitMode.includes('async'); +// const asyncValidation = +// validatorMode.includes('async') || onValidateMode.includes('async'); +// const hasValidationError = +// hasError || +// (validatorMode.includes('good') +// ? onValidateMode.includes('fail') +// : !onValidateMode.includes('good')); +// const hasSubmissionError = +// hasValidationError || onSubmitMode.includes('fail'); +// +// for (let run = 1; run <= 3; ++run) { +// validator.mockImplementationOnce(variantGroups[0][validatorMode]); +// onValidate.mockImplementationOnce(variantGroups[1][onValidateMode]); +// onSubmit.mockImplementationOnce(variantGroups[2][onSubmitMode]); +// +// const result = wrapper.instance().submit(); +// expect(validator).toHaveBeenCalledTimes(run); +// +// if (asyncValidation) { +// expect(wrapper.instance().getContext().validating).toBe(true); +// await new Promise(resolve => process.nextTick(resolve)); +// expect(wrapper.instance().getContext().validating).toBe(false); +// } +// +// await new Promise(resolve => process.nextTick(resolve)); +// +// expect(onValidate).toHaveBeenCalledTimes(run); +// +// if (hasValidationError) { +// expect(onSubmit).toHaveBeenCalledTimes(0); +// expect(wrapper.instance().getContext().error).toBe(error); +// } else { +// expect(onSubmit).toHaveBeenCalledTimes(run); +// expect(wrapper.instance().getContext().error).toBe(null); +// +// if (asyncSubmission) { +// expect(wrapper.instance().getContext().submitting).toBe(true); +// await new Promise(resolve => setTimeout(resolve)); +// expect(wrapper.instance().getContext().submitting).toBe(false); +// } +// } +// +// await new Promise(resolve => setTimeout(resolve)); +// +// if (hasSubmissionError) { +// expect(wrapper.instance().getContext().error).toBe(error); +// await expect(result).rejects.toEqual(error); +// } else { +// expect(wrapper.instance().getContext().error).toBe(null); +// const submissionResult = asyncSubmission ? 'ok' : undefined; +// await expect(result).resolves.toEqual(submissionResult); +// } +// } +// }); +// }); +// }); From 30508fa34fe71766462ee96630b9128298a35cd2 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Sun, 27 Nov 2022 13:01:40 +0100 Subject: [PATCH 08/27] delete test scripts --- scripts/test.ts | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 scripts/test.ts diff --git a/scripts/test.ts b/scripts/test.ts deleted file mode 100644 index 114985ea4..000000000 --- a/scripts/test.ts +++ /dev/null @@ -1,16 +0,0 @@ -const Environment = require('jest-environment-jsdom-global'); -/** - * A custom environment to set the TextEncoder - */ -module.exports = class CustomTestEnvironment extends Environment { - constructor( - { globalConfig, projectConfig }: { globalConfig: any; projectConfig: any }, - context: any, - ) { - super({ globalConfig, projectConfig }, context); - if (typeof this.global.TextEncoder === 'undefined') { - const { TextEncoder } = require('util'); - this.global.TextEncoder = TextEncoder; - } - } -}; From b73c2c0af15765cfba24ddb1c4644c46b0355c40 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Sun, 27 Nov 2022 16:34:37 +0100 Subject: [PATCH 09/27] fix ts error related with ref in ValidateForm --- packages/uniforms/__tests__/ValidatedForm.tsx | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/packages/uniforms/__tests__/ValidatedForm.tsx b/packages/uniforms/__tests__/ValidatedForm.tsx index 6b78381cc..f063f1c94 100644 --- a/packages/uniforms/__tests__/ValidatedForm.tsx +++ b/packages/uniforms/__tests__/ValidatedForm.tsx @@ -1,7 +1,7 @@ import { fireEvent, screen } from '@testing-library/react'; -import React, { useRef } from 'react'; +import React from 'react'; import SimpleSchema from 'simpl-schema'; -import { ValidatedForm, context } from 'uniforms'; +import { ValidatedForm, context, useForm } from 'uniforms'; import { SimpleSchema2Bridge } from 'uniforms-bridge-simple-schema-2'; import { AutoField } from 'uniforms-unstyled'; @@ -579,36 +579,39 @@ describe('ValidatedForm', () => { describe('on reset', () => { test('removes `error`', async () => { - const Component = () => { - // @ts-expect-error - let formRef; + const FormControls = () => { + const { formRef } = useForm(); return ( - // FIXME: ValidatedForm is not a valid Component. - // TODO: delete ts-expect-error error if this issue is resolved https://github.com/vazco/uniforms/issues/1165 - (formRef = ref)} - model={model} - onSubmit={onSubmit} - schema={schema} - > - - {context => ( - <> - {context ? ( -

{context.error?.message}

- ) : null} - - )} -
- {/* @ts-expect-error */} + <> -
+ ); }; + const Component = () => ( + // FIXME: ValidatedForm is not a valid Component. + // TODO: delete ts-expect-error error if this issue is resolved https://github.com/vazco/uniforms/issues/1165 + + + {context => ( + <> + {context ? ( +

{context.error?.message}

+ ) : null} + + )} +
+ +
+ ); + render(, { schema: { type: SimpleSchema2Bridge }, }); From b6251e882479d1de73f34bba098c4bedb215ab68 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Sun, 27 Nov 2022 21:27:36 +0100 Subject: [PATCH 10/27] fix skipped test in autoform --- packages/uniforms/__tests__/AutoForm.tsx | 118 ++++++++++-------- packages/uniforms/__tests__/ValidatedForm.tsx | 9 +- 2 files changed, 70 insertions(+), 57 deletions(-) diff --git a/packages/uniforms/__tests__/AutoForm.tsx b/packages/uniforms/__tests__/AutoForm.tsx index 3d916cb45..4983b12c6 100644 --- a/packages/uniforms/__tests__/AutoForm.tsx +++ b/packages/uniforms/__tests__/AutoForm.tsx @@ -3,6 +3,7 @@ import React from 'react'; import SimpleSchema from 'simpl-schema'; import { AutoForm, connectField, context } from 'uniforms'; import { SimpleSchema2Bridge } from 'uniforms-bridge-simple-schema-2'; +import { AutoField } from 'uniforms-unstyled'; import { render } from '../__suites__'; @@ -32,36 +33,35 @@ describe('', () => { describe('when changes', () => { test('updates', () => { render( - // TODO: delete ts-expect-error error if this issue is resolved https://github.com/vazco/uniforms/issues/1165 - // @ts-expect-error - , + , { schema: { type: SimpleSchema2Bridge } }, { onChange }, ); }); - // todo no way to test in rts cause we don't have access to validator function call - test.skip('validates', () => { + test('validates', () => { // FIXME: AutoForm is not a valid Component. render( , + > + + , { schema: { type: SimpleSchema2Bridge }, }, ); const form = screen.getByRole('form'); + const input = screen.getByLabelText('A'); fireEvent.submit(form); expect(validator).toHaveBeenCalledTimes(1); - expect(validator).toHaveBeenLastCalledWith({}); + expect(validator).toHaveBeenLastCalledWith({ a: '' }); - // fireEvent.change(form, onChange({ a: '2' })); + fireEvent.change(input, { target: { value: '2' } }); expect(validator).toHaveBeenCalledTimes(2); expect(validator).toHaveBeenLastCalledWith({ a: '2' }); @@ -80,32 +80,43 @@ describe('', () => { { schema: { type: SimpleSchema2Bridge } }, ); - const element = screen.getByRole('form'); - fireEvent.change(element, onChangeModel({ a: '2' })); + const form = screen.getByRole('form'); + fireEvent.change(form, onChangeModel({ a: '2' })); expect(onChangeModel).toHaveBeenCalledTimes(1); expect(onChangeModel).toHaveBeenLastCalledWith({ a: '2' }); }); - // todo no way to test in rts cause we don't have access to call onChange - test.skip('updates `changed` and `changedMap`', () => { + test('updates `changed` and `changedMap`', () => { // FIXME: AutoForm is not a valid Component. render( - // TODO: delete ts-expect-error if this issue is resolved https://github.com/vazco/uniforms/issues/1165 - // @ts-expect-error - , + + + {context => ( + <> + {context ? ( + <> +

{`${context.changed}`}

+

+ {JSON.stringify(context?.changedMap)} +

+ + ) : null} + + )} +
+ +
, { schema: { type: SimpleSchema2Bridge }, }, ); - const element = screen.getByRole('form'); - - expect(element).toBe('false'); - expect(element).toBe('{}'); + const changed = screen.getByTestId('changed').innerHTML; + const changedMap = JSON.parse(screen.getByTestId('changedMap').innerHTML); - expect(element).toHaveProperty('changed', true); - expect(element).toHaveProperty('changedMap.a'); - // expect(element.changedMap.a).toBeTruthy(); + expect(changed).toBe('true'); + expect(changedMap).toHaveProperty('b'); + expect(changedMap.b).toBeTruthy(); }); }); describe('when render', () => { @@ -136,18 +147,12 @@ describe('', () => { expect(onChange.mock.calls[0]).toEqual(expect.arrayContaining(['b', ''])); expect(onChange.mock.calls[1]).toEqual(expect.arrayContaining(['c', ''])); }); - // todo no way to test in rts cause we don't have access to onChange and validator function call - test.skip('skips `onSubmit` until rendered (`autosave` = true)', async () => { + test('skips `onSubmit` until rendered (`autosave` = true)', async () => { // FIXME: AutoForm is not a valid Component. render( - , + + + , { schema: { type: SimpleSchema2Bridge }, }, @@ -155,16 +160,18 @@ describe('', () => { expect(onSubmit).not.toBeCalled(); - const element = screen.getByRole('form'); - await new Promise(resolve => setTimeout(resolve)); - fireEvent.change(element, onChange({ a: '1' })); + const input = screen.getByLabelText('A'); expect(onSubmit).toHaveBeenCalledTimes(1); - expect(onSubmit).toHaveBeenLastCalledWith({ a: 1 }); - expect(validator).toHaveBeenCalledTimes(1); - expect(validator).toHaveBeenLastCalledWith({ a: 1 }); + expect(onSubmit).toHaveBeenLastCalledWith({ a: '' }); + + await new Promise(resolve => setTimeout(resolve)); + fireEvent.change(input, { target: { value: '1' } }); + + expect(validator).toHaveBeenCalledTimes(2); + expect(validator).toHaveBeenLastCalledWith({ a: '1' }); }); }); @@ -247,24 +254,37 @@ describe('', () => { }); }); describe('when update', () => { - // todo no way to test in rts cause we don't have access to props - test.skip(', updates', () => { + test(', updates', () => { // FIXME: AutoForm is not a valid Component. - render(, { - schema: { type: SimpleSchema2Bridge }, - }); + render( + + + {context => ( + <> + {context ? ( +

{JSON.stringify(context.model)}

+ ) : null} + + )} +
+
, + { + schema: { type: SimpleSchema2Bridge }, + }, + ); + + const model = JSON.parse(screen.getByTestId('model').innerHTML); - // expect(wrapper.instance().props.model).toEqual({}); + expect(model).toEqual({}); }); - test.skip(', validates', () => { - // todo no way to test in rts cause we don't have access to setProps + test(', validates', () => { // FIXME: AutoForm is not a valid Component. - render(, { + const { rerender } = render(, { schema: { type: SimpleSchema2Bridge }, }); - // element.setProps({ model, validate: 'onChange' }); + rerender(); expect(validator).toHaveBeenCalledTimes(1); }); }); diff --git a/packages/uniforms/__tests__/ValidatedForm.tsx b/packages/uniforms/__tests__/ValidatedForm.tsx index f063f1c94..f14d406d4 100644 --- a/packages/uniforms/__tests__/ValidatedForm.tsx +++ b/packages/uniforms/__tests__/ValidatedForm.tsx @@ -226,9 +226,6 @@ describe('ValidatedForm', () => { test('has `validating` context variable, default `false`', () => { render( { validator.mockImplementationOnce(() => { throw error; }); - // TODO: add role form to form html element + const form = screen.getByRole('form'); fireEvent.submit(form); await new Promise(resolve => process.nextTick(resolve)); @@ -641,8 +638,6 @@ describe('ValidatedForm', () => { // FIXME: ValidatedForm is not a valid Component. const Component = (props: any) => ( { // FIXME: ValidatedForm is not a valid Component. const Component = (props: any) => ( Date: Mon, 28 Nov 2022 14:40:22 +0100 Subject: [PATCH 11/27] add mockContext and replace test to it --- .../uniforms-antd/__tests__/AutoField.tsx | 26 +-- .../uniforms-antd/__tests__/AutoFields.tsx | 12 +- packages/uniforms-antd/__tests__/AutoForm.tsx | 2 +- packages/uniforms-antd/__tests__/BaseForm.tsx | 2 +- .../uniforms-antd/__tests__/BoolField.tsx | 50 +++--- .../uniforms-antd/__tests__/DateField.tsx | 28 +-- .../uniforms-antd/__tests__/ErrorField.tsx | 10 +- .../uniforms-antd/__tests__/ErrorsField.tsx | 8 +- .../uniforms-antd/__tests__/HiddenField.tsx | 28 +-- .../uniforms-antd/__tests__/ListAddField.tsx | 12 +- .../uniforms-antd/__tests__/ListDelField.tsx | 12 +- .../uniforms-antd/__tests__/ListField.tsx | 26 +-- .../uniforms-antd/__tests__/ListItemField.tsx | 8 +- .../uniforms-antd/__tests__/LongTextField.tsx | 32 ++-- .../uniforms-antd/__tests__/NestField.tsx | 10 +- packages/uniforms-antd/__tests__/NumField.tsx | 46 ++--- .../uniforms-antd/__tests__/QuickForm.tsx | 2 +- .../uniforms-antd/__tests__/RadioField.tsx | 32 ++-- .../uniforms-antd/__tests__/SelectField.tsx | 78 ++++----- .../uniforms-antd/__tests__/SubmitField.tsx | 6 +- .../uniforms-antd/__tests__/TextField.tsx | 38 ++-- .../__tests__/ValidateQuickForm.tsx | 2 +- .../uniforms-antd/__tests__/ValidatedForm.tsx | 2 +- .../uniforms-antd/__tests__/wrapField.tsx | 18 +- .../__tests__/AutoField.tsx | 26 +-- .../__tests__/AutoFields.tsx | 12 +- .../__tests__/AutoForm.tsx | 2 +- .../__tests__/BaseForm.tsx | 2 +- .../__tests__/BoolField.tsx | 28 +-- .../__tests__/DateField.tsx | 32 ++-- .../__tests__/ErrorField.tsx | 8 +- .../__tests__/ErrorsField.tsx | 6 +- .../__tests__/HiddenField.tsx | 28 +-- .../__tests__/ListAddField.tsx | 10 +- .../__tests__/ListDelField.tsx | 10 +- .../__tests__/ListField.tsx | 22 +-- .../__tests__/ListItemField.tsx | 8 +- .../__tests__/LongTextField.tsx | 30 ++-- .../__tests__/NestField.tsx | 12 +- .../__tests__/NumField.tsx | 48 +++--- .../__tests__/QuickForm.tsx | 2 +- .../__tests__/RadioField.tsx | 34 ++-- .../__tests__/SelectField.tsx | 94 +++++----- .../__tests__/SubmitField.tsx | 10 +- .../__tests__/TextField.tsx | 36 ++-- .../__tests__/ValidateQuickForm.tsx | 2 +- .../__tests__/ValidatedForm.tsx | 2 +- .../__tests__/gridClassName.ts | 8 +- .../__tests__/wrapField.tsx | 16 +- .../__tests__/AutoField.tsx | 26 +-- .../__tests__/AutoFields.tsx | 12 +- .../__tests__/AutoForm.tsx | 2 +- .../__tests__/BaseForm.tsx | 2 +- .../__tests__/BoolField.tsx | 28 +-- .../__tests__/DateField.tsx | 32 ++-- .../__tests__/ErrorField.tsx | 8 +- .../__tests__/ErrorsField.tsx | 6 +- .../__tests__/HiddenField.tsx | 28 +-- .../__tests__/ListAddField.tsx | 10 +- .../__tests__/ListDelField.tsx | 10 +- .../__tests__/ListField.tsx | 22 +-- .../__tests__/ListItemField.tsx | 8 +- .../__tests__/LongTextField.tsx | 30 ++-- .../__tests__/NestField.tsx | 12 +- .../__tests__/NumField.tsx | 48 +++--- .../__tests__/QuickForm.tsx | 2 +- .../__tests__/RadioField.tsx | 34 ++-- .../__tests__/SelectField.tsx | 102 +++++------ .../__tests__/SubmitField.tsx | 10 +- .../__tests__/TextField.tsx | 36 ++-- .../__tests__/ValidateQuickForm.tsx | 2 +- .../__tests__/ValidatedForm.tsx | 2 +- .../__tests__/gridClassName.ts | 8 +- .../__tests__/wrapField.tsx | 14 +- .../__tests__/AutoField.tsx | 26 +-- .../__tests__/AutoFields.tsx | 12 +- .../__tests__/AutoForm.tsx | 2 +- .../__tests__/BaseForm.tsx | 2 +- .../__tests__/BoolField.tsx | 28 +-- .../__tests__/DateField.tsx | 32 ++-- .../__tests__/ErrorField.tsx | 8 +- .../__tests__/ErrorsField.tsx | 6 +- .../__tests__/HiddenField.tsx | 28 +-- .../__tests__/ListAddField.tsx | 10 +- .../__tests__/ListDelField.tsx | 10 +- .../__tests__/ListField.tsx | 22 +-- .../__tests__/ListItemField.tsx | 8 +- .../__tests__/LongTextField.tsx | 30 ++-- .../__tests__/NestField.tsx | 12 +- .../__tests__/NumField.tsx | 48 +++--- .../__tests__/QuickForm.tsx | 2 +- .../__tests__/RadioField.tsx | 34 ++-- .../__tests__/SelectField.tsx | 102 +++++------ .../__tests__/SubmitField.tsx | 10 +- .../__tests__/TextField.tsx | 36 ++-- .../__tests__/ValidateQuickForm.tsx | 2 +- .../__tests__/ValidatedForm.tsx | 2 +- .../__tests__/gridClassName.ts | 8 +- .../__tests__/wrapField.tsx | 14 +- .../uniforms-material/__tests__/AutoField.tsx | 26 +-- .../__tests__/AutoFields.tsx | 12 +- .../uniforms-material/__tests__/AutoForm.tsx | 2 +- .../uniforms-material/__tests__/BaseForm.tsx | 2 +- .../uniforms-material/__tests__/BoolField.tsx | 52 +++--- .../uniforms-material/__tests__/DateField.tsx | 36 ++-- .../__tests__/ErrorField.tsx | 12 +- .../__tests__/ErrorsField.tsx | 12 +- .../__tests__/HiddenField.tsx | 28 +-- .../__tests__/ListAddField.tsx | 12 +- .../__tests__/ListDelField.tsx | 12 +- .../uniforms-material/__tests__/ListField.tsx | 18 +- .../__tests__/ListItemField.tsx | 8 +- .../__tests__/LongTextField.tsx | 38 ++-- .../uniforms-material/__tests__/NestField.tsx | 14 +- .../uniforms-material/__tests__/NumField.tsx | 56 +++--- .../uniforms-material/__tests__/QuickForm.tsx | 2 +- .../__tests__/RadioField.tsx | 40 ++--- .../__tests__/SelectField.tsx | 102 +++++------ .../__tests__/SubmitField.tsx | 12 +- .../uniforms-material/__tests__/TextField.tsx | 44 ++--- .../__tests__/ValidateQuickForm.tsx | 2 +- .../__tests__/ValidatedForm.tsx | 2 +- .../uniforms-material/__tests__/wrapField.tsx | 6 +- packages/uniforms-mui/__tests__/AutoField.tsx | 26 +-- .../uniforms-mui/__tests__/AutoFields.tsx | 12 +- packages/uniforms-mui/__tests__/AutoForm.tsx | 2 +- packages/uniforms-mui/__tests__/BaseForm.tsx | 2 +- packages/uniforms-mui/__tests__/BoolField.tsx | 46 ++--- packages/uniforms-mui/__tests__/DateField.tsx | 32 ++-- .../uniforms-mui/__tests__/ErrorField.tsx | 6 +- .../uniforms-mui/__tests__/ErrorsField.tsx | 6 +- .../uniforms-mui/__tests__/HiddenField.tsx | 28 +-- .../uniforms-mui/__tests__/ListAddField.tsx | 4 +- .../uniforms-mui/__tests__/ListDelField.tsx | 4 +- packages/uniforms-mui/__tests__/ListField.tsx | 16 +- .../uniforms-mui/__tests__/ListItemField.tsx | 8 +- .../uniforms-mui/__tests__/LongTextField.tsx | 32 ++-- packages/uniforms-mui/__tests__/NestField.tsx | 8 +- packages/uniforms-mui/__tests__/NumField.tsx | 50 +++--- packages/uniforms-mui/__tests__/QuickForm.tsx | 2 +- .../uniforms-mui/__tests__/RadioField.tsx | 34 ++-- .../uniforms-mui/__tests__/SelectField.tsx | 94 +++++----- .../uniforms-mui/__tests__/SubmitField.tsx | 6 +- packages/uniforms-mui/__tests__/TextField.tsx | 34 ++-- .../__tests__/ValidateQuickForm.tsx | 2 +- .../uniforms-mui/__tests__/ValidatedForm.tsx | 2 +- packages/uniforms-mui/__tests__/wrapField.tsx | 6 +- .../uniforms-semantic/__tests__/AutoField.tsx | 26 +-- .../__tests__/AutoFields.tsx | 12 +- .../uniforms-semantic/__tests__/AutoForm.tsx | 2 +- .../uniforms-semantic/__tests__/BaseForm.tsx | 2 +- .../uniforms-semantic/__tests__/BoolField.tsx | 38 ++-- .../uniforms-semantic/__tests__/DateField.tsx | 42 ++--- .../__tests__/ErrorField.tsx | 8 +- .../__tests__/ErrorsField.tsx | 6 +- .../__tests__/HiddenField.tsx | 28 +-- .../__tests__/ListAddField.tsx | 10 +- .../__tests__/ListDelField.tsx | 10 +- .../uniforms-semantic/__tests__/ListField.tsx | 22 +-- .../__tests__/ListItemField.tsx | 8 +- .../__tests__/LongTextField.tsx | 34 ++-- .../uniforms-semantic/__tests__/NestField.tsx | 12 +- .../uniforms-semantic/__tests__/NumField.tsx | 58 +++---- .../uniforms-semantic/__tests__/QuickForm.tsx | 2 +- .../__tests__/RadioField.tsx | 36 ++-- .../__tests__/SelectField.tsx | 96 +++++------ .../__tests__/SubmitField.tsx | 8 +- .../uniforms-semantic/__tests__/TextField.tsx | 54 +++--- .../__tests__/ValidateQuickForm.tsx | 2 +- .../__tests__/ValidatedForm.tsx | 2 +- .../uniforms-unstyled/__tests__/AutoField.tsx | 26 +-- .../__tests__/AutoFields.tsx | 10 +- .../uniforms-unstyled/__tests__/AutoForm.tsx | 2 +- .../uniforms-unstyled/__tests__/BaseForm.tsx | 2 +- .../uniforms-unstyled/__tests__/BoolField.tsx | 26 +-- .../uniforms-unstyled/__tests__/DateField.tsx | 32 ++-- .../__tests__/ErrorField.tsx | 6 +- .../__tests__/ErrorsField.tsx | 6 +- .../__tests__/HiddenField.tsx | 28 +-- .../__tests__/ListAddField.tsx | 10 +- .../__tests__/ListDelField.tsx | 10 +- .../uniforms-unstyled/__tests__/ListField.tsx | 18 +- .../__tests__/ListItemField.tsx | 8 +- .../__tests__/LongTextField.tsx | 30 ++-- .../uniforms-unstyled/__tests__/NestField.tsx | 8 +- .../uniforms-unstyled/__tests__/NumField.tsx | 48 +++--- .../uniforms-unstyled/__tests__/QuickForm.tsx | 2 +- .../__tests__/RadioField.tsx | 32 ++-- .../__tests__/SelectField.tsx | 92 +++++----- .../__tests__/SubmitField.tsx | 8 +- .../uniforms-unstyled/__tests__/TextField.tsx | 36 ++-- .../__tests__/ValidateQuickForm.tsx | 2 +- .../__tests__/ValidatedForm.tsx | 2 +- packages/uniforms/__suites__/ListField.tsx | 16 +- packages/uniforms/__suites__/TextField.tsx | 30 ++-- packages/uniforms/__tests__/AutoForm.tsx | 110 ++++-------- packages/uniforms/__tests__/Bridge.ts | 4 +- packages/uniforms/__tests__/ValidatedForm.tsx | 162 ++++++------------ packages/uniforms/__tests__/changedKeys.ts | 28 +-- packages/uniforms/__tests__/filterDOMProps.ts | 10 +- packages/uniforms/__tests__/joinName.ts | 18 +- packages/uniforms/__tests__/randomIds.ts | 8 +- packages/uniforms/__tests__/useField.tsx | 10 +- 203 files changed, 2114 insertions(+), 2222 deletions(-) diff --git a/packages/uniforms-antd/__tests__/AutoField.tsx b/packages/uniforms-antd/__tests__/AutoField.tsx index a432c2ce5..82726a49b 100644 --- a/packages/uniforms-antd/__tests__/AutoField.tsx +++ b/packages/uniforms-antd/__tests__/AutoField.tsx @@ -14,14 +14,14 @@ import { import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(AutoField)).toHaveLength(1); }); -test(' - detects RadioField', () => { +it(' - detects RadioField', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ test(' - detects RadioField', () => { expect(wrapper.find(RadioField.Component)).toHaveLength(1); }); -test(' - detects SelectField', () => { +it(' - detects SelectField', () => { const element = ; const wrapper = mount( element, @@ -50,14 +50,14 @@ test(' - detects SelectField', () => { expect(wrapper.find(SelectField.Component)).toHaveLength(1); }); -test(' - detects DateField', () => { +it(' - detects DateField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DateField.Component)).toHaveLength(1); }); -test(' - detects ListField', () => { +it(' - detects ListField', () => { const element = ; const wrapper = mount( element, @@ -67,35 +67,35 @@ test(' - detects ListField', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -test(' - detects NumField', () => { +it(' - detects NumField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(NumField.Component)).toHaveLength(1); }); -test(' - detects NestField', () => { +it(' - detects NestField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Object } })); expect(wrapper.find(NestField)).toHaveLength(1); }); -test(' - detects TextField', () => { +it(' - detects TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField.Component)).toHaveLength(1); }); -test(' - detects BoolField', () => { +it(' - detects BoolField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(BoolField.Component)).toHaveLength(1); }); -test(' - uses Component (schema)', () => { +it(' - uses Component (schema)', () => { const Component = jest.fn(() => null); const element = ; @@ -107,7 +107,7 @@ test(' - uses Component (schema)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -test(' - uses Component (props)', () => { +it(' - uses Component (props)', () => { const Component = jest.fn(() => null); const element = ; @@ -116,7 +116,7 @@ test(' - uses Component (props)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -test(' - uses Component (context)', () => { +it(' - uses Component (context)', () => { const FieldA = jest.fn(() => null); const FieldB = jest.fn(() => null); @@ -136,7 +136,7 @@ test(' - uses Component (context)', () => { expect(FieldB).toHaveBeenCalledTimes(1); }); -test(' - uses Component (invalid)', () => { +it(' - uses Component (invalid)', () => { const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {}); expect(() => { const element = ; diff --git a/packages/uniforms-antd/__tests__/AutoFields.tsx b/packages/uniforms-antd/__tests__/AutoFields.tsx index 0ece5d085..cd07a2aec 100644 --- a/packages/uniforms-antd/__tests__/AutoFields.tsx +++ b/packages/uniforms-antd/__tests__/AutoFields.tsx @@ -4,14 +4,14 @@ import { AutoField, AutoFields } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('AutoFields')).toHaveLength(1); }); -test(' - render all fields by default', () => { +it(' - render all fields by default', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - render all fields by default', () => { expect(wrapper.find('input')).toHaveLength(3); }); -test(' - renders only specified fields', () => { +it(' - renders only specified fields', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ test(' - renders only specified fields', () => { ); }); -test(' - does not render ommited fields', () => { +it(' - does not render ommited fields', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ test(' - does not render ommited fields', () => { ); }); -test(' - wraps fields in specified element', () => { +it(' - wraps fields in specified element', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ test(' - wraps fields in specified element', () => { expect(wrapper.find('section').find('input')).toHaveLength(3); }); -test(' - pass props to the children', () => { +it(' - pass props to the children', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-antd/__tests__/AutoForm.tsx b/packages/uniforms-antd/__tests__/AutoForm.tsx index ce87a92b9..085952dbc 100644 --- a/packages/uniforms-antd/__tests__/AutoForm.tsx +++ b/packages/uniforms-antd/__tests__/AutoForm.tsx @@ -4,7 +4,7 @@ import { AutoForm } from 'uniforms-antd'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-antd/__tests__/BaseForm.tsx b/packages/uniforms-antd/__tests__/BaseForm.tsx index ee88320c1..21ff2f290 100644 --- a/packages/uniforms-antd/__tests__/BaseForm.tsx +++ b/packages/uniforms-antd/__tests__/BaseForm.tsx @@ -4,7 +4,7 @@ import { BaseForm } from 'uniforms-antd'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-antd/__tests__/BoolField.tsx b/packages/uniforms-antd/__tests__/BoolField.tsx index 50c878bc4..f8877b6c0 100644 --- a/packages/uniforms-antd/__tests__/BoolField.tsx +++ b/packages/uniforms-antd/__tests__/BoolField.tsx @@ -6,14 +6,14 @@ import { BoolField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a switch input', () => { +it(' - renders a switch input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(Switch)).toHaveLength(1); }); -test(' - default props override', () => { +it(' - default props override', () => { const switchProps = { checkedChildren: , unCheckedChildren: , @@ -27,14 +27,14 @@ test(' - default props override', () => { ); }); -test(' - renders a checkbox input', () => { +it(' - renders a checkbox input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(Checkbox)).toHaveLength(1); }); -test(' - renders a switch input with correct id (inherited)', () => { +it(' - renders a switch input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -42,7 +42,7 @@ test(' - renders a switch input with correct id (inherited)', () => { expect(wrapper.find(Switch).prop('id')).toBeTruthy(); }); -test(' - renders a checkbox input with correct id (inherited)', () => { +it(' - renders a checkbox input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -50,7 +50,7 @@ test(' - renders a checkbox input with correct id (inherited)', () => expect(wrapper.find(Checkbox).prop('id')).toBeTruthy(); }); -test(' - renders a switch input with correct id (specified)', () => { +it(' - renders a switch input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -58,7 +58,7 @@ test(' - renders a switch input with correct id (specified)', () => { expect(wrapper.find(Switch).prop('id')).toBe('y'); }); -test(' - renders a checkbox input with correct id (specified)', () => { +it(' - renders a checkbox input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -66,7 +66,7 @@ test(' - renders a checkbox input with correct id (specified)', () => expect(wrapper.find(Checkbox).prop('id')).toBe('y'); }); -test(' - renders a switch input with correct name', () => { +it(' - renders a switch input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -74,7 +74,7 @@ test(' - renders a switch input with correct name', () => { expect(wrapper.find(Switch).prop('name')).toBe('x'); }); -test(' - renders a checkbox input with correct name', () => { +it(' - renders a checkbox input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -82,7 +82,7 @@ test(' - renders a checkbox input with correct name', () => { expect(wrapper.find(Checkbox).prop('name')).toBe('x'); }); -test(' - renders a switch input with correct disabled state', () => { +it(' - renders a switch input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -90,7 +90,7 @@ test(' - renders a switch input with correct disabled state', () => { expect(wrapper.find(Switch).prop('disabled')).toBe(true); }); -test(' - renders a checkbox input with correct disabled state', () => { +it(' - renders a checkbox input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -98,7 +98,7 @@ test(' - renders a checkbox input with correct disabled state', () => expect(wrapper.find(Checkbox).prop('disabled')).toBe(true); }); -test(' - renders a switch input with correct readOnly state', () => { +it(' - renders a switch input with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -113,7 +113,7 @@ test(' - renders a switch input with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a checkbox input with correct readOnly state', () => { +it(' - renders a checkbox input with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -128,7 +128,7 @@ test(' - renders a checkbox input with correct readOnly state', () => expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a switch input with correct label (specified)', () => { +it(' - renders a switch input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -136,7 +136,7 @@ test(' - renders a switch input with correct label (specified)', () = expect(wrapper.find('label').text()).toBe('BoolFieldLabel'); // Label is prefixed with a  . }); -test(' - renders a checkbox input with correct label (specified)', () => { +it(' - renders a checkbox input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -144,7 +144,7 @@ test(' - renders a checkbox input with correct label (specified)', () expect(wrapper.find('label').first().text()).toBe('BoolFieldLabel'); // Label is prefixed with a  . }); -test(' - renders a switch input with correct value (default)', () => { +it(' - renders a switch input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -152,7 +152,7 @@ test(' - renders a switch input with correct value (default)', () => expect(wrapper.find(Switch).prop('checked')).toBe(false); }); -test(' - renders a checkbox input with correct value (default)', () => { +it(' - renders a checkbox input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -160,7 +160,7 @@ test(' - renders a checkbox input with correct value (default)', () = expect(wrapper.find(Checkbox).prop('checked')).toBe(false); }); -test(' - renders a switch input with correct value (model)', () => { +it(' - renders a switch input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -171,7 +171,7 @@ test(' - renders a switch input with correct value (model)', () => { expect(wrapper.find(Switch).prop('checked')).toBe(true); }); -test(' - renders a checkbox input with correct value (model)', () => { +it(' - renders a checkbox input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -182,7 +182,7 @@ test(' - renders a checkbox input with correct value (model)', () => expect(wrapper.find(Checkbox).prop('checked')).toBe(true); }); -test(' - renders a switch input with correct value (specified)', () => { +it(' - renders a switch input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -190,7 +190,7 @@ test(' - renders a switch input with correct value (specified)', () = expect(wrapper.find(Switch).prop('checked')).toBe(true); }); -test(' - renders a checkbox input with correct value (specified)', () => { +it(' - renders a checkbox input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -198,7 +198,7 @@ test(' - renders a checkbox input with correct value (specified)', () expect(wrapper.find(Checkbox).prop('checked')).toBe(true); }); -test(' - renders a switch input which correctly reacts on change', () => { +it(' - renders a switch input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -213,7 +213,7 @@ test(' - renders a switch input which correctly reacts on change', () expect(onChange).toHaveBeenLastCalledWith('x', true); }); -test(' - renders a checkbox input which correctly reacts on change', () => { +it(' - renders a checkbox input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -228,7 +228,7 @@ test(' - renders a checkbox input which correctly reacts on change', expect(onChange).toHaveBeenLastCalledWith('x', true); }); -test(' - renders a switch wrapper with unknown props', () => { +it(' - renders a switch wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -237,7 +237,7 @@ test(' - renders a switch wrapper with unknown props', () => { expect(wrapper.find(Switch).prop('data-z')).toBe('z'); }); -test(' - renders a checkbox wrapper with unknown props', () => { +it(' - renders a checkbox wrapper with unknown props', () => { const element = ( ); diff --git a/packages/uniforms-antd/__tests__/DateField.tsx b/packages/uniforms-antd/__tests__/DateField.tsx index 28abf3d5e..14d8dd9c4 100644 --- a/packages/uniforms-antd/__tests__/DateField.tsx +++ b/packages/uniforms-antd/__tests__/DateField.tsx @@ -6,14 +6,14 @@ import { DateField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DatePicker)).toHaveLength(1); }); -test(' - default props override', () => { +it(' - default props override', () => { const pickerProps = { showTime: false, style: {} }; const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -23,7 +23,7 @@ test(' - default props override', () => { ); }); -test(' - renders a input with correct id (inherited)', () => { +it(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -31,7 +31,7 @@ test(' - renders a input with correct id (inherited)', () => { expect(wrapper.find(DatePicker).prop('id')).toBeTruthy(); }); -test(' - renders a input with correct id (specified)', () => { +it(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -39,7 +39,7 @@ test(' - renders a input with correct id (specified)', () => { expect(wrapper.find(DatePicker).prop('id')).toBe('y'); }); -test(' - renders a input with correct name', () => { +it(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -47,7 +47,7 @@ test(' - renders a input with correct name', () => { expect(wrapper.find(DatePicker).prop('name')).toBe('x'); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -55,7 +55,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find(DatePicker).prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const onChange = jest.fn(); const now = moment(); @@ -71,7 +71,7 @@ test(' - renders an input with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a input with correct label (specified)', () => { +it(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -79,7 +79,7 @@ test(' - renders a input with correct label (specified)', () => { expect(wrapper.find('label').text()).toBe('DateFieldLabel'); }); -test(' - renders a input with correct value (default)', () => { +it(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -87,7 +87,7 @@ test(' - renders a input with correct value (default)', () => { expect(wrapper.find(DatePicker).prop('value')).toBe(undefined); }); -test(' - renders a input with correct value (model)', () => { +it(' - renders a input with correct value (model)', () => { const now = moment(); const element = ; const wrapper = mount( @@ -99,7 +99,7 @@ test(' - renders a input with correct value (model)', () => { expect(wrapper.find(DatePicker).prop('value')).toEqual(now); }); -test(' - renders a input with correct value (specified)', () => { +it(' - renders a input with correct value (specified)', () => { const now = moment(); const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -108,7 +108,7 @@ test(' - renders a input with correct value (specified)', () => { expect(wrapper.find(DatePicker).prop('value')).toEqual(now); }); -test(' - renders a input which correctly reacts on change', () => { +it(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const now = moment(); @@ -124,7 +124,7 @@ test(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', now.toDate()); }); -test(' - renders a input which correctly reacts on change (empty)', () => { +it(' - renders a input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ test(' - renders a input which correctly reacts on change (empty)', ( expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); diff --git a/packages/uniforms-antd/__tests__/ErrorField.tsx b/packages/uniforms-antd/__tests__/ErrorField.tsx index 2f24d091a..0ee7eabb5 100644 --- a/packages/uniforms-antd/__tests__/ErrorField.tsx +++ b/packages/uniforms-antd/__tests__/ErrorField.tsx @@ -11,14 +11,14 @@ const error = { message: 'X is required [validation-error]', }; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorField)).toHaveLength(1); }); -test(' - default props override', () => { +it(' - default props override', () => { const divProps = { style: {} }; const element = ; @@ -29,7 +29,7 @@ test(' - default props override', () => { ); }); -test(' - renders correct error message (context)', () => { +it(' - renders correct error message (context)', () => { const element = ; const wrapper = mount( element, @@ -40,7 +40,7 @@ test(' - renders correct error message (context)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -test(' - renders correct error message (specified)', () => { +it(' - renders correct error message (specified)', () => { const element = ( - renders correct error message (specified)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -test(' - renders correct children if specified', () => { +it(' - renders correct children if specified', () => { const element = Error; const wrapper = mount( element, diff --git a/packages/uniforms-antd/__tests__/ErrorsField.tsx b/packages/uniforms-antd/__tests__/ErrorsField.tsx index 7576b2305..64a552426 100644 --- a/packages/uniforms-antd/__tests__/ErrorsField.tsx +++ b/packages/uniforms-antd/__tests__/ErrorsField.tsx @@ -15,14 +15,14 @@ const error = { message: 'X is required [validation-error]', }; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorsField)).toHaveLength(1); }); -test(' - default props override', () => { +it(' - default props override', () => { const divProps = { style: {} }; const element = ; @@ -33,7 +33,7 @@ test(' - default props override', () => { ); }); -test(' - renders list of correct error messages (context)', () => { +it(' - renders list of correct error messages (context)', () => { const element = ; const wrapper = mount( element, @@ -49,7 +49,7 @@ test(' - renders list of correct error messages (context)', () => { expect(wrapper.find('li').at(2).text()).toBe('Z is required'); }); -test(' - renders children (specified)', () => { +it(' - renders children (specified)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-antd/__tests__/HiddenField.tsx b/packages/uniforms-antd/__tests__/HiddenField.tsx index 5850a1f5a..44521d155 100644 --- a/packages/uniforms-antd/__tests__/HiddenField.tsx +++ b/packages/uniforms-antd/__tests__/HiddenField.tsx @@ -4,14 +4,14 @@ import { HiddenField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('hidden'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -62,7 +62,7 @@ test(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input which correctly reacts on model change', () => { +it(' - renders an input which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -76,7 +76,7 @@ test(' - renders an input which correctly reacts on model change', expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders an input which correctly reacts on model change (empty)', () => { +it(' - renders an input which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -90,7 +90,7 @@ test(' - renders an input which correctly reacts on model change (e expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders an input which correctly reacts on model change (same value)', () => { +it(' - renders an input which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -104,14 +104,14 @@ test(' - renders an input which correctly reacts on model change (s expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders nothing', () => { +it(' - renders nothing', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.children()).toHaveLength(0); }); -test(' - renders nothing which correctly reacts on model change', () => { +it(' - renders nothing which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ test(' - renders nothing which correctly reacts on model chan expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders nothing which correctly reacts on model change (empty)', () => { +it(' - renders nothing which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ test(' - renders nothing which correctly reacts on model chan expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders nothing which correctly reacts on model change (same value)', () => { +it(' - renders nothing which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; diff --git a/packages/uniforms-antd/__tests__/ListAddField.tsx b/packages/uniforms-antd/__tests__/ListAddField.tsx index de619524b..8b7d58f44 100644 --- a/packages/uniforms-antd/__tests__/ListAddField.tsx +++ b/packages/uniforms-antd/__tests__/ListAddField.tsx @@ -17,14 +17,14 @@ beforeEach(() => { onChange.mockClear(); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListAddField)).toHaveLength(1); }); -test(' - default props override', () => { +it(' - default props override', () => { const buttonProps = { icon: , size: 'large' as const, @@ -40,7 +40,7 @@ test(' - default props override', () => { ); }); -test(' - prevents onClick when disabled', () => { +it(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -48,7 +48,7 @@ test(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when readOnly', () => { +it(' - prevents onClick when readOnly', () => { const element = ; const wrapper = mount(element, context()); @@ -56,7 +56,7 @@ test(' - prevents onClick when readOnly', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when limit reached', () => { +it(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { maxCount: 0 } })); @@ -64,7 +64,7 @@ test(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - correctly reacts on click', () => { +it(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-antd/__tests__/ListDelField.tsx b/packages/uniforms-antd/__tests__/ListDelField.tsx index 75f6a79dd..49d42c45e 100644 --- a/packages/uniforms-antd/__tests__/ListDelField.tsx +++ b/packages/uniforms-antd/__tests__/ListDelField.tsx @@ -17,14 +17,14 @@ beforeEach(() => { onChange.mockClear(); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListDelField)).toHaveLength(1); }); -test(' - default props override', () => { +it(' - default props override', () => { const buttonProps = { icon: , size: 'large' as const, @@ -41,7 +41,7 @@ test(' - default props override', () => { ); }); -test(' - prevents onClick when disabled', () => { +it(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -49,7 +49,7 @@ test(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when readOnly', () => { +it(' - prevents onClick when readOnly', () => { const element = ; const wrapper = mount(element, context()); @@ -57,7 +57,7 @@ test(' - prevents onClick when readOnly', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when limit reached', () => { +it(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { minCount: 3 } })); @@ -65,7 +65,7 @@ test(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - correctly reacts on click', () => { +it(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-antd/__tests__/ListField.tsx b/packages/uniforms-antd/__tests__/ListField.tsx index d0ec65e89..0ff03b3e6 100644 --- a/packages/uniforms-antd/__tests__/ListField.tsx +++ b/packages/uniforms-antd/__tests__/ListField.tsx @@ -12,7 +12,7 @@ describe('@RTL - ListField tests', () => { addFieldLocator: () => screen.queryAllByRole('img').pop(), }); - test(' - works', () => { + it(' - works', () => { const element = ; const wrapper = mount( element, @@ -23,7 +23,7 @@ describe('@RTL - ListField tests', () => { }); }); -test(' - renders ListAddField', () => { +it(' - renders ListAddField', () => { const element = ; const wrapper = mount( element, @@ -34,7 +34,7 @@ test(' - renders ListAddField', () => { expect(wrapper.find(ListAddField).prop('name')).toBe('$'); }); -test(' - renders correct label and info (specified)', () => { +it(' - renders correct label and info (specified)', () => { const element = ( ); @@ -47,7 +47,7 @@ test(' - renders correct label and info (specified)', () => { expect(wrapper.find(Tooltip).prop('title')).toBe('ListFieldInfo'); }); -test(' - renders correct label (specified)', () => { +it(' - renders correct label (specified)', () => { const element = ; const wrapper = mount( element, @@ -59,7 +59,7 @@ test(' - renders correct label (specified)', () => { ); }); -test(' - renders correct numer of items with model (specified)', () => { +it(' - renders correct numer of items with model (specified)', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ test(' - renders correct numer of items with model (specified)', () = expect(wrapper.find('input')).toHaveLength(3); }); -test(' - passes itemProps to its children', () => { +it(' - passes itemProps to its children', () => { const element = ; const wrapper = mount( element, @@ -83,7 +83,7 @@ test(' - passes itemProps to its children', () => { expect(wrapper.find(ListItemField).first().prop('data-xyz')).toBe(1); }); -test(' - renders children (specified)', () => { +it(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -102,7 +102,7 @@ test(' - renders children (specified)', () => { expect(Child).toHaveBeenCalledTimes(2); }); -test(' - renders children with correct name (children)', () => { +it(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -121,7 +121,7 @@ test(' - renders children with correct name (children)', () => { expect(wrapper.find(Child).at(1).prop('name')).toBe('1'); }); -test(' - renders children with correct name (value)', () => { +it(' - renders children with correct name (value)', () => { const element = ; const wrapper = mount( element, @@ -134,7 +134,7 @@ test(' - renders children with correct name (value)', () => { expect(wrapper.find(ListItemField).at(1).prop('name')).toBe('1'); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -147,7 +147,7 @@ test(' - renders correct error text (specified)', () => { expect(wrapper.find('div > div').at(0).text()).toBe('Error'); }); -test(' - renders correct error style', () => { +it(' - renders correct error style', () => { const error = new Error(); const element = ; const wrapper = mount( @@ -161,7 +161,7 @@ test(' - renders correct error style', () => { ); }); -test(' - renders correct error style (with specified style prop)', () => { +it(' - renders correct error style (with specified style prop)', () => { const error = new Error(); const element = ( @@ -177,7 +177,7 @@ test(' - renders correct error style (with specified style prop)', () ); }); -test(' - renders proper number of optional values after add new value', () => { +it(' - renders proper number of optional values after add new value', () => { const element = ; const onChange = jest.fn(); const wrapper = mount( diff --git a/packages/uniforms-antd/__tests__/ListItemField.tsx b/packages/uniforms-antd/__tests__/ListItemField.tsx index 1a68cea18..4a9c5cb3f 100644 --- a/packages/uniforms-antd/__tests__/ListItemField.tsx +++ b/packages/uniforms-antd/__tests__/ListItemField.tsx @@ -4,7 +4,7 @@ import { AutoField, ListDelField, ListItemField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - works', () => { expect(wrapper.find(ListItemField)).toHaveLength(1); }); -test(' - renders ListDelField', () => { +it(' - renders ListDelField', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - renders ListDelField', () => { expect(wrapper.find(ListDelField).childAt(0).prop('name')).toBe('x.1'); }); -test(' - renders AutoField', () => { +it(' - renders AutoField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ test(' - renders AutoField', () => { expect(wrapper.find(AutoField)).toHaveLength(1); }); -test(' - renders children if specified', () => { +it(' - renders children if specified', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( diff --git a/packages/uniforms-antd/__tests__/LongTextField.tsx b/packages/uniforms-antd/__tests__/LongTextField.tsx index c59e5d39a..9156d5408 100644 --- a/packages/uniforms-antd/__tests__/LongTextField.tsx +++ b/packages/uniforms-antd/__tests__/LongTextField.tsx @@ -5,14 +5,14 @@ import { LongTextField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a textarea', () => { +it(' - renders a textarea', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextArea)).toHaveLength(1); }); -test(' - default props override', () => { +it(' - default props override', () => { const textareaProps = { rows: 1 }; const element = ; @@ -23,7 +23,7 @@ test(' - default props override', () => { ); }); -test(' - renders a textarea with correct disabled state', () => { +it(' - renders a textarea with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -31,7 +31,7 @@ test(' - renders a textarea with correct disabled state', () => { expect(wrapper.find(TextArea).prop('disabled')).toBe(true); }); -test(' - renders a textarea with correct readOnly state', () => { +it(' - renders a textarea with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -39,7 +39,7 @@ test(' - renders a textarea with correct readOnly state', () => { expect(wrapper.find(TextArea).prop('readOnly')).toBe(true); }); -test(' - renders a textarea with correct id (inherited)', () => { +it(' - renders a textarea with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -47,7 +47,7 @@ test(' - renders a textarea with correct id (inherited)', () => { expect(wrapper.find(TextArea).prop('id')).toBeTruthy(); }); -test(' - renders a textarea with correct id (specified)', () => { +it(' - renders a textarea with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -55,7 +55,7 @@ test(' - renders a textarea with correct id (specified)', () => { expect(wrapper.find(TextArea).prop('id')).toBe('y'); }); -test(' - renders a textarea with correct name', () => { +it(' - renders a textarea with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -63,7 +63,7 @@ test(' - renders a textarea with correct name', () => { expect(wrapper.find(TextArea).prop('name')).toBe('x'); }); -test(' - renders a textarea with correct placeholder', () => { +it(' - renders a textarea with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -71,7 +71,7 @@ test(' - renders a textarea with correct placeholder', () => { expect(wrapper.find(TextArea).prop('placeholder')).toBe('y'); }); -test(' - renders a textarea with correct value (default)', () => { +it(' - renders a textarea with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -79,7 +79,7 @@ test(' - renders a textarea with correct value (default)', () => expect(wrapper.find(TextArea).prop('value')).toBe(''); }); -test(' - renders a textarea with correct value (model)', () => { +it(' - renders a textarea with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -90,7 +90,7 @@ test(' - renders a textarea with correct value (model)', () => { expect(wrapper.find(TextArea).prop('value')).toBe('y'); }); -test(' - renders a textarea with correct value (specified)', () => { +it(' - renders a textarea with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -98,7 +98,7 @@ test(' - renders a textarea with correct value (specified)', () = expect(wrapper.find(TextArea).prop('value')).toBe('y'); }); -test(' - renders a textarea which correctly reacts on change', () => { +it(' - renders a textarea which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -114,7 +114,7 @@ test(' - renders a textarea which correctly reacts on change', () expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a textarea which correctly reacts on change (empty)', () => { +it(' - renders a textarea which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -130,7 +130,7 @@ test(' - renders a textarea which correctly reacts on change (emp expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders a textarea which correctly reacts on change (same value)', () => { +it(' - renders a textarea which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -146,7 +146,7 @@ test(' - renders a textarea which correctly reacts on change (sam expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -154,7 +154,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-antd/__tests__/NestField.tsx b/packages/uniforms-antd/__tests__/NestField.tsx index f4ad8182d..656c26bed 100644 --- a/packages/uniforms-antd/__tests__/NestField.tsx +++ b/packages/uniforms-antd/__tests__/NestField.tsx @@ -4,7 +4,7 @@ import { AutoField, NestField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an for each field', () => { +it(' - renders an for each field', () => { const element = ; const wrapper = mount( element, @@ -20,7 +20,7 @@ test(' - renders an for each field', () => { expect(wrapper.find(AutoField).at(1).prop('name')).toBe('b'); }); -test(' - renders custom content if given', () => { +it(' - renders custom content if given', () => { const element = (
@@ -40,7 +40,7 @@ test(' - renders custom content if given', () => { expect(wrapper.find('article').prop('data-test')).toBe('content'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( diff --git a/packages/uniforms-antd/__tests__/NumField.tsx b/packages/uniforms-antd/__tests__/NumField.tsx index b6f279309..9fdcf8ede 100644 --- a/packages/uniforms-antd/__tests__/NumField.tsx +++ b/packages/uniforms-antd/__tests__/NumField.tsx @@ -5,14 +5,14 @@ import { NumField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an InputNumber', () => { +it(' - renders an InputNumber', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(InputNumber)).toHaveLength(1); }); -test(' - renders an InputNumber with correct disabled state', () => { +it(' - renders an InputNumber with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -20,7 +20,7 @@ test(' - renders an InputNumber with correct disabled state', () => { expect(wrapper.find(InputNumber).prop('disabled')).toBe(true); }); -test(' - renders an InputNumber with correct readOnly state', () => { +it(' - renders an InputNumber with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -28,7 +28,7 @@ test(' - renders an InputNumber with correct readOnly state', () => { expect(wrapper.find(InputNumber).prop('readOnly')).toBe(true); }); -test(' - renders an InputNumber with correct id (inherited)', () => { +it(' - renders an InputNumber with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -36,7 +36,7 @@ test(' - renders an InputNumber with correct id (inherited)', () => { expect(wrapper.find(InputNumber).prop('id')).toBeTruthy(); }); -test(' - renders an InputNumber with correct id (specified)', () => { +it(' - renders an InputNumber with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -44,7 +44,7 @@ test(' - renders an InputNumber with correct id (specified)', () => { expect(wrapper.find(InputNumber).prop('id')).toBe('y'); }); -test(' - renders an InputNumber with correct max', () => { +it(' - renders an InputNumber with correct max', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -52,7 +52,7 @@ test(' - renders an InputNumber with correct max', () => { expect(wrapper.find(InputNumber).prop('max')).toBe(10); }); -test(' - renders an InputNumber with correct min', () => { +it(' - renders an InputNumber with correct min', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -60,7 +60,7 @@ test(' - renders an InputNumber with correct min', () => { expect(wrapper.find(InputNumber).prop('min')).toBe(10); }); -test(' - renders an InputNumber with correct name', () => { +it(' - renders an InputNumber with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -68,7 +68,7 @@ test(' - renders an InputNumber with correct name', () => { expect(wrapper.find(InputNumber).prop('name')).toBe('x'); }); -test(' - renders an InputNumber with correct placeholder', () => { +it(' - renders an InputNumber with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -76,7 +76,7 @@ test(' - renders an InputNumber with correct placeholder', () => { expect(wrapper.find(InputNumber).prop('placeholder')).toBe('y'); }); -test(' - renders an InputNumber with correct step (decimal)', () => { +it(' - renders an InputNumber with correct step (decimal)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -84,7 +84,7 @@ test(' - renders an InputNumber with correct step (decimal)', () => { expect(wrapper.find(InputNumber).prop('step')).toBe(0.01); }); -test(' - renders an InputNumber with correct step (integer)', () => { +it(' - renders an InputNumber with correct step (integer)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -92,7 +92,7 @@ test(' - renders an InputNumber with correct step (integer)', () => { expect(wrapper.find(InputNumber).prop('step')).toBe(1); }); -test(' - renders an InputNumber with correct step (set)', () => { +it(' - renders an InputNumber with correct step (set)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -100,7 +100,7 @@ test(' - renders an InputNumber with correct step (set)', () => { expect(wrapper.find(InputNumber).prop('step')).toBe(3); }); -test(' - renders an InputNumber with correct value (default)', () => { +it(' - renders an InputNumber with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -108,7 +108,7 @@ test(' - renders an InputNumber with correct value (default)', () => { expect(wrapper.find(InputNumber).prop('value')).toBe(undefined); }); -test(' - renders an InputNumber with correct value (model)', () => { +it(' - renders an InputNumber with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -119,7 +119,7 @@ test(' - renders an InputNumber with correct value (model)', () => { expect(wrapper.find(InputNumber).prop('value')).toBe(1); }); -test(' - renders an InputNumber with correct value (specified)', () => { +it(' - renders an InputNumber with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -127,7 +127,7 @@ test(' - renders an InputNumber with correct value (specified)', () => expect(wrapper.find(InputNumber).prop('value')).toBe(2); }); -test(' - renders an InputNumber which correctly reacts on change', () => { +it(' - renders an InputNumber which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -143,7 +143,7 @@ test(' - renders an InputNumber which correctly reacts on change', () expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -test(' - renders an InputNumber which correctly reacts on change (decimal on decimal)', () => { +it(' - renders an InputNumber which correctly reacts on change (decimal on decimal)', () => { const onChange = jest.fn(); const element = ; @@ -159,7 +159,7 @@ test(' - renders an InputNumber which correctly reacts on change (deci expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); -test(' - renders an InputNumber which correctly reacts on change (decimal on integer)', () => { +it(' - renders an InputNumber which correctly reacts on change (decimal on integer)', () => { const onChange = jest.fn(); const element = ; @@ -175,7 +175,7 @@ test(' - renders an InputNumber which correctly reacts on change (deci expect(onChange).toHaveBeenLastCalledWith('x', 2); }); -test(' - renders an InputNumber which correctly reacts on change (empty)', () => { +it(' - renders an InputNumber which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -191,7 +191,7 @@ test(' - renders an InputNumber which correctly reacts on change (empt expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders an InputNumber which correctly reacts on change (same value)', () => { +it(' - renders an InputNumber which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -207,7 +207,7 @@ test(' - renders an InputNumber which correctly reacts on change (same expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -test(' - renders an InputNumber which correctly reacts on change (zero)', () => { +it(' - renders an InputNumber which correctly reacts on change (zero)', () => { const onChange = jest.fn(); const element = ; @@ -223,7 +223,7 @@ test(' - renders an InputNumber which correctly reacts on change (zero expect(onChange).toHaveBeenLastCalledWith('x', 0); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -231,7 +231,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); diff --git a/packages/uniforms-antd/__tests__/QuickForm.tsx b/packages/uniforms-antd/__tests__/QuickForm.tsx index 4f1342e29..de5cdf1e4 100644 --- a/packages/uniforms-antd/__tests__/QuickForm.tsx +++ b/packages/uniforms-antd/__tests__/QuickForm.tsx @@ -4,7 +4,7 @@ import { QuickForm } from 'uniforms-antd'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - renders', () => { +it(' - renders', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-antd/__tests__/RadioField.tsx b/packages/uniforms-antd/__tests__/RadioField.tsx index da7420ff4..9db041f35 100644 --- a/packages/uniforms-antd/__tests__/RadioField.tsx +++ b/packages/uniforms-antd/__tests__/RadioField.tsx @@ -5,7 +5,7 @@ import { RadioField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a set of checkboxes', () => { +it(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -15,7 +15,7 @@ test(' - renders a set of checkboxes', () => { expect(wrapper.find(Radio)).toHaveLength(2); }); -test(' - renders a set of checkboxes with correct disabled state', () => { +it(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -26,7 +26,7 @@ test(' - renders a set of checkboxes with correct disabled state', ( expect(wrapper.find(Radio.Group).prop('disabled')).toBe(true); }); -test(' - renders a set of checkboxes with correct readOnly state', () => { +it(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -46,7 +46,7 @@ test(' - renders a set of checkboxes with correct readOnly state', ( expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a set of checkboxes with correct id (inherited)', () => { +it(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ test(' - renders a set of checkboxes with correct id (inherited)', ( expect(wrapper.find(Radio.Group).prop('id')).toBeTruthy(); }); -test(' - renders a set of checkboxes with correct id (specified)', () => { +it(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -68,7 +68,7 @@ test(' - renders a set of checkboxes with correct id (specified)', ( expect(wrapper.find(Radio.Group).prop('id')).toBe('y'); }); -test(' - renders a set of checkboxes with correct name', () => { +it(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -79,7 +79,7 @@ test(' - renders a set of checkboxes with correct name', () => { expect(wrapper.find(Radio.Group).prop('name')).toBe('x'); }); -test(' - renders a set of checkboxes with correct options', () => { +it(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -91,7 +91,7 @@ test(' - renders a set of checkboxes with correct options', () => { expect(wrapper.find('label').at(1).text()).toBe('b'); }); -test(' - renders a set of checkboxes with correct options (transform)', () => { +it(' - renders a set of checkboxes with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -103,7 +103,7 @@ test(' - renders a set of checkboxes with correct options (transform expect(wrapper.find('label').at(1).text()).toBe('B'); }); -test(' - renders a set of checkboxes with correct value (default)', () => { +it(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -114,7 +114,7 @@ test(' - renders a set of checkboxes with correct value (default)', expect(wrapper.find(Radio.Group).prop('value')).toBe(''); }); -test(' - renders a set of checkboxes with correct value (model)', () => { +it(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -128,7 +128,7 @@ test(' - renders a set of checkboxes with correct value (model)', () expect(wrapper.find(Radio.Group).prop('value')).toBe('b'); }); -test(' - renders a set of checkboxes with correct value (specified)', () => { +it(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -139,7 +139,7 @@ test(' - renders a set of checkboxes with correct value (specified)' expect(wrapper.find(Radio.Group).prop('value')).toBe('b'); }); -test(' - renders a set of checkboxes which correctly reacts on change', () => { +it(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -159,7 +159,7 @@ test(' - renders a set of checkboxes which correctly reacts on chang expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -179,7 +179,7 @@ test(' - renders a set of checkboxes which correctly reacts on chang expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -190,7 +190,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -202,7 +202,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find(Radio.Group).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), diff --git a/packages/uniforms-antd/__tests__/SelectField.tsx b/packages/uniforms-antd/__tests__/SelectField.tsx index c07cc2db1..7056f11cb 100644 --- a/packages/uniforms-antd/__tests__/SelectField.tsx +++ b/packages/uniforms-antd/__tests__/SelectField.tsx @@ -6,7 +6,7 @@ import { SelectField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a select', () => { +it(' - renders a select', () => { const element = ; const wrapper = mount( element, @@ -16,7 +16,7 @@ test(' - renders a select', () => { expect(wrapper.find(Select)).toHaveLength(1); }); -test(' - renders a select with correct disabled state', () => { +it(' - renders a select with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -27,7 +27,7 @@ test(' - renders a select with correct disabled state', () => { expect(wrapper.find(Select).prop('disabled')).toBe(true); }); -test(' - renders a select with correct readOnly state', () => { +it(' - renders a select with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -45,7 +45,7 @@ test(' - renders a select with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a select with correct id (inherited)', () => { +it(' - renders a select with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -56,7 +56,7 @@ test(' - renders a select with correct id (inherited)', () => { expect(wrapper.find(Select).prop('id')).toBeTruthy(); }); -test(' - renders a select with correct id (specified)', () => { +it(' - renders a select with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -67,7 +67,7 @@ test(' - renders a select with correct id (specified)', () => { expect(wrapper.find(Select).prop('id')).toBe('y'); }); -test(' - renders a select with correct name', () => { +it(' - renders a select with correct name', () => { const element = ; const wrapper = mount( element, @@ -78,7 +78,7 @@ test(' - renders a select with correct name', () => { expect(wrapper.find(Select).prop('name')).toBe('x'); }); -test(' - renders a select with correct options', () => { +it(' - renders a select with correct options', () => { const element = ; const wrapper = mount( element, @@ -97,7 +97,7 @@ test(' - renders a select with correct options', () => { expect(wrapper.find(Select).prop('children')[1].props.children).toBe('b'); }); -test(' - renders a select with correct options (transform)', () => { +it(' - renders a select with correct options (transform)', () => { const element = ( x.toUpperCase()} /> ); @@ -118,7 +118,7 @@ test(' - renders a select with correct options (transform)', () => expect(wrapper.find(Select).prop('children')[1].props.children).toBe('B'); }); -test(' - renders a select with correct placeholder (implicit)', () => { +it(' - renders a select with correct placeholder (implicit)', () => { const element = ; const wrapper = mount( element, @@ -130,7 +130,7 @@ test(' - renders a select with correct placeholder (implicit)', () expect(wrapper.find(Select).prop('value')).toBe(undefined); }); -test(' - renders a select with correct value (default)', () => { +it(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -141,7 +141,7 @@ test(' - renders a select with correct value (default)', () => { expect(wrapper.find(Select).prop('value')).toBe(undefined); }); -test(' - renders a select with correct value (model)', () => { +it(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -155,7 +155,7 @@ test(' - renders a select with correct value (model)', () => { expect(wrapper.find(Select).prop('value')).toBe('b'); }); -test(' - renders a select with correct value (specified)', () => { +it(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -166,7 +166,7 @@ test(' - renders a select with correct value (specified)', () => { expect(wrapper.find(Select).prop('value')).toBe('b'); }); -test(' - renders a select which correctly reacts on change', () => { +it(' - renders a select which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -184,7 +184,7 @@ test(' - renders a select which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a select which correctly reacts on change (array)', () => { +it(' - renders a select which correctly reacts on change (array)', () => { const onChange = jest.fn(); const element = ; @@ -207,7 +207,7 @@ test(' - renders a select which correctly reacts on change (array)' expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -test(' - renders a select (undefined values)', () => { +it(' - renders a select (undefined values)', () => { const element = ; const wrapper = mount( element, @@ -222,7 +222,7 @@ test(' - renders a select (undefined values)', () => { expect(wrapper.find(Select).prop('value')).toContain('a'); }); -test(' - renders a select which correctly reacts on change (empty)', () => { +it(' - renders a select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -240,7 +240,7 @@ test(' - renders a select which correctly reacts on change (empty)' expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders a select which correctly reacts on change (same value)', () => { +it(' - renders a select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -258,7 +258,7 @@ test(' - renders a select which correctly reacts on change (same va expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -270,14 +270,14 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find(Select).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -test(' - disabled items (options) based on predicate', () => { +it(' - disabled items (options) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( @@ -298,7 +298,7 @@ test(' - disabled items (options) based on predicate', () => { expect(children[1].props.disabled).toBe(false); }); -test(' - renders a set of checkboxes', () => { +it(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -310,7 +310,7 @@ test(' - renders a set of checkboxes', () => { expect(wrapper.find(Radio).at(1).prop('value')).toBe('b'); }); -test(' - renders a set of checkboxes with correct disabled state', () => { +it(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -321,7 +321,7 @@ test(' - renders a set of checkboxes with correct disabl expect(wrapper.find(Radio.Group).prop('disabled')).toBe(true); }); -test(' - renders a set of checkboxes with correct readOnly state', () => { +it(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -338,7 +338,7 @@ test(' - renders a set of checkboxes with correct readOn expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a set of checkboxes with correct id (inherited)', () => { +it(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -349,7 +349,7 @@ test(' - renders a set of checkboxes with correct id (in expect(wrapper.find(Radio.Group).prop('id')).toBeTruthy(); }); -test(' - renders a set of checkboxes with correct id (specified)', () => { +it(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -360,7 +360,7 @@ test(' - renders a set of checkboxes with correct id (sp expect(wrapper.find(Radio.Group).prop('id')).toBe('y'); }); -test(' - renders a set of checkboxes with correct name', () => { +it(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -371,7 +371,7 @@ test(' - renders a set of checkboxes with correct name', expect(wrapper.find(Radio.Group).prop('name')).toBe('x'); }); -test(' - renders a set of checkboxes with correct options', () => { +it(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -383,7 +383,7 @@ test(' - renders a set of checkboxes with correct option expect(wrapper.find('label').at(1).text()).toBe('b'); }); -test(' - renders a set of checkboxes with correct options (transform)', () => { +it(' - renders a set of checkboxes with correct options (transform)', () => { const element = ( - renders a set of checkboxes with correct option expect(wrapper.find('label').at(1).text()).toBe('B'); }); -test(' - renders a set of checkboxes with correct value (default)', () => { +it(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -413,7 +413,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -test(' - renders a set of checkboxes with correct value (model)', () => { +it(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -428,7 +428,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes with correct value (specified)', () => { +it(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -440,7 +440,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes which correctly reacts on change', () => { +it(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -457,7 +457,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { const onChange = jest.fn(); const element = ; @@ -477,7 +477,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -test(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); const element = ; @@ -497,7 +497,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -514,7 +514,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -525,7 +525,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ( ); @@ -539,14 +539,14 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find(Radio.Group).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -test(' - disabled items (checkboxes) based on predicate', () => { +it(' - disabled items (checkboxes) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( diff --git a/packages/uniforms-antd/__tests__/SubmitField.tsx b/packages/uniforms-antd/__tests__/SubmitField.tsx index 5cc3a94db..2f7f07406 100644 --- a/packages/uniforms-antd/__tests__/SubmitField.tsx +++ b/packages/uniforms-antd/__tests__/SubmitField.tsx @@ -5,14 +5,14 @@ import { SubmitField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders', () => { +it(' - renders', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper).toHaveLength(1); }); -test(' - renders disabled if error', () => { +it(' - renders disabled if error', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -20,7 +20,7 @@ test(' - renders disabled if error', () => { expect(wrapper.find(Button).prop('disabled')).toBe(true); }); -test(' - renders enabled if error and enabled', () => { +it(' - renders enabled if error and enabled', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); diff --git a/packages/uniforms-antd/__tests__/TextField.tsx b/packages/uniforms-antd/__tests__/TextField.tsx index 56ff900fd..a9e40ccb6 100644 --- a/packages/uniforms-antd/__tests__/TextField.tsx +++ b/packages/uniforms-antd/__tests__/TextField.tsx @@ -10,7 +10,7 @@ import mount from './_mount'; describe('@RTL - TextField tests', () => { testTextField(TextField); - test(' - renders component with unknown props', () => { + it(' - renders component with unknown props', () => { const props = { 'data-x': 'x', 'data-y': 'y', @@ -25,14 +25,14 @@ describe('@RTL - TextField tests', () => { }); }); -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(Input)).toHaveLength(1); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -40,7 +40,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find(Input).prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -48,7 +48,7 @@ test(' - renders an input with correct readOnly state', () => { expect(wrapper.find(Input).prop('readOnly')).toBe(true); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -56,7 +56,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find(Input).prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -64,7 +64,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find(Input).prop('id')).toBe('y'); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -72,7 +72,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find(Input).prop('name')).toBe('x'); }); -test(' - renders an input with correct placeholder', () => { +it(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -80,7 +80,7 @@ test(' - renders an input with correct placeholder', () => { expect(wrapper.find(Input).prop('placeholder')).toBe('y'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -88,7 +88,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find(Input).prop('type')).toBe('text'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -96,7 +96,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find(Input).prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -107,7 +107,7 @@ test(' - renders an input with correct value (model)', () => { expect(wrapper.find(Input).prop('value')).toBe('y'); }); -test(' - renders an input with correct value (specified)', () => { +it(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -115,7 +115,7 @@ test(' - renders an input with correct value (specified)', () => { expect(wrapper.find(Input).prop('value')).toBe('y'); }); -test(' - renders an input which correctly reacts on change', () => { +it(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -131,7 +131,7 @@ test(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders an input which correctly reacts on change (empty)', () => { +it(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -147,7 +147,7 @@ test(' - renders an input which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders an input which correctly reacts on change (same value)', () => { +it(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -163,7 +163,7 @@ test(' - renders an input which correctly reacts on change (same valu expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -171,7 +171,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -180,14 +180,14 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find(Input).prop('data-z')).toBe('z'); }); -test(' - renders a input with correct type prop', () => { +it(' - renders a input with correct type prop', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(Input).prop('type')).toBe('password'); }); -test(' - renders a input with autocomplete turned off', () => { +it(' - renders a input with autocomplete turned off', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-antd/__tests__/ValidateQuickForm.tsx b/packages/uniforms-antd/__tests__/ValidateQuickForm.tsx index 80a2d7d75..402c98cc9 100644 --- a/packages/uniforms-antd/__tests__/ValidateQuickForm.tsx +++ b/packages/uniforms-antd/__tests__/ValidateQuickForm.tsx @@ -4,7 +4,7 @@ import { ValidatedQuickForm } from 'uniforms-antd'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-antd/__tests__/ValidatedForm.tsx b/packages/uniforms-antd/__tests__/ValidatedForm.tsx index c27171e6b..34f5fad78 100644 --- a/packages/uniforms-antd/__tests__/ValidatedForm.tsx +++ b/packages/uniforms-antd/__tests__/ValidatedForm.tsx @@ -4,7 +4,7 @@ import { ValidatedForm } from 'uniforms-antd'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-antd/__tests__/wrapField.tsx b/packages/uniforms-antd/__tests__/wrapField.tsx index 4039b8930..f6b427998 100644 --- a/packages/uniforms-antd/__tests__/wrapField.tsx +++ b/packages/uniforms-antd/__tests__/wrapField.tsx @@ -5,7 +5,7 @@ import { wrapField } from 'uniforms-antd'; import mount from './_mount'; -test(' - renders wrapper with label', () => { +it(' - renders wrapper with label', () => { const element = wrapField({ label: 'Label' },
); const wrapper = mount(element); @@ -13,14 +13,14 @@ test(' - renders wrapper with label', () => { expect(wrapper.find(Form.Item).prop('label').props.children[0]).toBe('Label'); }); -test(' - renders wrapper with label and info', () => { +it(' - renders wrapper with label and info', () => { const element = wrapField({ label: 'Label', info: 'Info' },
); const wrapper = mount(element); expect(wrapper.find(Tooltip).prop('title')).toBe('Info'); }); -test(' - renders wrapper with an error message', () => { +it(' - renders wrapper with an error message', () => { const error = new Error(); const element = wrapField( { error, showInlineError: true, errorMessage: 'Error' }, @@ -31,14 +31,14 @@ test(' - renders wrapper with an error message', () => { expect(wrapper.find(Form.Item).prop('help')).toBe('Error'); }); -test(' - renders wrapper with an error status', () => { +it(' - renders wrapper with an error status', () => { const element = wrapField({},
); const wrapper = mount(element); expect(wrapper.find(Form.Item).prop('validateStatus')).toBe(undefined); }); -test(' - renders wrapper with an error status (error)', () => { +it(' - renders wrapper with an error status (error)', () => { const error = new Error(); const element = wrapField({ error },
); const wrapper = mount(element); @@ -46,28 +46,28 @@ test(' - renders wrapper with an error status (error)', () => { expect(wrapper.find(Form.Item).prop('validateStatus')).toBe('error'); }); -test(' - renders wrapper with help text', () => { +it(' - renders wrapper with help text', () => { const element = wrapField({ help: 'Help' },
); const wrapper = mount(element); expect(wrapper.find(Form.Item).prop('help')).toBe('Help'); }); -test(' - renders wrapper with extra text', () => { +it(' - renders wrapper with extra text', () => { const element = wrapField({ extra: 'Extra' },
); const wrapper = mount(element); expect(wrapper.find(Form.Item).prop('extra')).toBe('Extra'); }); -test(' - renders wrapper with extra style', () => { +it(' - renders wrapper with extra style', () => { const element = wrapField({ wrapperStyle: {} },
); const wrapper = mount(element); expect(wrapper.find(Form.Item).prop('style')).toEqual({}); }); -test(' - renders wrapper with a custom validateStatus', () => { +it(' - renders wrapper with a custom validateStatus', () => { const element = wrapField({ validateStatus: 'success' },
); const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap3/__tests__/AutoField.tsx b/packages/uniforms-bootstrap3/__tests__/AutoField.tsx index d26e7a3f7..1854ca326 100644 --- a/packages/uniforms-bootstrap3/__tests__/AutoField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/AutoField.tsx @@ -14,14 +14,14 @@ import { import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(AutoField)).toHaveLength(1); }); -test(' - detects RadioField', () => { +it(' - detects RadioField', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ test(' - detects RadioField', () => { expect(wrapper.find(RadioField.Component)).toHaveLength(1); }); -test(' - detects SelectField', () => { +it(' - detects SelectField', () => { const element = ; const wrapper = mount( element, @@ -50,14 +50,14 @@ test(' - detects SelectField', () => { expect(wrapper.find(SelectField.Component)).toHaveLength(1); }); -test(' - detects DateField', () => { +it(' - detects DateField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DateField.Component)).toHaveLength(1); }); -test(' - detects ListField', () => { +it(' - detects ListField', () => { const element = ; const wrapper = mount( element, @@ -67,35 +67,35 @@ test(' - detects ListField', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -test(' - detects NumField', () => { +it(' - detects NumField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(NumField.Component)).toHaveLength(1); }); -test(' - detects NestField', () => { +it(' - detects NestField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Object } })); expect(wrapper.find(NestField)).toHaveLength(1); }); -test(' - detects TextField', () => { +it(' - detects TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField.Component)).toHaveLength(1); }); -test(' - detects BoolField', () => { +it(' - detects BoolField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(BoolField.Component)).toHaveLength(1); }); -test(' - uses Component (schema)', () => { +it(' - uses Component (schema)', () => { const Component = jest.fn(() => null); const element = ; @@ -107,7 +107,7 @@ test(' - uses Component (schema)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -test(' - uses Component (props)', () => { +it(' - uses Component (props)', () => { const Component = jest.fn(() => null); const element = ; @@ -116,7 +116,7 @@ test(' - uses Component (props)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -test(' - uses Component (context)', () => { +it(' - uses Component (context)', () => { const FieldA = jest.fn(() => null); const FieldB = jest.fn(() => null); @@ -136,7 +136,7 @@ test(' - uses Component (context)', () => { expect(FieldB).toHaveBeenCalledTimes(1); }); -test(' - uses Component (invalid)', () => { +it(' - uses Component (invalid)', () => { const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {}); expect(() => { const element = ; diff --git a/packages/uniforms-bootstrap3/__tests__/AutoFields.tsx b/packages/uniforms-bootstrap3/__tests__/AutoFields.tsx index 86f1d1db4..6315c5f2c 100644 --- a/packages/uniforms-bootstrap3/__tests__/AutoFields.tsx +++ b/packages/uniforms-bootstrap3/__tests__/AutoFields.tsx @@ -4,14 +4,14 @@ import { AutoFields, AutoField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('AutoFields')).toHaveLength(1); }); -test(' - render all fields by default', () => { +it(' - render all fields by default', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - render all fields by default', () => { expect(wrapper.find('input')).toHaveLength(3); }); -test(' - renders only specified fields', () => { +it(' - renders only specified fields', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ test(' - renders only specified fields', () => { ); }); -test(' - does not render ommited fields', () => { +it(' - does not render ommited fields', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ test(' - does not render ommited fields', () => { ); }); -test(' - wraps fields in specified element', () => { +it(' - wraps fields in specified element', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ test(' - wraps fields in specified element', () => { expect(wrapper.find('section').find('input')).toHaveLength(3); }); -test(' - pass props to the children', () => { +it(' - pass props to the children', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap3/__tests__/AutoForm.tsx b/packages/uniforms-bootstrap3/__tests__/AutoForm.tsx index e34a1daaa..baf84d4e1 100644 --- a/packages/uniforms-bootstrap3/__tests__/AutoForm.tsx +++ b/packages/uniforms-bootstrap3/__tests__/AutoForm.tsx @@ -4,7 +4,7 @@ import { AutoForm } from 'uniforms-bootstrap3'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap3/__tests__/BaseForm.tsx b/packages/uniforms-bootstrap3/__tests__/BaseForm.tsx index 05dcf396b..91fd239f2 100644 --- a/packages/uniforms-bootstrap3/__tests__/BaseForm.tsx +++ b/packages/uniforms-bootstrap3/__tests__/BaseForm.tsx @@ -4,7 +4,7 @@ import { BaseForm } from 'uniforms-bootstrap3'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap3/__tests__/BoolField.tsx b/packages/uniforms-bootstrap3/__tests__/BoolField.tsx index 3fd395fc9..2331190da 100644 --- a/packages/uniforms-bootstrap3/__tests__/BoolField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/BoolField.tsx @@ -4,14 +4,14 @@ import { BoolField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an inline input', () => { +it(' - renders an inline input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -19,7 +19,7 @@ test(' - renders an inline input', () => { expect(wrapper.find('.checkbox-inline')).toHaveLength(1); }); -test(' - renders a input with correct id (inherited)', () => { +it(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -27,7 +27,7 @@ test(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders a input with correct id (specified)', () => { +it(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -35,7 +35,7 @@ test(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders a input with correct name', () => { +it(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -43,7 +43,7 @@ test(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('checkbox'); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -59,7 +59,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -73,7 +73,7 @@ test(' - renders an input with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a input with correct label (specified)', () => { +it(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -84,7 +84,7 @@ test(' - renders a input with correct label (specified)', () => { ); }); -test(' - renders a input with correct value (default)', () => { +it(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -92,7 +92,7 @@ test(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('checked')).toBe(false); }); -test(' - renders a input with correct value (model)', () => { +it(' - renders a input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -103,7 +103,7 @@ test(' - renders a input with correct value (model)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -test(' - renders a input with correct value (specified)', () => { +it(' - renders a input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -111,7 +111,7 @@ test(' - renders a input with correct value (specified)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -test(' - renders a input which correctly reacts on change', () => { +it(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ test(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', true); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); diff --git a/packages/uniforms-bootstrap3/__tests__/DateField.tsx b/packages/uniforms-bootstrap3/__tests__/DateField.tsx index dff9e15fd..04ba5c1d8 100644 --- a/packages/uniforms-bootstrap3/__tests__/DateField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/DateField.tsx @@ -8,7 +8,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - DateField tests', () => { - test(' - handles "date" type correctly', () => { + it(' - handles "date" type correctly', () => { const onChange = jest.fn(); const initialDate = new Date(Date.UTC(2020, 0, 1)); @@ -29,14 +29,14 @@ describe('@RTL - DateField tests', () => { }); }); -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders a input with correct id (inherited)', () => { +it(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -44,7 +44,7 @@ test(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders a input with correct id (specified)', () => { +it(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -52,7 +52,7 @@ test(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders a input with correct name', () => { +it(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -60,7 +60,7 @@ test(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -68,7 +68,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('datetime-local'); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -87,7 +87,7 @@ test.each(['date', 'datetime-local'] as const)( }, ); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -95,7 +95,7 @@ test(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -test(' - renders a input with correct label (specified)', () => { +it(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -106,7 +106,7 @@ test(' - renders a input with correct label (specified)', () => { ); }); -test(' - renders a input with correct value (default)', () => { +it(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -114,7 +114,7 @@ test(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders a input with correct value (model)', () => { +it(' - renders a input with correct value (model)', () => { const now = new Date(); const element = ; const wrapper = mount( @@ -128,7 +128,7 @@ test(' - renders a input with correct value (model)', () => { ); }); -test(' - renders a input with correct value (specified)', () => { +it(' - renders a input with correct value (specified)', () => { const now = new Date(); const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -139,7 +139,7 @@ test(' - renders a input with correct value (specified)', () => { ); }); -test(' - renders a input which correctly reacts on change', () => { +it(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const now = new Date(); @@ -158,7 +158,7 @@ test(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', now); }); -test(' - renders a input which correctly reacts on change (empty)', () => { +it(' - renders a input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -176,7 +176,7 @@ test(' - renders a input which correctly reacts on change (empty)', ( expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a input which correctly reacts on change (overflow)', () => { +it(' - renders a input which correctly reacts on change (overflow)', () => { const onChange = jest.fn(); const now = new Date(1e5, 0); @@ -195,7 +195,7 @@ test(' - renders a input which correctly reacts on change (overflow)' expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); diff --git a/packages/uniforms-bootstrap3/__tests__/ErrorField.tsx b/packages/uniforms-bootstrap3/__tests__/ErrorField.tsx index b7b5745d6..c66b6b831 100644 --- a/packages/uniforms-bootstrap3/__tests__/ErrorField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/ErrorField.tsx @@ -11,14 +11,14 @@ const error = { message: 'X is required [validation-error]', }; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorField)).toHaveLength(1); }); -test(' - renders correct error message (context)', () => { +it(' - renders correct error message (context)', () => { const element = ; const wrapper = mount( element, @@ -29,7 +29,7 @@ test(' - renders correct error message (context)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -test(' - renders correct error message (specified)', () => { +it(' - renders correct error message (specified)', () => { const element = ( - renders correct error message (specified)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -test(' - renders correct children if specified', () => { +it(' - renders correct children if specified', () => { const element = Error; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap3/__tests__/ErrorsField.tsx b/packages/uniforms-bootstrap3/__tests__/ErrorsField.tsx index c2ed3ee01..b4980975c 100644 --- a/packages/uniforms-bootstrap3/__tests__/ErrorsField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/ErrorsField.tsx @@ -15,14 +15,14 @@ const error = { message: 'X is required [validation-error]', }; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorsField)).toHaveLength(1); }); -test(' - renders list of correct error messages (context)', () => { +it(' - renders list of correct error messages (context)', () => { const element = ; const wrapper = mount( element, @@ -38,7 +38,7 @@ test(' - renders list of correct error messages (context)', () => { expect(wrapper.find('.panel-body > div').at(2).text()).toBe('Z is required'); }); -test(' - renders children (specified)', () => { +it(' - renders children (specified)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap3/__tests__/HiddenField.tsx b/packages/uniforms-bootstrap3/__tests__/HiddenField.tsx index bd6edef8c..bd9846896 100644 --- a/packages/uniforms-bootstrap3/__tests__/HiddenField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/HiddenField.tsx @@ -4,14 +4,14 @@ import { HiddenField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('hidden'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -62,7 +62,7 @@ test(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input which correctly reacts on model change', () => { +it(' - renders an input which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -76,7 +76,7 @@ test(' - renders an input which correctly reacts on model change', expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders an input which correctly reacts on model change (empty)', () => { +it(' - renders an input which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -90,7 +90,7 @@ test(' - renders an input which correctly reacts on model change (e expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders an input which correctly reacts on model change (same value)', () => { +it(' - renders an input which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -104,14 +104,14 @@ test(' - renders an input which correctly reacts on model change (s expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders nothing', () => { +it(' - renders nothing', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.children()).toHaveLength(0); }); -test(' - renders nothing which correctly reacts on model change', () => { +it(' - renders nothing which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ test(' - renders nothing which correctly reacts on model chan expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders nothing which correctly reacts on model change (empty)', () => { +it(' - renders nothing which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ test(' - renders nothing which correctly reacts on model chan expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders nothing which correctly reacts on model change (same value)', () => { +it(' - renders nothing which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; diff --git a/packages/uniforms-bootstrap3/__tests__/ListAddField.tsx b/packages/uniforms-bootstrap3/__tests__/ListAddField.tsx index a922f12be..b16f8d8d4 100644 --- a/packages/uniforms-bootstrap3/__tests__/ListAddField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/ListAddField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListAddField)).toHaveLength(1); }); -test(' - prevents onClick when disabled', () => { +it(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ test(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when limit reached', () => { +it(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { maxCount: 0 } })); @@ -39,7 +39,7 @@ test(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - correctly reacts on click', () => { +it(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ test(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['y']); }); -test(' - correctly reacts on keyboard enter key', () => { +it(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-bootstrap3/__tests__/ListDelField.tsx b/packages/uniforms-bootstrap3/__tests__/ListDelField.tsx index 83ee440d5..e34de84f5 100644 --- a/packages/uniforms-bootstrap3/__tests__/ListDelField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/ListDelField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListDelField)).toHaveLength(1); }); -test(' - prevents onClick when disabled', () => { +it(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ test(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when limit reached', () => { +it(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { minCount: 3 } })); @@ -39,7 +39,7 @@ test(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - correctly reacts on click', () => { +it(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ test(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['x', 'z']); }); -test(' - correctly reacts on keyboard enter key', () => { +it(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-bootstrap3/__tests__/ListField.tsx b/packages/uniforms-bootstrap3/__tests__/ListField.tsx index 39f8754e8..763db6167 100644 --- a/packages/uniforms-bootstrap3/__tests__/ListField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/ListField.tsx @@ -12,7 +12,7 @@ describe('@RTL - ListField tests', () => { }); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount( element, @@ -22,7 +22,7 @@ test(' - works', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -test(' - renders ListAddField', () => { +it(' - renders ListAddField', () => { const element = ; const wrapper = mount( element, @@ -33,7 +33,7 @@ test(' - renders ListAddField', () => { expect(wrapper.find(ListAddField).prop('name')).toBe('$'); }); -test(' - renders correct label (specified)', () => { +it(' - renders correct label (specified)', () => { const element = ; const wrapper = mount( element, @@ -46,7 +46,7 @@ test(' - renders correct label (specified)', () => { ); }); -test(' - renders correct numer of items with model (specified)', () => { +it(' - renders correct numer of items with model (specified)', () => { const element = ; const wrapper = mount( element, @@ -58,7 +58,7 @@ test(' - renders correct numer of items with model (specified)', () = expect(wrapper.find('input')).toHaveLength(3); }); -test(' - passes itemProps to its children', () => { +it(' - passes itemProps to its children', () => { const element = ; const wrapper = mount( element, @@ -70,7 +70,7 @@ test(' - passes itemProps to its children', () => { expect(wrapper.find(ListItemField).first().prop('data-xyz')).toBe(1); }); -test(' - renders children (specified)', () => { +it(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -89,7 +89,7 @@ test(' - renders children (specified)', () => { expect(Child).toHaveBeenCalledTimes(2); }); -test(' - renders children with correct name (children)', () => { +it(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -108,7 +108,7 @@ test(' - renders children with correct name (children)', () => { expect(wrapper.find(Child).at(1).prop('name')).toBe('1'); }); -test(' - renders children with correct name (value)', () => { +it(' - renders children with correct name (value)', () => { const element = ; const wrapper = mount( element, @@ -121,7 +121,7 @@ test(' - renders children with correct name (value)', () => { expect(wrapper.find(ListItemField).at(1).prop('name')).toBe('1'); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( - renders correct error text (specified)', () => { expect(wrapper.find('.help-block').text()).toBe('Error'); }); -test(' - renders correct error text (showInlineError=false)', () => { +it(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.find('.help-block')).toHaveLength(0); }); -test(' - renders proper number of optional values after add new value', () => { +it(' - renders proper number of optional values after add new value', () => { const element = ; const onChange = jest.fn(); const wrapper = mount( diff --git a/packages/uniforms-bootstrap3/__tests__/ListItemField.tsx b/packages/uniforms-bootstrap3/__tests__/ListItemField.tsx index b8f55cafb..8e3249a4b 100644 --- a/packages/uniforms-bootstrap3/__tests__/ListItemField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/ListItemField.tsx @@ -4,7 +4,7 @@ import { AutoField, ListDelField, ListItemField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - works', () => { expect(wrapper.find(ListItemField)).toHaveLength(1); }); -test(' - renders ListDelField', () => { +it(' - renders ListDelField', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - renders ListDelField', () => { expect(wrapper.find(ListDelField).childAt(0).prop('name')).toBe('x.1'); }); -test(' - renders AutoField', () => { +it(' - renders AutoField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ test(' - renders AutoField', () => { expect(wrapper.find(AutoField)).toHaveLength(1); }); -test(' - renders children if specified', () => { +it(' - renders children if specified', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( diff --git a/packages/uniforms-bootstrap3/__tests__/LongTextField.tsx b/packages/uniforms-bootstrap3/__tests__/LongTextField.tsx index 6eb99efb9..118f8c657 100644 --- a/packages/uniforms-bootstrap3/__tests__/LongTextField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/LongTextField.tsx @@ -4,14 +4,14 @@ import { LongTextField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a textarea', () => { +it(' - renders a textarea', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('textarea')).toHaveLength(1); }); -test(' - renders a textarea with correct disabled state', () => { +it(' - renders a textarea with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ test(' - renders a textarea with correct disabled state', () => { expect(wrapper.find('textarea').prop('disabled')).toBe(true); }); -test(' - renders a textarea with correct readOnly state', () => { +it(' - renders a textarea with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ test(' - renders a textarea with correct readOnly state', () => { expect(wrapper.find('textarea').prop('readOnly')).toBe(true); }); -test(' - renders a textarea with correct id (inherited)', () => { +it(' - renders a textarea with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ test(' - renders a textarea with correct id (inherited)', () => { expect(wrapper.find('textarea').prop('id')).toBeTruthy(); }); -test(' - renders a textarea with correct id (specified)', () => { +it(' - renders a textarea with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ test(' - renders a textarea with correct id (specified)', () => { expect(wrapper.find('textarea').prop('id')).toBe('y'); }); -test(' - renders a textarea with correct name', () => { +it(' - renders a textarea with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ test(' - renders a textarea with correct name', () => { expect(wrapper.find('textarea').prop('name')).toBe('x'); }); -test(' - renders a textarea with correct placeholder', () => { +it(' - renders a textarea with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -59,7 +59,7 @@ test(' - renders a textarea with correct placeholder', () => { expect(wrapper.find('textarea').prop('placeholder')).toBe('y'); }); -test(' - renders a textarea with correct value (default)', () => { +it(' - renders a textarea with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -67,7 +67,7 @@ test(' - renders a textarea with correct value (default)', () => expect(wrapper.find('textarea').prop('value')).toBe(''); }); -test(' - renders a textarea with correct value (model)', () => { +it(' - renders a textarea with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -78,7 +78,7 @@ test(' - renders a textarea with correct value (model)', () => { expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -test(' - renders a textarea with correct value (specified)', () => { +it(' - renders a textarea with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -86,7 +86,7 @@ test(' - renders a textarea with correct value (specified)', () = expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -test(' - renders a textarea which correctly reacts on change', () => { +it(' - renders a textarea which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -102,7 +102,7 @@ test(' - renders a textarea which correctly reacts on change', () expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a textarea which correctly reacts on change (empty)', () => { +it(' - renders a textarea which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -118,7 +118,7 @@ test(' - renders a textarea which correctly reacts on change (emp expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders a textarea which correctly reacts on change (same value)', () => { +it(' - renders a textarea which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -134,7 +134,7 @@ test(' - renders a textarea which correctly reacts on change (sam expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -145,7 +145,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-bootstrap3/__tests__/NestField.tsx b/packages/uniforms-bootstrap3/__tests__/NestField.tsx index 793418a7f..e79e3913e 100644 --- a/packages/uniforms-bootstrap3/__tests__/NestField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/NestField.tsx @@ -4,7 +4,7 @@ import { AutoField, NestField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an for each field', () => { +it(' - renders an for each field', () => { const element = ; const wrapper = mount( element, @@ -20,7 +20,7 @@ test(' - renders an for each field', () => { expect(wrapper.find(AutoField).at(1).prop('name')).toBe('b'); }); -test(' - renders custom content if given', () => { +it(' - renders custom content if given', () => { const element = (
@@ -40,7 +40,7 @@ test(' - renders custom content if given', () => { expect(wrapper.find('article').prop('data-test')).toBe('content'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -88,7 +88,7 @@ test(' - renders correct error text (specified)', () => { expect(wrapper.find('.help-block').text()).toBe('Error'); }); -test(' - renders correct error text (showInlineError=false)', () => { +it(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -19,7 +19,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -27,7 +27,7 @@ test(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -35,7 +35,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -43,7 +43,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct max', () => { +it(' - renders an input with correct max', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct max', () => { expect(wrapper.find('input').prop('max')).toBe(10); }); -test(' - renders an input with correct min', () => { +it(' - renders an input with correct min', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -59,7 +59,7 @@ test(' - renders an input with correct min', () => { expect(wrapper.find('input').prop('min')).toBe(10); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -67,7 +67,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct placeholder', () => { +it(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -75,7 +75,7 @@ test(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -test(' - renders an input with correct step (decimal)', () => { +it(' - renders an input with correct step (decimal)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -83,7 +83,7 @@ test(' - renders an input with correct step (decimal)', () => { expect(wrapper.find('input').prop('step')).toBe(0.01); }); -test(' - renders an input with correct step (integer)', () => { +it(' - renders an input with correct step (integer)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -91,7 +91,7 @@ test(' - renders an input with correct step (integer)', () => { expect(wrapper.find('input').prop('step')).toBe(1); }); -test(' - renders an input with correct step (set)', () => { +it(' - renders an input with correct step (set)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -99,7 +99,7 @@ test(' - renders an input with correct step (set)', () => { expect(wrapper.find('input').prop('step')).toBe(3); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -107,7 +107,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('number'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -115,7 +115,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const onChange = jest.fn(); const element = ; @@ -157,7 +157,7 @@ test(' - renders an input with correct value (model)', () => { spy.mockRestore(); }); -test(' - renders an input with correct value (specified)', () => { +it(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -165,7 +165,7 @@ test(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe(2); }); -test(' - renders an input which correctly reacts on change', () => { +it(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -181,7 +181,7 @@ test(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -test(' - renders an input which correctly reacts on change (decimal on decimal)', () => { +it(' - renders an input which correctly reacts on change (decimal on decimal)', () => { const onChange = jest.fn(); const element = ; @@ -197,7 +197,7 @@ test(' - renders an input which correctly reacts on change (decimal on expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); -test(' - renders an input which correctly reacts on change (decimal on integer)', () => { +it(' - renders an input which correctly reacts on change (decimal on integer)', () => { const onChange = jest.fn(); const element = ; @@ -213,7 +213,7 @@ test(' - renders an input which correctly reacts on change (decimal on expect(onChange).toHaveBeenLastCalledWith('x', 2); }); -test(' - renders an input which correctly reacts on change (empty)', () => { +it(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -229,7 +229,7 @@ test(' - renders an input which correctly reacts on change (empty)', ( expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders an input which correctly reacts on change (same value)', () => { +it(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -245,7 +245,7 @@ test(' - renders an input which correctly reacts on change (same value expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -test(' - renders an input which correctly reacts on change (zero)', () => { +it(' - renders an input which correctly reacts on change (zero)', () => { const onChange = jest.fn(); const element = ; @@ -261,7 +261,7 @@ test(' - renders an input which correctly reacts on change (zero)', () expect(onChange).toHaveBeenLastCalledWith('x', 0); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -272,7 +272,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); diff --git a/packages/uniforms-bootstrap3/__tests__/QuickForm.tsx b/packages/uniforms-bootstrap3/__tests__/QuickForm.tsx index 13417500e..2dcd57204 100644 --- a/packages/uniforms-bootstrap3/__tests__/QuickForm.tsx +++ b/packages/uniforms-bootstrap3/__tests__/QuickForm.tsx @@ -4,7 +4,7 @@ import { QuickForm } from 'uniforms-bootstrap3'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - renders', () => { +it(' - renders', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap3/__tests__/RadioField.tsx b/packages/uniforms-bootstrap3/__tests__/RadioField.tsx index 891ffcead..6f4b55c5c 100644 --- a/packages/uniforms-bootstrap3/__tests__/RadioField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/RadioField.tsx @@ -4,7 +4,7 @@ import { RadioField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a set of checkboxes', () => { +it(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -test(' - renders a set of inline checkboxes', () => { +it(' - renders a set of inline checkboxes', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - renders a set of inline checkboxes', () => { expect(wrapper.find('.radio-inline')).toHaveLength(2); }); -test(' - renders a set of checkboxes with correct disabled state', () => { +it(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ test(' - renders a set of checkboxes with correct disabled state', ( expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -test(' - renders a set of checkboxes with correct readOnly state', () => { +it(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -54,7 +54,7 @@ test(' - renders a set of checkboxes with correct readOnly state', ( expect(onChange).not.toBeCalled(); }); -test(' - renders a set of checkboxes with correct id (inherited)', () => { +it(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -66,7 +66,7 @@ test(' - renders a set of checkboxes with correct id (inherited)', ( expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -test(' - renders a set of checkboxes with correct id (specified)', () => { +it(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -78,7 +78,7 @@ test(' - renders a set of checkboxes with correct id (specified)', ( expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -test(' - renders a set of checkboxes with correct name', () => { +it(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -90,7 +90,7 @@ test(' - renders a set of checkboxes with correct name', () => { expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -test(' - renders a set of checkboxes with correct options', () => { +it(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -102,7 +102,7 @@ test(' - renders a set of checkboxes with correct options', () => { expect(wrapper.find('label').at(1).text()).toBe('b'); }); -test(' - renders a set of checkboxes with correct options (transform)', () => { +it(' - renders a set of checkboxes with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -114,7 +114,7 @@ test(' - renders a set of checkboxes with correct options (transform expect(wrapper.find('label').at(1).text()).toBe('B'); }); -test(' - renders a set of checkboxes with correct value (default)', () => { +it(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -126,7 +126,7 @@ test(' - renders a set of checkboxes with correct value (default)', expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -test(' - renders a set of checkboxes with correct value (model)', () => { +it(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -141,7 +141,7 @@ test(' - renders a set of checkboxes with correct value (model)', () expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes with correct value (specified)', () => { +it(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -153,7 +153,7 @@ test(' - renders a set of checkboxes with correct value (specified)' expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes which correctly reacts on change', () => { +it(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -170,7 +170,7 @@ test(' - renders a set of checkboxes which correctly reacts on chang expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -187,7 +187,7 @@ test(' - renders a set of checkboxes which correctly reacts on chang expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -198,7 +198,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -210,7 +210,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), diff --git a/packages/uniforms-bootstrap3/__tests__/SelectField.tsx b/packages/uniforms-bootstrap3/__tests__/SelectField.tsx index 73ffe5620..35dc35f4b 100644 --- a/packages/uniforms-bootstrap3/__tests__/SelectField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/SelectField.tsx @@ -4,7 +4,7 @@ import { SelectField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a select', () => { +it(' - renders a select', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - renders a select', () => { expect(wrapper.find('select')).toHaveLength(1); }); -test(' - renders a select with correct disabled state', () => { +it(' - renders a select with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - renders a select with correct disabled state', () => { expect(wrapper.find('select').prop('disabled')).toBe(true); }); -test(' - renders a select with correct readOnly state', () => { +it(' - renders a select with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -44,7 +44,7 @@ test(' - renders a select with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a select with correct id (inherited)', () => { +it(' - renders a select with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ test(' - renders a select with correct id (inherited)', () => { expect(wrapper.find('select').prop('id')).toBeTruthy(); }); -test(' - renders a select with correct id (specified)', () => { +it(' - renders a select with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -66,7 +66,7 @@ test(' - renders a select with correct id (specified)', () => { expect(wrapper.find('select').prop('id')).toBe('y'); }); -test(' - renders a select with correct name', () => { +it(' - renders a select with correct name', () => { const element = ; const wrapper = mount( element, @@ -77,7 +77,7 @@ test(' - renders a select with correct name', () => { expect(wrapper.find('select').prop('name')).toBe('x'); }); -test(' - renders a select with correct options', () => { +it(' - renders a select with correct options', () => { const element = ; const wrapper = mount( element, @@ -97,7 +97,7 @@ test(' - renders a select with correct options', () => { }); }); -test(' - renders a select with correct options (transform)', () => { +it(' - renders a select with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -117,7 +117,7 @@ test(' - renders a select with correct options (transform)', () => }); }); -test(' - renders a select with correct placeholder (fallback)', () => { +it(' - renders a select with correct placeholder (fallback)', () => { const element = ; const wrapper = mount( element, @@ -139,7 +139,7 @@ test(' - renders a select with correct placeholder (fallback)', () }); }); -test(' - renders a select with correct placeholder (implicit)', () => { +it(' - renders a select with correct placeholder (implicit)', () => { const element = ; const wrapper = mount( element, @@ -159,7 +159,7 @@ test(' - renders a select with correct placeholder (implicit)', () }); }); -test(' - renders a select with correct value (default)', () => { +it(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -170,7 +170,7 @@ test(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toBe(''); }); -test(' - renders a select with correct value (model)', () => { +it(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -184,7 +184,7 @@ test(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -test(' - renders a select with correct value (specified)', () => { +it(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -195,7 +195,7 @@ test(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -test(' - renders a select which correctly reacts on change', () => { +it(' - renders a select which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -214,7 +214,7 @@ test(' - renders a select which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a select which correctly reacts on change (empty)', () => { +it(' - renders a select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -233,7 +233,7 @@ test(' - renders a select which correctly reacts on change (empty)' expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a select which correctly reacts on change (same value)', () => { +it(' - renders a select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -252,7 +252,7 @@ test(' - renders a select which correctly reacts on change (same va expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -266,7 +266,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -278,14 +278,14 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -test(' - disabled items (options) based on predicate', () => { +it(' - disabled items (options) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( @@ -301,7 +301,7 @@ test(' - disabled items (options) based on predicate', () => { expect(wrapper.find('option[value="b"]').at(0).prop('disabled')).toBe(false); }); -test(' - renders a set of checkboxes', () => { +it(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -311,7 +311,7 @@ test(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -test(' - renders a set of inline checkboxes', () => { +it(' - renders a set of inline checkboxes', () => { const element = ; const wrapper = mount( element, @@ -322,7 +322,7 @@ test(' - renders a set of inline checkboxes', () => { expect(wrapper.find('.checkbox-inline')).toHaveLength(2); }); -test(' - renders a set of checkboxes with correct disabled state', () => { +it(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -334,7 +334,7 @@ test(' - renders a set of checkboxes with correct disabl expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -test(' - renders a set of checkboxes with correct readOnly state', () => { +it(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -351,7 +351,7 @@ test(' - renders a set of checkboxes with correct readOn expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a set of checkboxes with correct id (inherited)', () => { +it(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -363,7 +363,7 @@ test(' - renders a set of checkboxes with correct id (in expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -test(' - renders a select with correct value (default)', () => { +it(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -377,7 +377,7 @@ test(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual([]); }); -test(' - renders a select with correct value (model)', () => { +it(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -394,7 +394,7 @@ test(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -test(' - renders a select with correct value (specified)', () => { +it(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -408,7 +408,7 @@ test(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -test(' - renders a select which correctly reacts on change (first value)', () => { +it(' - renders a select which correctly reacts on change (first value)', () => { const onChange = jest.fn(); const element = ; @@ -430,7 +430,7 @@ test(' - renders a select which correctly reacts on change (first v expect(onChange).toHaveBeenLastCalledWith('x', ['a']); }); -test(' - renders a select which correctly reacts on change (next value)', () => { +it(' - renders a select which correctly reacts on change (next value)', () => { const onChange = jest.fn(); const element = ; @@ -452,7 +452,7 @@ test(' - renders a select which correctly reacts on change (next va expect(onChange).toHaveBeenLastCalledWith('x', ['a', 'b']); }); -test(' - renders a select which correctly reacts on change (uncheck) by value', () => { +it(' - renders a select which correctly reacts on change (uncheck) by value', () => { const onChange = jest.fn(); const element = ; @@ -474,7 +474,7 @@ test(' - renders a select which correctly reacts on change (uncheck expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { +it(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { const onChange = jest.fn(); const element = ; @@ -498,7 +498,7 @@ test(' - renders a select which correctly reacts on change (uncheck expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a set of checkboxes with correct id (specified)', () => { +it(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -510,7 +510,7 @@ test(' - renders a set of checkboxes with correct id (sp expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -test(' - renders a set of checkboxes with correct name', () => { +it(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -522,7 +522,7 @@ test(' - renders a set of checkboxes with correct name', expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -test(' - renders a set of checkboxes with correct options', () => { +it(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -534,7 +534,7 @@ test(' - renders a set of checkboxes with correct option expect(wrapper.find('label').at(1).text()).toBe('b'); }); -test(' - renders a set of checkboxes with correct options (transform)', () => { +it(' - renders a set of checkboxes with correct options (transform)', () => { const element = ( x.toUpperCase()} /> ); @@ -548,7 +548,7 @@ test(' - renders a set of checkboxes with correct option expect(wrapper.find('label').at(1).text()).toBe('B'); }); -test(' - renders a set of checkboxes with correct value (default)', () => { +it(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -560,7 +560,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -test(' - renders a set of checkboxes with correct value (model)', () => { +it(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -575,7 +575,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes with correct value (specified)', () => { +it(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -587,7 +587,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes which correctly reacts on change', () => { +it(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -604,7 +604,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { const onChange = jest.fn(); const element = ; @@ -624,7 +624,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -test(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); const element = ; @@ -644,7 +644,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -661,7 +661,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -672,7 +672,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ( ); @@ -686,14 +686,14 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -test(' - disabled items (checkboxes) based on predicate', () => { +it(' - disabled items (checkboxes) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( diff --git a/packages/uniforms-bootstrap3/__tests__/SubmitField.tsx b/packages/uniforms-bootstrap3/__tests__/SubmitField.tsx index ba7300491..031566f68 100644 --- a/packages/uniforms-bootstrap3/__tests__/SubmitField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/SubmitField.tsx @@ -4,14 +4,14 @@ import { SubmitField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders', () => { +it(' - renders', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper).toHaveLength(1); }); -test(' - renders disabled if error', () => { +it(' - renders disabled if error', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -19,7 +19,7 @@ test(' - renders disabled if error', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders enabled if error and enabled', () => { +it(' - renders enabled if error and enabled', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -27,7 +27,7 @@ test(' - renders enabled if error and enabled', () => { expect(wrapper.find('input').prop('disabled')).toBe(false); }); -test(' - renders a wrapper with correct class', () => { +it(' - renders a wrapper with correct class', () => { const element = ; const wrapper = mount(element, createContext()); @@ -35,7 +35,7 @@ test(' - renders a wrapper with correct class', () => { expect(wrapper.find('.container')).toHaveLength(1); }); -test(' - renders a wrapper with correct value', () => { +it(' - renders a wrapper with correct value', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-bootstrap3/__tests__/TextField.tsx b/packages/uniforms-bootstrap3/__tests__/TextField.tsx index 1e097f0ba..a49cdfefd 100644 --- a/packages/uniforms-bootstrap3/__tests__/TextField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/TextField.tsx @@ -9,7 +9,7 @@ import mount from './_mount'; describe('@RTL - TextField tests', () => { testTextField(TextField); - test(' - renders a wrapper with unknown props', () => { + it(' - renders a wrapper with unknown props', () => { const props = { 'data-x': 'x', 'data-y': 'y', @@ -24,14 +24,14 @@ describe('@RTL - TextField tests', () => { }); }); -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -39,7 +39,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -47,7 +47,7 @@ test(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -55,7 +55,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -63,7 +63,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -71,7 +71,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct placeholder', () => { +it(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -79,7 +79,7 @@ test(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -87,7 +87,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('text'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -95,7 +95,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -106,7 +106,7 @@ test(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input with correct value (specified)', () => { +it(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -114,7 +114,7 @@ test(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input which correctly reacts on change', () => { +it(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -130,7 +130,7 @@ test(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders an input which correctly reacts on change (empty)', () => { +it(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -146,7 +146,7 @@ test(' - renders an input which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders an input which correctly reacts on change (same value)', () => { +it(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -162,7 +162,7 @@ test(' - renders an input which correctly reacts on change (same valu expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -173,7 +173,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -182,7 +182,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - renders a input with autocomplete turned off', () => { +it(' - renders a input with autocomplete turned off', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-bootstrap3/__tests__/ValidateQuickForm.tsx b/packages/uniforms-bootstrap3/__tests__/ValidateQuickForm.tsx index c51f578c9..88146511d 100644 --- a/packages/uniforms-bootstrap3/__tests__/ValidateQuickForm.tsx +++ b/packages/uniforms-bootstrap3/__tests__/ValidateQuickForm.tsx @@ -4,7 +4,7 @@ import { ValidatedQuickForm } from 'uniforms-bootstrap3'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap3/__tests__/ValidatedForm.tsx b/packages/uniforms-bootstrap3/__tests__/ValidatedForm.tsx index 94a79ddef..652f1c84c 100644 --- a/packages/uniforms-bootstrap3/__tests__/ValidatedForm.tsx +++ b/packages/uniforms-bootstrap3/__tests__/ValidatedForm.tsx @@ -4,7 +4,7 @@ import { ValidatedForm } from 'uniforms-bootstrap3'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap3/__tests__/gridClassName.ts b/packages/uniforms-bootstrap3/__tests__/gridClassName.ts index 1af0c5192..dab1c3937 100644 --- a/packages/uniforms-bootstrap3/__tests__/gridClassName.ts +++ b/packages/uniforms-bootstrap3/__tests__/gridClassName.ts @@ -1,6 +1,6 @@ import { gridClassName } from 'uniforms-bootstrap3'; -test('gridClassName - object', () => { +it('gridClassName - object', () => { expect(gridClassName({ md: 3 }, 'input')).toBe('col-md-9'); expect(gridClassName({ md: 5 }, 'input')).toBe('col-md-7'); expect(gridClassName({ md: 7 }, 'input')).toBe('col-md-5'); @@ -20,21 +20,21 @@ test('gridClassName - object', () => { expect(gridClassName({ md: 9, xs: 8 }, 'label')).toBe('col-md-9 col-xs-8'); }); -test('gridClassName - number', () => { +it('gridClassName - number', () => { expect(gridClassName(3, 'input')).toBe('col-sm-9'); expect(gridClassName(3, 'label')).toBe('col-sm-3'); expect(gridClassName(5, 'input')).toBe('col-sm-7'); expect(gridClassName(5, 'label')).toBe('col-sm-5'); }); -test('gridClassName - number (string)', () => { +it('gridClassName - number (string)', () => { expect(gridClassName('3', 'input')).toBe('col-sm-9'); expect(gridClassName('3', 'label')).toBe('col-sm-3'); expect(gridClassName('5', 'input')).toBe('col-sm-7'); expect(gridClassName('5', 'label')).toBe('col-sm-5'); }); -test('gridClassName - string', () => { +it('gridClassName - string', () => { expect(gridClassName('col-md-9')).toBe('col-md-9'); expect(gridClassName('col-md-3')).toBe('col-md-3'); expect(gridClassName('col-md-7')).toBe('col-md-7'); diff --git a/packages/uniforms-bootstrap3/__tests__/wrapField.tsx b/packages/uniforms-bootstrap3/__tests__/wrapField.tsx index 9089eec21..cbf51a578 100644 --- a/packages/uniforms-bootstrap3/__tests__/wrapField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/wrapField.tsx @@ -3,21 +3,21 @@ import { wrapField } from 'uniforms-bootstrap3'; import mount from './_mount'; -test(' - renders wrapper with correct class', () => { +it(' - renders wrapper with correct class', () => { const element = wrapField({ wrapClassName: 'container' },
); const wrapper = mount(element); expect(wrapper.find('.container')).toHaveLength(1); }); -test(' - renders help block', () => { +it(' - renders help block', () => { const element = wrapField({ help: 'Hint' },
); const wrapper = mount(element); expect(wrapper.find('.help-block').text()).toBe('Hint'); }); -test(' - renders help block with specified class', () => { +it(' - renders help block with specified class', () => { const element = wrapField( { help: 'Hint', helpClassName: 'text-hint' },
, @@ -27,7 +27,7 @@ test(' - renders help block with specified class', () => { expect(wrapper.find('.help-block.text-hint')).toHaveLength(1); }); -test(' - renders error block', () => { +it(' - renders error block', () => { const error = new Error(); const element = wrapField( { error, showInlineError: true, errorMessage: 'Error' }, @@ -38,7 +38,7 @@ test(' - renders error block', () => { expect(wrapper.find('.help-block').text()).toBe('Error'); }); -test(' - renders error block (feedbackable)', () => { +it(' - renders error block (feedbackable)', () => { const error = new Error(); const element = wrapField({ error, feedbackable: true },
); const wrapper = mount(element); @@ -46,7 +46,7 @@ test(' - renders error block (feedbackable)', () => { expect(wrapper.find('.form-control-feedback')).toHaveLength(1); }); -test(' - renders error block (showInlineError=false)', () => { +it(' - renders error block (showInlineError=false)', () => { const error = new Error(); const element = wrapField( { error, showInlineError: false, errorMessage: 'Error' }, @@ -57,7 +57,7 @@ test(' - renders error block (showInlineError=false)', () => { expect(wrapper.find('.help-block')).toHaveLength(0); }); -test(' - label has custom class (String)', () => { +it(' - label has custom class (String)', () => { const element = wrapField( { label: 'A field label', @@ -70,7 +70,7 @@ test(' - label has custom class (String)', () => { expect(wrapper.find('label.custom-label-class')).toHaveLength(1); }); -test(' - label has custom class (Array[String])', () => { +it(' - label has custom class (Array[String])', () => { const element = wrapField( { label: 'A field label', diff --git a/packages/uniforms-bootstrap4/__tests__/AutoField.tsx b/packages/uniforms-bootstrap4/__tests__/AutoField.tsx index dd8ba92f3..a70adc958 100644 --- a/packages/uniforms-bootstrap4/__tests__/AutoField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/AutoField.tsx @@ -14,14 +14,14 @@ import { import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(AutoField)).toHaveLength(1); }); -test(' - detects RadioField', () => { +it(' - detects RadioField', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ test(' - detects RadioField', () => { expect(wrapper.find(RadioField.Component)).toHaveLength(1); }); -test(' - detects SelectField', () => { +it(' - detects SelectField', () => { const element = ; const wrapper = mount( element, @@ -50,14 +50,14 @@ test(' - detects SelectField', () => { expect(wrapper.find(SelectField.Component)).toHaveLength(1); }); -test(' - detects DateField', () => { +it(' - detects DateField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DateField.Component)).toHaveLength(1); }); -test(' - detects ListField', () => { +it(' - detects ListField', () => { const element = ; const wrapper = mount( element, @@ -67,35 +67,35 @@ test(' - detects ListField', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -test(' - detects NumField', () => { +it(' - detects NumField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(NumField.Component)).toHaveLength(1); }); -test(' - detects NestField', () => { +it(' - detects NestField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Object } })); expect(wrapper.find(NestField)).toHaveLength(1); }); -test(' - detects TextField', () => { +it(' - detects TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField.Component)).toHaveLength(1); }); -test(' - detects BoolField', () => { +it(' - detects BoolField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(BoolField.Component)).toHaveLength(1); }); -test(' - uses Component (schema)', () => { +it(' - uses Component (schema)', () => { const Component = jest.fn(() => null); const element = ; @@ -107,7 +107,7 @@ test(' - uses Component (schema)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -test(' - uses Component (props)', () => { +it(' - uses Component (props)', () => { const Component = jest.fn(() => null); const element = ; @@ -116,7 +116,7 @@ test(' - uses Component (props)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -test(' - uses Component (context)', () => { +it(' - uses Component (context)', () => { const FieldA = jest.fn(() => null); const FieldB = jest.fn(() => null); @@ -136,7 +136,7 @@ test(' - uses Component (context)', () => { expect(FieldB).toHaveBeenCalledTimes(1); }); -test(' - uses Component (invalid)', () => { +it(' - uses Component (invalid)', () => { const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {}); expect(() => { const element = ; diff --git a/packages/uniforms-bootstrap4/__tests__/AutoFields.tsx b/packages/uniforms-bootstrap4/__tests__/AutoFields.tsx index a9b06ef63..a1d601c5a 100644 --- a/packages/uniforms-bootstrap4/__tests__/AutoFields.tsx +++ b/packages/uniforms-bootstrap4/__tests__/AutoFields.tsx @@ -4,14 +4,14 @@ import { AutoFields, AutoField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('AutoFields')).toHaveLength(1); }); -test(' - render all fields by default', () => { +it(' - render all fields by default', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - render all fields by default', () => { expect(wrapper.find('input')).toHaveLength(3); }); -test(' - renders only specified fields', () => { +it(' - renders only specified fields', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ test(' - renders only specified fields', () => { ); }); -test(' - does not render ommited fields', () => { +it(' - does not render ommited fields', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ test(' - does not render ommited fields', () => { ); }); -test(' - wraps fields in specified element', () => { +it(' - wraps fields in specified element', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ test(' - wraps fields in specified element', () => { expect(wrapper.find('section').find('input')).toHaveLength(3); }); -test(' - pass props to the child AutoField', () => { +it(' - pass props to the child AutoField', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap4/__tests__/AutoForm.tsx b/packages/uniforms-bootstrap4/__tests__/AutoForm.tsx index d6e6f8605..dcdba5235 100644 --- a/packages/uniforms-bootstrap4/__tests__/AutoForm.tsx +++ b/packages/uniforms-bootstrap4/__tests__/AutoForm.tsx @@ -4,7 +4,7 @@ import { AutoForm } from 'uniforms-bootstrap4'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap4/__tests__/BaseForm.tsx b/packages/uniforms-bootstrap4/__tests__/BaseForm.tsx index ac215765b..7d9e01996 100644 --- a/packages/uniforms-bootstrap4/__tests__/BaseForm.tsx +++ b/packages/uniforms-bootstrap4/__tests__/BaseForm.tsx @@ -4,7 +4,7 @@ import { BaseForm } from 'uniforms-bootstrap4'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap4/__tests__/BoolField.tsx b/packages/uniforms-bootstrap4/__tests__/BoolField.tsx index 6e2bd031b..e5fa513bf 100644 --- a/packages/uniforms-bootstrap4/__tests__/BoolField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/BoolField.tsx @@ -4,14 +4,14 @@ import { BoolField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an inline input', () => { +it(' - renders an inline input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -20,7 +20,7 @@ test(' - renders an inline input', () => { expect(wrapper.find('.custom-control-inline')).toHaveLength(1); }); -test(' - renders a input with correct id (inherited)', () => { +it(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -28,7 +28,7 @@ test(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders a input with correct id (specified)', () => { +it(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -36,7 +36,7 @@ test(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders a input with correct name', () => { +it(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -44,7 +44,7 @@ test(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -52,7 +52,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('checkbox'); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -60,7 +60,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -74,7 +74,7 @@ test(' - renders an input with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a input with correct label (specified)', () => { +it(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -85,7 +85,7 @@ test(' - renders a input with correct label (specified)', () => { ); }); -test(' - renders a input with correct value (default)', () => { +it(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -93,7 +93,7 @@ test(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('checked')).toBe(false); }); -test(' - renders a input with correct value (model)', () => { +it(' - renders a input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -104,7 +104,7 @@ test(' - renders a input with correct value (model)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -test(' - renders a input with correct value (specified)', () => { +it(' - renders a input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -112,7 +112,7 @@ test(' - renders a input with correct value (specified)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -test(' - renders a input which correctly reacts on change', () => { +it(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -126,7 +126,7 @@ test(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', true); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); diff --git a/packages/uniforms-bootstrap4/__tests__/DateField.tsx b/packages/uniforms-bootstrap4/__tests__/DateField.tsx index 1678cc2fb..0898672fd 100644 --- a/packages/uniforms-bootstrap4/__tests__/DateField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/DateField.tsx @@ -8,7 +8,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - DateField tests', () => { - test(' - handles "date" type correctly', () => { + it(' - handles "date" type correctly', () => { const onChange = jest.fn(); const initialDate = new Date(Date.UTC(2020, 0, 1)); @@ -29,14 +29,14 @@ describe('@RTL - DateField tests', () => { }); }); -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders a input with correct id (inherited)', () => { +it(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -44,7 +44,7 @@ test(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders a input with correct id (specified)', () => { +it(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -52,7 +52,7 @@ test(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders a input with correct name', () => { +it(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -60,7 +60,7 @@ test(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -79,7 +79,7 @@ test.each(['datetime-local', 'date'] as const)( }, ); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -87,7 +87,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -95,7 +95,7 @@ test(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -test(' - renders a input with correct label (specified)', () => { +it(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -106,7 +106,7 @@ test(' - renders a input with correct label (specified)', () => { ); }); -test(' - renders a input with correct value (default)', () => { +it(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -114,7 +114,7 @@ test(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders a input with correct value (model)', () => { +it(' - renders a input with correct value (model)', () => { const now = new Date(); const element = ; const wrapper = mount( @@ -128,7 +128,7 @@ test(' - renders a input with correct value (model)', () => { ); }); -test(' - renders a input with correct value (specified)', () => { +it(' - renders a input with correct value (specified)', () => { const now = new Date(); const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -139,7 +139,7 @@ test(' - renders a input with correct value (specified)', () => { ); }); -test(' - renders a input which correctly reacts on change', () => { +it(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const now = new Date(); @@ -158,7 +158,7 @@ test(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', now); }); -test(' - renders a input which correctly reacts on change (empty)', () => { +it(' - renders a input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -176,7 +176,7 @@ test(' - renders a input which correctly reacts on change (empty)', ( expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a input which correctly reacts on change (overflow)', () => { +it(' - renders a input which correctly reacts on change (overflow)', () => { const onChange = jest.fn(); const now = new Date(1e5, 0); @@ -195,7 +195,7 @@ test(' - renders a input which correctly reacts on change (overflow)' expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); diff --git a/packages/uniforms-bootstrap4/__tests__/ErrorField.tsx b/packages/uniforms-bootstrap4/__tests__/ErrorField.tsx index e0e525b59..56d052213 100644 --- a/packages/uniforms-bootstrap4/__tests__/ErrorField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/ErrorField.tsx @@ -11,14 +11,14 @@ const error = { message: 'X is required [validation-error]', }; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorField)).toHaveLength(1); }); -test(' - renders correct error message (context)', () => { +it(' - renders correct error message (context)', () => { const element = ; const wrapper = mount( element, @@ -29,7 +29,7 @@ test(' - renders correct error message (context)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -test(' - renders correct error message (specified)', () => { +it(' - renders correct error message (specified)', () => { const element = ( - renders correct error message (specified)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -test(' - renders correct children if specified', () => { +it(' - renders correct children if specified', () => { const element = Error; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap4/__tests__/ErrorsField.tsx b/packages/uniforms-bootstrap4/__tests__/ErrorsField.tsx index e30f69e7b..c6d90a048 100644 --- a/packages/uniforms-bootstrap4/__tests__/ErrorsField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/ErrorsField.tsx @@ -15,14 +15,14 @@ const error = { message: 'X is required [validation-error]', }; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorsField)).toHaveLength(1); }); -test(' - renders list of correct error messages (context)', () => { +it(' - renders list of correct error messages (context)', () => { const element = ; const wrapper = mount( element, @@ -38,7 +38,7 @@ test(' - renders list of correct error messages (context)', () => { expect(wrapper.find('.card-body > div').at(2).text()).toBe('Z is required'); }); -test(' - renders children (specified)', () => { +it(' - renders children (specified)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap4/__tests__/HiddenField.tsx b/packages/uniforms-bootstrap4/__tests__/HiddenField.tsx index 29953c05f..2ca9e063e 100644 --- a/packages/uniforms-bootstrap4/__tests__/HiddenField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/HiddenField.tsx @@ -4,14 +4,14 @@ import { HiddenField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('hidden'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -62,7 +62,7 @@ test(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input which correctly reacts on model change', () => { +it(' - renders an input which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -76,7 +76,7 @@ test(' - renders an input which correctly reacts on model change', expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders an input which correctly reacts on model change (empty)', () => { +it(' - renders an input which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -90,7 +90,7 @@ test(' - renders an input which correctly reacts on model change (e expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders an input which correctly reacts on model change (same value)', () => { +it(' - renders an input which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -104,14 +104,14 @@ test(' - renders an input which correctly reacts on model change (s expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders nothing', () => { +it(' - renders nothing', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.children()).toHaveLength(0); }); -test(' - renders nothing which correctly reacts on model change', () => { +it(' - renders nothing which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ test(' - renders nothing which correctly reacts on model chan expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders nothing which correctly reacts on model change (empty)', () => { +it(' - renders nothing which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ test(' - renders nothing which correctly reacts on model chan expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders nothing which correctly reacts on model change (same value)', () => { +it(' - renders nothing which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; diff --git a/packages/uniforms-bootstrap4/__tests__/ListAddField.tsx b/packages/uniforms-bootstrap4/__tests__/ListAddField.tsx index 3ff8d18fb..3a5094a39 100644 --- a/packages/uniforms-bootstrap4/__tests__/ListAddField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/ListAddField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListAddField)).toHaveLength(1); }); -test(' - prevents onClick when disabled', () => { +it(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ test(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when limit reached', () => { +it(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { maxCount: 0 } })); @@ -39,7 +39,7 @@ test(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - correctly reacts on click', () => { +it(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ test(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['y']); }); -test(' - correctly reacts on keyboard enter key', () => { +it(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-bootstrap4/__tests__/ListDelField.tsx b/packages/uniforms-bootstrap4/__tests__/ListDelField.tsx index 4623ec05e..5824830b3 100644 --- a/packages/uniforms-bootstrap4/__tests__/ListDelField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/ListDelField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListDelField)).toHaveLength(1); }); -test(' - prevents onClick when disabled', () => { +it(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ test(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when limit reached', () => { +it(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { minCount: 3 } })); @@ -39,7 +39,7 @@ test(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - correctly reacts on click', () => { +it(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ test(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['x', 'z']); }); -test(' - correctly reacts on keyboard enter key', () => { +it(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-bootstrap4/__tests__/ListField.tsx b/packages/uniforms-bootstrap4/__tests__/ListField.tsx index 57333b06d..b62f86f5f 100644 --- a/packages/uniforms-bootstrap4/__tests__/ListField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/ListField.tsx @@ -12,7 +12,7 @@ describe('@RTL - ListField tests', () => { }); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount( element, @@ -22,7 +22,7 @@ test(' - works', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -test(' - renders ListAddField', () => { +it(' - renders ListAddField', () => { const element = ; const wrapper = mount( element, @@ -33,7 +33,7 @@ test(' - renders ListAddField', () => { expect(wrapper.find(ListAddField).prop('name')).toBe('$'); }); -test(' - renders correct label (specified)', () => { +it(' - renders correct label (specified)', () => { const element = ; const wrapper = mount( element, @@ -46,7 +46,7 @@ test(' - renders correct label (specified)', () => { ); }); -test(' - renders correct numer of items with model (specified)', () => { +it(' - renders correct numer of items with model (specified)', () => { const element = ; const wrapper = mount( element, @@ -58,7 +58,7 @@ test(' - renders correct numer of items with model (specified)', () = expect(wrapper.find('input')).toHaveLength(3); }); -test(' - passes itemProps to its children', () => { +it(' - passes itemProps to its children', () => { const element = ; const wrapper = mount( element, @@ -70,7 +70,7 @@ test(' - passes itemProps to its children', () => { expect(wrapper.find(ListItemField).first().prop('data-xyz')).toBe(1); }); -test(' - renders children (specified)', () => { +it(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -89,7 +89,7 @@ test(' - renders children (specified)', () => { expect(Child).toHaveBeenCalledTimes(2); }); -test(' - renders children with correct name (children)', () => { +it(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -108,7 +108,7 @@ test(' - renders children with correct name (children)', () => { expect(wrapper.find(Child).at(1).prop('name')).toBe('1'); }); -test(' - renders children with correct name (value)', () => { +it(' - renders children with correct name (value)', () => { const element = ; const wrapper = mount( element, @@ -121,7 +121,7 @@ test(' - renders children with correct name (value)', () => { expect(wrapper.find(ListItemField).at(1).prop('name')).toBe('1'); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( - renders correct error text (specified)', () => { expect(wrapper.find('.text-danger').text()).toBe('Error'); }); -test(' - renders correct error text (showInlineError=false)', () => { +it(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.find('.text-danger')).toHaveLength(0); }); -test(' - renders proper number of optional values after add new value', () => { +it(' - renders proper number of optional values after add new value', () => { const element = ; const onChange = jest.fn(); const wrapper = mount( diff --git a/packages/uniforms-bootstrap4/__tests__/ListItemField.tsx b/packages/uniforms-bootstrap4/__tests__/ListItemField.tsx index 3bc76866e..69a1e70d4 100644 --- a/packages/uniforms-bootstrap4/__tests__/ListItemField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/ListItemField.tsx @@ -4,7 +4,7 @@ import { AutoField, ListDelField, ListItemField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - works', () => { expect(wrapper.find(ListItemField)).toHaveLength(1); }); -test(' - renders ListDelField', () => { +it(' - renders ListDelField', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - renders ListDelField', () => { expect(wrapper.find(ListDelField).childAt(0).prop('name')).toBe('x.1'); }); -test(' - renders AutoField', () => { +it(' - renders AutoField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ test(' - renders AutoField', () => { expect(wrapper.find(AutoField)).toHaveLength(1); }); -test(' - renders children if specified', () => { +it(' - renders children if specified', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( diff --git a/packages/uniforms-bootstrap4/__tests__/LongTextField.tsx b/packages/uniforms-bootstrap4/__tests__/LongTextField.tsx index 14ddda3f3..58dc6a35b 100644 --- a/packages/uniforms-bootstrap4/__tests__/LongTextField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/LongTextField.tsx @@ -4,14 +4,14 @@ import { LongTextField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a textarea', () => { +it(' - renders a textarea', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('textarea')).toHaveLength(1); }); -test(' - renders a textarea with correct disabled state', () => { +it(' - renders a textarea with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ test(' - renders a textarea with correct disabled state', () => { expect(wrapper.find('textarea').prop('disabled')).toBe(true); }); -test(' - renders a textarea with correct readOnly state', () => { +it(' - renders a textarea with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ test(' - renders a textarea with correct readOnly state', () => { expect(wrapper.find('textarea').prop('readOnly')).toBe(true); }); -test(' - renders a textarea with correct id (inherited)', () => { +it(' - renders a textarea with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ test(' - renders a textarea with correct id (inherited)', () => { expect(wrapper.find('textarea').prop('id')).toBeTruthy(); }); -test(' - renders a textarea with correct id (specified)', () => { +it(' - renders a textarea with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ test(' - renders a textarea with correct id (specified)', () => { expect(wrapper.find('textarea').prop('id')).toBe('y'); }); -test(' - renders a textarea with correct name', () => { +it(' - renders a textarea with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ test(' - renders a textarea with correct name', () => { expect(wrapper.find('textarea').prop('name')).toBe('x'); }); -test(' - renders a textarea with correct placeholder', () => { +it(' - renders a textarea with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -59,7 +59,7 @@ test(' - renders a textarea with correct placeholder', () => { expect(wrapper.find('textarea').prop('placeholder')).toBe('y'); }); -test(' - renders a textarea with correct value (default)', () => { +it(' - renders a textarea with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -67,7 +67,7 @@ test(' - renders a textarea with correct value (default)', () => expect(wrapper.find('textarea').prop('value')).toBe(''); }); -test(' - renders a textarea with correct value (model)', () => { +it(' - renders a textarea with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -78,7 +78,7 @@ test(' - renders a textarea with correct value (model)', () => { expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -test(' - renders a textarea with correct value (specified)', () => { +it(' - renders a textarea with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -86,7 +86,7 @@ test(' - renders a textarea with correct value (specified)', () = expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -test(' - renders a textarea which correctly reacts on change', () => { +it(' - renders a textarea which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -102,7 +102,7 @@ test(' - renders a textarea which correctly reacts on change', () expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a textarea which correctly reacts on change (empty)', () => { +it(' - renders a textarea which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -118,7 +118,7 @@ test(' - renders a textarea which correctly reacts on change (emp expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders a textarea which correctly reacts on change (same value)', () => { +it(' - renders a textarea which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -134,7 +134,7 @@ test(' - renders a textarea which correctly reacts on change (sam expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -145,7 +145,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-bootstrap4/__tests__/NestField.tsx b/packages/uniforms-bootstrap4/__tests__/NestField.tsx index c1606ba7c..acd562a22 100644 --- a/packages/uniforms-bootstrap4/__tests__/NestField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/NestField.tsx @@ -4,7 +4,7 @@ import { AutoField, NestField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an for each field', () => { +it(' - renders an for each field', () => { const element = ; const wrapper = mount( element, @@ -20,7 +20,7 @@ test(' - renders an for each field', () => { expect(wrapper.find(AutoField).at(1).prop('name')).toBe('b'); }); -test(' - renders custom content if given', () => { +it(' - renders custom content if given', () => { const element = (
@@ -40,7 +40,7 @@ test(' - renders custom content if given', () => { expect(wrapper.find('article').prop('data-test')).toBe('content'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -88,7 +88,7 @@ test(' - renders correct error text (specified)', () => { expect(wrapper.find('.text-danger').text()).toBe('Error'); }); -test(' - renders correct error text (showInlineError=false)', () => { +it(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -19,7 +19,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -27,7 +27,7 @@ test(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -35,7 +35,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -43,7 +43,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct max', () => { +it(' - renders an input with correct max', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct max', () => { expect(wrapper.find('input').prop('max')).toBe(10); }); -test(' - renders an input with correct min', () => { +it(' - renders an input with correct min', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -59,7 +59,7 @@ test(' - renders an input with correct min', () => { expect(wrapper.find('input').prop('min')).toBe(10); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -67,7 +67,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct placeholder', () => { +it(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -75,7 +75,7 @@ test(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -test(' - renders an input with correct step (decimal)', () => { +it(' - renders an input with correct step (decimal)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -83,7 +83,7 @@ test(' - renders an input with correct step (decimal)', () => { expect(wrapper.find('input').prop('step')).toBe(0.01); }); -test(' - renders an input with correct step (integer)', () => { +it(' - renders an input with correct step (integer)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -91,7 +91,7 @@ test(' - renders an input with correct step (integer)', () => { expect(wrapper.find('input').prop('step')).toBe(1); }); -test(' - renders an input with correct step (set)', () => { +it(' - renders an input with correct step (set)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -99,7 +99,7 @@ test(' - renders an input with correct step (set)', () => { expect(wrapper.find('input').prop('step')).toBe(3); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -107,7 +107,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('number'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -115,7 +115,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const onChange = jest.fn(); const element = ; @@ -157,7 +157,7 @@ test(' - renders an input with correct value (model)', () => { spy.mockRestore(); }); -test(' - renders an input with correct value (specified)', () => { +it(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -165,7 +165,7 @@ test(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe(2); }); -test(' - renders an input which correctly reacts on change', () => { +it(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -181,7 +181,7 @@ test(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -test(' - renders an input which correctly reacts on change (decimal on decimal)', () => { +it(' - renders an input which correctly reacts on change (decimal on decimal)', () => { const onChange = jest.fn(); const element = ; @@ -197,7 +197,7 @@ test(' - renders an input which correctly reacts on change (decimal on expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); -test(' - renders an input which correctly reacts on change (decimal on integer)', () => { +it(' - renders an input which correctly reacts on change (decimal on integer)', () => { const onChange = jest.fn(); const element = ; @@ -213,7 +213,7 @@ test(' - renders an input which correctly reacts on change (decimal on expect(onChange).toHaveBeenLastCalledWith('x', 2); }); -test(' - renders an input which correctly reacts on change (empty)', () => { +it(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -229,7 +229,7 @@ test(' - renders an input which correctly reacts on change (empty)', ( expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders an input which correctly reacts on change (same value)', () => { +it(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -245,7 +245,7 @@ test(' - renders an input which correctly reacts on change (same value expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -test(' - renders an input which correctly reacts on change (zero)', () => { +it(' - renders an input which correctly reacts on change (zero)', () => { const onChange = jest.fn(); const element = ; @@ -261,7 +261,7 @@ test(' - renders an input which correctly reacts on change (zero)', () expect(onChange).toHaveBeenLastCalledWith('x', 0); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -272,7 +272,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); diff --git a/packages/uniforms-bootstrap4/__tests__/QuickForm.tsx b/packages/uniforms-bootstrap4/__tests__/QuickForm.tsx index 2255dce6d..5890fb6a8 100644 --- a/packages/uniforms-bootstrap4/__tests__/QuickForm.tsx +++ b/packages/uniforms-bootstrap4/__tests__/QuickForm.tsx @@ -4,7 +4,7 @@ import { QuickForm } from 'uniforms-bootstrap4'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - renders', () => { +it(' - renders', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap4/__tests__/RadioField.tsx b/packages/uniforms-bootstrap4/__tests__/RadioField.tsx index cd77ce09c..0a2916a11 100644 --- a/packages/uniforms-bootstrap4/__tests__/RadioField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/RadioField.tsx @@ -4,7 +4,7 @@ import { RadioField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a set of checkboxes', () => { +it(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -test(' - renders a set of inline checkboxes', () => { +it(' - renders a set of inline checkboxes', () => { const element = ; const wrapper = mount( element, @@ -26,7 +26,7 @@ test(' - renders a set of inline checkboxes', () => { expect(wrapper.find('.custom-control-inline')).toHaveLength(2); }); -test(' - renders a set of checkboxes with correct disabled state', () => { +it(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -38,7 +38,7 @@ test(' - renders a set of checkboxes with correct disabled state', ( expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -test(' - renders a set of checkboxes with correct readOnly state', () => { +it(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -55,7 +55,7 @@ test(' - renders a set of checkboxes with correct readOnly state', ( expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a set of checkboxes with correct id (inherited)', () => { +it(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -67,7 +67,7 @@ test(' - renders a set of checkboxes with correct id (inherited)', ( expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -test(' - renders a set of checkboxes with correct id (specified)', () => { +it(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -79,7 +79,7 @@ test(' - renders a set of checkboxes with correct id (specified)', ( expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -test(' - renders a set of checkboxes with correct name', () => { +it(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -91,7 +91,7 @@ test(' - renders a set of checkboxes with correct name', () => { expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -test(' - renders a set of checkboxes with correct options', () => { +it(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -103,7 +103,7 @@ test(' - renders a set of checkboxes with correct options', () => { expect(wrapper.find('label').at(1).text()).toBe(' b'); }); -test(' - renders a set of checkboxes with correct options (transform)', () => { +it(' - renders a set of checkboxes with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -115,7 +115,7 @@ test(' - renders a set of checkboxes with correct options (transform expect(wrapper.find('label').at(1).text()).toBe(' B'); }); -test(' - renders a set of checkboxes with correct value (default)', () => { +it(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -127,7 +127,7 @@ test(' - renders a set of checkboxes with correct value (default)', expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -test(' - renders a set of checkboxes with correct value (model)', () => { +it(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -142,7 +142,7 @@ test(' - renders a set of checkboxes with correct value (model)', () expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes with correct value (specified)', () => { +it(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -154,7 +154,7 @@ test(' - renders a set of checkboxes with correct value (specified)' expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes which correctly reacts on change', () => { +it(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -171,7 +171,7 @@ test(' - renders a set of checkboxes which correctly reacts on chang expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -188,7 +188,7 @@ test(' - renders a set of checkboxes which correctly reacts on chang expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -199,7 +199,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -211,7 +211,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), diff --git a/packages/uniforms-bootstrap4/__tests__/SelectField.tsx b/packages/uniforms-bootstrap4/__tests__/SelectField.tsx index a6f577752..de94cfcd2 100644 --- a/packages/uniforms-bootstrap4/__tests__/SelectField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/SelectField.tsx @@ -4,7 +4,7 @@ import { SelectField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a select', () => { +it(' - renders a select', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - renders a select', () => { expect(wrapper.find('select')).toHaveLength(1); }); -test(' - renders a select with correct disabled state', () => { +it(' - renders a select with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - renders a select with correct disabled state', () => { expect(wrapper.find('select').prop('disabled')).toBe(true); }); -test(' - renders a select with correct readOnly state', () => { +it(' - renders a select with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -44,7 +44,7 @@ test(' - renders a select with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a select with correct id (inherited)', () => { +it(' - renders a select with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ test(' - renders a select with correct id (inherited)', () => { expect(wrapper.find('select').prop('id')).toBeTruthy(); }); -test(' - renders a select with correct id (specified)', () => { +it(' - renders a select with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -66,7 +66,7 @@ test(' - renders a select with correct id (specified)', () => { expect(wrapper.find('select').prop('id')).toBe('y'); }); -test(' - renders a select with correct name', () => { +it(' - renders a select with correct name', () => { const element = ; const wrapper = mount( element, @@ -77,7 +77,7 @@ test(' - renders a select with correct name', () => { expect(wrapper.find('select').prop('name')).toBe('x'); }); -test(' - renders a select with correct options', () => { +it(' - renders a select with correct options', () => { const element = ; const wrapper = mount( element, @@ -97,7 +97,7 @@ test(' - renders a select with correct options', () => { }); }); -test(' - renders a select with correct options (transform)', () => { +it(' - renders a select with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -117,7 +117,7 @@ test(' - renders a select with correct options (transform)', () => }); }); -test(' - renders a select with correct placeholder (fallback)', () => { +it(' - renders a select with correct placeholder (fallback)', () => { const element = ; const wrapper = mount( element, @@ -139,7 +139,7 @@ test(' - renders a select with correct placeholder (fallback)', () }); }); -test(' - renders a select with correct placeholder (implicit)', () => { +it(' - renders a select with correct placeholder (implicit)', () => { const element = ; const wrapper = mount( element, @@ -159,7 +159,7 @@ test(' - renders a select with correct placeholder (implicit)', () }); }); -test(' - renders a select with correct value (default)', () => { +it(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -170,7 +170,7 @@ test(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toBe(''); }); -test(' - renders a select with correct value (model)', () => { +it(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -184,7 +184,7 @@ test(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -test(' - renders a select with correct value (specified)', () => { +it(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -195,7 +195,7 @@ test(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -test(' - renders a select which correctly reacts on change', () => { +it(' - renders a select which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -214,7 +214,7 @@ test(' - renders a select which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a select which correctly reacts on change (empty)', () => { +it(' - renders a select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -233,7 +233,7 @@ test(' - renders a select which correctly reacts on change (empty)' expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a select which correctly reacts on change (same value)', () => { +it(' - renders a select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -252,7 +252,7 @@ test(' - renders a select which correctly reacts on change (same va expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -266,7 +266,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a select with class "bg-red" beside "form-group"', () => { +it(' - renders a select with class "bg-red" beside "form-group"', () => { const element = ; const wrapper = mount( element, @@ -275,7 +275,7 @@ test(' - renders a select with class "bg-red" beside "form-group"', expect(wrapper.find('.bg-red.form-group')).toHaveLength(1); }); -test(' - renders a disabled select', () => { +it(' - renders a disabled select', () => { const element = ; const wrapper = mount( element, @@ -284,7 +284,7 @@ test(' - renders a disabled select', () => { expect(wrapper.find('select').prop('disabled')).toEqual(true); }); -test(' - renders a required select', () => { +it(' - renders a required select', () => { const element = ; const wrapper = mount( element, @@ -293,7 +293,7 @@ test(' - renders a required select', () => { expect(wrapper.find('.form-group.required')).toHaveLength(1); }); -test(' - renders am error massge in select', () => { +it(' - renders am error massge in select', () => { const element = ( - renders am error massge in select', () => { expect(wrapper.find('.form-text.text-danger')).toHaveLength(1); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -321,14 +321,14 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -test(' - disabled items (options) based on predicate', () => { +it(' - disabled items (options) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( @@ -344,7 +344,7 @@ test(' - disabled items (options) based on predicate', () => { expect(wrapper.find('option[value="b"]').at(0).prop('disabled')).toBe(false); }); -test(' - renders a select with correct value (default)', () => { +it(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -358,7 +358,7 @@ test(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual([]); }); -test(' - renders a select with correct value (model)', () => { +it(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -375,7 +375,7 @@ test(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -test(' - renders a select with correct value (specified)', () => { +it(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -389,7 +389,7 @@ test(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -test(' - renders a select which correctly reacts on change (first value)', () => { +it(' - renders a select which correctly reacts on change (first value)', () => { const onChange = jest.fn(); const element = ; @@ -411,7 +411,7 @@ test(' - renders a select which correctly reacts on change (first v expect(onChange).toHaveBeenLastCalledWith('x', ['a']); }); -test(' - renders a select which correctly reacts on change (next value)', () => { +it(' - renders a select which correctly reacts on change (next value)', () => { const onChange = jest.fn(); const element = ; @@ -433,7 +433,7 @@ test(' - renders a select which correctly reacts on change (next va expect(onChange).toHaveBeenLastCalledWith('x', ['a', 'b']); }); -test(' - renders a select which correctly reacts on change (uncheck) by value', () => { +it(' - renders a select which correctly reacts on change (uncheck) by value', () => { const onChange = jest.fn(); const element = ; @@ -455,7 +455,7 @@ test(' - renders a select which correctly reacts on change (uncheck expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { +it(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { const onChange = jest.fn(); const element = ; @@ -479,7 +479,7 @@ test(' - renders a select which correctly reacts on change (uncheck expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a set of checkboxes', () => { +it(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -489,7 +489,7 @@ test(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -test(' - renders a set of inline checkboxes', () => { +it(' - renders a set of inline checkboxes', () => { const element = ; const wrapper = mount( element, @@ -500,7 +500,7 @@ test(' - renders a set of inline checkboxes', () => { expect(wrapper.find('.checkbox-inline')).toHaveLength(2); }); -test(' - renders a set of checkboxes with correct disabled state', () => { +it(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -512,7 +512,7 @@ test(' - renders a set of checkboxes with correct disabl expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -test(' - renders a set of checkboxes with correct readOnly state', () => { +it(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -529,7 +529,7 @@ test(' - renders a set of checkboxes with correct readOn expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a set of checkboxes with correct id (inherited)', () => { +it(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -541,7 +541,7 @@ test(' - renders a set of checkboxes with correct id (in expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -test(' - renders a set of checkboxes with correct id (specified)', () => { +it(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -553,7 +553,7 @@ test(' - renders a set of checkboxes with correct id (sp expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -test(' - renders a set of checkboxes with correct name', () => { +it(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -565,7 +565,7 @@ test(' - renders a set of checkboxes with correct name', expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -test(' - renders a set of checkboxes with correct options', () => { +it(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -577,7 +577,7 @@ test(' - renders a set of checkboxes with correct option expect(wrapper.find('label').at(1).text()).toBe('b'); }); -test(' - renders a set of checkboxes with correct options (transform)', () => { +it(' - renders a set of checkboxes with correct options (transform)', () => { const element = ( x.toUpperCase()} /> ); @@ -591,7 +591,7 @@ test(' - renders a set of checkboxes with correct option expect(wrapper.find('label').at(1).text()).toBe('B'); }); -test(' - renders a set of checkboxes with correct value (default)', () => { +it(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -603,7 +603,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -test(' - renders a set of checkboxes with correct value (model)', () => { +it(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -618,7 +618,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes with correct value (specified)', () => { +it(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -630,7 +630,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes which correctly reacts on change', () => { +it(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -647,7 +647,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { const onChange = jest.fn(); const element = ; @@ -667,7 +667,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -test(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); const element = ; @@ -687,7 +687,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -704,7 +704,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -715,7 +715,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ( ); @@ -729,14 +729,14 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -test(' - disabled items (checkboxes) based on predicate', () => { +it(' - disabled items (checkboxes) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( diff --git a/packages/uniforms-bootstrap4/__tests__/SubmitField.tsx b/packages/uniforms-bootstrap4/__tests__/SubmitField.tsx index afacdc06e..45097b974 100644 --- a/packages/uniforms-bootstrap4/__tests__/SubmitField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/SubmitField.tsx @@ -4,14 +4,14 @@ import { SubmitField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders', () => { +it(' - renders', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper).toHaveLength(1); }); -test(' - renders disabled if error', () => { +it(' - renders disabled if error', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -19,7 +19,7 @@ test(' - renders disabled if error', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders enabled if error and enabled', () => { +it(' - renders enabled if error and enabled', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -27,7 +27,7 @@ test(' - renders enabled if error and enabled', () => { expect(wrapper.find('input').prop('disabled')).toBe(false); }); -test(' - renders a wrapper with correct class', () => { +it(' - renders a wrapper with correct class', () => { const element = ; const wrapper = mount(element, createContext()); @@ -35,7 +35,7 @@ test(' - renders a wrapper with correct class', () => { expect(wrapper.find('.container')).toHaveLength(1); }); -test(' - renders a wrapper with correct value', () => { +it(' - renders a wrapper with correct value', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-bootstrap4/__tests__/TextField.tsx b/packages/uniforms-bootstrap4/__tests__/TextField.tsx index 9993d2a32..b9abcc95b 100644 --- a/packages/uniforms-bootstrap4/__tests__/TextField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/TextField.tsx @@ -9,7 +9,7 @@ import mount from './_mount'; describe('@RTL - TextField tests', () => { testTextField(TextField); - test(' - renders a wrapper with unknown props', () => { + it(' - renders a wrapper with unknown props', () => { const props = { 'data-x': 'x', 'data-y': 'y', @@ -24,14 +24,14 @@ describe('@RTL - TextField tests', () => { }); }); -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -39,7 +39,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -47,7 +47,7 @@ test(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -55,7 +55,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -63,7 +63,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -71,7 +71,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct placeholder', () => { +it(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -79,7 +79,7 @@ test(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -87,7 +87,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('text'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -95,7 +95,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -106,7 +106,7 @@ test(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input with correct value (specified)', () => { +it(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -114,7 +114,7 @@ test(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input which correctly reacts on change', () => { +it(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -130,7 +130,7 @@ test(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders an input which correctly reacts on change (empty)', () => { +it(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -146,7 +146,7 @@ test(' - renders an input which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders an input which correctly reacts on change (same value)', () => { +it(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -162,7 +162,7 @@ test(' - renders an input which correctly reacts on change (same valu expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -173,7 +173,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -182,7 +182,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - renders a input with autocomplete turned off', () => { +it(' - renders a input with autocomplete turned off', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-bootstrap4/__tests__/ValidateQuickForm.tsx b/packages/uniforms-bootstrap4/__tests__/ValidateQuickForm.tsx index 49bf9a9cb..78ae6908e 100644 --- a/packages/uniforms-bootstrap4/__tests__/ValidateQuickForm.tsx +++ b/packages/uniforms-bootstrap4/__tests__/ValidateQuickForm.tsx @@ -4,7 +4,7 @@ import { ValidatedQuickForm } from 'uniforms-bootstrap4'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap4/__tests__/ValidatedForm.tsx b/packages/uniforms-bootstrap4/__tests__/ValidatedForm.tsx index ae097857c..b889067f9 100644 --- a/packages/uniforms-bootstrap4/__tests__/ValidatedForm.tsx +++ b/packages/uniforms-bootstrap4/__tests__/ValidatedForm.tsx @@ -4,7 +4,7 @@ import { ValidatedForm } from 'uniforms-bootstrap4'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap4/__tests__/gridClassName.ts b/packages/uniforms-bootstrap4/__tests__/gridClassName.ts index 0a1bd7e8d..2e89a0027 100644 --- a/packages/uniforms-bootstrap4/__tests__/gridClassName.ts +++ b/packages/uniforms-bootstrap4/__tests__/gridClassName.ts @@ -1,6 +1,6 @@ import { gridClassName } from 'uniforms-bootstrap4'; -test('gridClassName - object', () => { +it('gridClassName - object', () => { expect(gridClassName({ md: 3 }, 'input')).toBe('col-9 col-md-9'); expect(gridClassName({ md: 5 }, 'input')).toBe('col-7 col-md-7'); expect(gridClassName({ md: 7 }, 'input')).toBe('col-5 col-md-5'); @@ -54,21 +54,21 @@ test('gridClassName - object', () => { expect(gridClassName({ xl: 9 }, 'label')).toBe('col-9 col-xl-9'); }); -test('gridClassName - number', () => { +it('gridClassName - number', () => { expect(gridClassName(3, 'input')).toBe('col-9'); expect(gridClassName(3, 'label')).toBe('col-3'); expect(gridClassName(5, 'input')).toBe('col-7'); expect(gridClassName(5, 'label')).toBe('col-5'); }); -test('gridClassName - number (string)', () => { +it('gridClassName - number (string)', () => { expect(gridClassName('3', 'input')).toBe('col-9'); expect(gridClassName('3', 'label')).toBe('col-3'); expect(gridClassName('5', 'input')).toBe('col-7'); expect(gridClassName('5', 'label')).toBe('col-5'); }); -test('gridClassName - string', () => { +it('gridClassName - string', () => { expect(gridClassName('col-9 col-md-9')).toBe('col-9 col-md-9'); expect(gridClassName('col-3 col-md-3')).toBe('col-3 col-md-3'); expect(gridClassName('col-7 col-md-7')).toBe('col-7 col-md-7'); diff --git a/packages/uniforms-bootstrap4/__tests__/wrapField.tsx b/packages/uniforms-bootstrap4/__tests__/wrapField.tsx index ec97accf1..e245da212 100644 --- a/packages/uniforms-bootstrap4/__tests__/wrapField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/wrapField.tsx @@ -3,21 +3,21 @@ import { wrapField } from 'uniforms-bootstrap4'; import mount from './_mount'; -test(' - renders wrapper with correct class', () => { +it(' - renders wrapper with correct class', () => { const element = wrapField({ wrapClassName: 'container' },
); const wrapper = mount(element); expect(wrapper.find('.container')).toHaveLength(1); }); -test(' - renders help block', () => { +it(' - renders help block', () => { const element = wrapField({ help: 'Hint' },
); const wrapper = mount(element); expect(wrapper.find('.form-text').text()).toBe('Hint'); }); -test(' - renders help block with specified class', () => { +it(' - renders help block with specified class', () => { const element = wrapField( { help: 'Hint', helpClassName: 'text-hint' },
, @@ -27,7 +27,7 @@ test(' - renders help block with specified class', () => { expect(wrapper.find('.form-text.text-hint')).toHaveLength(1); }); -test(' - renders error block', () => { +it(' - renders error block', () => { const error = new Error(); const element = wrapField( { error, showInlineError: true, errorMessage: 'Error' }, @@ -38,7 +38,7 @@ test(' - renders error block', () => { expect(wrapper.find('.text-danger').text()).toBe('Error'); }); -test(' - renders error block (showInlineError=false)', () => { +it(' - renders error block (showInlineError=false)', () => { const error = new Error(); const element = wrapField( { error, showInlineError: false, errorMessage: 'Error' }, @@ -49,7 +49,7 @@ test(' - renders error block (showInlineError=false)', () => { expect(wrapper.find('.text-danger')).toHaveLength(0); }); -test(' - label has custom class (String)', () => { +it(' - label has custom class (String)', () => { const element = wrapField( { label: 'A field label', @@ -62,7 +62,7 @@ test(' - label has custom class (String)', () => { expect(wrapper.find('label.custom-label-class')).toHaveLength(1); }); -test(' - label has custom class (Array[String])', () => { +it(' - label has custom class (Array[String])', () => { const element = wrapField( { label: 'A field label', diff --git a/packages/uniforms-bootstrap5/__tests__/AutoField.tsx b/packages/uniforms-bootstrap5/__tests__/AutoField.tsx index 4b3b49d58..6a08c4bbd 100644 --- a/packages/uniforms-bootstrap5/__tests__/AutoField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/AutoField.tsx @@ -14,14 +14,14 @@ import { import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(AutoField)).toHaveLength(1); }); -test(' - detects RadioField', () => { +it(' - detects RadioField', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ test(' - detects RadioField', () => { expect(wrapper.find(RadioField.Component)).toHaveLength(1); }); -test(' - detects SelectField', () => { +it(' - detects SelectField', () => { const element = ; const wrapper = mount( element, @@ -50,14 +50,14 @@ test(' - detects SelectField', () => { expect(wrapper.find(SelectField.Component)).toHaveLength(1); }); -test(' - detects DateField', () => { +it(' - detects DateField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DateField.Component)).toHaveLength(1); }); -test(' - detects ListField', () => { +it(' - detects ListField', () => { const element = ; const wrapper = mount( element, @@ -67,35 +67,35 @@ test(' - detects ListField', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -test(' - detects NumField', () => { +it(' - detects NumField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(NumField.Component)).toHaveLength(1); }); -test(' - detects NestField', () => { +it(' - detects NestField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Object } })); expect(wrapper.find(NestField)).toHaveLength(1); }); -test(' - detects TextField', () => { +it(' - detects TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField.Component)).toHaveLength(1); }); -test(' - detects BoolField', () => { +it(' - detects BoolField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(BoolField.Component)).toHaveLength(1); }); -test(' - uses Component (schema)', () => { +it(' - uses Component (schema)', () => { const Component = jest.fn(() => null); const element = ; @@ -107,7 +107,7 @@ test(' - uses Component (schema)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -test(' - uses Component (props)', () => { +it(' - uses Component (props)', () => { const Component = jest.fn(() => null); const element = ; @@ -116,7 +116,7 @@ test(' - uses Component (props)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -test(' - uses Component (context)', () => { +it(' - uses Component (context)', () => { const FieldA = jest.fn(() => null); const FieldB = jest.fn(() => null); @@ -136,7 +136,7 @@ test(' - uses Component (context)', () => { expect(FieldB).toHaveBeenCalledTimes(1); }); -test(' - uses Component (invalid)', () => { +it(' - uses Component (invalid)', () => { const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {}); expect(() => { const element = ; diff --git a/packages/uniforms-bootstrap5/__tests__/AutoFields.tsx b/packages/uniforms-bootstrap5/__tests__/AutoFields.tsx index ccf6a542f..3458d0394 100644 --- a/packages/uniforms-bootstrap5/__tests__/AutoFields.tsx +++ b/packages/uniforms-bootstrap5/__tests__/AutoFields.tsx @@ -4,14 +4,14 @@ import { AutoFields, AutoField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('AutoFields')).toHaveLength(1); }); -test(' - render all fields by default', () => { +it(' - render all fields by default', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - render all fields by default', () => { expect(wrapper.find('input')).toHaveLength(3); }); -test(' - renders only specified fields', () => { +it(' - renders only specified fields', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ test(' - renders only specified fields', () => { ); }); -test(' - does not render ommited fields', () => { +it(' - does not render ommited fields', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ test(' - does not render ommited fields', () => { ); }); -test(' - wraps fields in specified element', () => { +it(' - wraps fields in specified element', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ test(' - wraps fields in specified element', () => { expect(wrapper.find('section').find('input')).toHaveLength(3); }); -test(' - pass props to the children', () => { +it(' - pass props to the children', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap5/__tests__/AutoForm.tsx b/packages/uniforms-bootstrap5/__tests__/AutoForm.tsx index d781907d0..f99bddb35 100644 --- a/packages/uniforms-bootstrap5/__tests__/AutoForm.tsx +++ b/packages/uniforms-bootstrap5/__tests__/AutoForm.tsx @@ -4,7 +4,7 @@ import { AutoForm } from 'uniforms-bootstrap5'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap5/__tests__/BaseForm.tsx b/packages/uniforms-bootstrap5/__tests__/BaseForm.tsx index 093839796..a7815b94d 100644 --- a/packages/uniforms-bootstrap5/__tests__/BaseForm.tsx +++ b/packages/uniforms-bootstrap5/__tests__/BaseForm.tsx @@ -4,7 +4,7 @@ import { BaseForm } from 'uniforms-bootstrap5'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap5/__tests__/BoolField.tsx b/packages/uniforms-bootstrap5/__tests__/BoolField.tsx index 58671202e..8ece193e9 100644 --- a/packages/uniforms-bootstrap5/__tests__/BoolField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/BoolField.tsx @@ -4,14 +4,14 @@ import { BoolField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an inline input', () => { +it(' - renders an inline input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -19,7 +19,7 @@ test(' - renders an inline input', () => { expect(wrapper.find('.form-check-inline')).toHaveLength(1); }); -test(' - renders a input with correct id (inherited)', () => { +it(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -27,7 +27,7 @@ test(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders a input with correct id (specified)', () => { +it(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -35,7 +35,7 @@ test(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders a input with correct name', () => { +it(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -43,7 +43,7 @@ test(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('checkbox'); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -59,7 +59,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -73,7 +73,7 @@ test(' - renders an input with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a input with correct label (specified)', () => { +it(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -84,7 +84,7 @@ test(' - renders a input with correct label (specified)', () => { ); }); -test(' - renders a input with correct value (default)', () => { +it(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -92,7 +92,7 @@ test(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('checked')).toBe(false); }); -test(' - renders a input with correct value (model)', () => { +it(' - renders a input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -103,7 +103,7 @@ test(' - renders a input with correct value (model)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -test(' - renders a input with correct value (specified)', () => { +it(' - renders a input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -111,7 +111,7 @@ test(' - renders a input with correct value (specified)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -test(' - renders a input which correctly reacts on change', () => { +it(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ test(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', true); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); diff --git a/packages/uniforms-bootstrap5/__tests__/DateField.tsx b/packages/uniforms-bootstrap5/__tests__/DateField.tsx index 95c0efc58..66c2fcaff 100644 --- a/packages/uniforms-bootstrap5/__tests__/DateField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/DateField.tsx @@ -8,7 +8,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - DateField tests', () => { - test(' - handles "date" type correctly', () => { + it(' - handles "date" type correctly', () => { const onChange = jest.fn(); const initialDate = new Date(Date.UTC(2020, 0, 1)); @@ -29,14 +29,14 @@ describe('@RTL - DateField tests', () => { }); }); -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders a input with correct id (inherited)', () => { +it(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -44,7 +44,7 @@ test(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders a input with correct id (specified)', () => { +it(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -52,7 +52,7 @@ test(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders a input with correct name', () => { +it(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -60,7 +60,7 @@ test(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -79,7 +79,7 @@ test.each(['datetime-local', 'date'] as const)( }, ); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -87,7 +87,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -95,7 +95,7 @@ test(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -test(' - renders a input with correct label (specified)', () => { +it(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -106,7 +106,7 @@ test(' - renders a input with correct label (specified)', () => { ); }); -test(' - renders a input with correct value (default)', () => { +it(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -114,7 +114,7 @@ test(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders a input with correct value (model)', () => { +it(' - renders a input with correct value (model)', () => { const now = new Date(); const element = ; const wrapper = mount( @@ -128,7 +128,7 @@ test(' - renders a input with correct value (model)', () => { ); }); -test(' - renders a input with correct value (specified)', () => { +it(' - renders a input with correct value (specified)', () => { const now = new Date(); const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -139,7 +139,7 @@ test(' - renders a input with correct value (specified)', () => { ); }); -test(' - renders a input which correctly reacts on change', () => { +it(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const now = new Date(); @@ -158,7 +158,7 @@ test(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', now); }); -test(' - renders a input which correctly reacts on change (empty)', () => { +it(' - renders a input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -176,7 +176,7 @@ test(' - renders a input which correctly reacts on change (empty)', ( expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a input which correctly reacts on change (overflow)', () => { +it(' - renders a input which correctly reacts on change (overflow)', () => { const onChange = jest.fn(); const now = new Date(1e5, 0); @@ -195,7 +195,7 @@ test(' - renders a input which correctly reacts on change (overflow)' expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); diff --git a/packages/uniforms-bootstrap5/__tests__/ErrorField.tsx b/packages/uniforms-bootstrap5/__tests__/ErrorField.tsx index f778281bc..2ac5204e6 100644 --- a/packages/uniforms-bootstrap5/__tests__/ErrorField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/ErrorField.tsx @@ -11,14 +11,14 @@ const error = { message: 'X is required [validation-error]', }; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorField)).toHaveLength(1); }); -test(' - renders correct error message (context)', () => { +it(' - renders correct error message (context)', () => { const element = ; const wrapper = mount( element, @@ -29,7 +29,7 @@ test(' - renders correct error message (context)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -test(' - renders correct error message (specified)', () => { +it(' - renders correct error message (specified)', () => { const element = ( - renders correct error message (specified)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -test(' - renders correct children if specified', () => { +it(' - renders correct children if specified', () => { const element = Error; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap5/__tests__/ErrorsField.tsx b/packages/uniforms-bootstrap5/__tests__/ErrorsField.tsx index 096ac27a4..871f68a7a 100644 --- a/packages/uniforms-bootstrap5/__tests__/ErrorsField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/ErrorsField.tsx @@ -15,14 +15,14 @@ const error = { message: 'X is required [validation-error]', }; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorsField)).toHaveLength(1); }); -test(' - renders list of correct error messages (context)', () => { +it(' - renders list of correct error messages (context)', () => { const element = ; const wrapper = mount( element, @@ -38,7 +38,7 @@ test(' - renders list of correct error messages (context)', () => { expect(wrapper.find('.card-body > div').at(2).text()).toBe('Z is required'); }); -test(' - renders children (specified)', () => { +it(' - renders children (specified)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap5/__tests__/HiddenField.tsx b/packages/uniforms-bootstrap5/__tests__/HiddenField.tsx index 460baa415..0fad71f31 100644 --- a/packages/uniforms-bootstrap5/__tests__/HiddenField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/HiddenField.tsx @@ -4,14 +4,14 @@ import { HiddenField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('hidden'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -62,7 +62,7 @@ test(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input which correctly reacts on model change', () => { +it(' - renders an input which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -76,7 +76,7 @@ test(' - renders an input which correctly reacts on model change', expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders an input which correctly reacts on model change (empty)', () => { +it(' - renders an input which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -90,7 +90,7 @@ test(' - renders an input which correctly reacts on model change (e expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders an input which correctly reacts on model change (same value)', () => { +it(' - renders an input which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -104,14 +104,14 @@ test(' - renders an input which correctly reacts on model change (s expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders nothing', () => { +it(' - renders nothing', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.children()).toHaveLength(0); }); -test(' - renders nothing which correctly reacts on model change', () => { +it(' - renders nothing which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ test(' - renders nothing which correctly reacts on model chan expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders nothing which correctly reacts on model change (empty)', () => { +it(' - renders nothing which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ test(' - renders nothing which correctly reacts on model chan expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders nothing which correctly reacts on model change (same value)', () => { +it(' - renders nothing which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; diff --git a/packages/uniforms-bootstrap5/__tests__/ListAddField.tsx b/packages/uniforms-bootstrap5/__tests__/ListAddField.tsx index 698b5a2cf..7bc0b187d 100644 --- a/packages/uniforms-bootstrap5/__tests__/ListAddField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/ListAddField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListAddField)).toHaveLength(1); }); -test(' - prevents onClick when disabled', () => { +it(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ test(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when limit reached', () => { +it(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { maxCount: 0 } })); @@ -39,7 +39,7 @@ test(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - correctly reacts on click', () => { +it(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ test(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['y']); }); -test(' - correctly reacts on keyboard enter key', () => { +it(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-bootstrap5/__tests__/ListDelField.tsx b/packages/uniforms-bootstrap5/__tests__/ListDelField.tsx index 3d7bbe1ee..841099fb2 100644 --- a/packages/uniforms-bootstrap5/__tests__/ListDelField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/ListDelField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListDelField)).toHaveLength(1); }); -test(' - prevents onClick when disabled', () => { +it(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ test(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when limit reached', () => { +it(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { minCount: 3 } })); @@ -39,7 +39,7 @@ test(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - correctly reacts on click', () => { +it(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ test(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['x', 'z']); }); -test(' - correctly reacts on keyboard enter key', () => { +it(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-bootstrap5/__tests__/ListField.tsx b/packages/uniforms-bootstrap5/__tests__/ListField.tsx index d1d9dca44..78d6657b4 100644 --- a/packages/uniforms-bootstrap5/__tests__/ListField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/ListField.tsx @@ -12,7 +12,7 @@ describe('@RTL - ListField tests', () => { }); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount( element, @@ -22,7 +22,7 @@ test(' - works', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -test(' - renders ListAddField', () => { +it(' - renders ListAddField', () => { const element = ; const wrapper = mount( element, @@ -33,7 +33,7 @@ test(' - renders ListAddField', () => { expect(wrapper.find(ListAddField).prop('name')).toBe('$'); }); -test(' - renders correct label (specified)', () => { +it(' - renders correct label (specified)', () => { const element = ; const wrapper = mount( element, @@ -46,7 +46,7 @@ test(' - renders correct label (specified)', () => { ); }); -test(' - renders correct numer of items with model (specified)', () => { +it(' - renders correct numer of items with model (specified)', () => { const element = ; const wrapper = mount( element, @@ -58,7 +58,7 @@ test(' - renders correct numer of items with model (specified)', () = expect(wrapper.find('input')).toHaveLength(3); }); -test(' - passes itemProps to its children', () => { +it(' - passes itemProps to its children', () => { const element = ; const wrapper = mount( element, @@ -70,7 +70,7 @@ test(' - passes itemProps to its children', () => { expect(wrapper.find(ListItemField).first().prop('data-xyz')).toBe(1); }); -test(' - renders children (specified)', () => { +it(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -89,7 +89,7 @@ test(' - renders children (specified)', () => { expect(Child).toHaveBeenCalledTimes(2); }); -test(' - renders children with correct name (children)', () => { +it(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -108,7 +108,7 @@ test(' - renders children with correct name (children)', () => { expect(wrapper.find(Child).at(1).prop('name')).toBe('1'); }); -test(' - renders children with correct name (value)', () => { +it(' - renders children with correct name (value)', () => { const element = ; const wrapper = mount( element, @@ -121,7 +121,7 @@ test(' - renders children with correct name (value)', () => { expect(wrapper.find(ListItemField).at(1).prop('name')).toBe('1'); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( - renders correct error text (specified)', () => { expect(wrapper.find('.text-danger').text()).toBe('Error'); }); -test(' - renders correct error text (showInlineError=false)', () => { +it(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.find('.text-danger')).toHaveLength(0); }); -test(' - renders proper number of optional values after add new value', () => { +it(' - renders proper number of optional values after add new value', () => { const element = ; const onChange = jest.fn(); const wrapper = mount( diff --git a/packages/uniforms-bootstrap5/__tests__/ListItemField.tsx b/packages/uniforms-bootstrap5/__tests__/ListItemField.tsx index c105a0ba2..a285acaaa 100644 --- a/packages/uniforms-bootstrap5/__tests__/ListItemField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/ListItemField.tsx @@ -4,7 +4,7 @@ import { AutoField, ListDelField, ListItemField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - works', () => { expect(wrapper.find(ListItemField)).toHaveLength(1); }); -test(' - renders ListDelField', () => { +it(' - renders ListDelField', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - renders ListDelField', () => { expect(wrapper.find(ListDelField).childAt(0).prop('name')).toBe('x.1'); }); -test(' - renders AutoField', () => { +it(' - renders AutoField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ test(' - renders AutoField', () => { expect(wrapper.find(AutoField)).toHaveLength(1); }); -test(' - renders children if specified', () => { +it(' - renders children if specified', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( diff --git a/packages/uniforms-bootstrap5/__tests__/LongTextField.tsx b/packages/uniforms-bootstrap5/__tests__/LongTextField.tsx index a08565c9b..16a713738 100644 --- a/packages/uniforms-bootstrap5/__tests__/LongTextField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/LongTextField.tsx @@ -4,14 +4,14 @@ import { LongTextField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a textarea', () => { +it(' - renders a textarea', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('textarea')).toHaveLength(1); }); -test(' - renders a textarea with correct disabled state', () => { +it(' - renders a textarea with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ test(' - renders a textarea with correct disabled state', () => { expect(wrapper.find('textarea').prop('disabled')).toBe(true); }); -test(' - renders a textarea with correct readOnly state', () => { +it(' - renders a textarea with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ test(' - renders a textarea with correct readOnly state', () => { expect(wrapper.find('textarea').prop('readOnly')).toBe(true); }); -test(' - renders a textarea with correct id (inherited)', () => { +it(' - renders a textarea with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ test(' - renders a textarea with correct id (inherited)', () => { expect(wrapper.find('textarea').prop('id')).toBeTruthy(); }); -test(' - renders a textarea with correct id (specified)', () => { +it(' - renders a textarea with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ test(' - renders a textarea with correct id (specified)', () => { expect(wrapper.find('textarea').prop('id')).toBe('y'); }); -test(' - renders a textarea with correct name', () => { +it(' - renders a textarea with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ test(' - renders a textarea with correct name', () => { expect(wrapper.find('textarea').prop('name')).toBe('x'); }); -test(' - renders a textarea with correct placeholder', () => { +it(' - renders a textarea with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -59,7 +59,7 @@ test(' - renders a textarea with correct placeholder', () => { expect(wrapper.find('textarea').prop('placeholder')).toBe('y'); }); -test(' - renders a textarea with correct value (default)', () => { +it(' - renders a textarea with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -67,7 +67,7 @@ test(' - renders a textarea with correct value (default)', () => expect(wrapper.find('textarea').prop('value')).toBe(''); }); -test(' - renders a textarea with correct value (model)', () => { +it(' - renders a textarea with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -78,7 +78,7 @@ test(' - renders a textarea with correct value (model)', () => { expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -test(' - renders a textarea with correct value (specified)', () => { +it(' - renders a textarea with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -86,7 +86,7 @@ test(' - renders a textarea with correct value (specified)', () = expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -test(' - renders a textarea which correctly reacts on change', () => { +it(' - renders a textarea which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -102,7 +102,7 @@ test(' - renders a textarea which correctly reacts on change', () expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a textarea which correctly reacts on change (empty)', () => { +it(' - renders a textarea which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -118,7 +118,7 @@ test(' - renders a textarea which correctly reacts on change (emp expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders a textarea which correctly reacts on change (same value)', () => { +it(' - renders a textarea which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -134,7 +134,7 @@ test(' - renders a textarea which correctly reacts on change (sam expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -145,7 +145,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-bootstrap5/__tests__/NestField.tsx b/packages/uniforms-bootstrap5/__tests__/NestField.tsx index fb1948e5b..a7dff2e1a 100644 --- a/packages/uniforms-bootstrap5/__tests__/NestField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/NestField.tsx @@ -4,7 +4,7 @@ import { AutoField, NestField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an for each field', () => { +it(' - renders an for each field', () => { const element = ; const wrapper = mount( element, @@ -20,7 +20,7 @@ test(' - renders an for each field', () => { expect(wrapper.find(AutoField).at(1).prop('name')).toBe('b'); }); -test(' - renders custom content if given', () => { +it(' - renders custom content if given', () => { const element = (
@@ -40,7 +40,7 @@ test(' - renders custom content if given', () => { expect(wrapper.find('article').prop('data-test')).toBe('content'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -88,7 +88,7 @@ test(' - renders correct error text (specified)', () => { expect(wrapper.find('.text-danger').text()).toBe('Error'); }); -test(' - renders correct error text (showInlineError=false)', () => { +it(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -19,7 +19,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -27,7 +27,7 @@ test(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -35,7 +35,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -43,7 +43,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct max', () => { +it(' - renders an input with correct max', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct max', () => { expect(wrapper.find('input').prop('max')).toBe(10); }); -test(' - renders an input with correct min', () => { +it(' - renders an input with correct min', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -59,7 +59,7 @@ test(' - renders an input with correct min', () => { expect(wrapper.find('input').prop('min')).toBe(10); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -67,7 +67,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct placeholder', () => { +it(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -75,7 +75,7 @@ test(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -test(' - renders an input with correct step (decimal)', () => { +it(' - renders an input with correct step (decimal)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -83,7 +83,7 @@ test(' - renders an input with correct step (decimal)', () => { expect(wrapper.find('input').prop('step')).toBe(0.01); }); -test(' - renders an input with correct step (integer)', () => { +it(' - renders an input with correct step (integer)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -91,7 +91,7 @@ test(' - renders an input with correct step (integer)', () => { expect(wrapper.find('input').prop('step')).toBe(1); }); -test(' - renders an input with correct step (set)', () => { +it(' - renders an input with correct step (set)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -99,7 +99,7 @@ test(' - renders an input with correct step (set)', () => { expect(wrapper.find('input').prop('step')).toBe(3); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -107,7 +107,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('number'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -115,7 +115,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const onChange = jest.fn(); const element = ; @@ -157,7 +157,7 @@ test(' - renders an input with correct value (model)', () => { spy.mockRestore(); }); -test(' - renders an input with correct value (specified)', () => { +it(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -165,7 +165,7 @@ test(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe(2); }); -test(' - renders an input which correctly reacts on change', () => { +it(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -181,7 +181,7 @@ test(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -test(' - renders an input which correctly reacts on change (decimal on decimal)', () => { +it(' - renders an input which correctly reacts on change (decimal on decimal)', () => { const onChange = jest.fn(); const element = ; @@ -197,7 +197,7 @@ test(' - renders an input which correctly reacts on change (decimal on expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); -test(' - renders an input which correctly reacts on change (decimal on integer)', () => { +it(' - renders an input which correctly reacts on change (decimal on integer)', () => { const onChange = jest.fn(); const element = ; @@ -213,7 +213,7 @@ test(' - renders an input which correctly reacts on change (decimal on expect(onChange).toHaveBeenLastCalledWith('x', 2); }); -test(' - renders an input which correctly reacts on change (empty)', () => { +it(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -229,7 +229,7 @@ test(' - renders an input which correctly reacts on change (empty)', ( expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders an input which correctly reacts on change (same value)', () => { +it(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -245,7 +245,7 @@ test(' - renders an input which correctly reacts on change (same value expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -test(' - renders an input which correctly reacts on change (zero)', () => { +it(' - renders an input which correctly reacts on change (zero)', () => { const onChange = jest.fn(); const element = ; @@ -261,7 +261,7 @@ test(' - renders an input which correctly reacts on change (zero)', () expect(onChange).toHaveBeenLastCalledWith('x', 0); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -272,7 +272,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); diff --git a/packages/uniforms-bootstrap5/__tests__/QuickForm.tsx b/packages/uniforms-bootstrap5/__tests__/QuickForm.tsx index 4da914435..4b01a3818 100644 --- a/packages/uniforms-bootstrap5/__tests__/QuickForm.tsx +++ b/packages/uniforms-bootstrap5/__tests__/QuickForm.tsx @@ -4,7 +4,7 @@ import { QuickForm } from 'uniforms-bootstrap5'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - renders', () => { +it(' - renders', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap5/__tests__/RadioField.tsx b/packages/uniforms-bootstrap5/__tests__/RadioField.tsx index b132acdd6..4e870c26e 100644 --- a/packages/uniforms-bootstrap5/__tests__/RadioField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/RadioField.tsx @@ -4,7 +4,7 @@ import { RadioField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a set of checkboxes', () => { +it(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -test(' - renders a set of inline checkboxes', () => { +it(' - renders a set of inline checkboxes', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - renders a set of inline checkboxes', () => { expect(wrapper.find('.form-check-inline')).toHaveLength(2); }); -test(' - renders a set of checkboxes with correct disabled state', () => { +it(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ test(' - renders a set of checkboxes with correct disabled state', ( expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -test(' - renders a set of checkboxes with correct readOnly state', () => { +it(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -54,7 +54,7 @@ test(' - renders a set of checkboxes with correct readOnly state', ( expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a set of checkboxes with correct id (inherited)', () => { +it(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -66,7 +66,7 @@ test(' - renders a set of checkboxes with correct id (inherited)', ( expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -test(' - renders a set of checkboxes with correct id (specified)', () => { +it(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -78,7 +78,7 @@ test(' - renders a set of checkboxes with correct id (specified)', ( expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -test(' - renders a set of checkboxes with correct name', () => { +it(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -90,7 +90,7 @@ test(' - renders a set of checkboxes with correct name', () => { expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -test(' - renders a set of checkboxes with correct options', () => { +it(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -102,7 +102,7 @@ test(' - renders a set of checkboxes with correct options', () => { expect(wrapper.find('label').at(1).text()).toBe(' b'); }); -test(' - renders a set of checkboxes with correct options (transform)', () => { +it(' - renders a set of checkboxes with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -114,7 +114,7 @@ test(' - renders a set of checkboxes with correct options (transform expect(wrapper.find('label').at(1).text()).toBe(' B'); }); -test(' - renders a set of checkboxes with correct value (default)', () => { +it(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -126,7 +126,7 @@ test(' - renders a set of checkboxes with correct value (default)', expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -test(' - renders a set of checkboxes with correct value (model)', () => { +it(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -141,7 +141,7 @@ test(' - renders a set of checkboxes with correct value (model)', () expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes with correct value (specified)', () => { +it(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -153,7 +153,7 @@ test(' - renders a set of checkboxes with correct value (specified)' expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes which correctly reacts on change', () => { +it(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -170,7 +170,7 @@ test(' - renders a set of checkboxes which correctly reacts on chang expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -187,7 +187,7 @@ test(' - renders a set of checkboxes which correctly reacts on chang expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -198,7 +198,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -210,7 +210,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), diff --git a/packages/uniforms-bootstrap5/__tests__/SelectField.tsx b/packages/uniforms-bootstrap5/__tests__/SelectField.tsx index 353eba951..f5d9fb576 100644 --- a/packages/uniforms-bootstrap5/__tests__/SelectField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/SelectField.tsx @@ -4,7 +4,7 @@ import { SelectField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a select', () => { +it(' - renders a select', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - renders a select', () => { expect(wrapper.find('select')).toHaveLength(1); }); -test(' - renders a select with correct disabled state', () => { +it(' - renders a select with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - renders a select with correct disabled state', () => { expect(wrapper.find('select').prop('disabled')).toBe(true); }); -test(' - renders a select with correct readOnly state', () => { +it(' - renders a select with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -44,7 +44,7 @@ test(' - renders a select with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a select with correct id (inherited)', () => { +it(' - renders a select with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ test(' - renders a select with correct id (inherited)', () => { expect(wrapper.find('select').prop('id')).toBeTruthy(); }); -test(' - renders a select with correct id (specified)', () => { +it(' - renders a select with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -66,7 +66,7 @@ test(' - renders a select with correct id (specified)', () => { expect(wrapper.find('select').prop('id')).toBe('y'); }); -test(' - renders a select with correct name', () => { +it(' - renders a select with correct name', () => { const element = ; const wrapper = mount( element, @@ -77,7 +77,7 @@ test(' - renders a select with correct name', () => { expect(wrapper.find('select').prop('name')).toBe('x'); }); -test(' - renders a select with correct options', () => { +it(' - renders a select with correct options', () => { const element = ; const wrapper = mount( element, @@ -97,7 +97,7 @@ test(' - renders a select with correct options', () => { }); }); -test(' - renders a select with correct options (transform)', () => { +it(' - renders a select with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -117,7 +117,7 @@ test(' - renders a select with correct options (transform)', () => }); }); -test(' - renders a select with correct placeholder (fallback)', () => { +it(' - renders a select with correct placeholder (fallback)', () => { const element = ; const wrapper = mount( element, @@ -139,7 +139,7 @@ test(' - renders a select with correct placeholder (fallback)', () }); }); -test(' - renders a select with correct placeholder (implicit)', () => { +it(' - renders a select with correct placeholder (implicit)', () => { const element = ; const wrapper = mount( element, @@ -159,7 +159,7 @@ test(' - renders a select with correct placeholder (implicit)', () }); }); -test(' - renders a select with correct value (default)', () => { +it(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -170,7 +170,7 @@ test(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toBe(''); }); -test(' - renders a select with correct value (model)', () => { +it(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -184,7 +184,7 @@ test(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -test(' - renders a select with correct value (specified)', () => { +it(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -195,7 +195,7 @@ test(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -test(' - renders a select which correctly reacts on change', () => { +it(' - renders a select which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -214,7 +214,7 @@ test(' - renders a select which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a select which correctly reacts on change (empty)', () => { +it(' - renders a select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -233,7 +233,7 @@ test(' - renders a select which correctly reacts on change (empty)' expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a select which correctly reacts on change (same value)', () => { +it(' - renders a select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -252,7 +252,7 @@ test(' - renders a select which correctly reacts on change (same va expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -266,7 +266,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a select with class "bg-red" beside "mb-3"', () => { +it(' - renders a select with class "bg-red" beside "mb-3"', () => { const element = ; const wrapper = mount( element, @@ -275,7 +275,7 @@ test(' - renders a select with class "bg-red" beside "mb-3"', () => expect(wrapper.find('.bg-red.mb-3')).toHaveLength(1); }); -test(' - renders a disabled select', () => { +it(' - renders a disabled select', () => { const element = ; const wrapper = mount( element, @@ -284,7 +284,7 @@ test(' - renders a disabled select', () => { expect(wrapper.find('select').prop('disabled')).toEqual(true); }); -test(' - renders a required select', () => { +it(' - renders a required select', () => { const element = ; const wrapper = mount( element, @@ -293,7 +293,7 @@ test(' - renders a required select', () => { expect(wrapper.find('.mb-3.required')).toHaveLength(1); }); -test(' - renders am error massge in select', () => { +it(' - renders am error massge in select', () => { const element = ( - renders am error massge in select', () => { expect(wrapper.find('.form-text.text-danger')).toHaveLength(1); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -321,14 +321,14 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -test(' - disabled items (options) based on predicate', () => { +it(' - disabled items (options) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( @@ -344,7 +344,7 @@ test(' - disabled items (options) based on predicate', () => { expect(wrapper.find('option[value="b"]').at(0).prop('disabled')).toBe(false); }); -test(' - renders a select with correct value (default)', () => { +it(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -358,7 +358,7 @@ test(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual([]); }); -test(' - renders a select with correct value (model)', () => { +it(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -375,7 +375,7 @@ test(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -test(' - renders a select with correct value (specified)', () => { +it(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -389,7 +389,7 @@ test(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -test(' - renders a select which correctly reacts on change (first value)', () => { +it(' - renders a select which correctly reacts on change (first value)', () => { const onChange = jest.fn(); const element = ; @@ -411,7 +411,7 @@ test(' - renders a select which correctly reacts on change (first v expect(onChange).toHaveBeenLastCalledWith('x', ['a']); }); -test(' - renders a select which correctly reacts on change (next value)', () => { +it(' - renders a select which correctly reacts on change (next value)', () => { const onChange = jest.fn(); const element = ; @@ -433,7 +433,7 @@ test(' - renders a select which correctly reacts on change (next va expect(onChange).toHaveBeenLastCalledWith('x', ['a', 'b']); }); -test(' - renders a select which correctly reacts on change (uncheck) by value', () => { +it(' - renders a select which correctly reacts on change (uncheck) by value', () => { const onChange = jest.fn(); const element = ; @@ -455,7 +455,7 @@ test(' - renders a select which correctly reacts on change (uncheck expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { +it(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { const onChange = jest.fn(); const element = ; @@ -479,7 +479,7 @@ test(' - renders a select which correctly reacts on change (uncheck expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a set of checkboxes', () => { +it(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -489,7 +489,7 @@ test(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -test(' - renders a set of inline checkboxes', () => { +it(' - renders a set of inline checkboxes', () => { const element = ; const wrapper = mount( element, @@ -501,7 +501,7 @@ test(' - renders a set of inline checkboxes', () => { expect(wrapper.find('.form-check-inline')).toHaveLength(2); }); -test(' - renders a set of checkboxes with correct disabled state', () => { +it(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -513,7 +513,7 @@ test(' - renders a set of checkboxes with correct disabl expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -test(' - renders a set of checkboxes with correct readOnly state', () => { +it(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -530,7 +530,7 @@ test(' - renders a set of checkboxes with correct readOn expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a set of checkboxes with correct id (inherited)', () => { +it(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -542,7 +542,7 @@ test(' - renders a set of checkboxes with correct id (in expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -test(' - renders a set of checkboxes with correct id (specified)', () => { +it(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -554,7 +554,7 @@ test(' - renders a set of checkboxes with correct id (sp expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -test(' - renders a set of checkboxes with correct name', () => { +it(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -566,7 +566,7 @@ test(' - renders a set of checkboxes with correct name', expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -test(' - renders a set of checkboxes with correct options', () => { +it(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -578,7 +578,7 @@ test(' - renders a set of checkboxes with correct option expect(wrapper.find('label').at(1).text()).toBe('b'); }); -test(' - renders a set of checkboxes with correct options (transform)', () => { +it(' - renders a set of checkboxes with correct options (transform)', () => { const element = ( x.toUpperCase()} /> ); @@ -592,7 +592,7 @@ test(' - renders a set of checkboxes with correct option expect(wrapper.find('label').at(1).text()).toBe('B'); }); -test(' - renders a set of checkboxes with correct value (default)', () => { +it(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -604,7 +604,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -test(' - renders a set of checkboxes with correct value (model)', () => { +it(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -619,7 +619,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes with correct value (specified)', () => { +it(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -631,7 +631,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes which correctly reacts on change', () => { +it(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -648,7 +648,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { const onChange = jest.fn(); const element = ; @@ -668,7 +668,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -test(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); const element = ; @@ -688,7 +688,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -705,7 +705,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -716,7 +716,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ( ); @@ -730,14 +730,14 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -test(' - disabled items (checkboxes) based on predicate', () => { +it(' - disabled items (checkboxes) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( diff --git a/packages/uniforms-bootstrap5/__tests__/SubmitField.tsx b/packages/uniforms-bootstrap5/__tests__/SubmitField.tsx index d629c76d1..90ae16eb1 100644 --- a/packages/uniforms-bootstrap5/__tests__/SubmitField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/SubmitField.tsx @@ -4,14 +4,14 @@ import { SubmitField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders', () => { +it(' - renders', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper).toHaveLength(1); }); -test(' - renders disabled if error', () => { +it(' - renders disabled if error', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -19,7 +19,7 @@ test(' - renders disabled if error', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders enabled if error and enabled', () => { +it(' - renders enabled if error and enabled', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -27,7 +27,7 @@ test(' - renders enabled if error and enabled', () => { expect(wrapper.find('input').prop('disabled')).toBe(false); }); -test(' - renders a wrapper with correct class', () => { +it(' - renders a wrapper with correct class', () => { const element = ; const wrapper = mount(element, createContext()); @@ -35,7 +35,7 @@ test(' - renders a wrapper with correct class', () => { expect(wrapper.find('.container')).toHaveLength(1); }); -test(' - renders a wrapper with correct value', () => { +it(' - renders a wrapper with correct value', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-bootstrap5/__tests__/TextField.tsx b/packages/uniforms-bootstrap5/__tests__/TextField.tsx index 43ccd04c2..3b18bb1cc 100644 --- a/packages/uniforms-bootstrap5/__tests__/TextField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/TextField.tsx @@ -9,7 +9,7 @@ import mount from './_mount'; describe('@RTL - TextField tests', () => { testTextField(TextField); - test(' - renders a wrapper with unknown props', () => { + it(' - renders a wrapper with unknown props', () => { const props = { 'data-x': 'x', 'data-y': 'y', @@ -24,14 +24,14 @@ describe('@RTL - TextField tests', () => { }); }); -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -39,7 +39,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -47,7 +47,7 @@ test(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -55,7 +55,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -63,7 +63,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -71,7 +71,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct placeholder', () => { +it(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -79,7 +79,7 @@ test(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -87,7 +87,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('text'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -95,7 +95,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -106,7 +106,7 @@ test(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input with correct value (specified)', () => { +it(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -114,7 +114,7 @@ test(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input which correctly reacts on change', () => { +it(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -130,7 +130,7 @@ test(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders an input which correctly reacts on change (empty)', () => { +it(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -146,7 +146,7 @@ test(' - renders an input which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders an input which correctly reacts on change (same value)', () => { +it(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -162,7 +162,7 @@ test(' - renders an input which correctly reacts on change (same valu expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -173,7 +173,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -182,7 +182,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - renders a input with autocomplete turned off', () => { +it(' - renders a input with autocomplete turned off', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-bootstrap5/__tests__/ValidateQuickForm.tsx b/packages/uniforms-bootstrap5/__tests__/ValidateQuickForm.tsx index bb4128046..cb69f05f7 100644 --- a/packages/uniforms-bootstrap5/__tests__/ValidateQuickForm.tsx +++ b/packages/uniforms-bootstrap5/__tests__/ValidateQuickForm.tsx @@ -4,7 +4,7 @@ import { ValidatedQuickForm } from 'uniforms-bootstrap5'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap5/__tests__/ValidatedForm.tsx b/packages/uniforms-bootstrap5/__tests__/ValidatedForm.tsx index 80ac93702..a6c950010 100644 --- a/packages/uniforms-bootstrap5/__tests__/ValidatedForm.tsx +++ b/packages/uniforms-bootstrap5/__tests__/ValidatedForm.tsx @@ -4,7 +4,7 @@ import { ValidatedForm } from 'uniforms-bootstrap5'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap5/__tests__/gridClassName.ts b/packages/uniforms-bootstrap5/__tests__/gridClassName.ts index fed2b2d9b..af0587ea0 100644 --- a/packages/uniforms-bootstrap5/__tests__/gridClassName.ts +++ b/packages/uniforms-bootstrap5/__tests__/gridClassName.ts @@ -1,6 +1,6 @@ import { gridClassName } from 'uniforms-bootstrap5'; -test('gridClassName - object', () => { +it('gridClassName - object', () => { expect(gridClassName({ md: 3 }, 'input')).toBe('col-9 col-md-9'); expect(gridClassName({ md: 5 }, 'input')).toBe('col-7 col-md-7'); expect(gridClassName({ md: 7 }, 'input')).toBe('col-5 col-md-5'); @@ -59,21 +59,21 @@ test('gridClassName - object', () => { expect(gridClassName({ xxl: 9 }, 'label')).toBe('col-9 col-xxl-9'); }); -test('gridClassName - number', () => { +it('gridClassName - number', () => { expect(gridClassName(3, 'input')).toBe('col-9'); expect(gridClassName(3, 'label')).toBe('col-3'); expect(gridClassName(5, 'input')).toBe('col-7'); expect(gridClassName(5, 'label')).toBe('col-5'); }); -test('gridClassName - number (string)', () => { +it('gridClassName - number (string)', () => { expect(gridClassName('3', 'input')).toBe('col-9'); expect(gridClassName('3', 'label')).toBe('col-3'); expect(gridClassName('5', 'input')).toBe('col-7'); expect(gridClassName('5', 'label')).toBe('col-5'); }); -test('gridClassName - string', () => { +it('gridClassName - string', () => { expect(gridClassName('col-9 col-md-9')).toBe('col-9 col-md-9'); expect(gridClassName('col-3 col-md-3')).toBe('col-3 col-md-3'); expect(gridClassName('col-7 col-md-7')).toBe('col-7 col-md-7'); diff --git a/packages/uniforms-bootstrap5/__tests__/wrapField.tsx b/packages/uniforms-bootstrap5/__tests__/wrapField.tsx index 88b7b8bbd..1d150d210 100644 --- a/packages/uniforms-bootstrap5/__tests__/wrapField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/wrapField.tsx @@ -3,21 +3,21 @@ import { wrapField } from 'uniforms-bootstrap5'; import mount from './_mount'; -test(' - renders wrapper with correct class', () => { +it(' - renders wrapper with correct class', () => { const element = wrapField({ wrapClassName: 'container' },
); const wrapper = mount(element); expect(wrapper.find('.container')).toHaveLength(1); }); -test(' - renders help block', () => { +it(' - renders help block', () => { const element = wrapField({ help: 'Hint' },
); const wrapper = mount(element); expect(wrapper.find('.form-text').text()).toBe('Hint'); }); -test(' - renders help block with specified class', () => { +it(' - renders help block with specified class', () => { const element = wrapField( { help: 'Hint', helpClassName: 'text-hint' },
, @@ -27,7 +27,7 @@ test(' - renders help block with specified class', () => { expect(wrapper.find('.form-text.text-hint')).toHaveLength(1); }); -test(' - renders error block', () => { +it(' - renders error block', () => { const error = new Error(); const element = wrapField( { error, showInlineError: true, errorMessage: 'Error' }, @@ -38,7 +38,7 @@ test(' - renders error block', () => { expect(wrapper.find('.text-danger').text()).toBe('Error'); }); -test(' - renders error block (showInlineError=false)', () => { +it(' - renders error block (showInlineError=false)', () => { const error = new Error(); const element = wrapField( { error, showInlineError: false, errorMessage: 'Error' }, @@ -49,7 +49,7 @@ test(' - renders error block (showInlineError=false)', () => { expect(wrapper.find('.text-danger')).toHaveLength(0); }); -test(' - label has custom class (String)', () => { +it(' - label has custom class (String)', () => { const element = wrapField( { label: 'A field label', @@ -62,7 +62,7 @@ test(' - label has custom class (String)', () => { expect(wrapper.find('label.custom-label-class')).toHaveLength(1); }); -test(' - label has custom class (Array[String])', () => { +it(' - label has custom class (Array[String])', () => { const element = wrapField( { label: 'A field label', diff --git a/packages/uniforms-material/__tests__/AutoField.tsx b/packages/uniforms-material/__tests__/AutoField.tsx index 02d0e3d47..5d39d0d79 100644 --- a/packages/uniforms-material/__tests__/AutoField.tsx +++ b/packages/uniforms-material/__tests__/AutoField.tsx @@ -14,14 +14,14 @@ import { import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(AutoField)).toHaveLength(1); }); -test(' - detects RadioField', () => { +it(' - detects RadioField', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ test(' - detects RadioField', () => { expect(wrapper.find(RadioField.Component)).toHaveLength(1); }); -test(' - detects SelectField', () => { +it(' - detects SelectField', () => { const element = ; const wrapper = mount( element, @@ -50,14 +50,14 @@ test(' - detects SelectField', () => { expect(wrapper.find(SelectField.Component)).toHaveLength(1); }); -test(' - detects DateField', () => { +it(' - detects DateField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DateField.Component)).toHaveLength(1); }); -test(' - detects ListField', () => { +it(' - detects ListField', () => { const element = ; const wrapper = mount( element, @@ -67,35 +67,35 @@ test(' - detects ListField', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -test(' - detects NumField', () => { +it(' - detects NumField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(NumField.Component)).toHaveLength(1); }); -test(' - detects NestField', () => { +it(' - detects NestField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Object } })); expect(wrapper.find(NestField)).toHaveLength(1); }); -test(' - detects TextField', () => { +it(' - detects TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField.Component)).toHaveLength(1); }); -test(' - detects BoolField', () => { +it(' - detects BoolField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(BoolField.Component)).toHaveLength(1); }); -test(' - uses Component (schema)', () => { +it(' - uses Component (schema)', () => { const Component = jest.fn(() => null); const element = ; @@ -107,7 +107,7 @@ test(' - uses Component (schema)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -test(' - uses Component (props)', () => { +it(' - uses Component (props)', () => { const Component = jest.fn(() => null); const element = ; @@ -116,7 +116,7 @@ test(' - uses Component (props)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -test(' - uses Component (context)', () => { +it(' - uses Component (context)', () => { const FieldA = jest.fn(() => null); const FieldB = jest.fn(() => null); @@ -136,7 +136,7 @@ test(' - uses Component (context)', () => { expect(FieldB).toHaveBeenCalledTimes(1); }); -test(' - uses Component (invalid)', () => { +it(' - uses Component (invalid)', () => { const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {}); expect(() => { const element = ; diff --git a/packages/uniforms-material/__tests__/AutoFields.tsx b/packages/uniforms-material/__tests__/AutoFields.tsx index 87a716af2..3047a901b 100644 --- a/packages/uniforms-material/__tests__/AutoFields.tsx +++ b/packages/uniforms-material/__tests__/AutoFields.tsx @@ -4,14 +4,14 @@ import { AutoField, AutoFields } from 'uniforms-material'; import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('AutoFields')).toHaveLength(1); }); -test(' - render all fields by default', () => { +it(' - render all fields by default', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - render all fields by default', () => { expect(wrapper.find('input')).toHaveLength(3); }); -test(' - renders only specified fields', () => { +it(' - renders only specified fields', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ test(' - renders only specified fields', () => { ); }); -test(' - does not render ommited fields', () => { +it(' - does not render ommited fields', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ test(' - does not render ommited fields', () => { ); }); -test(' - wraps fields in specified element', () => { +it(' - wraps fields in specified element', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ test(' - wraps fields in specified element', () => { expect(wrapper.find('section').find('input')).toHaveLength(3); }); -test(' - pass props to the children', () => { +it(' - pass props to the children', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-material/__tests__/AutoForm.tsx b/packages/uniforms-material/__tests__/AutoForm.tsx index ad19f360c..6b6f4f134 100644 --- a/packages/uniforms-material/__tests__/AutoForm.tsx +++ b/packages/uniforms-material/__tests__/AutoForm.tsx @@ -5,7 +5,7 @@ import createContext from './_createContext'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-material/__tests__/BaseForm.tsx b/packages/uniforms-material/__tests__/BaseForm.tsx index ae68898b5..2a4cf5c4d 100644 --- a/packages/uniforms-material/__tests__/BaseForm.tsx +++ b/packages/uniforms-material/__tests__/BaseForm.tsx @@ -5,7 +5,7 @@ import createContext from './_createContext'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-material/__tests__/BoolField.tsx b/packages/uniforms-material/__tests__/BoolField.tsx index e6f6b4fdb..a14e1bbd9 100644 --- a/packages/uniforms-material/__tests__/BoolField.tsx +++ b/packages/uniforms-material/__tests__/BoolField.tsx @@ -13,7 +13,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - BoolField tests', () => { - test(' - default props are not passed when MUI theme props are specified', () => { + it(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: false, margin: 'normal' } }, }); @@ -33,7 +33,7 @@ describe('@RTL - BoolField tests', () => { ); }); - test(' - default props are passed when MUI theme props are absent', () => { + it(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -51,7 +51,7 @@ describe('@RTL - BoolField tests', () => { ); }); - test(' - explicit props are passed when MUI theme props are specified', () => { + it(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: true, margin: 'dense' } }, }); @@ -77,14 +77,14 @@ describe('@RTL - BoolField tests', () => { }); }); -test(' - renders an Checkbox', () => { +it(' - renders an Checkbox', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(Checkbox)).toHaveLength(1); }); -test(' - renders a Checkbox with correct id (inherited)', () => { +it(' - renders a Checkbox with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -92,7 +92,7 @@ test(' - renders a Checkbox with correct id (inherited)', () => { expect(wrapper.find(Checkbox).prop('id')).toBeTruthy(); }); -test(' - renders a Checkbox with correct id (specified)', () => { +it(' - renders a Checkbox with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -100,7 +100,7 @@ test(' - renders a Checkbox with correct id (specified)', () => { expect(wrapper.find(Checkbox).prop('id')).toBe('y'); }); -test(' - renders a Checkbox with correct name', () => { +it(' - renders a Checkbox with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -108,7 +108,7 @@ test(' - renders a Checkbox with correct name', () => { expect(wrapper.find(Checkbox).prop('name')).toBe('x'); }); -test(' - renders an Checkbox with correct disabled state', () => { +it(' - renders an Checkbox with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -116,7 +116,7 @@ test(' - renders an Checkbox with correct disabled state', () => { expect(wrapper.find(Checkbox).prop('disabled')).toBe(true); }); -test(' - renders a Checkbox with correct label (specified)', () => { +it(' - renders a Checkbox with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -124,7 +124,7 @@ test(' - renders a Checkbox with correct label (specified)', () => { expect(wrapper.find(FormControlLabel).prop('label')).toBe('BoolFieldLabel'); }); -test(' - renders a Checkbox with correct value (default)', () => { +it(' - renders a Checkbox with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -132,7 +132,7 @@ test(' - renders a Checkbox with correct value (default)', () => { expect(wrapper.find(Checkbox).prop('checked')).toBe(false); }); -test(' - renders a Checkbox with correct value (model)', () => { +it(' - renders a Checkbox with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -143,7 +143,7 @@ test(' - renders a Checkbox with correct value (model)', () => { expect(wrapper.find(Checkbox).prop('checked')).toBe(true); }); -test(' - renders a Checkbox with correct value (specified)', () => { +it(' - renders a Checkbox with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -151,7 +151,7 @@ test(' - renders a Checkbox with correct value (specified)', () => { expect(wrapper.find(Checkbox).prop('checked')).toBe(true); }); -test(' - renders a Checkbox which correctly reacts on change', () => { +it(' - renders a Checkbox which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -165,14 +165,14 @@ test(' - renders a Checkbox which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', false); }); -test(' - renders an Switch', () => { +it(' - renders an Switch', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(Switch)).toHaveLength(1); }); -test(' - renders a Switch with correct id (inherited)', () => { +it(' - renders a Switch with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -180,7 +180,7 @@ test(' - renders a Switch with correct id (inherited)', () => { expect(wrapper.find(Switch).prop('id')).toBeTruthy(); }); -test(' - renders a Switch with correct id (specified)', () => { +it(' - renders a Switch with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -188,7 +188,7 @@ test(' - renders a Switch with correct id (specified)', () => { expect(wrapper.find(Switch).prop('id')).toBe('y'); }); -test(' - renders a Switch with correct name', () => { +it(' - renders a Switch with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -196,7 +196,7 @@ test(' - renders a Switch with correct name', () => { expect(wrapper.find(Switch).prop('name')).toBe('x'); }); -test(' - renders an Switch with correct disabled state', () => { +it(' - renders an Switch with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -204,7 +204,7 @@ test(' - renders an Switch with correct disabled state', () => { expect(wrapper.find(Switch).prop('disabled')).toBe(true); }); -test(' - renders a Switch with correct label (specified)', () => { +it(' - renders a Switch with correct label (specified)', () => { const element = ( ); @@ -214,7 +214,7 @@ test(' - renders a Switch with correct label (specified)', () => { expect(wrapper.find(FormControlLabel).prop('label')).toBe('BoolFieldLabel'); }); -test(' - renders a Switch with correct label (transform)', () => { +it(' - renders a Switch with correct label (transform)', () => { const element = ( - renders a Switch with correct label (transform)', () => { expect(wrapper.find(FormControlLabel).prop('label')).toBe('BOOLFIELDLABEL'); }); -test(' - renders a Switch with correct legend (specified)', () => { +it(' - renders a Switch with correct legend (specified)', () => { const element = ( ); @@ -239,7 +239,7 @@ test(' - renders a Switch with correct legend (specified)', () => { expect(wrapper.find(FormLabel).text()).toBe('BoolFieldLegend *'); }); -test(' - renders a Switch with correct value (default)', () => { +it(' - renders a Switch with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -247,7 +247,7 @@ test(' - renders a Switch with correct value (default)', () => { expect(wrapper.find(Switch).prop('checked')).toBe(false); }); -test(' - renders a Switch with correct value (model)', () => { +it(' - renders a Switch with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -258,7 +258,7 @@ test(' - renders a Switch with correct value (model)', () => { expect(wrapper.find(Switch).prop('checked')).toBe(true); }); -test(' - renders a Switch with correct value (specified)', () => { +it(' - renders a Switch with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -266,7 +266,7 @@ test(' - renders a Switch with correct value (specified)', () => { expect(wrapper.find(Switch).prop('checked')).toBe(true); }); -test(' - renders a Switch which correctly reacts on change', () => { +it(' - renders a Switch which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -280,7 +280,7 @@ test(' - renders a Switch which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', false); }); -test(' - renders a helperText', () => { +it(' - renders a helperText', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); diff --git a/packages/uniforms-material/__tests__/DateField.tsx b/packages/uniforms-material/__tests__/DateField.tsx index fcd15f1dc..0df7166de 100644 --- a/packages/uniforms-material/__tests__/DateField.tsx +++ b/packages/uniforms-material/__tests__/DateField.tsx @@ -14,7 +14,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - DateField tests', () => { - test(' - handles "date" type correctly', () => { + it(' - handles "date" type correctly', () => { const onChange = jest.fn(); const initialDate = new Date(Date.UTC(2020, 0, 1)); @@ -36,7 +36,7 @@ describe('@RTL - DateField tests', () => { }); describe('@RTL - DateField tests', () => { - test(' - default props are not passed when MUI theme props are specified', () => { + it(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: false, margin: 'normal' } }, }); @@ -56,7 +56,7 @@ describe('@RTL - DateField tests', () => { ); }); - test(' - default props are passed when MUI theme props are absent', () => { + it(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -74,7 +74,7 @@ describe('@RTL - DateField tests', () => { ); }); - test(' - explicit props are passed when MUI theme props are specified', () => { + it(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: true, margin: 'dense' } }, }); @@ -100,56 +100,56 @@ describe('@RTL - DateField tests', () => { }); }); -test(' - renders Input', () => { +it(' - renders Input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(Input)).toHaveLength(1); }); -test(' - renders a Input with correct id (inherited)', () => { +it(' - renders a Input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(Input).prop('id')).toBeTruthy(); }); -test(' - renders a Input with correct id (specified)', () => { +it(' - renders a Input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(Input).prop('id')).toBe('y'); }); -test(' - renders a Input with correct name', () => { +it(' - renders a Input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(Input).prop('name')).toBe('x'); }); -test(' - renders an Input with correct disabled state', () => { +it(' - renders an Input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(FormControl).prop('disabled')).toBe(true); }); -test(' - renders an Input with correct readOnly state', () => { +it(' - renders an Input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(Input).prop('inputProps')!.readOnly).toBe(true); }); -test(' - renders a Input with correct label (specified)', () => { +it(' - renders a Input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(FormLabel).text()).toBe('DateFieldLabel *'); }); -test(' - renders a Input with correct value (default)', () => { +it(' - renders a Input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -173,7 +173,7 @@ test.each(['datetime-local', 'date'] as const)( }, ); -test(' - renders a Input with correct value (specified)', () => { +it(' - renders a Input with correct value (specified)', () => { const now = new Date(); const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -183,7 +183,7 @@ test(' - renders a Input with correct value (specified)', () => { ); }); -test(' - renders a Input which correctly reacts on change', () => { +it(' - renders a Input which correctly reacts on change', () => { const onChange = jest.fn(); const now = new Date(); @@ -198,7 +198,7 @@ test(' - renders a Input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', now); }); -test(' - renders a Input which correctly reacts on change (empty)', () => { +it(' - renders a Input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -214,7 +214,7 @@ test(' - renders a Input which correctly reacts on change (empty)', ( expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a Input which correctly reacts on change (overflow)', () => { +it(' - renders a Input which correctly reacts on change (overflow)', () => { const onChange = jest.fn(); const now = new Date(1e5, 0); @@ -229,7 +229,7 @@ test(' - renders a Input which correctly reacts on change (overflow)' expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a Input with correct error text (specified)', () => { +it(' - renders a Input with correct error text (specified)', () => { const error = new Error(); const element = ( @@ -239,7 +239,7 @@ test(' - renders a Input with correct error text (specified)', () => expect(wrapper.find(FormHelperText).text()).toBe('Error'); }); -test(' - renders a Input with correct error text (showInlineError=false)', () => { +it(' - renders a Input with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( { - test(' - default props are not passed when MUI theme props are specified', () => { + it(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { @@ -45,7 +45,7 @@ describe('@RTL - ErrorField tests', () => { ).toHaveLength(1); }); - test(' - default props are passed when MUI theme props are absent', () => { + it(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -67,7 +67,7 @@ describe('@RTL - ErrorField tests', () => { ).toHaveLength(0); }); - test(' - explicit props are passed when MUI theme props are specified', () => { + it(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: true, margin: 'dense', variant: 'filled' }, @@ -100,14 +100,14 @@ describe('@RTL - ErrorField tests', () => { }); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorField)).toHaveLength(1); }); -test(' - renders correct error message (context)', () => { +it(' - renders correct error message (context)', () => { const element = ; const wrapper = mount( element, @@ -118,7 +118,7 @@ test(' - renders correct error message (context)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -test(' - renders correct error message (specified)', () => { +it(' - renders correct error message (specified)', () => { const element = ( { - test(' - default props are not passed when MUI theme props are specified', () => { + it(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { @@ -50,7 +50,7 @@ describe('@RTL - ErrorsField tests', () => { ).toHaveLength(3); }); - test(' - default props are passed when MUI theme props are absent', () => { + it(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -72,7 +72,7 @@ describe('@RTL - ErrorsField tests', () => { ).toHaveLength(0); }); - test(' - explicit props are passed when MUI theme props are specified', () => { + it(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: true, margin: 'dense', variant: 'filled' }, @@ -105,14 +105,14 @@ describe('@RTL - ErrorsField tests', () => { }); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorsField)).toHaveLength(1); }); -test(' - renders list of correct error messages (context)', () => { +it(' - renders list of correct error messages (context)', () => { const element = ; const wrapper = mount( element, @@ -128,7 +128,7 @@ test(' - renders list of correct error messages (context)', () => { expect(wrapper.find(FormHelperText).at(2).text()).toBe('Z is required'); }); -test(' - renders children (specified)', () => { +it(' - renders children (specified)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-material/__tests__/HiddenField.tsx b/packages/uniforms-material/__tests__/HiddenField.tsx index 6f0ad02d0..c0258a9f4 100644 --- a/packages/uniforms-material/__tests__/HiddenField.tsx +++ b/packages/uniforms-material/__tests__/HiddenField.tsx @@ -4,14 +4,14 @@ import { HiddenField } from 'uniforms-material'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('hidden'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -62,7 +62,7 @@ test(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input which correctly reacts on model change', () => { +it(' - renders an input which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -76,7 +76,7 @@ test(' - renders an input which correctly reacts on model change', expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders an input which correctly reacts on model change (empty)', () => { +it(' - renders an input which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -90,7 +90,7 @@ test(' - renders an input which correctly reacts on model change (e expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders an input which correctly reacts on model change (same value)', () => { +it(' - renders an input which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -104,14 +104,14 @@ test(' - renders an input which correctly reacts on model change (s expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders nothing', () => { +it(' - renders nothing', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.children()).toHaveLength(0); }); -test(' - renders nothing which correctly reacts on model change', () => { +it(' - renders nothing which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ test(' - renders nothing which correctly reacts on model chan expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders nothing which correctly reacts on model change (empty)', () => { +it(' - renders nothing which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ test(' - renders nothing which correctly reacts on model chan expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders nothing which correctly reacts on model change (same value)', () => { +it(' - renders nothing which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; diff --git a/packages/uniforms-material/__tests__/ListAddField.tsx b/packages/uniforms-material/__tests__/ListAddField.tsx index a7455f9ba..d7037f519 100644 --- a/packages/uniforms-material/__tests__/ListAddField.tsx +++ b/packages/uniforms-material/__tests__/ListAddField.tsx @@ -14,14 +14,14 @@ const context = (schema?: object) => { onChange, model: { x: [] } }, ); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListAddField)).toHaveLength(1); }); -test(' - prevents onClick when disabled', () => { +it(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -29,7 +29,7 @@ test(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when readOnly', () => { +it(' - prevents onClick when readOnly', () => { const element = ; const wrapper = mount(element, context()); @@ -37,7 +37,7 @@ test(' - prevents onClick when readOnly', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when limit reached', () => { +it(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { maxCount: 0 } })); @@ -45,7 +45,7 @@ test(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - correctly reacts on click', () => { +it(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -53,7 +53,7 @@ test(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['y']); }); -test(' - renders correct icon', () => { +it(' - renders correct icon', () => { const element = } />; const wrapper = mount(element, context()); diff --git a/packages/uniforms-material/__tests__/ListDelField.tsx b/packages/uniforms-material/__tests__/ListDelField.tsx index 58dc59433..fad6e45ea 100644 --- a/packages/uniforms-material/__tests__/ListDelField.tsx +++ b/packages/uniforms-material/__tests__/ListDelField.tsx @@ -14,14 +14,14 @@ const context = (schema?: object) => { onChange, model: { x: ['x', 'y', 'z'] } }, ); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListDelField)).toHaveLength(1); }); -test(' - prevents onClick when disabled', () => { +it(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -29,7 +29,7 @@ test(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when readOnly', () => { +it(' - prevents onClick when readOnly', () => { const element = ; const wrapper = mount(element, context()); @@ -37,7 +37,7 @@ test(' - prevents onClick when readOnly', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when limit reached', () => { +it(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { minCount: 3 } })); @@ -45,7 +45,7 @@ test(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - correctly reacts on click', () => { +it(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -53,7 +53,7 @@ test(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['x', 'z']); }); -test(' - renders correct icon', () => { +it(' - renders correct icon', () => { const element = } />; const wrapper = mount(element, context()); diff --git a/packages/uniforms-material/__tests__/ListField.tsx b/packages/uniforms-material/__tests__/ListField.tsx index 0756ca02c..a8738c8a3 100644 --- a/packages/uniforms-material/__tests__/ListField.tsx +++ b/packages/uniforms-material/__tests__/ListField.tsx @@ -14,7 +14,7 @@ describe('@RTL - ListField tests', () => { }); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount( element, @@ -24,7 +24,7 @@ test(' - works', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -test(' - renders ListAddField', () => { +it(' - renders ListAddField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ test(' - renders ListAddField', () => { expect(wrapper.find(ListAddField).prop('name')).toBe('$'); }); -test(' - renders correct label (specified)', () => { +it(' - renders correct label (specified)', () => { const element = ; const wrapper = mount( element, @@ -46,7 +46,7 @@ test(' - renders correct label (specified)', () => { expect(wrapper.find(ListSubheader).text()).toBe('ListFieldLabel'); }); -test(' - renders correct number of items with model', () => { +it(' - renders correct number of items with model', () => { const element = ; const wrapper = mount( element, @@ -58,7 +58,7 @@ test(' - renders correct number of items with model', () => { expect(wrapper.find(ListItemField)).toHaveLength(3); }); -test(' - passes itemProps to its children', () => { +it(' - passes itemProps to its children', () => { const element = ; const wrapper = mount( element, @@ -70,7 +70,7 @@ test(' - passes itemProps to its children', () => { expect(wrapper.find(ListItemField).first().prop('data-xyz')).toBe(1); }); -test(' - renders children (specified)', () => { +it(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -89,7 +89,7 @@ test(' - renders children (specified)', () => { expect(Child).toHaveBeenCalledTimes(2); }); -test(' - renders children with correct name (children)', () => { +it(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -108,7 +108,7 @@ test(' - renders children with correct name (children)', () => { expect(wrapper.find(Child).at(1).prop('name')).toBe('1'); }); -test(' - renders children with correct name (value)', () => { +it(' - renders children with correct name (value)', () => { const element = ; const wrapper = mount( element, @@ -121,7 +121,7 @@ test(' - renders children with correct name (value)', () => { expect(wrapper.find(ListItemField).at(1).prop('name')).toBe('1'); }); -test(' - renders proper number of optional values after add new value', () => { +it(' - renders proper number of optional values after add new value', () => { const element = ; const onChange = jest.fn(); const wrapper = mount( diff --git a/packages/uniforms-material/__tests__/ListItemField.tsx b/packages/uniforms-material/__tests__/ListItemField.tsx index 996d39dbb..1bb1091e9 100644 --- a/packages/uniforms-material/__tests__/ListItemField.tsx +++ b/packages/uniforms-material/__tests__/ListItemField.tsx @@ -4,7 +4,7 @@ import { AutoField, ListDelField, ListItemField } from 'uniforms-material'; import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - works', () => { expect(wrapper.find(ListItemField)).toHaveLength(1); }); -test(' - renders ListDelField', () => { +it(' - renders ListDelField', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - renders ListDelField', () => { expect(wrapper.find(ListDelField).childAt(0).prop('name')).toBe('x.1'); }); -test(' - renders AutoField', () => { +it(' - renders AutoField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ test(' - renders AutoField', () => { expect(wrapper.find(AutoField)).toHaveLength(1); }); -test(' - renders children if specified', () => { +it(' - renders children if specified', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( diff --git a/packages/uniforms-material/__tests__/LongTextField.tsx b/packages/uniforms-material/__tests__/LongTextField.tsx index ad45237f4..c4cdd93f0 100644 --- a/packages/uniforms-material/__tests__/LongTextField.tsx +++ b/packages/uniforms-material/__tests__/LongTextField.tsx @@ -9,7 +9,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - LongTextField tests', () => { - test(' - default props are not passed when MUI theme props are specified', () => { + it(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: false, margin: 'normal' } }, }); @@ -29,7 +29,7 @@ describe('@RTL - LongTextField tests', () => { ); }); - test(' - default props are passed when MUI theme props are absent', () => { + it(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -47,7 +47,7 @@ describe('@RTL - LongTextField tests', () => { ); }); - test(' - explicit props are passed when MUI theme props are specified', () => { + it(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: true, margin: 'dense' } }, }); @@ -73,14 +73,14 @@ describe('@RTL - LongTextField tests', () => { }); }); -test(' - renders a TextField', () => { +it(' - renders a TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField)).toHaveLength(1); }); -test(' - renders a TextField with correct disabled state', () => { +it(' - renders a TextField with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -88,7 +88,7 @@ test(' - renders a TextField with correct disabled state', () => expect(wrapper.find(TextField).prop('disabled')).toBe(true); }); -test(' - renders a TextField with correct readOnly state', () => { +it(' - renders a TextField with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -96,7 +96,7 @@ test(' - renders a TextField with correct readOnly state', () => expect(wrapper.find(TextField).prop('inputProps')!.readOnly).toBe(true); }); -test(' - renders a TextField with correct id (inherited)', () => { +it(' - renders a TextField with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -104,7 +104,7 @@ test(' - renders a TextField with correct id (inherited)', () => expect(wrapper.find(TextField).prop('id')).toBeTruthy(); }); -test(' - renders a TextField with correct id (specified)', () => { +it(' - renders a TextField with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -112,7 +112,7 @@ test(' - renders a TextField with correct id (specified)', () => expect(wrapper.find(TextField).prop('id')).toBe('y'); }); -test(' - renders a TextField with correct name', () => { +it(' - renders a TextField with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -120,7 +120,7 @@ test(' - renders a TextField with correct name', () => { expect(wrapper.find(TextField).prop('name')).toBe('x'); }); -test(' - renders a TextField with correct placeholder', () => { +it(' - renders a TextField with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -128,7 +128,7 @@ test(' - renders a TextField with correct placeholder', () => { expect(wrapper.find(TextField).prop('placeholder')).toBe('y'); }); -test(' - renders a TextField with correct value (default)', () => { +it(' - renders a TextField with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -136,7 +136,7 @@ test(' - renders a TextField with correct value (default)', () => expect(wrapper.find(TextField).prop('value')).toBe(''); }); -test(' - renders a TextField with correct value (model)', () => { +it(' - renders a TextField with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -147,7 +147,7 @@ test(' - renders a TextField with correct value (model)', () => { expect(wrapper.find(TextField).prop('value')).toBe('y'); }); -test(' - renders a TextField with correct value (specified)', () => { +it(' - renders a TextField with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -155,7 +155,7 @@ test(' - renders a TextField with correct value (specified)', () expect(wrapper.find(TextField).prop('value')).toBe('y'); }); -test(' - renders a TextField which correctly reacts on change', () => { +it(' - renders a TextField which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -170,7 +170,7 @@ test(' - renders a TextField which correctly reacts on change', ( expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a TextField which correctly reacts on change (empty)', () => { +it(' - renders a TextField which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -185,7 +185,7 @@ test(' - renders a TextField which correctly reacts on change (em expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders a TextField which correctly reacts on change (same value)', () => { +it(' - renders a TextField which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -200,14 +200,14 @@ test(' - renders a TextField which correctly reacts on change (sa expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField).prop('label')).toBe('y'); }); -test(' - renders a TextField with correct error text (specified)', () => { +it(' - renders a TextField with correct error text (specified)', () => { const error = new Error(); const element = ( - renders a TextField with correct error text (specified)' expect(wrapper.find(TextField).prop('helperText')).toBe('Error'); }); -test(' - renders a TextField with correct error text (showInlineError=false)', () => { +it(' - renders a TextField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( { - test(' - default props are not passed when MUI theme props are specified', () => { + it(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: false, margin: 'normal' } }, }); @@ -30,7 +30,7 @@ describe('@RTL - NestField tests', () => { ); }); - test(' - default props are passed when MUI theme props are absent', () => { + it(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -48,7 +48,7 @@ describe('@RTL - NestField tests', () => { ); }); - test(' - explicit props are passed when MUI theme props are specified', () => { + it(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: true, margin: 'dense' } }, }); @@ -74,7 +74,7 @@ describe('@RTL - NestField tests', () => { }); }); -test(' - renders an for each field', () => { +it(' - renders an for each field', () => { const element = ; const wrapper = mount( element, @@ -90,7 +90,7 @@ test(' - renders an for each field', () => { expect(wrapper.find(AutoField).at(1).prop('name')).toBe('b'); }); -test(' - renders custom content if given', () => { +it(' - renders custom content if given', () => { const element = (
@@ -110,7 +110,7 @@ test(' - renders custom content if given', () => { expect(wrapper.find('article').prop('data-test')).toBe('content'); }); -test(' - renders a Subheader', () => { +it(' - renders a Subheader', () => { const element = ; const wrapper = mount( element, @@ -124,7 +124,7 @@ test(' - renders a Subheader', () => { expect(wrapper.find(FormLabel).at(0).text()).toBe('y *'); }); -test(' - renders a helperText', () => { +it(' - renders a helperText', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-material/__tests__/NumField.tsx b/packages/uniforms-material/__tests__/NumField.tsx index c8f73349c..e0eccbe0b 100644 --- a/packages/uniforms-material/__tests__/NumField.tsx +++ b/packages/uniforms-material/__tests__/NumField.tsx @@ -9,7 +9,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - NumField tests', () => { - test(' - default props are not passed when MUI theme props are specified', () => { + it(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: false, margin: 'normal' } }, }); @@ -29,7 +29,7 @@ describe('@RTL - NumField tests', () => { ); }); - test(' - default props are passed when MUI theme props are absent', () => { + it(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -47,7 +47,7 @@ describe('@RTL - NumField tests', () => { ); }); - test(' - explicit props are passed when MUI theme props are specified', () => { + it(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: true, margin: 'dense' } }, }); @@ -73,14 +73,14 @@ describe('@RTL - NumField tests', () => { }); }); -test(' - renders a TextField', () => { +it(' - renders a TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(TextField)).toHaveLength(1); }); -test(' - renders a TextField with correct disabled state', () => { +it(' - renders a TextField with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -88,7 +88,7 @@ test(' - renders a TextField with correct disabled state', () => { expect(wrapper.find(TextField).prop('disabled')).toBe(true); }); -test(' - renders a TextField with correct readOnly state', () => { +it(' - renders a TextField with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -96,7 +96,7 @@ test(' - renders a TextField with correct readOnly state', () => { expect(wrapper.find(TextField).prop('inputProps')!.readOnly).toBe(true); }); -test(' - renders a TextField with correct id (inherited)', () => { +it(' - renders a TextField with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -104,7 +104,7 @@ test(' - renders a TextField with correct id (inherited)', () => { expect(wrapper.find(TextField).prop('id')).toBeTruthy(); }); -test(' - renders a TextField with correct id (specified)', () => { +it(' - renders a TextField with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -112,7 +112,7 @@ test(' - renders a TextField with correct id (specified)', () => { expect(wrapper.find(TextField).prop('id')).toBe('y'); }); -test(' - renders a TextField with correct max', () => { +it(' - renders a TextField with correct max', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -120,7 +120,7 @@ test(' - renders a TextField with correct max', () => { expect(wrapper.find('input').prop('max')).toBe(10); }); -test(' - renders a TextField with correct min', () => { +it(' - renders a TextField with correct min', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -128,7 +128,7 @@ test(' - renders a TextField with correct min', () => { expect(wrapper.find('input').prop('min')).toBe(10); }); -test(' - renders a TextField with correct name', () => { +it(' - renders a TextField with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -136,7 +136,7 @@ test(' - renders a TextField with correct name', () => { expect(wrapper.find(TextField).prop('name')).toBe('x'); }); -test(' - renders a TextField with correct placeholder', () => { +it(' - renders a TextField with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -144,7 +144,7 @@ test(' - renders a TextField with correct placeholder', () => { expect(wrapper.find(TextField).prop('placeholder')).toBe('y'); }); -test(' - renders a TextField with correct step (decimal)', () => { +it(' - renders a TextField with correct step (decimal)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -152,7 +152,7 @@ test(' - renders a TextField with correct step (decimal)', () => { expect(wrapper.find('input').prop('step')).toBe(0.01); }); -test(' - renders a TextField with correct step (integer)', () => { +it(' - renders a TextField with correct step (integer)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -160,7 +160,7 @@ test(' - renders a TextField with correct step (integer)', () => { expect(wrapper.find('input').prop('step')).toBe(1); }); -test(' - renders a TextField with correct step (set)', () => { +it(' - renders a TextField with correct step (set)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -168,7 +168,7 @@ test(' - renders a TextField with correct step (set)', () => { expect(wrapper.find('input').prop('step')).toBe(3); }); -test(' - renders a TextField with correct type', () => { +it(' - renders a TextField with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -176,7 +176,7 @@ test(' - renders a TextField with correct type', () => { expect(wrapper.find(TextField).prop('type')).toBe('number'); }); -test(' - renders a TextField with correct value (default)', () => { +it(' - renders a TextField with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -184,7 +184,7 @@ test(' - renders a TextField with correct value (default)', () => { expect(wrapper.find(TextField).prop('value')).toBe(''); }); -test(' - renders a TextField with correct value (model)', () => { +it(' - renders a TextField with correct value (model)', () => { const onChange = jest.fn(); const element = ; @@ -226,7 +226,7 @@ test(' - renders a TextField with correct value (model)', () => { spy.mockRestore(); }); -test(' - renders a TextField with correct value (specified)', () => { +it(' - renders a TextField with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -234,7 +234,7 @@ test(' - renders a TextField with correct value (specified)', () => { expect(wrapper.find(TextField).prop('value')).toBe(2); }); -test(' - renders a TextField which correctly reacts on change', () => { +it(' - renders a TextField which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -249,7 +249,7 @@ test(' - renders a TextField which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -test(' - renders a TextField which correctly reacts on change (decimal on decimal)', () => { +it(' - renders a TextField which correctly reacts on change (decimal on decimal)', () => { const onChange = jest.fn(); const element = ; @@ -264,7 +264,7 @@ test(' - renders a TextField which correctly reacts on change (decimal expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); -test(' - renders a TextField which correctly reacts on change (decimal on integer)', () => { +it(' - renders a TextField which correctly reacts on change (decimal on integer)', () => { const onChange = jest.fn(); const element = ; @@ -279,7 +279,7 @@ test(' - renders a TextField which correctly reacts on change (decimal expect(onChange).toHaveBeenLastCalledWith('x', 2); }); -test(' - renders a TextField which correctly reacts on change (empty)', () => { +it(' - renders a TextField which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -294,7 +294,7 @@ test(' - renders a TextField which correctly reacts on change (empty)' expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a TextField which correctly reacts on change (same value)', () => { +it(' - renders a TextField which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -309,7 +309,7 @@ test(' - renders a TextField which correctly reacts on change (same va expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -test(' - renders a TextField which correctly reacts on change (zero)', () => { +it(' - renders a TextField which correctly reacts on change (zero)', () => { const onChange = jest.fn(); const element = ; @@ -324,7 +324,7 @@ test(' - renders a TextField which correctly reacts on change (zero)', expect(onChange).toHaveBeenLastCalledWith('x', 0); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -332,7 +332,7 @@ test(' - renders a label', () => { expect(wrapper.find(TextField).prop('label')).toBe('y'); }); -test(' - renders a TextField with correct error text (specified)', () => { +it(' - renders a TextField with correct error text (specified)', () => { const error = new Error(); const element = ( @@ -342,7 +342,7 @@ test(' - renders a TextField with correct error text (specified)', () expect(wrapper.find(TextField).prop('helperText')).toBe('Error'); }); -test(' - renders a TextField with correct error text (showInlineError=false)', () => { +it(' - renders a TextField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-material/__tests__/RadioField.tsx b/packages/uniforms-material/__tests__/RadioField.tsx index 3476330c6..3beaa6ffd 100644 --- a/packages/uniforms-material/__tests__/RadioField.tsx +++ b/packages/uniforms-material/__tests__/RadioField.tsx @@ -14,7 +14,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - RadioField tests', () => { - test(' - default props are not passed when MUI theme props are specified', () => { + it(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: false, margin: 'normal' } }, }); @@ -34,7 +34,7 @@ describe('@RTL - RadioField tests', () => { ); }); - test(' - default props are passed when MUI theme props are absent', () => { + it(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -52,7 +52,7 @@ describe('@RTL - RadioField tests', () => { ); }); - test(' - explicit props are passed when MUI theme props are specified', () => { + it(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: true, margin: 'dense' } }, }); @@ -78,7 +78,7 @@ describe('@RTL - RadioField tests', () => { }); }); -test(' - renders a set of Radio buttons', () => { +it(' - renders a set of Radio buttons', () => { const element = ; const wrapper = mount( element, @@ -88,7 +88,7 @@ test(' - renders a set of Radio buttons', () => { expect(wrapper.find(Radio)).toHaveLength(2); }); -test(' - renders a set of Radio buttons wrapped with RadioGroup', () => { +it(' - renders a set of Radio buttons wrapped with RadioGroup', () => { const element = ; const wrapper = mount( element, @@ -99,7 +99,7 @@ test(' - renders a set of Radio buttons wrapped with RadioGroup', () expect(wrapper.find(RadioGroup).find(Radio)).toHaveLength(2); }); -test(' - renders a set of Radio buttons with correct disabled state', () => { +it(' - renders a set of Radio buttons with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -109,7 +109,7 @@ test(' - renders a set of Radio buttons with correct disabled state' expect(wrapper.find(FormControl).prop('disabled')).toBe(true); }); -test(' - renders a RadioGroup with correct id (inherited)', () => { +it(' - renders a RadioGroup with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -120,7 +120,7 @@ test(' - renders a RadioGroup with correct id (inherited)', () => { expect(wrapper.find(RadioGroup).prop('id')).toBeTruthy(); }); -test(' - renders a RadioGroup with correct id (specified)', () => { +it(' - renders a RadioGroup with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -131,7 +131,7 @@ test(' - renders a RadioGroup with correct id (specified)', () => { expect(wrapper.find(RadioGroup).prop('id')).toBe('y'); }); -test(' - renders a RadioGroup with correct name', () => { +it(' - renders a RadioGroup with correct name', () => { const element = ; const wrapper = mount( element, @@ -142,7 +142,7 @@ test(' - renders a RadioGroup with correct name', () => { expect(wrapper.find(RadioGroup).prop('name')).toBe('x'); }); -test(' - renders a set of Radio buttons with correct options', () => { +it(' - renders a set of Radio buttons with correct options', () => { const element = ; const wrapper = mount( element, @@ -154,7 +154,7 @@ test(' - renders a set of Radio buttons with correct options', () => expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('b'); }); -test(' - renders a set of Radio buttons with correct options (transform)', () => { +it(' - renders a set of Radio buttons with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -166,7 +166,7 @@ test(' - renders a set of Radio buttons with correct options (transf expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('B'); }); -test(' - renders a RadioGroup with correct value (default)', () => { +it(' - renders a RadioGroup with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -177,7 +177,7 @@ test(' - renders a RadioGroup with correct value (default)', () => { expect(wrapper.find(RadioGroup).prop('value')).toBeFalsy(); }); -test(' - renders a RadioGroup with correct value (model)', () => { +it(' - renders a RadioGroup with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -191,7 +191,7 @@ test(' - renders a RadioGroup with correct value (model)', () => { expect(wrapper.find(RadioGroup).prop('value')).toBe('b'); }); -test(' - renders a RadioGroup with correct value (specified)', () => { +it(' - renders a RadioGroup with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -202,7 +202,7 @@ test(' - renders a RadioGroup with correct value (specified)', () => expect(wrapper.find(RadioGroup).prop('value')).toBe('b'); }); -test(' - renders a RadioGroup which correctly reacts on change', () => { +it(' - renders a RadioGroup which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -220,7 +220,7 @@ test(' - renders a RadioGroup which correctly reacts on change', () expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a RadioGroup which correctly reacts on change (same value)', () => { +it(' - renders a RadioGroup which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -238,7 +238,7 @@ test(' - renders a RadioGroup which correctly reacts on change (same expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -249,7 +249,7 @@ test(' - renders a label', () => { expect(wrapper.find(FormLabel).text()).toBe('y *'); }); -test(' - renders a helperText', () => { +it(' - renders a helperText', () => { const element = ; const wrapper = mount( element, @@ -260,7 +260,7 @@ test(' - renders a helperText', () => { expect(wrapper.find(FormHelperText).text()).toBe('Helper'); }); -test(' - renders a TextField with correct error text (specified)', () => { +it(' - renders a TextField with correct error text (specified)', () => { const error = new Error(); const element = ( @@ -273,7 +273,7 @@ test(' - renders a TextField with correct error text (specified)', ( expect(wrapper.find(FormHelperText).text()).toBe('Error'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), diff --git a/packages/uniforms-material/__tests__/SelectField.tsx b/packages/uniforms-material/__tests__/SelectField.tsx index 3d4c87aa6..632e868a0 100644 --- a/packages/uniforms-material/__tests__/SelectField.tsx +++ b/packages/uniforms-material/__tests__/SelectField.tsx @@ -18,7 +18,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - SelectField tests', () => { - test(' - default props are not passed when MUI theme props are specified', () => { + it(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: false, margin: 'normal' } }, }); @@ -38,7 +38,7 @@ describe('@RTL - SelectField tests', () => { ); }); - test(' - default props are passed when MUI theme props are absent', () => { + it(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -56,7 +56,7 @@ describe('@RTL - SelectField tests', () => { ); }); - test(' - explicit props are passed when MUI theme props are specified', () => { + it(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: true, margin: 'dense' } }, }); @@ -81,7 +81,7 @@ describe('@RTL - SelectField tests', () => { ); }); - test(' - MUI theme props are passed', () => { + it(' - MUI theme props are passed', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: false, margin: 'normal' } }, }); @@ -102,7 +102,7 @@ describe('@RTL - SelectField tests', () => { }); }); -test(' - renders a Select', () => { +it(' - renders a Select', () => { const element = ; const wrapper = mount( element, @@ -112,7 +112,7 @@ test(' - renders a Select', () => { expect(wrapper.find(Select)).toHaveLength(1); }); -test(' - renders a Select with correct disabled state', () => { +it(' - renders a Select with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -123,7 +123,7 @@ test(' - renders a Select with correct disabled state', () => { expect(wrapper.find(FormControl).prop('disabled')).toBe(true); }); -test(' - renders a Select with correct required state', () => { +it(' - renders a Select with correct required state', () => { const element = ; const wrapper = mount( element, @@ -134,7 +134,7 @@ test(' - renders a Select with correct required state', () => { expect(wrapper.find(TextField).prop('required')).toBe(true); }); -test(' - renders a Select with correct id (inherited)', () => { +it(' - renders a Select with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -146,7 +146,7 @@ test(' - renders a Select with correct id (inherited)', () => { expect(wrapper.find(Select).prop('inputProps')!.id).toBeTruthy(); }); -test(' - renders a Select with correct id (specified)', () => { +it(' - renders a Select with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -158,7 +158,7 @@ test(' - renders a Select with correct id (specified)', () => { expect(wrapper.find(Select).prop('inputProps')!.id).toBe('y'); }); -test(' - renders a Select with correct name', () => { +it(' - renders a Select with correct name', () => { const element = ; const wrapper = mount( element, @@ -170,7 +170,7 @@ test(' - renders a Select with correct name', () => { expect(wrapper.find(Select).prop('inputProps')!.name).toBe('x'); }); -test(' - renders a Select with correct options', () => { +it(' - renders a Select with correct options', () => { const element = ; const wrapper = mount( element, @@ -190,7 +190,7 @@ test(' - renders a Select with correct options', () => { }); }); -test(' - renders a Select with correct options (transform)', () => { +it(' - renders a Select with correct options (transform)', () => { const element = ( x.toUpperCase()} native /> ); @@ -212,7 +212,7 @@ test(' - renders a Select with correct options (transform)', () => }); }); -test(' - renders a Select with correct placeholder (implicit)', () => { +it(' - renders a Select with correct placeholder (implicit)', () => { const element = ; const wrapper = mount( element, @@ -232,7 +232,7 @@ test(' - renders a Select with correct placeholder (implicit)', () }); }); -test(' - renders a Select with correct value (default)', () => { +it(' - renders a Select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -243,7 +243,7 @@ test(' - renders a Select with correct value (default)', () => { expect(wrapper.find(Select).prop('value')).toBe(''); }); -test(' - renders a Select with correct value (model)', () => { +it(' - renders a Select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -257,7 +257,7 @@ test(' - renders a Select with correct value (model)', () => { expect(wrapper.find(Select).prop('value')).toBe('b'); }); -test(' - renders a Select with correct value (specified)', () => { +it(' - renders a Select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -268,7 +268,7 @@ test(' - renders a Select with correct value (specified)', () => { expect(wrapper.find(Select).prop('value')).toBe('b'); }); -test(' - renders a Select which correctly reacts on change', () => { +it(' - renders a Select which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -286,7 +286,7 @@ test(' - renders a Select which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a Select which correctly reacts on change (empty)', () => { +it(' - renders a Select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -304,7 +304,7 @@ test(' - renders a Select which correctly reacts on change (empty)' expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a Select which correctly reacts on change (same value)', () => { +it(' - renders a Select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -322,7 +322,7 @@ test(' - renders a Select which correctly reacts on change (same va expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -333,7 +333,7 @@ test(' - renders a label', () => { expect(wrapper.find(TextField).prop('label')).toBe('y'); }); -test(' - renders a SelectField with correct error text (showInlineError=true)', () => { +it(' - renders a SelectField with correct error text (showInlineError=true)', () => { const error = new Error(); const element = ( @@ -346,7 +346,7 @@ test(' - renders a SelectField with correct error text (showInlineE expect(wrapper.find(FormHelperText).text()).toBe('Error'); }); -test(' - renders a SelectField with correct error text (showInlineError=false)', () => { +it(' - renders a SelectField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders a SelectField with correct error text (showInlineE expect(wrapper.find(FormHelperText)).toHaveLength(0); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -test(' - disabled items (options) based on predicate', () => { +it(' - disabled items (options) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( @@ -394,7 +394,7 @@ test(' - disabled items (options) based on predicate', () => { expect(wrapper.find('option').at(1).prop('disabled')).toBe(false); }); -test(' - renders with correct classnames', () => { +it(' - renders with correct classnames', () => { const wrapper = mount( , createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), @@ -405,7 +405,7 @@ test(' - renders with correct classnames', () => { ); }); -test(' - renders a multiselect with correct value (default)', () => { +it(' - renders a multiselect with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -419,7 +419,7 @@ test(' - renders a multiselect with correct value (default)', () => expect(wrapper.find(Select).prop('value')).toStrictEqual([]); }); -test(' - renders a multiselect with correct value (model)', () => { +it(' - renders a multiselect with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -436,7 +436,7 @@ test(' - renders a multiselect with correct value (model)', () => { expect(wrapper.find(Select).prop('value')).toStrictEqual(['b']); }); -test(' - renders a multiselect with correct value (specified)', () => { +it(' - renders a multiselect with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -450,7 +450,7 @@ test(' - renders a multiselect with correct value (specified)', () expect(wrapper.find(Select).prop('value')).toStrictEqual(['b']); }); -test(' - renders a set of Radio buttons', () => { +it(' - renders a set of Radio buttons', () => { const element = ; const wrapper = mount( element, @@ -460,7 +460,7 @@ test(' - renders a set of Radio buttons', () => { expect(wrapper.find(Radio)).toHaveLength(2); }); -test(' - renders a set of Radio buttons with correct disabled state', () => { +it(' - renders a set of Radio buttons with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -472,7 +472,7 @@ test(' - renders a set of Radio buttons with correct dis expect(wrapper.find(Radio).at(1).prop('disabled')).toBe(true); }); -test(' - renders a set of Radio buttons with correct id (inherited)', () => { +it(' - renders a set of Radio buttons with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -484,7 +484,7 @@ test(' - renders a set of Radio buttons with correct id expect(wrapper.find(Radio).at(1).prop('id')).toBeTruthy(); }); -test(' - renders a set of Radio buttons with correct id (specified)', () => { +it(' - renders a set of Radio buttons with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -496,7 +496,7 @@ test(' - renders a set of Radio buttons with correct id expect(wrapper.find(Radio).at(1).prop('id')).toBe('y-Yg'); }); -test(' - renders a set of Radio buttons with correct name', () => { +it(' - renders a set of Radio buttons with correct name', () => { const element = ; const wrapper = mount( element, @@ -508,7 +508,7 @@ test(' - renders a set of Radio buttons with correct nam expect(wrapper.find(Radio).at(1).find('input').prop('name')).toBe('x'); }); -test(' - renders a set of Radio buttons with correct options', () => { +it(' - renders a set of Radio buttons with correct options', () => { const element = ; const wrapper = mount( element, @@ -520,7 +520,7 @@ test(' - renders a set of Radio buttons with correct opt expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('b'); }); -test(' - renders a set of Radio buttons with correct options (transform)', () => { +it(' - renders a set of Radio buttons with correct options (transform)', () => { const element = ( x.toUpperCase()} /> ); @@ -534,7 +534,7 @@ test(' - renders a set of Radio buttons with correct opt expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('B'); }); -test(' - renders a set of Radio buttons with correct value (default)', () => { +it(' - renders a set of Radio buttons with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -546,7 +546,7 @@ test(' - renders a set of Radio buttons with correct val expect(wrapper.find(Radio).at(1).find('input').prop('checked')).toBe(false); }); -test(' - renders a set of Radio buttons with correct value (model)', () => { +it(' - renders a set of Radio buttons with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -561,7 +561,7 @@ test(' - renders a set of Radio buttons with correct val expect(wrapper.find(Radio).at(1).find('input').prop('checked')).toBe(true); }); -test(' - renders a set of Radio buttons with correct value (specified)', () => { +it(' - renders a set of Radio buttons with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -573,7 +573,7 @@ test(' - renders a set of Radio buttons with correct val expect(wrapper.find(Radio).at(1).find('input').prop('checked')).toBe(true); }); -test(' - renders a set of Radio buttons which correctly reacts on change', () => { +it(' - renders a set of Radio buttons which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -591,7 +591,7 @@ test(' - renders a set of Radio buttons which correctly expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a set of Checkboxes which correctly reacts on change (array check)', () => { +it(' - renders a set of Checkboxes which correctly reacts on change (array check)', () => { const onChange = jest.fn(); const element = ; @@ -611,7 +611,7 @@ test(' - renders a set of Checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -test(' - renders a set of Checkboxes which correctly reacts on change (array uncheck)', () => { +it(' - renders a set of Checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); const element = ; const wrapper = mount( @@ -630,7 +630,7 @@ test(' - renders a set of Checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a set of Checkboxes with correct labels', () => { +it(' - renders a set of Checkboxes with correct labels', () => { const onChange = jest.fn(); const element = ; const wrapper = mount( @@ -649,7 +649,7 @@ test(' - renders a set of Checkboxes with correct labels expect(wrapper.find(FormControlLabel).at(1).text()).toBe('b'); }); -test(' - renders a set of Checkboxes which correct labels (transform)', () => { +it(' - renders a set of Checkboxes which correct labels (transform)', () => { const onChange = jest.fn(); const element = ( x.toUpperCase()} /> @@ -670,7 +670,7 @@ test(' - renders a set of Checkboxes which correct label expect(wrapper.find(FormControlLabel).at(1).text()).toBe('B'); }); -test(' - renders a set of Radio buttons which correctly reacts on change (same value)', () => { +it(' - renders a set of Radio buttons which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -690,7 +690,7 @@ test(' - renders a set of Radio buttons which correctly expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -700,7 +700,7 @@ test(' - renders a label', () => { expect(wrapper.find(FormLabel).text()).toBe('y *'); }); -test(' - renders a SelectField with correct error text (showInlineError=true)', () => { +it(' - renders a SelectField with correct error text (showInlineError=true)', () => { const error = new Error(); const element = ( - renders a SelectField with correct error text ( expect(wrapper.find(FormHelperText).text()).toBe('Error'); }); -test(' - renders a SelectField with correct error text (showInlineError=false)', () => { +it(' - renders a SelectField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders a SelectField with correct error text ( expect(wrapper.find(FormHelperText)).toHaveLength(0); }); -test(' - renders Checkbox with appearance=checkbox', () => { +it(' - renders Checkbox with appearance=checkbox', () => { const element = ; const wrapper = mount( element, @@ -752,7 +752,7 @@ test(' - renders Checkbox with appearance=checkbox', () expect(wrapper.find(Switch)).toHaveLength(0); }); -test(' - renders Switch with appearance=switch', () => { +it(' - renders Switch with appearance=switch', () => { const element = ; const wrapper = mount( element, @@ -766,14 +766,14 @@ test(' - renders Switch with appearance=switch', () => { expect(wrapper.find(Switch)).toHaveLength(2); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -test(' - disabled items (checkboxes) based on predicate', () => { +it(' - disabled items (checkboxes) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( diff --git a/packages/uniforms-material/__tests__/SubmitField.tsx b/packages/uniforms-material/__tests__/SubmitField.tsx index 720b639f4..824c4fcc2 100644 --- a/packages/uniforms-material/__tests__/SubmitField.tsx +++ b/packages/uniforms-material/__tests__/SubmitField.tsx @@ -8,7 +8,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - SubmitField tests', () => { - test(' - default props are not passed when MUI theme props are specified', () => { + it(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiButton: { variant: 'outlined' } }, }); @@ -23,7 +23,7 @@ describe('@RTL - SubmitField tests', () => { expect(elements).toHaveLength(1); }); - test(' - default props are passed when MUI theme props are absent', () => { + it(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -36,7 +36,7 @@ describe('@RTL - SubmitField tests', () => { expect(elements).toHaveLength(1); }); - test(' - explicit props are passed when MUI theme props are specified', () => { + it(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiButton: { variant: 'outlined' } }, }); @@ -56,21 +56,21 @@ describe('@RTL - SubmitField tests', () => { }); }); -test(' - renders', () => { +it(' - renders', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper).toHaveLength(1); }); -test(' - renders SubmitField with correct disabled state', () => { +it(' - renders SubmitField with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper.children().first().prop('disabled')).toBe(true); }); -test(' - renders SubmitField with correct disabled state when error (context)', () => { +it(' - renders SubmitField with correct disabled state when error (context)', () => { const error = new Error(); const element = ; const wrapper = mount(element, createContext({}, { error })); diff --git a/packages/uniforms-material/__tests__/TextField.tsx b/packages/uniforms-material/__tests__/TextField.tsx index efceb84cf..f472b0939 100644 --- a/packages/uniforms-material/__tests__/TextField.tsx +++ b/packages/uniforms-material/__tests__/TextField.tsx @@ -12,7 +12,7 @@ import mount from './_mount'; describe('@RTL - TextField tests', () => { testTextField(TextField); - test(' - renders a TextField with correct error text (specified)', () => { + it(' - renders a TextField with correct error text (specified)', () => { const errorMessage = 'Error'; render( { expect(screen.getByText(errorMessage)).toBeInTheDocument(); }); - test(' - renders a TextField with correct error text (showInlineError=false)', () => { + it(' - renders a TextField with correct error text (showInlineError=false)', () => { const errorMessage = 'Error'; render( { expect(screen.queryByText(errorMessage)).not.toBeInTheDocument(); }); - test(' - default props are not passed when MUI theme props are specified', () => { + it(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: false, margin: 'normal' } }, }); @@ -62,7 +62,7 @@ describe('@RTL - TextField tests', () => { ); }); - test(' - default props are passed when MUI theme props are absent', () => { + it(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -80,7 +80,7 @@ describe('@RTL - TextField tests', () => { ); }); - test(' - explicit props are passed when MUI theme props are specified', () => { + it(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: true, margin: 'dense' } }, }); @@ -106,14 +106,14 @@ describe('@RTL - TextField tests', () => { }); }); -test(' - renders an TextField', () => { +it(' - renders an TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextFieldMaterial)).toHaveLength(1); }); -test(' - renders a TextField with correct disabled state', () => { +it(' - renders a TextField with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -121,7 +121,7 @@ test(' - renders a TextField with correct disabled state', () => { expect(wrapper.find(TextFieldMaterial).prop('disabled')).toBe(true); }); -test(' - renders a TextField with correct readOnly state', () => { +it(' - renders a TextField with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -131,7 +131,7 @@ test(' - renders a TextField with correct readOnly state', () => { ); }); -test(' - renders a TextField with correct id (inherited)', () => { +it(' - renders a TextField with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -139,7 +139,7 @@ test(' - renders a TextField with correct id (inherited)', () => { expect(wrapper.find(TextFieldMaterial).prop('id')).toBeTruthy(); }); -test(' - renders a TextField with correct id (specified)', () => { +it(' - renders a TextField with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -147,7 +147,7 @@ test(' - renders a TextField with correct id (specified)', () => { expect(wrapper.find(TextFieldMaterial).prop('id')).toBe('y'); }); -test(' - renders a TextField with correct name', () => { +it(' - renders a TextField with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -155,7 +155,7 @@ test(' - renders a TextField with correct name', () => { expect(wrapper.find(TextFieldMaterial).prop('name')).toBe('x'); }); -test(' - renders a TextField with correct placeholder', () => { +it(' - renders a TextField with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -163,7 +163,7 @@ test(' - renders a TextField with correct placeholder', () => { expect(wrapper.find(TextFieldMaterial).prop('placeholder')).toBe('y'); }); -test(' - renders a TextField with correct value (default)', () => { +it(' - renders a TextField with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -171,7 +171,7 @@ test(' - renders a TextField with correct value (default)', () => { expect(wrapper.find(TextFieldMaterial).prop('value')).toBe(''); }); -test(' - renders a TextField with correct value (model)', () => { +it(' - renders a TextField with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -182,7 +182,7 @@ test(' - renders a TextField with correct value (model)', () => { expect(wrapper.find(TextFieldMaterial).prop('value')).toBe('y'); }); -test(' - renders a TextField with correct value (specified)', () => { +it(' - renders a TextField with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -190,7 +190,7 @@ test(' - renders a TextField with correct value (specified)', () => { expect(wrapper.find(TextFieldMaterial).prop('value')).toBe('y'); }); -test(' - renders a TextField which correctly reacts on change', () => { +it(' - renders a TextField which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -206,7 +206,7 @@ test(' - renders a TextField which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a TextField which correctly reacts on change (empty)', () => { +it(' - renders a TextField which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -222,7 +222,7 @@ test(' - renders a TextField which correctly reacts on change (empty) expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders a TextField which correctly reacts on change (same value)', () => { +it(' - renders a TextField which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -238,7 +238,7 @@ test(' - renders a TextField which correctly reacts on change (same v expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -246,7 +246,7 @@ test(' - renders a label', () => { expect(wrapper.find(TextFieldMaterial).prop('label')).toBe('y'); }); -test(' - renders a TextField with correct error text (specified)', () => { +it(' - renders a TextField with correct error text (specified)', () => { const error = new Error(); const element = ( @@ -256,7 +256,7 @@ test(' - renders a TextField with correct error text (specified)', () expect(wrapper.find(TextFieldMaterial).prop('helperText')).toBe('Error'); }); -test(' - renders a TextField with correct error text (showInlineError=false)', () => { +it(' - renders a TextField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders a TextField with correct error text (showInlineError expect(wrapper.find(TextFieldMaterial).prop('helperText')).toBeUndefined(); }); -test(' - renders a input with autocomplete off', () => { +it(' - renders a input with autocomplete off', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-material/__tests__/ValidateQuickForm.tsx b/packages/uniforms-material/__tests__/ValidateQuickForm.tsx index 8835ace6f..5a8633b1d 100644 --- a/packages/uniforms-material/__tests__/ValidateQuickForm.tsx +++ b/packages/uniforms-material/__tests__/ValidateQuickForm.tsx @@ -5,7 +5,7 @@ import createContext from './_createContext'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-material/__tests__/ValidatedForm.tsx b/packages/uniforms-material/__tests__/ValidatedForm.tsx index c8af38014..50ddb853a 100644 --- a/packages/uniforms-material/__tests__/ValidatedForm.tsx +++ b/packages/uniforms-material/__tests__/ValidatedForm.tsx @@ -5,7 +5,7 @@ import createContext from './_createContext'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-material/__tests__/wrapField.tsx b/packages/uniforms-material/__tests__/wrapField.tsx index 27f25020f..f44d2c911 100644 --- a/packages/uniforms-material/__tests__/wrapField.tsx +++ b/packages/uniforms-material/__tests__/wrapField.tsx @@ -5,21 +5,21 @@ import { wrapField } from 'uniforms-material'; import mount from './_mount'; -test(' - renders wrapper', () => { +it(' - renders wrapper', () => { const element = wrapField({},
); const wrapper = mount(element); expect(wrapper.find(FormControl)).toHaveLength(1); }); -test(' - renders wrapper with helper text', () => { +it(' - renders wrapper with helper text', () => { const element = wrapField({ helperText: 'Helper text' },
); const wrapper = mount(element); expect(wrapper.find(FormHelperText).text()).toBe('Helper text'); }); -test(' - renders wrapper with error', () => { +it(' - renders wrapper with error', () => { const element = wrapField( { showInlineError: true, diff --git a/packages/uniforms-mui/__tests__/AutoField.tsx b/packages/uniforms-mui/__tests__/AutoField.tsx index 806cb2df9..a8e6ffcb6 100644 --- a/packages/uniforms-mui/__tests__/AutoField.tsx +++ b/packages/uniforms-mui/__tests__/AutoField.tsx @@ -14,14 +14,14 @@ import { import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(AutoField)).toHaveLength(1); }); -test(' - detects RadioField', () => { +it(' - detects RadioField', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ test(' - detects RadioField', () => { expect(wrapper.find(RadioField.Component)).toHaveLength(1); }); -test(' - detects SelectField', () => { +it(' - detects SelectField', () => { const element = ; const wrapper = mount( element, @@ -50,14 +50,14 @@ test(' - detects SelectField', () => { expect(wrapper.find(SelectField.Component)).toHaveLength(1); }); -test(' - detects DateField', () => { +it(' - detects DateField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DateField.Component)).toHaveLength(1); }); -test(' - detects ListField', () => { +it(' - detects ListField', () => { const element = ; const wrapper = mount( element, @@ -67,35 +67,35 @@ test(' - detects ListField', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -test(' - detects NumField', () => { +it(' - detects NumField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(NumField.Component)).toHaveLength(1); }); -test(' - detects NestField', () => { +it(' - detects NestField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Object } })); expect(wrapper.find(NestField)).toHaveLength(1); }); -test(' - detects TextField', () => { +it(' - detects TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField.Component)).toHaveLength(1); }); -test(' - detects BoolField', () => { +it(' - detects BoolField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(BoolField.Component)).toHaveLength(1); }); -test(' - uses Component (schema)', () => { +it(' - uses Component (schema)', () => { const Component = jest.fn(() => null); const element = ; @@ -107,7 +107,7 @@ test(' - uses Component (schema)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -test(' - uses Component (props)', () => { +it(' - uses Component (props)', () => { const Component = jest.fn(() => null); const element = ; @@ -116,7 +116,7 @@ test(' - uses Component (props)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -test(' - uses Component (context)', () => { +it(' - uses Component (context)', () => { const FieldA = jest.fn(() => null); const FieldB = jest.fn(() => null); @@ -136,7 +136,7 @@ test(' - uses Component (context)', () => { expect(FieldB).toHaveBeenCalledTimes(1); }); -test(' - uses Component (invalid)', () => { +it(' - uses Component (invalid)', () => { const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {}); expect(() => { const element = ; diff --git a/packages/uniforms-mui/__tests__/AutoFields.tsx b/packages/uniforms-mui/__tests__/AutoFields.tsx index 37451658d..ac22fc9a5 100644 --- a/packages/uniforms-mui/__tests__/AutoFields.tsx +++ b/packages/uniforms-mui/__tests__/AutoFields.tsx @@ -4,14 +4,14 @@ import { AutoField, AutoFields } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('AutoFields')).toHaveLength(1); }); -test(' - render all fields by default', () => { +it(' - render all fields by default', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - render all fields by default', () => { expect(wrapper.find('input')).toHaveLength(3); }); -test(' - renders only specified fields', () => { +it(' - renders only specified fields', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ test(' - renders only specified fields', () => { ); }); -test(' - does not render ommited fields', () => { +it(' - does not render ommited fields', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ test(' - does not render ommited fields', () => { ); }); -test(' - wraps fields in specified element', () => { +it(' - wraps fields in specified element', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ test(' - wraps fields in specified element', () => { expect(wrapper.find('section').find('input')).toHaveLength(3); }); -test(' - pass props to the children', () => { +it(' - pass props to the children', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-mui/__tests__/AutoForm.tsx b/packages/uniforms-mui/__tests__/AutoForm.tsx index 29099e1c0..97929e35e 100644 --- a/packages/uniforms-mui/__tests__/AutoForm.tsx +++ b/packages/uniforms-mui/__tests__/AutoForm.tsx @@ -5,7 +5,7 @@ import createContext from './_createContext'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-mui/__tests__/BaseForm.tsx b/packages/uniforms-mui/__tests__/BaseForm.tsx index 4699e70cb..f87bed819 100644 --- a/packages/uniforms-mui/__tests__/BaseForm.tsx +++ b/packages/uniforms-mui/__tests__/BaseForm.tsx @@ -5,7 +5,7 @@ import createContext from './_createContext'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-mui/__tests__/BoolField.tsx b/packages/uniforms-mui/__tests__/BoolField.tsx index 4a863767e..49d8957d4 100644 --- a/packages/uniforms-mui/__tests__/BoolField.tsx +++ b/packages/uniforms-mui/__tests__/BoolField.tsx @@ -9,14 +9,14 @@ import { BoolField } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an Checkbox', () => { +it(' - renders an Checkbox', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(Checkbox)).toHaveLength(1); }); -test(' - renders a Checkbox with correct id (inherited)', () => { +it(' - renders a Checkbox with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -24,7 +24,7 @@ test(' - renders a Checkbox with correct id (inherited)', () => { expect(wrapper.find(Checkbox).prop('id')).toBeTruthy(); }); -test(' - renders a Checkbox with correct id (specified)', () => { +it(' - renders a Checkbox with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -32,7 +32,7 @@ test(' - renders a Checkbox with correct id (specified)', () => { expect(wrapper.find(Checkbox).prop('id')).toBe('y'); }); -test(' - renders a Checkbox with correct name', () => { +it(' - renders a Checkbox with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -40,7 +40,7 @@ test(' - renders a Checkbox with correct name', () => { expect(wrapper.find(Checkbox).prop('name')).toBe('x'); }); -test(' - renders an Checkbox with correct disabled state', () => { +it(' - renders an Checkbox with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -48,7 +48,7 @@ test(' - renders an Checkbox with correct disabled state', () => { expect(wrapper.find(Checkbox).prop('disabled')).toBe(true); }); -test(' - renders a Checkbox with correct label (specified)', () => { +it(' - renders a Checkbox with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -56,7 +56,7 @@ test(' - renders a Checkbox with correct label (specified)', () => { expect(wrapper.find(FormControlLabel).prop('label')).toBe('BoolFieldLabel'); }); -test(' - renders a Checkbox with correct value (default)', () => { +it(' - renders a Checkbox with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -64,7 +64,7 @@ test(' - renders a Checkbox with correct value (default)', () => { expect(wrapper.find(Checkbox).prop('checked')).toBe(false); }); -test(' - renders a Checkbox with correct value (model)', () => { +it(' - renders a Checkbox with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -75,7 +75,7 @@ test(' - renders a Checkbox with correct value (model)', () => { expect(wrapper.find(Checkbox).prop('checked')).toBe(true); }); -test(' - renders a Checkbox with correct value (specified)', () => { +it(' - renders a Checkbox with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -83,7 +83,7 @@ test(' - renders a Checkbox with correct value (specified)', () => { expect(wrapper.find(Checkbox).prop('checked')).toBe(true); }); -test(' - renders a Checkbox which correctly reacts on change', () => { +it(' - renders a Checkbox which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -97,14 +97,14 @@ test(' - renders a Checkbox which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', false); }); -test(' - renders an Switch', () => { +it(' - renders an Switch', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(Switch)).toHaveLength(1); }); -test(' - renders a Switch with correct id (inherited)', () => { +it(' - renders a Switch with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -112,7 +112,7 @@ test(' - renders a Switch with correct id (inherited)', () => { expect(wrapper.find(Switch).prop('id')).toBeTruthy(); }); -test(' - renders a Switch with correct id (specified)', () => { +it(' - renders a Switch with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -120,7 +120,7 @@ test(' - renders a Switch with correct id (specified)', () => { expect(wrapper.find(Switch).prop('id')).toBe('y'); }); -test(' - renders a Switch with correct name', () => { +it(' - renders a Switch with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -128,7 +128,7 @@ test(' - renders a Switch with correct name', () => { expect(wrapper.find(Switch).prop('name')).toBe('x'); }); -test(' - renders an Switch with correct disabled state', () => { +it(' - renders an Switch with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -136,7 +136,7 @@ test(' - renders an Switch with correct disabled state', () => { expect(wrapper.find(Switch).prop('disabled')).toBe(true); }); -test(' - renders a Switch with correct label (specified)', () => { +it(' - renders a Switch with correct label (specified)', () => { const element = ( ); @@ -146,7 +146,7 @@ test(' - renders a Switch with correct label (specified)', () => { expect(wrapper.find(FormControlLabel).prop('label')).toBe('BoolFieldLabel'); }); -test(' - renders a Switch with correct label (transform)', () => { +it(' - renders a Switch with correct label (transform)', () => { const element = ( - renders a Switch with correct label (transform)', () => { expect(wrapper.find(FormControlLabel).prop('label')).toBe('BOOLFIELDLABEL'); }); -test(' - renders a Switch with correct legend (specified)', () => { +it(' - renders a Switch with correct legend (specified)', () => { const element = ( ); @@ -171,7 +171,7 @@ test(' - renders a Switch with correct legend (specified)', () => { expect(wrapper.find(FormLabel).text()).toBe('BoolFieldLegend *'); }); -test(' - renders a Switch with correct value (default)', () => { +it(' - renders a Switch with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -179,7 +179,7 @@ test(' - renders a Switch with correct value (default)', () => { expect(wrapper.find(Switch).prop('checked')).toBe(false); }); -test(' - renders a Switch with correct value (model)', () => { +it(' - renders a Switch with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -190,7 +190,7 @@ test(' - renders a Switch with correct value (model)', () => { expect(wrapper.find(Switch).prop('checked')).toBe(true); }); -test(' - renders a Switch with correct value (specified)', () => { +it(' - renders a Switch with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -198,7 +198,7 @@ test(' - renders a Switch with correct value (specified)', () => { expect(wrapper.find(Switch).prop('checked')).toBe(true); }); -test(' - renders a Switch which correctly reacts on change', () => { +it(' - renders a Switch which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -212,7 +212,7 @@ test(' - renders a Switch which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', false); }); -test(' - renders a helperText', () => { +it(' - renders a helperText', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); diff --git a/packages/uniforms-mui/__tests__/DateField.tsx b/packages/uniforms-mui/__tests__/DateField.tsx index c282c5088..38f401437 100644 --- a/packages/uniforms-mui/__tests__/DateField.tsx +++ b/packages/uniforms-mui/__tests__/DateField.tsx @@ -12,7 +12,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - DateField tests', () => { - test(' - handles "date" type correctly', () => { + it(' - handles "date" type correctly', () => { const onChange = jest.fn(); const initialDate = new Date(Date.UTC(2020, 0, 1)); @@ -33,63 +33,63 @@ describe('@RTL - DateField tests', () => { }); }); -test(' - renders Input', () => { +it(' - renders Input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(OutlinedInput)).toHaveLength(1); }); -test(' - renders a Input with correct id (inherited)', () => { +it(' - renders a Input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(OutlinedInput).prop('id')).toBeTruthy(); }); -test(' - renders a Input with correct id (specified)', () => { +it(' - renders a Input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(OutlinedInput).prop('id')).toBe('y'); }); -test(' - renders a Input with correct name', () => { +it(' - renders a Input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(OutlinedInput).prop('name')).toBe('x'); }); -test(' - renders an Input with correct disabled state', () => { +it(' - renders an Input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(FormControl).prop('disabled')).toBe(true); }); -test(' - renders an Input with correct readOnly state', () => { +it(' - renders an Input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(OutlinedInput).prop('inputProps')!.readOnly).toBe(true); }); -test(' - renders a Input with correct label (specified)', () => { +it(' - renders a Input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(FormLabel).text()).toBe('DateFieldLabel *'); }); -test(' - renders a Input with correct value (default)', () => { +it(' - renders a Input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(OutlinedInput).prop('value')).toBe(''); }); -test(' - renders a Input with correct value (model)', () => { +it(' - renders a Input with correct value (model)', () => { const now = new Date(); const element = ; const wrapper = mount( @@ -102,7 +102,7 @@ test(' - renders a Input with correct value (model)', () => { ); }); -test(' - renders a Input with correct value (specified)', () => { +it(' - renders a Input with correct value (specified)', () => { const now = new Date(); const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -112,7 +112,7 @@ test(' - renders a Input with correct value (specified)', () => { ); }); -test(' - renders a Input which correctly reacts on change', () => { +it(' - renders a Input which correctly reacts on change', () => { const onChange = jest.fn(); const now = new Date(); @@ -129,7 +129,7 @@ test(' - renders a Input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', now); }); -test(' - renders a Input which correctly reacts on change (empty)', () => { +it(' - renders a Input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -145,7 +145,7 @@ test(' - renders a Input which correctly reacts on change (empty)', ( expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a Input which correctly reacts on change (overflow)', () => { +it(' - renders a Input which correctly reacts on change (overflow)', () => { const onChange = jest.fn(); const now = new Date(1e5, 0); @@ -162,7 +162,7 @@ test(' - renders a Input which correctly reacts on change (overflow)' expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a Input with correct error text (specified)', () => { +it(' - renders a Input with correct error text (specified)', () => { const error = new Error(); const element = ( @@ -172,7 +172,7 @@ test(' - renders a Input with correct error text (specified)', () => expect(wrapper.find(FormHelperText).text()).toBe('Error'); }); -test(' - renders a Input with correct error text (showInlineError=false)', () => { +it(' - renders a Input with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorField)).toHaveLength(1); }); -test(' - renders correct error message (context)', () => { +it(' - renders correct error message (context)', () => { const element = ; const wrapper = mount( element, @@ -29,7 +29,7 @@ test(' - renders correct error message (context)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -test(' - renders correct error message (specified)', () => { +it(' - renders correct error message (specified)', () => { const element = ( - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorsField)).toHaveLength(1); }); -test(' - renders list of correct error messages (context)', () => { +it(' - renders list of correct error messages (context)', () => { const element = ; const wrapper = mount( element, @@ -39,7 +39,7 @@ test(' - renders list of correct error messages (context)', () => { expect(wrapper.find(FormHelperText).at(2).text()).toBe('Z is required'); }); -test(' - renders children (specified)', () => { +it(' - renders children (specified)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-mui/__tests__/HiddenField.tsx b/packages/uniforms-mui/__tests__/HiddenField.tsx index 95771874a..c494d6216 100644 --- a/packages/uniforms-mui/__tests__/HiddenField.tsx +++ b/packages/uniforms-mui/__tests__/HiddenField.tsx @@ -4,14 +4,14 @@ import { HiddenField } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('hidden'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -62,7 +62,7 @@ test(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input which correctly reacts on model change', () => { +it(' - renders an input which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -76,7 +76,7 @@ test(' - renders an input which correctly reacts on model change', expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders an input which correctly reacts on model change (empty)', () => { +it(' - renders an input which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -90,7 +90,7 @@ test(' - renders an input which correctly reacts on model change (e expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders an input which correctly reacts on model change (same value)', () => { +it(' - renders an input which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -104,14 +104,14 @@ test(' - renders an input which correctly reacts on model change (s expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders nothing', () => { +it(' - renders nothing', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.children()).toHaveLength(0); }); -test(' - renders nothing which correctly reacts on model change', () => { +it(' - renders nothing which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ test(' - renders nothing which correctly reacts on model chan expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders nothing which correctly reacts on model change (empty)', () => { +it(' - renders nothing which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ test(' - renders nothing which correctly reacts on model chan expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders nothing which correctly reacts on model change (same value)', () => { +it(' - renders nothing which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; diff --git a/packages/uniforms-mui/__tests__/ListAddField.tsx b/packages/uniforms-mui/__tests__/ListAddField.tsx index 89a9c1799..329b9295f 100644 --- a/packages/uniforms-mui/__tests__/ListAddField.tsx +++ b/packages/uniforms-mui/__tests__/ListAddField.tsx @@ -14,7 +14,7 @@ const context = (schema?: object) => { onChange, model: { x: [] } }, ); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, context()); @@ -56,7 +56,7 @@ test.skip(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['y']); }); -test(' - renders correct icon', () => { +it(' - renders correct icon', () => { const element = } />; const wrapper = mount(element, context()); diff --git a/packages/uniforms-mui/__tests__/ListDelField.tsx b/packages/uniforms-mui/__tests__/ListDelField.tsx index 50b6849a7..9144f4832 100644 --- a/packages/uniforms-mui/__tests__/ListDelField.tsx +++ b/packages/uniforms-mui/__tests__/ListDelField.tsx @@ -14,7 +14,7 @@ const context = (schema?: object) => { onChange, model: { x: ['x', 'y', 'z'] } }, ); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, context()); @@ -56,7 +56,7 @@ test.skip(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['x', 'z']); }); -test(' - renders correct icon', () => { +it(' - renders correct icon', () => { const element = } />; const wrapper = mount(element, context()); diff --git a/packages/uniforms-mui/__tests__/ListField.tsx b/packages/uniforms-mui/__tests__/ListField.tsx index 908267623..57151b4fd 100644 --- a/packages/uniforms-mui/__tests__/ListField.tsx +++ b/packages/uniforms-mui/__tests__/ListField.tsx @@ -14,7 +14,7 @@ describe('@RTL - ListField tests', () => { }); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount( element, @@ -24,7 +24,7 @@ test(' - works', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -test(' - renders ListAddField', () => { +it(' - renders ListAddField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ test(' - renders ListAddField', () => { expect(wrapper.find(ListAddField).prop('name')).toBe('$'); }); -test(' - renders correct label (specified)', () => { +it(' - renders correct label (specified)', () => { const element = ; const wrapper = mount( element, @@ -46,7 +46,7 @@ test(' - renders correct label (specified)', () => { expect(wrapper.find(ListSubheader).text()).toBe('ListFieldLabel'); }); -test(' - renders correct number of items with model (specified)', () => { +it(' - renders correct number of items with model (specified)', () => { const element = ; const wrapper = mount( element, @@ -58,7 +58,7 @@ test(' - renders correct number of items with model (specified)', () expect(wrapper.find(ListItemField)).toHaveLength(3); }); -test(' - passes itemProps to its children', () => { +it(' - passes itemProps to its children', () => { const element = ; const wrapper = mount( element, @@ -70,7 +70,7 @@ test(' - passes itemProps to its children', () => { expect(wrapper.find(ListItemField).first().prop('data-xyz')).toBe(1); }); -test(' - renders children (specified)', () => { +it(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -89,7 +89,7 @@ test(' - renders children (specified)', () => { expect(Child).toHaveBeenCalledTimes(2); }); -test(' - renders children with correct name (children)', () => { +it(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -108,7 +108,7 @@ test(' - renders children with correct name (children)', () => { expect(wrapper.find(Child).at(1).prop('name')).toBe('1'); }); -test(' - renders children with correct name (value)', () => { +it(' - renders children with correct name (value)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-mui/__tests__/ListItemField.tsx b/packages/uniforms-mui/__tests__/ListItemField.tsx index 25de0fd8e..a0db11d60 100644 --- a/packages/uniforms-mui/__tests__/ListItemField.tsx +++ b/packages/uniforms-mui/__tests__/ListItemField.tsx @@ -4,7 +4,7 @@ import { AutoField, ListDelField, ListItemField } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - works', () => { expect(wrapper.find(ListItemField)).toHaveLength(1); }); -test(' - renders ListDelField', () => { +it(' - renders ListDelField', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - renders ListDelField', () => { expect(wrapper.find(ListDelField).childAt(0).prop('name')).toBe('x.1'); }); -test(' - renders AutoField', () => { +it(' - renders AutoField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ test(' - renders AutoField', () => { expect(wrapper.find(AutoField)).toHaveLength(1); }); -test(' - renders children if specified', () => { +it(' - renders children if specified', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( diff --git a/packages/uniforms-mui/__tests__/LongTextField.tsx b/packages/uniforms-mui/__tests__/LongTextField.tsx index 91089bfff..c24952f2b 100644 --- a/packages/uniforms-mui/__tests__/LongTextField.tsx +++ b/packages/uniforms-mui/__tests__/LongTextField.tsx @@ -5,14 +5,14 @@ import { LongTextField } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a TextField', () => { +it(' - renders a TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField)).toHaveLength(1); }); -test(' - renders a TextField with correct disabled state', () => { +it(' - renders a TextField with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -20,7 +20,7 @@ test(' - renders a TextField with correct disabled state', () => expect(wrapper.find(TextField).prop('disabled')).toBe(true); }); -test(' - renders a TextField with correct readOnly state', () => { +it(' - renders a TextField with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -28,7 +28,7 @@ test(' - renders a TextField with correct readOnly state', () => expect(wrapper.find(TextField).prop('inputProps')!.readOnly).toBe(true); }); -test(' - renders a TextField with correct id (inherited)', () => { +it(' - renders a TextField with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -36,7 +36,7 @@ test(' - renders a TextField with correct id (inherited)', () => expect(wrapper.find(TextField).prop('id')).toBeTruthy(); }); -test(' - renders a TextField with correct id (specified)', () => { +it(' - renders a TextField with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -44,7 +44,7 @@ test(' - renders a TextField with correct id (specified)', () => expect(wrapper.find(TextField).prop('id')).toBe('y'); }); -test(' - renders a TextField with correct name', () => { +it(' - renders a TextField with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -52,7 +52,7 @@ test(' - renders a TextField with correct name', () => { expect(wrapper.find(TextField).prop('name')).toBe('x'); }); -test(' - renders a TextField with correct placeholder', () => { +it(' - renders a TextField with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -60,7 +60,7 @@ test(' - renders a TextField with correct placeholder', () => { expect(wrapper.find(TextField).prop('placeholder')).toBe('y'); }); -test(' - renders a TextField with correct value (default)', () => { +it(' - renders a TextField with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -68,7 +68,7 @@ test(' - renders a TextField with correct value (default)', () => expect(wrapper.find(TextField).prop('value')).toBe(''); }); -test(' - renders a TextField with correct value (model)', () => { +it(' - renders a TextField with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -79,7 +79,7 @@ test(' - renders a TextField with correct value (model)', () => { expect(wrapper.find(TextField).prop('value')).toBe('y'); }); -test(' - renders a TextField with correct value (specified)', () => { +it(' - renders a TextField with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -87,7 +87,7 @@ test(' - renders a TextField with correct value (specified)', () expect(wrapper.find(TextField).prop('value')).toBe('y'); }); -test(' - renders a TextField which correctly reacts on change', () => { +it(' - renders a TextField which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -102,7 +102,7 @@ test(' - renders a TextField which correctly reacts on change', ( expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a TextField which correctly reacts on change (empty)', () => { +it(' - renders a TextField which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -117,7 +117,7 @@ test(' - renders a TextField which correctly reacts on change (em expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders a TextField which correctly reacts on change (same value)', () => { +it(' - renders a TextField which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -132,14 +132,14 @@ test(' - renders a TextField which correctly reacts on change (sa expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField).prop('label')).toBe('y'); }); -test(' - renders a TextField with correct error text (specified)', () => { +it(' - renders a TextField with correct error text (specified)', () => { const error = new Error(); const element = ( - renders a TextField with correct error text (specified)' expect(wrapper.find(TextField).prop('helperText')).toBe('Error'); }); -test(' - renders a TextField with correct error text (showInlineError=false)', () => { +it(' - renders a TextField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders an for each field', () => { +it(' - renders an for each field', () => { const element = ; const wrapper = mount( element, @@ -22,7 +22,7 @@ test(' - renders an for each field', () => { expect(wrapper.find(AutoField).at(1).prop('name')).toBe('b'); }); -test(' - renders custom content if given', () => { +it(' - renders custom content if given', () => { const element = (
@@ -42,7 +42,7 @@ test(' - renders custom content if given', () => { expect(wrapper.find('article').prop('data-test')).toBe('content'); }); -test(' - renders a Subheader', () => { +it(' - renders a Subheader', () => { const element = ; const wrapper = mount( element, @@ -56,7 +56,7 @@ test(' - renders a Subheader', () => { expect(wrapper.find(FormLabel).at(0).text()).toBe('y *'); }); -test(' - renders a helperText', () => { +it(' - renders a helperText', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-mui/__tests__/NumField.tsx b/packages/uniforms-mui/__tests__/NumField.tsx index 26afeb0ae..7c3c5988f 100644 --- a/packages/uniforms-mui/__tests__/NumField.tsx +++ b/packages/uniforms-mui/__tests__/NumField.tsx @@ -5,14 +5,14 @@ import { NumField } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a TextField', () => { +it(' - renders a TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(TextField)).toHaveLength(1); }); -test(' - renders a TextField with correct disabled state', () => { +it(' - renders a TextField with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -20,7 +20,7 @@ test(' - renders a TextField with correct disabled state', () => { expect(wrapper.find(TextField).prop('disabled')).toBe(true); }); -test(' - renders a TextField with correct readOnly state', () => { +it(' - renders a TextField with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -28,7 +28,7 @@ test(' - renders a TextField with correct readOnly state', () => { expect(wrapper.find(TextField).prop('inputProps')!.readOnly).toBe(true); }); -test(' - renders a TextField with correct id (inherited)', () => { +it(' - renders a TextField with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -36,7 +36,7 @@ test(' - renders a TextField with correct id (inherited)', () => { expect(wrapper.find(TextField).prop('id')).toBeTruthy(); }); -test(' - renders a TextField with correct id (specified)', () => { +it(' - renders a TextField with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -44,7 +44,7 @@ test(' - renders a TextField with correct id (specified)', () => { expect(wrapper.find(TextField).prop('id')).toBe('y'); }); -test(' - renders a TextField with correct max', () => { +it(' - renders a TextField with correct max', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -52,7 +52,7 @@ test(' - renders a TextField with correct max', () => { expect(wrapper.find('input').prop('max')).toBe(10); }); -test(' - renders a TextField with correct min', () => { +it(' - renders a TextField with correct min', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -60,7 +60,7 @@ test(' - renders a TextField with correct min', () => { expect(wrapper.find('input').prop('min')).toBe(10); }); -test(' - renders a TextField with correct name', () => { +it(' - renders a TextField with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -68,7 +68,7 @@ test(' - renders a TextField with correct name', () => { expect(wrapper.find(TextField).prop('name')).toBe('x'); }); -test(' - renders a TextField with correct placeholder', () => { +it(' - renders a TextField with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -76,7 +76,7 @@ test(' - renders a TextField with correct placeholder', () => { expect(wrapper.find(TextField).prop('placeholder')).toBe('y'); }); -test(' - renders a TextField with correct step (decimal)', () => { +it(' - renders a TextField with correct step (decimal)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -84,7 +84,7 @@ test(' - renders a TextField with correct step (decimal)', () => { expect(wrapper.find('input').prop('step')).toBe(0.01); }); -test(' - renders a TextField with correct step (integer)', () => { +it(' - renders a TextField with correct step (integer)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -92,7 +92,7 @@ test(' - renders a TextField with correct step (integer)', () => { expect(wrapper.find('input').prop('step')).toBe(1); }); -test(' - renders a TextField with correct step (set)', () => { +it(' - renders a TextField with correct step (set)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -100,7 +100,7 @@ test(' - renders a TextField with correct step (set)', () => { expect(wrapper.find('input').prop('step')).toBe(3); }); -test(' - renders a TextField with correct type', () => { +it(' - renders a TextField with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -108,7 +108,7 @@ test(' - renders a TextField with correct type', () => { expect(wrapper.find(TextField).prop('type')).toBe('number'); }); -test(' - renders a TextField with correct value (default)', () => { +it(' - renders a TextField with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -116,7 +116,7 @@ test(' - renders a TextField with correct value (default)', () => { expect(wrapper.find(TextField).prop('value')).toBe(''); }); -test(' - renders a TextField with correct value (model)', () => { +it(' - renders a TextField with correct value (model)', () => { const onChange = jest.fn(); const element = ; @@ -158,7 +158,7 @@ test(' - renders a TextField with correct value (model)', () => { spy.mockRestore(); }); -test(' - renders a TextField with correct value (specified)', () => { +it(' - renders a TextField with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -166,7 +166,7 @@ test(' - renders a TextField with correct value (specified)', () => { expect(wrapper.find(TextField).prop('value')).toBe(2); }); -test(' - renders a TextField which correctly reacts on change', () => { +it(' - renders a TextField which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -181,7 +181,7 @@ test(' - renders a TextField which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -test(' - renders a TextField which correctly reacts on change (decimal on decimal)', () => { +it(' - renders a TextField which correctly reacts on change (decimal on decimal)', () => { const onChange = jest.fn(); const element = ; @@ -196,7 +196,7 @@ test(' - renders a TextField which correctly reacts on change (decimal expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); -test(' - renders a TextField which correctly reacts on change (decimal on integer)', () => { +it(' - renders a TextField which correctly reacts on change (decimal on integer)', () => { const onChange = jest.fn(); const element = ; @@ -211,7 +211,7 @@ test(' - renders a TextField which correctly reacts on change (decimal expect(onChange).toHaveBeenLastCalledWith('x', 2); }); -test(' - renders a TextField which correctly reacts on change (empty)', () => { +it(' - renders a TextField which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -226,7 +226,7 @@ test(' - renders a TextField which correctly reacts on change (empty)' expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a TextField which correctly reacts on change (same value)', () => { +it(' - renders a TextField which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -241,7 +241,7 @@ test(' - renders a TextField which correctly reacts on change (same va expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -test(' - renders a TextField which correctly reacts on change (zero)', () => { +it(' - renders a TextField which correctly reacts on change (zero)', () => { const onChange = jest.fn(); const element = ; @@ -256,7 +256,7 @@ test(' - renders a TextField which correctly reacts on change (zero)', expect(onChange).toHaveBeenLastCalledWith('x', 0); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -264,7 +264,7 @@ test(' - renders a label', () => { expect(wrapper.find(TextField).prop('label')).toBe('y'); }); -test(' - renders a TextField with correct error text (specified)', () => { +it(' - renders a TextField with correct error text (specified)', () => { const error = new Error(); const element = ( @@ -274,7 +274,7 @@ test(' - renders a TextField with correct error text (specified)', () expect(wrapper.find(TextField).prop('helperText')).toBe('Error'); }); -test(' - renders a TextField with correct error text (showInlineError=false)', () => { +it(' - renders a TextField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-mui/__tests__/RadioField.tsx b/packages/uniforms-mui/__tests__/RadioField.tsx index 981da2dea..8144dcbcd 100644 --- a/packages/uniforms-mui/__tests__/RadioField.tsx +++ b/packages/uniforms-mui/__tests__/RadioField.tsx @@ -10,7 +10,7 @@ import { RadioField } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a set of Radio buttons', () => { +it(' - renders a set of Radio buttons', () => { const element = ; const wrapper = mount( element, @@ -20,7 +20,7 @@ test(' - renders a set of Radio buttons', () => { expect(wrapper.find(Radio)).toHaveLength(2); }); -test(' - renders a set of Radio buttons wrapped with RadioGroup', () => { +it(' - renders a set of Radio buttons wrapped with RadioGroup', () => { const element = ; const wrapper = mount( element, @@ -31,7 +31,7 @@ test(' - renders a set of Radio buttons wrapped with RadioGroup', () expect(wrapper.find(RadioGroup).find(Radio)).toHaveLength(2); }); -test(' - renders a set of Radio buttons with correct disabled state', () => { +it(' - renders a set of Radio buttons with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ test(' - renders a set of Radio buttons with correct disabled state' expect(wrapper.find(FormControl).prop('disabled')).toBe(true); }); -test(' - renders a RadioGroup with correct id (inherited)', () => { +it(' - renders a RadioGroup with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -52,7 +52,7 @@ test(' - renders a RadioGroup with correct id (inherited)', () => { expect(wrapper.find(RadioGroup).prop('id')).toBeTruthy(); }); -test(' - renders a RadioGroup with correct id (specified)', () => { +it(' - renders a RadioGroup with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -63,7 +63,7 @@ test(' - renders a RadioGroup with correct id (specified)', () => { expect(wrapper.find(RadioGroup).prop('id')).toBe('y'); }); -test(' - renders a RadioGroup with correct name', () => { +it(' - renders a RadioGroup with correct name', () => { const element = ; const wrapper = mount( element, @@ -74,7 +74,7 @@ test(' - renders a RadioGroup with correct name', () => { expect(wrapper.find(RadioGroup).prop('name')).toBe('x'); }); -test(' - renders a set of Radio buttons with correct options', () => { +it(' - renders a set of Radio buttons with correct options', () => { const element = ; const wrapper = mount( element, @@ -86,7 +86,7 @@ test(' - renders a set of Radio buttons with correct options', () => expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('b'); }); -test(' - renders a set of Radio buttons with correct options (transform)', () => { +it(' - renders a set of Radio buttons with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -98,7 +98,7 @@ test(' - renders a set of Radio buttons with correct options (transf expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('B'); }); -test(' - renders a RadioGroup with correct value (default)', () => { +it(' - renders a RadioGroup with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -109,7 +109,7 @@ test(' - renders a RadioGroup with correct value (default)', () => { expect(wrapper.find(RadioGroup).prop('value')).toBeFalsy(); }); -test(' - renders a RadioGroup with correct value (model)', () => { +it(' - renders a RadioGroup with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -123,7 +123,7 @@ test(' - renders a RadioGroup with correct value (model)', () => { expect(wrapper.find(RadioGroup).prop('value')).toBe('b'); }); -test(' - renders a RadioGroup with correct value (specified)', () => { +it(' - renders a RadioGroup with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -134,7 +134,7 @@ test(' - renders a RadioGroup with correct value (specified)', () => expect(wrapper.find(RadioGroup).prop('value')).toBe('b'); }); -test(' - renders a RadioGroup which correctly reacts on change', () => { +it(' - renders a RadioGroup which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -152,7 +152,7 @@ test(' - renders a RadioGroup which correctly reacts on change', () expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a RadioGroup which correctly reacts on change (same value)', () => { +it(' - renders a RadioGroup which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -170,7 +170,7 @@ test(' - renders a RadioGroup which correctly reacts on change (same expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -181,7 +181,7 @@ test(' - renders a label', () => { expect(wrapper.find(FormLabel).text()).toBe('y *'); }); -test(' - renders a helperText', () => { +it(' - renders a helperText', () => { const element = ; const wrapper = mount( element, @@ -192,7 +192,7 @@ test(' - renders a helperText', () => { expect(wrapper.find(FormHelperText).text()).toBe('Helper'); }); -test(' - renders a TextField with correct error text (specified)', () => { +it(' - renders a TextField with correct error text (specified)', () => { const error = new Error(); const element = ( @@ -205,7 +205,7 @@ test(' - renders a TextField with correct error text (specified)', ( expect(wrapper.find(FormHelperText).text()).toBe('Error'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), diff --git a/packages/uniforms-mui/__tests__/SelectField.tsx b/packages/uniforms-mui/__tests__/SelectField.tsx index b9e770ec5..840c69da2 100644 --- a/packages/uniforms-mui/__tests__/SelectField.tsx +++ b/packages/uniforms-mui/__tests__/SelectField.tsx @@ -14,7 +14,7 @@ import { SelectField } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a Select', () => { +it(' - renders a Select', () => { const element = ; const wrapper = mount( element, @@ -24,7 +24,7 @@ test(' - renders a Select', () => { expect(wrapper.find(Select)).toHaveLength(1); }); -test(' - renders a Select with correct disabled state', () => { +it(' - renders a Select with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ test(' - renders a Select with correct disabled state', () => { expect(wrapper.find(FormControl).prop('disabled')).toBe(true); }); -test(' - renders a Select with correct required state', () => { +it(' - renders a Select with correct required state', () => { const element = ; const wrapper = mount( element, @@ -46,7 +46,7 @@ test(' - renders a Select with correct required state', () => { expect(wrapper.find(TextField).prop('required')).toBe(true); }); -test(' - renders a Select with correct id (inherited)', () => { +it(' - renders a Select with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -58,7 +58,7 @@ test(' - renders a Select with correct id (inherited)', () => { expect(wrapper.find(Select).prop('inputProps')!.id).toBeTruthy(); }); -test(' - renders a Select with correct id (specified)', () => { +it(' - renders a Select with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -70,7 +70,7 @@ test(' - renders a Select with correct id (specified)', () => { expect(wrapper.find(Select).prop('inputProps')!.id).toBe('y'); }); -test(' - renders a Select with correct name', () => { +it(' - renders a Select with correct name', () => { const element = ; const wrapper = mount( element, @@ -82,7 +82,7 @@ test(' - renders a Select with correct name', () => { expect(wrapper.find(Select).prop('inputProps')!.name).toBe('x'); }); -test(' - renders a Select with correct options', () => { +it(' - renders a Select with correct options', () => { const element = ; const wrapper = mount( element, @@ -102,7 +102,7 @@ test(' - renders a Select with correct options', () => { }); }); -test(' - renders a Select with correct options (transform)', () => { +it(' - renders a Select with correct options (transform)', () => { const element = ( x.toUpperCase()} native /> ); @@ -124,7 +124,7 @@ test(' - renders a Select with correct options (transform)', () => }); }); -test(' - renders a Select with correct placeholder (implicit)', () => { +it(' - renders a Select with correct placeholder (implicit)', () => { const element = ; const wrapper = mount( element, @@ -144,7 +144,7 @@ test(' - renders a Select with correct placeholder (implicit)', () }); }); -test(' - renders a Select with correct value (default)', () => { +it(' - renders a Select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -155,7 +155,7 @@ test(' - renders a Select with correct value (default)', () => { expect(wrapper.find(Select).prop('value')).toBe(''); }); -test(' - renders a Select with correct value (model)', () => { +it(' - renders a Select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -169,7 +169,7 @@ test(' - renders a Select with correct value (model)', () => { expect(wrapper.find(Select).prop('value')).toBe('b'); }); -test(' - renders a Select with correct value (specified)', () => { +it(' - renders a Select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -180,7 +180,7 @@ test(' - renders a Select with correct value (specified)', () => { expect(wrapper.find(Select).prop('value')).toBe('b'); }); -test(' - renders a Select which correctly reacts on change', () => { +it(' - renders a Select which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -198,7 +198,7 @@ test(' - renders a Select which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a Select which correctly reacts on change (empty)', () => { +it(' - renders a Select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -216,7 +216,7 @@ test(' - renders a Select which correctly reacts on change (empty)' expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a Select which correctly reacts on change (same value)', () => { +it(' - renders a Select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -234,7 +234,7 @@ test(' - renders a Select which correctly reacts on change (same va expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -245,7 +245,7 @@ test(' - renders a label', () => { expect(wrapper.find(TextField).prop('label')).toBe('y'); }); -test(' - renders a SelectField with correct error text (showInlineError=true)', () => { +it(' - renders a SelectField with correct error text (showInlineError=true)', () => { const error = new Error(); const element = ( @@ -258,7 +258,7 @@ test(' - renders a SelectField with correct error text (showInlineE expect(wrapper.find(FormHelperText).text()).toBe('Error'); }); -test(' - renders a SelectField with correct error text (showInlineError=false)', () => { +it(' - renders a SelectField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders a SelectField with correct error text (showInlineE expect(wrapper.find(FormHelperText)).toHaveLength(0); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -test(' - disabled items (options) based on predicate', () => { +it(' - disabled items (options) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( @@ -306,7 +306,7 @@ test(' - disabled items (options) based on predicate', () => { expect(wrapper.find('option').at(1).prop('disabled')).toBe(false); }); -test(' - renders with correct classnames', () => { +it(' - renders with correct classnames', () => { const wrapper = mount( , createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), @@ -317,7 +317,7 @@ test(' - renders with correct classnames', () => { ); }); -test(' - renders a multiselect with correct value (default)', () => { +it(' - renders a multiselect with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -331,7 +331,7 @@ test(' - renders a multiselect with correct value (default)', () => expect(wrapper.find(Select).prop('value')).toStrictEqual([]); }); -test(' - renders a multiselect with correct value (model)', () => { +it(' - renders a multiselect with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -348,7 +348,7 @@ test(' - renders a multiselect with correct value (model)', () => { expect(wrapper.find(Select).prop('value')).toStrictEqual(['b']); }); -test(' - renders a multiselect with correct value (specified)', () => { +it(' - renders a multiselect with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -362,7 +362,7 @@ test(' - renders a multiselect with correct value (specified)', () expect(wrapper.find(Select).prop('value')).toStrictEqual(['b']); }); -test(' - renders a set of Radio buttons', () => { +it(' - renders a set of Radio buttons', () => { const element = ; const wrapper = mount( element, @@ -372,7 +372,7 @@ test(' - renders a set of Radio buttons', () => { expect(wrapper.find(Radio)).toHaveLength(2); }); -test(' - renders a set of Radio buttons with correct disabled state', () => { +it(' - renders a set of Radio buttons with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -384,7 +384,7 @@ test(' - renders a set of Radio buttons with correct dis expect(wrapper.find(Radio).at(1).prop('disabled')).toBe(true); }); -test(' - renders a set of Radio buttons with correct id (inherited)', () => { +it(' - renders a set of Radio buttons with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -396,7 +396,7 @@ test(' - renders a set of Radio buttons with correct id expect(wrapper.find(Radio).at(1).prop('id')).toBeTruthy(); }); -test(' - renders a set of Radio buttons with correct id (specified)', () => { +it(' - renders a set of Radio buttons with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -408,7 +408,7 @@ test(' - renders a set of Radio buttons with correct id expect(wrapper.find(Radio).at(1).prop('id')).toBe('y-Yg'); }); -test(' - renders a set of Radio buttons with correct name', () => { +it(' - renders a set of Radio buttons with correct name', () => { const element = ; const wrapper = mount( element, @@ -420,7 +420,7 @@ test(' - renders a set of Radio buttons with correct nam expect(wrapper.find(Radio).at(1).find('input').prop('name')).toBe('x'); }); -test(' - renders a set of Radio buttons with correct options', () => { +it(' - renders a set of Radio buttons with correct options', () => { const element = ; const wrapper = mount( element, @@ -432,7 +432,7 @@ test(' - renders a set of Radio buttons with correct opt expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('b'); }); -test(' - renders a set of Radio buttons with correct options (transform)', () => { +it(' - renders a set of Radio buttons with correct options (transform)', () => { const element = ( x.toUpperCase()} /> ); @@ -446,7 +446,7 @@ test(' - renders a set of Radio buttons with correct opt expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('B'); }); -test(' - renders a set of Radio buttons with correct value (default)', () => { +it(' - renders a set of Radio buttons with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -458,7 +458,7 @@ test(' - renders a set of Radio buttons with correct val expect(wrapper.find(Radio).at(1).find('input').prop('checked')).toBe(false); }); -test(' - renders a set of Radio buttons with correct value (model)', () => { +it(' - renders a set of Radio buttons with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -473,7 +473,7 @@ test(' - renders a set of Radio buttons with correct val expect(wrapper.find(Radio).at(1).find('input').prop('checked')).toBe(true); }); -test(' - renders a set of Radio buttons with correct value (specified)', () => { +it(' - renders a set of Radio buttons with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -485,7 +485,7 @@ test(' - renders a set of Radio buttons with correct val expect(wrapper.find(Radio).at(1).find('input').prop('checked')).toBe(true); }); -test(' - renders a set of Radio buttons which correctly reacts on change', () => { +it(' - renders a set of Radio buttons which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -503,7 +503,7 @@ test(' - renders a set of Radio buttons which correctly expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a set of Checkboxes which correctly reacts on change (array check)', () => { +it(' - renders a set of Checkboxes which correctly reacts on change (array check)', () => { const onChange = jest.fn(); const element = ; @@ -523,7 +523,7 @@ test(' - renders a set of Checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -test(' - renders a set of Checkboxes which correctly reacts on change (array uncheck)', () => { +it(' - renders a set of Checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); const element = ; const wrapper = mount( @@ -542,7 +542,7 @@ test(' - renders a set of Checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a set of Checkboxes with correct labels', () => { +it(' - renders a set of Checkboxes with correct labels', () => { const onChange = jest.fn(); const element = ; const wrapper = mount( @@ -561,7 +561,7 @@ test(' - renders a set of Checkboxes with correct labels expect(wrapper.find(FormControlLabel).at(1).text()).toBe('b'); }); -test(' - renders a set of Checkboxes which correct labels (transform)', () => { +it(' - renders a set of Checkboxes which correct labels (transform)', () => { const onChange = jest.fn(); const element = ( x.toUpperCase()} /> @@ -582,7 +582,7 @@ test(' - renders a set of Checkboxes which correct label expect(wrapper.find(FormControlLabel).at(1).text()).toBe('B'); }); -test(' - renders a set of Radio buttons which correctly reacts on change (same value)', () => { +it(' - renders a set of Radio buttons which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -602,7 +602,7 @@ test(' - renders a set of Radio buttons which correctly expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -612,7 +612,7 @@ test(' - renders a label', () => { expect(wrapper.find(FormLabel).text()).toBe('y *'); }); -test(' - renders a SelectField with correct error text (showInlineError=true)', () => { +it(' - renders a SelectField with correct error text (showInlineError=true)', () => { const error = new Error(); const element = ( - renders a SelectField with correct error text ( expect(wrapper.find(FormHelperText).text()).toBe('Error'); }); -test(' - renders a SelectField with correct error text (showInlineError=false)', () => { +it(' - renders a SelectField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders a SelectField with correct error text ( expect(wrapper.find(FormHelperText)).toHaveLength(0); }); -test(' - renders Checkbox with appearance=checkbox', () => { +it(' - renders Checkbox with appearance=checkbox', () => { const element = ; const wrapper = mount( element, @@ -664,7 +664,7 @@ test(' - renders Checkbox with appearance=checkbox', () expect(wrapper.find(Switch)).toHaveLength(0); }); -test(' - renders Switch with appearance=switch', () => { +it(' - renders Switch with appearance=switch', () => { const element = ; const wrapper = mount( element, @@ -678,14 +678,14 @@ test(' - renders Switch with appearance=switch', () => { expect(wrapper.find(Switch)).toHaveLength(2); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -test(' - disabled items (checkboxes) based on predicate', () => { +it(' - disabled items (checkboxes) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( diff --git a/packages/uniforms-mui/__tests__/SubmitField.tsx b/packages/uniforms-mui/__tests__/SubmitField.tsx index 046eb8fd1..ae6e6f92c 100644 --- a/packages/uniforms-mui/__tests__/SubmitField.tsx +++ b/packages/uniforms-mui/__tests__/SubmitField.tsx @@ -4,21 +4,21 @@ import { SubmitField } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders', () => { +it(' - renders', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper).toHaveLength(1); }); -test(' - renders SubmitField with correct disabled state', () => { +it(' - renders SubmitField with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper.children().first().prop('disabled')).toBe(true); }); -test(' - renders SubmitField with correct disabled state when error (context)', () => { +it(' - renders SubmitField with correct disabled state when error (context)', () => { const error = new Error(); const element = ; const wrapper = mount(element, createContext({}, { error })); diff --git a/packages/uniforms-mui/__tests__/TextField.tsx b/packages/uniforms-mui/__tests__/TextField.tsx index c9d563ca6..f2975ae55 100644 --- a/packages/uniforms-mui/__tests__/TextField.tsx +++ b/packages/uniforms-mui/__tests__/TextField.tsx @@ -10,14 +10,14 @@ describe('@RTL - TextField tests', () => { testTextField(TextField); }); -test(' - renders an TextField', () => { +it(' - renders an TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextFieldMaterial)).toHaveLength(1); }); -test(' - renders a TextField with correct disabled state', () => { +it(' - renders a TextField with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -25,7 +25,7 @@ test(' - renders a TextField with correct disabled state', () => { expect(wrapper.find(TextFieldMaterial).prop('disabled')).toBe(true); }); -test(' - renders a TextField with correct readOnly state', () => { +it(' - renders a TextField with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ test(' - renders a TextField with correct readOnly state', () => { ); }); -test(' - renders a TextField with correct id (inherited)', () => { +it(' - renders a TextField with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ test(' - renders a TextField with correct id (inherited)', () => { expect(wrapper.find(TextFieldMaterial).prop('id')).toBeTruthy(); }); -test(' - renders a TextField with correct id (specified)', () => { +it(' - renders a TextField with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ test(' - renders a TextField with correct id (specified)', () => { expect(wrapper.find(TextFieldMaterial).prop('id')).toBe('y'); }); -test(' - renders a TextField with correct name', () => { +it(' - renders a TextField with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -59,7 +59,7 @@ test(' - renders a TextField with correct name', () => { expect(wrapper.find(TextFieldMaterial).prop('name')).toBe('x'); }); -test(' - renders a TextField with correct placeholder', () => { +it(' - renders a TextField with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -67,7 +67,7 @@ test(' - renders a TextField with correct placeholder', () => { expect(wrapper.find(TextFieldMaterial).prop('placeholder')).toBe('y'); }); -test(' - renders a TextField with correct value (default)', () => { +it(' - renders a TextField with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -75,7 +75,7 @@ test(' - renders a TextField with correct value (default)', () => { expect(wrapper.find(TextFieldMaterial).prop('value')).toBe(''); }); -test(' - renders a TextField with correct value (model)', () => { +it(' - renders a TextField with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -86,7 +86,7 @@ test(' - renders a TextField with correct value (model)', () => { expect(wrapper.find(TextFieldMaterial).prop('value')).toBe('y'); }); -test(' - renders a TextField with correct value (specified)', () => { +it(' - renders a TextField with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -94,7 +94,7 @@ test(' - renders a TextField with correct value (specified)', () => { expect(wrapper.find(TextFieldMaterial).prop('value')).toBe('y'); }); -test(' - renders a TextField which correctly reacts on change', () => { +it(' - renders a TextField which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -110,7 +110,7 @@ test(' - renders a TextField which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a TextField which correctly reacts on change (empty)', () => { +it(' - renders a TextField which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -126,7 +126,7 @@ test(' - renders a TextField which correctly reacts on change (empty) expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders a TextField which correctly reacts on change (same value)', () => { +it(' - renders a TextField which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -142,7 +142,7 @@ test(' - renders a TextField which correctly reacts on change (same v expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -150,7 +150,7 @@ test(' - renders a label', () => { expect(wrapper.find(TextFieldMaterial).prop('label')).toBe('y'); }); -test(' - renders a TextField with correct error text (specified)', () => { +it(' - renders a TextField with correct error text (specified)', () => { const error = new Error(); const element = ( @@ -160,7 +160,7 @@ test(' - renders a TextField with correct error text (specified)', () expect(wrapper.find(TextFieldMaterial).prop('helperText')).toBe('Error'); }); -test(' - renders a TextField with correct error text (showInlineError=false)', () => { +it(' - renders a TextField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders a TextField with correct error text (showInlineError expect(wrapper.find(TextFieldMaterial).prop('helperText')).toBeUndefined(); }); -test(' - renders a input with autocomplete off', () => { +it(' - renders a input with autocomplete off', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-mui/__tests__/ValidateQuickForm.tsx b/packages/uniforms-mui/__tests__/ValidateQuickForm.tsx index fdae9b151..c9fa7957c 100644 --- a/packages/uniforms-mui/__tests__/ValidateQuickForm.tsx +++ b/packages/uniforms-mui/__tests__/ValidateQuickForm.tsx @@ -5,7 +5,7 @@ import createContext from './_createContext'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-mui/__tests__/ValidatedForm.tsx b/packages/uniforms-mui/__tests__/ValidatedForm.tsx index 2fc84e79f..c76a52065 100644 --- a/packages/uniforms-mui/__tests__/ValidatedForm.tsx +++ b/packages/uniforms-mui/__tests__/ValidatedForm.tsx @@ -5,7 +5,7 @@ import createContext from './_createContext'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-mui/__tests__/wrapField.tsx b/packages/uniforms-mui/__tests__/wrapField.tsx index af882cc7a..10ef50abc 100644 --- a/packages/uniforms-mui/__tests__/wrapField.tsx +++ b/packages/uniforms-mui/__tests__/wrapField.tsx @@ -5,21 +5,21 @@ import { wrapField } from 'uniforms-mui'; import mount from './_mount'; -test(' - renders wrapper', () => { +it(' - renders wrapper', () => { const element = wrapField({},
); const wrapper = mount(element); expect(wrapper.find(FormControl)).toHaveLength(1); }); -test(' - renders wrapper with helper text', () => { +it(' - renders wrapper with helper text', () => { const element = wrapField({ helperText: 'Helper text' },
); const wrapper = mount(element); expect(wrapper.find(FormHelperText).text()).toBe('Helper text'); }); -test(' - renders wrapper with error', () => { +it(' - renders wrapper with error', () => { const element = wrapField( { showInlineError: true, diff --git a/packages/uniforms-semantic/__tests__/AutoField.tsx b/packages/uniforms-semantic/__tests__/AutoField.tsx index 28b7de9fe..5afc791e6 100644 --- a/packages/uniforms-semantic/__tests__/AutoField.tsx +++ b/packages/uniforms-semantic/__tests__/AutoField.tsx @@ -14,14 +14,14 @@ import { import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(AutoField)).toHaveLength(1); }); -test(' - detects RadioField', () => { +it(' - detects RadioField', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ test(' - detects RadioField', () => { expect(wrapper.find(RadioField.Component)).toHaveLength(1); }); -test(' - detects SelectField', () => { +it(' - detects SelectField', () => { const element = ; const wrapper = mount( element, @@ -50,14 +50,14 @@ test(' - detects SelectField', () => { expect(wrapper.find(SelectField.Component)).toHaveLength(1); }); -test(' - detects DateField', () => { +it(' - detects DateField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DateField.Component)).toHaveLength(1); }); -test(' - detects ListField', () => { +it(' - detects ListField', () => { const element = ; const wrapper = mount( element, @@ -67,35 +67,35 @@ test(' - detects ListField', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -test(' - detects NumField', () => { +it(' - detects NumField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(NumField.Component)).toHaveLength(1); }); -test(' - detects NestField', () => { +it(' - detects NestField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Object } })); expect(wrapper.find(NestField)).toHaveLength(1); }); -test(' - detects TextField', () => { +it(' - detects TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField.Component)).toHaveLength(1); }); -test(' - detects BoolField', () => { +it(' - detects BoolField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(BoolField.Component)).toHaveLength(1); }); -test(' - detects Component (model)', () => { +it(' - detects Component (model)', () => { const Component = jest.fn(() => null); const element = ; @@ -107,7 +107,7 @@ test(' - detects Component (model)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -test(' - uses Component (props)', () => { +it(' - uses Component (props)', () => { const Component = jest.fn(() => null); const element = ; @@ -116,7 +116,7 @@ test(' - uses Component (props)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -test(' - uses Component (context)', () => { +it(' - uses Component (context)', () => { const FieldA = jest.fn(() => null); const FieldB = jest.fn(() => null); @@ -136,7 +136,7 @@ test(' - uses Component (context)', () => { expect(FieldB).toHaveBeenCalledTimes(1); }); -test(' - uses Component (invalid)', () => { +it(' - uses Component (invalid)', () => { const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {}); expect(() => { const element = ; diff --git a/packages/uniforms-semantic/__tests__/AutoFields.tsx b/packages/uniforms-semantic/__tests__/AutoFields.tsx index 96f48bf62..33f77caf2 100644 --- a/packages/uniforms-semantic/__tests__/AutoFields.tsx +++ b/packages/uniforms-semantic/__tests__/AutoFields.tsx @@ -4,14 +4,14 @@ import { AutoField, AutoFields } from 'uniforms-semantic'; import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('AutoFields')).toHaveLength(1); }); -test(' - render all fields by default', () => { +it(' - render all fields by default', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - render all fields by default', () => { expect(wrapper.find('input')).toHaveLength(3); }); -test(' - renders only specified fields', () => { +it(' - renders only specified fields', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ test(' - renders only specified fields', () => { ); }); -test(' - does not render ommited fields', () => { +it(' - does not render ommited fields', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ test(' - does not render ommited fields', () => { ); }); -test(' - wraps fields in specified element', () => { +it(' - wraps fields in specified element', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ test(' - wraps fields in specified element', () => { expect(wrapper.find('section').find('input')).toHaveLength(3); }); -test(' - pass props to the children', () => { +it(' - pass props to the children', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-semantic/__tests__/AutoForm.tsx b/packages/uniforms-semantic/__tests__/AutoForm.tsx index ec60672e8..b65febc85 100644 --- a/packages/uniforms-semantic/__tests__/AutoForm.tsx +++ b/packages/uniforms-semantic/__tests__/AutoForm.tsx @@ -4,7 +4,7 @@ import { AutoForm } from 'uniforms-semantic'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-semantic/__tests__/BaseForm.tsx b/packages/uniforms-semantic/__tests__/BaseForm.tsx index a89a9044b..b6170e597 100644 --- a/packages/uniforms-semantic/__tests__/BaseForm.tsx +++ b/packages/uniforms-semantic/__tests__/BaseForm.tsx @@ -4,7 +4,7 @@ import { BaseForm } from 'uniforms-semantic'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-semantic/__tests__/BoolField.tsx b/packages/uniforms-semantic/__tests__/BoolField.tsx index e4d8feb99..19a565477 100644 --- a/packages/uniforms-semantic/__tests__/BoolField.tsx +++ b/packages/uniforms-semantic/__tests__/BoolField.tsx @@ -4,14 +4,14 @@ import { BoolField } from 'uniforms-semantic'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders a input with correct id (inherited)', () => { +it(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -19,7 +19,7 @@ test(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders a input with correct id (specified)', () => { +it(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -27,7 +27,7 @@ test(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders a input with correct name', () => { +it(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -35,7 +35,7 @@ test(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -43,7 +43,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('checkbox'); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -65,7 +65,7 @@ test(' - renders an input with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a input with correct label (specified)', () => { +it(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -76,7 +76,7 @@ test(' - renders a input with correct label (specified)', () => { ); }); -test(' - renders a input with correct value (default)', () => { +it(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -84,7 +84,7 @@ test(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('checked')).toBe(false); }); -test(' - renders a input with correct value (model)', () => { +it(' - renders a input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -95,7 +95,7 @@ test(' - renders a input with correct value (model)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -test(' - renders a input with correct value (specified)', () => { +it(' - renders a input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -103,7 +103,7 @@ test(' - renders a input with correct value (specified)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -test(' - renders a input which correctly reacts on change', () => { +it(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -117,7 +117,7 @@ test(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', true); }); -test(' - renders a input which correctly reacts on change', () => { +it(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -131,7 +131,7 @@ test(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', true); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -140,7 +140,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -150,7 +150,7 @@ test(' - renders correct error text (specified)', () => { expect(wrapper.children().last().text()).toBe('Error'); }); -test(' - renders correct error text (showInlineError=false)', () => { +it(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.children().last().text()).not.toBe('Error'); }); -test(' - renders with a custom wrapClassName', () => { +it(' - renders with a custom wrapClassName', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('.ui.test-class-name')).toHaveLength(1); }); -test(' - renders with a `fitted` className when `label` is disabled', () => { +it(' - renders with a `fitted` className when `label` is disabled', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -180,7 +180,7 @@ test(' - renders with a `fitted` className when `label` is disabled', expect(found.hasClass('fitted')).toEqual(true); }); -test(' - renders without a `fitted` className when `label` is enabled', () => { +it(' - renders without a `fitted` className when `label` is enabled', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-semantic/__tests__/DateField.tsx b/packages/uniforms-semantic/__tests__/DateField.tsx index 121e08ce7..7568cb1c9 100644 --- a/packages/uniforms-semantic/__tests__/DateField.tsx +++ b/packages/uniforms-semantic/__tests__/DateField.tsx @@ -8,7 +8,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - DateField tests', () => { - test(' - handles "date" type correctly', () => { + it(' - handles "date" type correctly', () => { const onChange = jest.fn(); const initialDate = new Date(Date.UTC(2020, 0, 1)); @@ -29,14 +29,14 @@ describe('@RTL - DateField tests', () => { }); }); -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders a input with correct id (inherited)', () => { +it(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -44,7 +44,7 @@ test(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders a input with correct id (specified)', () => { +it(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -52,7 +52,7 @@ test(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders a input with correct name', () => { +it(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -60,7 +60,7 @@ test(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -79,7 +79,7 @@ test.each(['datetime-local', 'date'] as const)( }, ); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -87,7 +87,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -95,7 +95,7 @@ test(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -test(' - renders a input with correct label (specified)', () => { +it(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -106,7 +106,7 @@ test(' - renders a input with correct label (specified)', () => { ); }); -test(' - renders a input with correct value (default)', () => { +it(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -114,7 +114,7 @@ test(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders a input with correct value (model)', () => { +it(' - renders a input with correct value (model)', () => { const now = new Date(); const element = ; const wrapper = mount( @@ -128,7 +128,7 @@ test(' - renders a input with correct value (model)', () => { ); }); -test(' - renders a input with correct value (specified)', () => { +it(' - renders a input with correct value (specified)', () => { const now = new Date(); const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -139,7 +139,7 @@ test(' - renders a input with correct value (specified)', () => { ); }); -test(' - renders a input which correctly reacts on change', () => { +it(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const now = new Date(); @@ -158,7 +158,7 @@ test(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', now); }); -test(' - renders a input which correctly reacts on change (empty)', () => { +it(' - renders a input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -176,7 +176,7 @@ test(' - renders a input which correctly reacts on change (empty)', ( expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a input which correctly reacts on change (overflow)', () => { +it(' - renders a input which correctly reacts on change (overflow)', () => { const onChange = jest.fn(); const now = new Date(1e5, 0); @@ -195,7 +195,7 @@ test(' - renders a input which correctly reacts on change (overflow)' expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -204,7 +204,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -214,7 +214,7 @@ test(' - renders correct error text (specified)', () => { expect(wrapper.children().last().text()).toBe('Error'); }); -test(' - renders correct error text (showInlineError=false)', () => { +it(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.children().last().text()).not.toBe('Error'); }); -test(' - renders a icon', () => { +it(' - renders a icon', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find('i')).toHaveLength(1); }); -test(' - renders a icon', () => { +it(' - renders a icon', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find('i')).toHaveLength(1); }); -test(' - renders with a custom wrapClassName', () => { +it(' - renders with a custom wrapClassName', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); diff --git a/packages/uniforms-semantic/__tests__/ErrorField.tsx b/packages/uniforms-semantic/__tests__/ErrorField.tsx index ed4e36e25..607afaa10 100644 --- a/packages/uniforms-semantic/__tests__/ErrorField.tsx +++ b/packages/uniforms-semantic/__tests__/ErrorField.tsx @@ -11,14 +11,14 @@ const error = { message: 'X is required [validation-error]', }; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorField)).toHaveLength(1); }); -test(' - renders correct error message (context)', () => { +it(' - renders correct error message (context)', () => { const element = ; const wrapper = mount( element, @@ -29,7 +29,7 @@ test(' - renders correct error message (context)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -test(' - renders correct error message (specified)', () => { +it(' - renders correct error message (specified)', () => { const element = ( - renders correct error message (specified)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -test(' - renders correct children if specified', () => { +it(' - renders correct children if specified', () => { const element = Error; const wrapper = mount( element, diff --git a/packages/uniforms-semantic/__tests__/ErrorsField.tsx b/packages/uniforms-semantic/__tests__/ErrorsField.tsx index 8b83e5ff7..7d7146fd6 100644 --- a/packages/uniforms-semantic/__tests__/ErrorsField.tsx +++ b/packages/uniforms-semantic/__tests__/ErrorsField.tsx @@ -15,14 +15,14 @@ const error = { message: 'X is required [validation-error]', }; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorsField)).toHaveLength(1); }); -test(' - renders list of correct error messages (context)', () => { +it(' - renders list of correct error messages (context)', () => { const element = ; const wrapper = mount( element, @@ -38,7 +38,7 @@ test(' - renders list of correct error messages (context)', () => { expect(wrapper.find('li').at(2).text()).toBe('Z is required'); }); -test(' - renders children (specified)', () => { +it(' - renders children (specified)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-semantic/__tests__/HiddenField.tsx b/packages/uniforms-semantic/__tests__/HiddenField.tsx index f8d7481d2..5d1cc49a4 100644 --- a/packages/uniforms-semantic/__tests__/HiddenField.tsx +++ b/packages/uniforms-semantic/__tests__/HiddenField.tsx @@ -4,14 +4,14 @@ import { HiddenField } from 'uniforms-semantic'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('hidden'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -62,7 +62,7 @@ test(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input which correctly reacts on model change', () => { +it(' - renders an input which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -76,7 +76,7 @@ test(' - renders an input which correctly reacts on model change', expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders an input which correctly reacts on model change (empty)', () => { +it(' - renders an input which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -90,7 +90,7 @@ test(' - renders an input which correctly reacts on model change (e expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders an input which correctly reacts on model change (same value)', () => { +it(' - renders an input which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -104,14 +104,14 @@ test(' - renders an input which correctly reacts on model change (s expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders nothing', () => { +it(' - renders nothing', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.children()).toHaveLength(0); }); -test(' - renders nothing which correctly reacts on model change', () => { +it(' - renders nothing which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ test(' - renders nothing which correctly reacts on model chan expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders nothing which correctly reacts on model change (empty)', () => { +it(' - renders nothing which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ test(' - renders nothing which correctly reacts on model chan expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders nothing which correctly reacts on model change (same value)', () => { +it(' - renders nothing which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; diff --git a/packages/uniforms-semantic/__tests__/ListAddField.tsx b/packages/uniforms-semantic/__tests__/ListAddField.tsx index 409bf402c..a2472a43a 100644 --- a/packages/uniforms-semantic/__tests__/ListAddField.tsx +++ b/packages/uniforms-semantic/__tests__/ListAddField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListAddField)).toHaveLength(1); }); -test(' - prevents onClick when disabled', () => { +it(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ test(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when limit reached', () => { +it(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { maxCount: 0 } })); @@ -39,7 +39,7 @@ test(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - correctly reacts on click', () => { +it(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ test(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['y']); }); -test(' - correctly reacts on keyboard enter key', () => { +it(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-semantic/__tests__/ListDelField.tsx b/packages/uniforms-semantic/__tests__/ListDelField.tsx index 9d0d6e2e5..6ae5ead98 100644 --- a/packages/uniforms-semantic/__tests__/ListDelField.tsx +++ b/packages/uniforms-semantic/__tests__/ListDelField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListDelField)).toHaveLength(1); }); -test(' - prevents onClick when disabled', () => { +it(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ test(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when limit reached', () => { +it(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { minCount: 3 } })); @@ -39,7 +39,7 @@ test(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - correctly reacts on click', () => { +it(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ test(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['x', 'z']); }); -test(' - correctly reacts on keyboard enter key', () => { +it(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-semantic/__tests__/ListField.tsx b/packages/uniforms-semantic/__tests__/ListField.tsx index ba41431a1..7616a1329 100644 --- a/packages/uniforms-semantic/__tests__/ListField.tsx +++ b/packages/uniforms-semantic/__tests__/ListField.tsx @@ -12,7 +12,7 @@ describe('@RTL - ListField tests', () => { }); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount( element, @@ -22,7 +22,7 @@ test(' - works', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -test(' - renders ListAddField', () => { +it(' - renders ListAddField', () => { const element = ; const wrapper = mount( element, @@ -33,7 +33,7 @@ test(' - renders ListAddField', () => { expect(wrapper.find(ListAddField).prop('name')).toBe('$'); }); -test(' - renders correct label (specified)', () => { +it(' - renders correct label (specified)', () => { const element = ; const wrapper = mount( element, @@ -46,7 +46,7 @@ test(' - renders correct label (specified)', () => { ); }); -test(' - renders correct number of items with model (specified)', () => { +it(' - renders correct number of items with model (specified)', () => { const element = ; const wrapper = mount( element, @@ -58,7 +58,7 @@ test(' - renders correct number of items with model (specified)', () expect(wrapper.find('input')).toHaveLength(3); }); -test(' - passes itemProps to its children', () => { +it(' - passes itemProps to its children', () => { const element = ; const wrapper = mount( element, @@ -70,7 +70,7 @@ test(' - passes itemProps to its children', () => { expect(wrapper.find(ListItemField).first().prop('data-xyz')).toBe(1); }); -test(' - renders children (specified)', () => { +it(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -89,7 +89,7 @@ test(' - renders children (specified)', () => { expect(Child).toHaveBeenCalledTimes(2); }); -test(' - renders children with correct name (children)', () => { +it(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -108,7 +108,7 @@ test(' - renders children with correct name (children)', () => { expect(wrapper.find(Child).at(1).prop('name')).toBe('1'); }); -test(' - renders children with correct name (value)', () => { +it(' - renders children with correct name (value)', () => { const element = ; const wrapper = mount( element, @@ -121,7 +121,7 @@ test(' - renders children with correct name (value)', () => { expect(wrapper.find(ListItemField).at(1).prop('name')).toBe('1'); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -134,7 +134,7 @@ test(' - renders correct error text (specified)', () => { expect(wrapper.children().first().text()).toBe('Error'); }); -test(' - renders correct error text (showInlineError=false)', () => { +it(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.children().first().text()).not.toBe('Error'); }); -test(' - renders proper number of optional values after add new value', () => { +it(' - renders proper number of optional values after add new value', () => { const element = ; const onChange = jest.fn(); const wrapper = mount( diff --git a/packages/uniforms-semantic/__tests__/ListItemField.tsx b/packages/uniforms-semantic/__tests__/ListItemField.tsx index 2c4224268..5519809b7 100644 --- a/packages/uniforms-semantic/__tests__/ListItemField.tsx +++ b/packages/uniforms-semantic/__tests__/ListItemField.tsx @@ -4,7 +4,7 @@ import { AutoField, ListDelField, ListItemField } from 'uniforms-semantic'; import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - works', () => { expect(wrapper.find(ListItemField)).toHaveLength(1); }); -test(' - renders ListDelField', () => { +it(' - renders ListDelField', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - renders ListDelField', () => { expect(wrapper.find(ListDelField).childAt(0).prop('name')).toBe('x.1'); }); -test(' - renders AutoField', () => { +it(' - renders AutoField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ test(' - renders AutoField', () => { expect(wrapper.find(AutoField)).toHaveLength(1); }); -test(' - renders children if specified', () => { +it(' - renders children if specified', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( diff --git a/packages/uniforms-semantic/__tests__/LongTextField.tsx b/packages/uniforms-semantic/__tests__/LongTextField.tsx index c8a43cba7..c977b6829 100644 --- a/packages/uniforms-semantic/__tests__/LongTextField.tsx +++ b/packages/uniforms-semantic/__tests__/LongTextField.tsx @@ -4,14 +4,14 @@ import { LongTextField } from 'uniforms-semantic'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a textarea', () => { +it(' - renders a textarea', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('textarea')).toHaveLength(1); }); -test(' - renders a textarea with correct disabled state', () => { +it(' - renders a textarea with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ test(' - renders a textarea with correct disabled state', () => { expect(wrapper.find('textarea').prop('disabled')).toBe(true); }); -test(' - renders a textarea with correct readOnly state', () => { +it(' - renders a textarea with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ test(' - renders a textarea with correct readOnly state', () => { expect(wrapper.find('textarea').prop('readOnly')).toBe(true); }); -test(' - renders a textarea with correct id (inherited)', () => { +it(' - renders a textarea with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ test(' - renders a textarea with correct id (inherited)', () => { expect(wrapper.find('textarea').prop('id')).toBeTruthy(); }); -test(' - renders a textarea with correct id (specified)', () => { +it(' - renders a textarea with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ test(' - renders a textarea with correct id (specified)', () => { expect(wrapper.find('textarea').prop('id')).toBe('y'); }); -test(' - renders a textarea with correct name', () => { +it(' - renders a textarea with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ test(' - renders a textarea with correct name', () => { expect(wrapper.find('textarea').prop('name')).toBe('x'); }); -test(' - renders a textarea with correct placeholder', () => { +it(' - renders a textarea with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -59,7 +59,7 @@ test(' - renders a textarea with correct placeholder', () => { expect(wrapper.find('textarea').prop('placeholder')).toBe('y'); }); -test(' - renders a textarea with correct value (default)', () => { +it(' - renders a textarea with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -67,7 +67,7 @@ test(' - renders a textarea with correct value (default)', () => expect(wrapper.find('textarea').prop('value')).toBe(''); }); -test(' - renders a textarea with correct value (model)', () => { +it(' - renders a textarea with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -78,7 +78,7 @@ test(' - renders a textarea with correct value (model)', () => { expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -test(' - renders a textarea with correct value (specified)', () => { +it(' - renders a textarea with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -86,7 +86,7 @@ test(' - renders a textarea with correct value (specified)', () = expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -test(' - renders a textarea which correctly reacts on change', () => { +it(' - renders a textarea which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -102,7 +102,7 @@ test(' - renders a textarea which correctly reacts on change', () expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a textarea which correctly reacts on change (empty)', () => { +it(' - renders a textarea which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -118,7 +118,7 @@ test(' - renders a textarea which correctly reacts on change (emp expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders a textarea which correctly reacts on change (same value)', () => { +it(' - renders a textarea which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -134,7 +134,7 @@ test(' - renders a textarea which correctly reacts on change (sam expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -145,7 +145,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -154,7 +154,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( - renders correct error text (specified)', () => { expect(wrapper.children().last().text()).toBe('Error'); }); -test(' - renders correct error text (showInlineError=false)', () => { +it(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders an for each field', () => { +it(' - renders an for each field', () => { const element = ; const wrapper = mount( element, @@ -20,7 +20,7 @@ test(' - renders an for each field', () => { expect(wrapper.find(AutoField).at(1).prop('name')).toBe('b'); }); -test(' - renders custom content if given', () => { +it(' - renders custom content if given', () => { const element = (
@@ -40,7 +40,7 @@ test(' - renders custom content if given', () => { expect(wrapper.find('article').prop('data-test')).toBe('content'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -88,7 +88,7 @@ test(' - renders correct error text (specified)', () => { expect(wrapper.children().at(0).text()).toBe('Error'); }); -test(' - renders correct error text (showInlineError=false)', () => { +it(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -19,7 +19,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -27,7 +27,7 @@ test(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -35,7 +35,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -43,7 +43,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct max', () => { +it(' - renders an input with correct max', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct max', () => { expect(wrapper.find('input').prop('max')).toBe(10); }); -test(' - renders an input with correct min', () => { +it(' - renders an input with correct min', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -59,7 +59,7 @@ test(' - renders an input with correct min', () => { expect(wrapper.find('input').prop('min')).toBe(10); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -67,7 +67,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct placeholder', () => { +it(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -75,7 +75,7 @@ test(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -test(' - renders an input with correct step (decimal)', () => { +it(' - renders an input with correct step (decimal)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -83,7 +83,7 @@ test(' - renders an input with correct step (decimal)', () => { expect(wrapper.find('input').prop('step')).toBe(0.01); }); -test(' - renders an input with correct step (integer)', () => { +it(' - renders an input with correct step (integer)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -91,7 +91,7 @@ test(' - renders an input with correct step (integer)', () => { expect(wrapper.find('input').prop('step')).toBe(1); }); -test(' - renders an input with correct step (set)', () => { +it(' - renders an input with correct step (set)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -99,7 +99,7 @@ test(' - renders an input with correct step (set)', () => { expect(wrapper.find('input').prop('step')).toBe(3); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -107,7 +107,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('number'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -115,7 +115,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const onChange = jest.fn(); const element = ; @@ -157,7 +157,7 @@ test(' - renders an input with correct value (model)', () => { spy.mockRestore(); }); -test(' - renders an input with correct value (specified)', () => { +it(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -165,7 +165,7 @@ test(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe(2); }); -test(' - renders an input which correctly reacts on change', () => { +it(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -181,7 +181,7 @@ test(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -test(' - renders an input which correctly reacts on change (decimal on decimal)', () => { +it(' - renders an input which correctly reacts on change (decimal on decimal)', () => { const onChange = jest.fn(); const element = ; @@ -197,7 +197,7 @@ test(' - renders an input which correctly reacts on change (decimal on expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); -test(' - renders an input which correctly reacts on change (decimal on integer)', () => { +it(' - renders an input which correctly reacts on change (decimal on integer)', () => { const onChange = jest.fn(); const element = ; @@ -213,7 +213,7 @@ test(' - renders an input which correctly reacts on change (decimal on expect(onChange).toHaveBeenLastCalledWith('x', 2); }); -test(' - renders an input which correctly reacts on change (empty)', () => { +it(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -229,7 +229,7 @@ test(' - renders an input which correctly reacts on change (empty)', ( expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders an input which correctly reacts on change (same value)', () => { +it(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -245,7 +245,7 @@ test(' - renders an input which correctly reacts on change (same value expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -test(' - renders an input which correctly reacts on change (zero)', () => { +it(' - renders an input which correctly reacts on change (zero)', () => { const onChange = jest.fn(); const element = ; @@ -261,7 +261,7 @@ test(' - renders an input which correctly reacts on change (zero)', () expect(onChange).toHaveBeenLastCalledWith('x', 0); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -272,7 +272,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -281,7 +281,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -291,7 +291,7 @@ test(' - renders correct error text (specified)', () => { expect(wrapper.children().last().text()).toBe('Error'); }); -test(' - renders correct error text (showInlineError=false)', () => { +it(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.children().last().text()).not.toBe('Error'); }); -test(' - renders a icon', () => { +it(' - renders a icon', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find('i')).toHaveLength(1); }); -test(' - renders a icon', () => { +it(' - renders a icon', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find('i')).toHaveLength(1); }); -test(' - renders with a custom wrapClassName', () => { +it(' - renders with a custom wrapClassName', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); diff --git a/packages/uniforms-semantic/__tests__/QuickForm.tsx b/packages/uniforms-semantic/__tests__/QuickForm.tsx index 2abd1b716..83923a142 100644 --- a/packages/uniforms-semantic/__tests__/QuickForm.tsx +++ b/packages/uniforms-semantic/__tests__/QuickForm.tsx @@ -4,7 +4,7 @@ import { QuickForm } from 'uniforms-semantic'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - renders', () => { +it(' - renders', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-semantic/__tests__/RadioField.tsx b/packages/uniforms-semantic/__tests__/RadioField.tsx index c882c04cc..7b8596df8 100644 --- a/packages/uniforms-semantic/__tests__/RadioField.tsx +++ b/packages/uniforms-semantic/__tests__/RadioField.tsx @@ -4,7 +4,7 @@ import { RadioField } from 'uniforms-semantic'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a set of checkboxes', () => { +it(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -test(' - renders a set of checkboxes with correct disabled state', () => { +it(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -26,7 +26,7 @@ test(' - renders a set of checkboxes with correct disabled state', ( expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -test(' - renders a set of checkboxes with correct readOnly state', () => { +it(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -43,7 +43,7 @@ test(' - renders a set of checkboxes with correct readOnly state', ( expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a set of checkboxes with correct id (inherited)', () => { +it(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ test(' - renders a set of checkboxes with correct id (inherited)', ( expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -test(' - renders a set of checkboxes with correct id (specified)', () => { +it(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -67,7 +67,7 @@ test(' - renders a set of checkboxes with correct id (specified)', ( expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -test(' - renders a set of checkboxes with correct name', () => { +it(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -79,7 +79,7 @@ test(' - renders a set of checkboxes with correct name', () => { expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -test(' - renders a set of checkboxes with correct options', () => { +it(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -91,7 +91,7 @@ test(' - renders a set of checkboxes with correct options', () => { expect(wrapper.find('label').at(1).text()).toBe('b'); }); -test(' - renders a set of checkboxes with correct options (transform)', () => { +it(' - renders a set of checkboxes with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -103,7 +103,7 @@ test(' - renders a set of checkboxes with correct options (transform expect(wrapper.find('label').at(1).text()).toBe('B'); }); -test(' - renders a set of checkboxes with correct value (default)', () => { +it(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -115,7 +115,7 @@ test(' - renders a set of checkboxes with correct value (default)', expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -test(' - renders a set of checkboxes with correct value (model)', () => { +it(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -130,7 +130,7 @@ test(' - renders a set of checkboxes with correct value (model)', () expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes with correct value (specified)', () => { +it(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -142,7 +142,7 @@ test(' - renders a set of checkboxes with correct value (specified)' expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes which correctly reacts on change', () => { +it(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -159,7 +159,7 @@ test(' - renders a set of checkboxes which correctly reacts on chang expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -176,7 +176,7 @@ test(' - renders a set of checkboxes which correctly reacts on chang expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -187,7 +187,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -199,7 +199,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -213,7 +213,7 @@ test(' - renders correct error text (specified)', () => { expect(wrapper.find('.ui.red.label').text()).toBe('Error'); }); -test(' - renders correct error text (showInlineError=false)', () => { +it(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => expect(wrapper.find('.ui.red.label').length).toBe(0); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), diff --git a/packages/uniforms-semantic/__tests__/SelectField.tsx b/packages/uniforms-semantic/__tests__/SelectField.tsx index 239a11783..2dea37b89 100644 --- a/packages/uniforms-semantic/__tests__/SelectField.tsx +++ b/packages/uniforms-semantic/__tests__/SelectField.tsx @@ -4,7 +4,7 @@ import { SelectField } from 'uniforms-semantic'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a select', () => { +it(' - renders a select', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - renders a select', () => { expect(wrapper.find('select')).toHaveLength(1); }); -test(' - renders a select with correct disabled state', () => { +it(' - renders a select with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - renders a select with correct disabled state', () => { expect(wrapper.find('select').prop('disabled')).toBe(true); }); -test(' - renders a select with correct readOnly state', () => { +it(' - renders a select with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -44,7 +44,7 @@ test(' - renders a select with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a select with correct id (inherited)', () => { +it(' - renders a select with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ test(' - renders a select with correct id (inherited)', () => { expect(wrapper.find('select').prop('id')).toBeTruthy(); }); -test(' - renders a select with correct id (specified)', () => { +it(' - renders a select with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -66,7 +66,7 @@ test(' - renders a select with correct id (specified)', () => { expect(wrapper.find('select').prop('id')).toBe('y'); }); -test(' - renders a select with correct name', () => { +it(' - renders a select with correct name', () => { const element = ; const wrapper = mount( element, @@ -77,7 +77,7 @@ test(' - renders a select with correct name', () => { expect(wrapper.find('select').prop('name')).toBe('x'); }); -test(' - renders a select with correct options', () => { +it(' - renders a select with correct options', () => { const element = ; const wrapper = mount( element, @@ -97,7 +97,7 @@ test(' - renders a select with correct options', () => { }); }); -test(' - renders a select with correct options (transform)', () => { +it(' - renders a select with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -117,7 +117,7 @@ test(' - renders a select with correct options (transform)', () => }); }); -test(' - renders a select with correct placeholder (fallback)', () => { +it(' - renders a select with correct placeholder (fallback)', () => { const element = ; const wrapper = mount( element, @@ -139,7 +139,7 @@ test(' - renders a select with correct placeholder (fallback)', () }); }); -test(' - renders a select with correct placeholder (implicit)', () => { +it(' - renders a select with correct placeholder (implicit)', () => { const element = ; const wrapper = mount( element, @@ -159,7 +159,7 @@ test(' - renders a select with correct placeholder (implicit)', () }); }); -test(' - renders a select with correct value (default)', () => { +it(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -170,7 +170,7 @@ test(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toBe(''); }); -test(' - renders a select with correct value (model)', () => { +it(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -184,7 +184,7 @@ test(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -test(' - renders a select with correct value (specified)', () => { +it(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -195,7 +195,7 @@ test(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -test(' - renders a select which correctly reacts on change', () => { +it(' - renders a select which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -214,7 +214,7 @@ test(' - renders a select which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a select which correctly reacts on change (empty)', () => { +it(' - renders a select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -233,7 +233,7 @@ test(' - renders a select which correctly reacts on change (empty)' expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a select which correctly reacts on change (same value)', () => { +it(' - renders a select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -252,7 +252,7 @@ test(' - renders a select which correctly reacts on change (same va expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -266,7 +266,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -278,14 +278,14 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -test(' - disabled items (options) based on predicate', () => { +it(' - disabled items (options) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( @@ -301,7 +301,7 @@ test(' - disabled items (options) based on predicate', () => { expect(wrapper.find('option[value="b"]').at(0).prop('disabled')).toBe(false); }); -test(' - renders a select with correct value (default)', () => { +it(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -315,7 +315,7 @@ test(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual([]); }); -test(' - renders a select with correct value (model)', () => { +it(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -332,7 +332,7 @@ test(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -test(' - renders a select with correct value (specified)', () => { +it(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -346,7 +346,7 @@ test(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -test(' - renders a select which correctly reacts on change (first value)', () => { +it(' - renders a select which correctly reacts on change (first value)', () => { const onChange = jest.fn(); const element = ; @@ -368,7 +368,7 @@ test(' - renders a select which correctly reacts on change (first v expect(onChange).toHaveBeenLastCalledWith('x', ['a']); }); -test(' - renders a select which correctly reacts on change (next value)', () => { +it(' - renders a select which correctly reacts on change (next value)', () => { const onChange = jest.fn(); const element = ; @@ -390,7 +390,7 @@ test(' - renders a select which correctly reacts on change (next va expect(onChange).toHaveBeenLastCalledWith('x', ['a', 'b']); }); -test(' - renders a select which correctly reacts on change (uncheck) by value', () => { +it(' - renders a select which correctly reacts on change (uncheck) by value', () => { const onChange = jest.fn(); const element = ; @@ -412,7 +412,7 @@ test(' - renders a select which correctly reacts on change (uncheck expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { +it(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { const onChange = jest.fn(); const element = ; @@ -436,7 +436,7 @@ test(' - renders a select which correctly reacts on change (uncheck expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a set of checkboxes', () => { +it(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -446,7 +446,7 @@ test(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -test(' - renders a set of checkboxes with correct disabled state', () => { +it(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -458,7 +458,7 @@ test(' - renders a set of checkboxes with correct disabl expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -test(' - renders a set of checkboxes with correct readOnly state', () => { +it(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -475,7 +475,7 @@ test(' - renders a set of checkboxes with correct readOn expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a set of checkboxes with correct id (inherited)', () => { +it(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -487,7 +487,7 @@ test(' - renders a set of checkboxes with correct id (in expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -test(' - renders a set of checkboxes with correct id (specified)', () => { +it(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -499,7 +499,7 @@ test(' - renders a set of checkboxes with correct id (sp expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -test(' - renders a set of checkboxes with correct name', () => { +it(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -511,7 +511,7 @@ test(' - renders a set of checkboxes with correct name', expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -test(' - renders a set of checkboxes with correct options', () => { +it(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -523,7 +523,7 @@ test(' - renders a set of checkboxes with correct option expect(wrapper.find('label').at(1).text()).toBe('b'); }); -test(' - renders a set of checkboxes with correct options (transform)', () => { +it(' - renders a set of checkboxes with correct options (transform)', () => { const element = ( x.toUpperCase()} /> ); @@ -537,7 +537,7 @@ test(' - renders a set of checkboxes with correct option expect(wrapper.find('label').at(1).text()).toBe('B'); }); -test(' - renders a set of checkboxes with correct value (default)', () => { +it(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -549,7 +549,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -test(' - renders a set of checkboxes with correct value (model)', () => { +it(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -564,7 +564,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes with correct value (specified)', () => { +it(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -576,7 +576,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes which correctly reacts on change', () => { +it(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -593,7 +593,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { const onChange = jest.fn(); const element = ; @@ -613,7 +613,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -test(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); const element = ; @@ -633,7 +633,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -650,7 +650,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -661,7 +661,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ( ); @@ -675,14 +675,14 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -696,7 +696,7 @@ test(' - renders correct error text (specified)', () => { expect(wrapper.find('.ui.red.label').text()).toBe('Error'); }); -test(' - renders correct error text (showInlineError=false)', () => { +it(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => expect(wrapper.find('.ui.red.label').length).toBe(0); }); -test(' - disabled items (checkboxes) based on predicate', () => { +it(' - disabled items (checkboxes) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( diff --git a/packages/uniforms-semantic/__tests__/SubmitField.tsx b/packages/uniforms-semantic/__tests__/SubmitField.tsx index c70b97941..fa5df267a 100644 --- a/packages/uniforms-semantic/__tests__/SubmitField.tsx +++ b/packages/uniforms-semantic/__tests__/SubmitField.tsx @@ -4,14 +4,14 @@ import { SubmitField } from 'uniforms-semantic'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders', () => { +it(' - renders', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper).toHaveLength(1); }); -test(' - renders disabled if error', () => { +it(' - renders disabled if error', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -19,7 +19,7 @@ test(' - renders disabled if error', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders enabled if error and enabled', () => { +it(' - renders enabled if error and enabled', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -27,7 +27,7 @@ test(' - renders enabled if error and enabled', () => { expect(wrapper.find('input').prop('disabled')).toBe(false); }); -test(' - renders a wrapper with correct value', () => { +it(' - renders a wrapper with correct value', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-semantic/__tests__/TextField.tsx b/packages/uniforms-semantic/__tests__/TextField.tsx index 1da5efac2..e73bad83e 100644 --- a/packages/uniforms-semantic/__tests__/TextField.tsx +++ b/packages/uniforms-semantic/__tests__/TextField.tsx @@ -9,7 +9,7 @@ import mount from './_mount'; describe('@RTL - TextField tests', () => { testTextField(TextField); - test(' - renders a wrapper with unknown props', () => { + it(' - renders a wrapper with unknown props', () => { const props = { 'data-x': 'x', 'data-y': 'y', @@ -23,7 +23,7 @@ describe('@RTL - TextField tests', () => { ); }); - test(' - renders a TextField with correct error text (specified)', () => { + it(' - renders a TextField with correct error text (specified)', () => { const errorMessage = 'Error'; render( { expect(screen.getByText(errorMessage)).toBeInTheDocument(); }); - test(' - renders a TextField with correct error text (showInlineError=false)', () => { + it(' - renders a TextField with correct error text (showInlineError=false)', () => { const errorMessage = 'Error'; render( { expect(screen.queryByText(errorMessage)).not.toBeInTheDocument(); }); - test(' - renders an icon', () => { + it(' - renders an icon', () => { const { container } = render(, { x: String, }); @@ -61,7 +61,7 @@ describe('@RTL - TextField tests', () => { expect(container.querySelector('i')).toBeInTheDocument(); }); - test(' - renders with a custom wrapClassName', () => { + it(' - renders with a custom wrapClassName', () => { const testClassName = 'test-class-name'; render(, { x: String }); @@ -71,14 +71,14 @@ describe('@RTL - TextField tests', () => { }); }); -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -86,7 +86,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -94,7 +94,7 @@ test(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -102,7 +102,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -110,7 +110,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -118,7 +118,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct placeholder', () => { +it(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -126,7 +126,7 @@ test(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -134,7 +134,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('text'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -142,7 +142,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -153,7 +153,7 @@ test(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input with correct value (specified)', () => { +it(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -161,7 +161,7 @@ test(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input which correctly reacts on change', () => { +it(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -177,7 +177,7 @@ test(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders an input which correctly reacts on change (empty)', () => { +it(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -193,7 +193,7 @@ test(' - renders an input which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders an input which correctly reacts on change (same value)', () => { +it(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -209,7 +209,7 @@ test(' - renders an input which correctly reacts on change (same valu expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -220,7 +220,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -229,7 +229,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - renders correct error text (specified)', () => { +it(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -239,7 +239,7 @@ test(' - renders correct error text (specified)', () => { expect(wrapper.children().last().text()).toBe('Error'); }); -test(' - renders correct error text (showInlineError=false)', () => { +it(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.children().last().text()).not.toBe('Error'); }); -test(' - renders a icon', () => { +it(' - renders a icon', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('i')).toHaveLength(1); }); -test(' - renders a icon', () => { +it(' - renders a icon', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('i')).toHaveLength(1); }); -test(' - renders with a custom wrapClassName', () => { +it(' - renders with a custom wrapClassName', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('.ui.input.test-class-name')).toHaveLength(1); }); -test(' - renders a input with autocomplete turned off', () => { +it(' - renders a input with autocomplete turned off', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-semantic/__tests__/ValidateQuickForm.tsx b/packages/uniforms-semantic/__tests__/ValidateQuickForm.tsx index ff8bb4376..c2253493f 100644 --- a/packages/uniforms-semantic/__tests__/ValidateQuickForm.tsx +++ b/packages/uniforms-semantic/__tests__/ValidateQuickForm.tsx @@ -4,7 +4,7 @@ import { ValidatedQuickForm } from 'uniforms-semantic'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-semantic/__tests__/ValidatedForm.tsx b/packages/uniforms-semantic/__tests__/ValidatedForm.tsx index f392f0b78..37fde0587 100644 --- a/packages/uniforms-semantic/__tests__/ValidatedForm.tsx +++ b/packages/uniforms-semantic/__tests__/ValidatedForm.tsx @@ -4,7 +4,7 @@ import { ValidatedForm } from 'uniforms-semantic'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-unstyled/__tests__/AutoField.tsx b/packages/uniforms-unstyled/__tests__/AutoField.tsx index 2bd06da5e..d5d759dda 100644 --- a/packages/uniforms-unstyled/__tests__/AutoField.tsx +++ b/packages/uniforms-unstyled/__tests__/AutoField.tsx @@ -14,14 +14,14 @@ import { import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(AutoField)).toHaveLength(1); }); -test(' - detects RadioField', () => { +it(' - detects RadioField', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ test(' - detects RadioField', () => { expect(wrapper.find(RadioField.Component)).toHaveLength(1); }); -test(' - detects SelectField', () => { +it(' - detects SelectField', () => { const element = ; const wrapper = mount( element, @@ -50,14 +50,14 @@ test(' - detects SelectField', () => { expect(wrapper.find(SelectField.Component)).toHaveLength(1); }); -test(' - detects DateField', () => { +it(' - detects DateField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DateField.Component)).toHaveLength(1); }); -test(' - detects ListField', () => { +it(' - detects ListField', () => { const element = ; const wrapper = mount( element, @@ -67,35 +67,35 @@ test(' - detects ListField', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -test(' - detects NumField', () => { +it(' - detects NumField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(NumField.Component)).toHaveLength(1); }); -test(' - detects NestField', () => { +it(' - detects NestField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Object } })); expect(wrapper.find(NestField)).toHaveLength(1); }); -test(' - detects TextField', () => { +it(' - detects TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField.Component)).toHaveLength(1); }); -test(' - detects BoolField', () => { +it(' - detects BoolField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(BoolField.Component)).toHaveLength(1); }); -test(' - uses Component (schema)', () => { +it(' - uses Component (schema)', () => { const Component = jest.fn(() => null); const element = ; @@ -107,7 +107,7 @@ test(' - uses Component (schema)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -test(' - uses Component (props)', () => { +it(' - uses Component (props)', () => { const Component = jest.fn(() => null); const element = ; @@ -116,7 +116,7 @@ test(' - uses Component (props)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -test(' - uses Component (context)', () => { +it(' - uses Component (context)', () => { const FieldA = jest.fn(() => null); const FieldB = jest.fn(() => null); @@ -136,7 +136,7 @@ test(' - uses Component (context)', () => { expect(FieldB).toHaveBeenCalledTimes(1); }); -test(' - uses Component (invalid)', () => { +it(' - uses Component (invalid)', () => { const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {}); expect(() => { const element = ; diff --git a/packages/uniforms-unstyled/__tests__/AutoFields.tsx b/packages/uniforms-unstyled/__tests__/AutoFields.tsx index 306810c5e..024dc1f62 100644 --- a/packages/uniforms-unstyled/__tests__/AutoFields.tsx +++ b/packages/uniforms-unstyled/__tests__/AutoFields.tsx @@ -4,14 +4,14 @@ import { AutoFields } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('AutoFields')).toHaveLength(1); }); -test(' - render all fields by default', () => { +it(' - render all fields by default', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - render all fields by default', () => { expect(wrapper.find('input')).toHaveLength(3); }); -test(' - renders only specified fields', () => { +it(' - renders only specified fields', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ test(' - renders only specified fields', () => { ); }); -test(' - does not render ommited fields', () => { +it(' - does not render ommited fields', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ test(' - does not render ommited fields', () => { ); }); -test(' - wraps fields in specified element', () => { +it(' - wraps fields in specified element', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-unstyled/__tests__/AutoForm.tsx b/packages/uniforms-unstyled/__tests__/AutoForm.tsx index e64bb5cf7..7eea63d6d 100644 --- a/packages/uniforms-unstyled/__tests__/AutoForm.tsx +++ b/packages/uniforms-unstyled/__tests__/AutoForm.tsx @@ -4,7 +4,7 @@ import { AutoForm } from 'uniforms-unstyled'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-unstyled/__tests__/BaseForm.tsx b/packages/uniforms-unstyled/__tests__/BaseForm.tsx index d074d727e..7a7e99417 100644 --- a/packages/uniforms-unstyled/__tests__/BaseForm.tsx +++ b/packages/uniforms-unstyled/__tests__/BaseForm.tsx @@ -4,7 +4,7 @@ import { BaseForm } from 'uniforms-unstyled'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-unstyled/__tests__/BoolField.tsx b/packages/uniforms-unstyled/__tests__/BoolField.tsx index 04748d027..fe3e4e159 100644 --- a/packages/uniforms-unstyled/__tests__/BoolField.tsx +++ b/packages/uniforms-unstyled/__tests__/BoolField.tsx @@ -4,14 +4,14 @@ import { BoolField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders a input with correct id (inherited)', () => { +it(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -19,7 +19,7 @@ test(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders a input with correct id (specified)', () => { +it(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -27,7 +27,7 @@ test(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders a input with correct name', () => { +it(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -35,7 +35,7 @@ test(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -43,7 +43,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('checkbox'); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -65,7 +65,7 @@ test(' - renders an input with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a input with correct label (specified)', () => { +it(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -76,7 +76,7 @@ test(' - renders a input with correct label (specified)', () => { ); }); -test(' - renders a input with correct value (default)', () => { +it(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -84,7 +84,7 @@ test(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('checked')).toBe(false); }); -test(' - renders a input with correct value (model)', () => { +it(' - renders a input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -95,7 +95,7 @@ test(' - renders a input with correct value (model)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -test(' - renders a input with correct value (specified)', () => { +it(' - renders a input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -103,7 +103,7 @@ test(' - renders a input with correct value (specified)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -test(' - renders a input which correctly reacts on change', () => { +it(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -117,7 +117,7 @@ test(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', true); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); diff --git a/packages/uniforms-unstyled/__tests__/DateField.tsx b/packages/uniforms-unstyled/__tests__/DateField.tsx index d18815530..9f0367532 100644 --- a/packages/uniforms-unstyled/__tests__/DateField.tsx +++ b/packages/uniforms-unstyled/__tests__/DateField.tsx @@ -8,7 +8,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - DateField tests', () => { - test(' - handles "date" type correctly', () => { + it(' - handles "date" type correctly', () => { const onChange = jest.fn(); const initialDate = new Date(Date.UTC(2020, 0, 1)); @@ -29,14 +29,14 @@ describe('@RTL - DateField tests', () => { }); }); -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders a input with correct id (inherited)', () => { +it(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -44,7 +44,7 @@ test(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders a input with correct id (specified)', () => { +it(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -52,7 +52,7 @@ test(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders a input with correct name', () => { +it(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -60,7 +60,7 @@ test(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -79,7 +79,7 @@ test.each(['datetime-local', 'date'] as const)( }, ); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -87,7 +87,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -95,7 +95,7 @@ test(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -test(' - renders a input with correct label (specified)', () => { +it(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -106,7 +106,7 @@ test(' - renders a input with correct label (specified)', () => { ); }); -test(' - renders a input with correct value (default)', () => { +it(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -114,7 +114,7 @@ test(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders a input with correct value (model)', () => { +it(' - renders a input with correct value (model)', () => { const now = new Date(); const element = ; const wrapper = mount( @@ -128,7 +128,7 @@ test(' - renders a input with correct value (model)', () => { ); }); -test(' - renders a input with correct value (specified)', () => { +it(' - renders a input with correct value (specified)', () => { const now = new Date(); const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -139,7 +139,7 @@ test(' - renders a input with correct value (specified)', () => { ); }); -test(' - renders a input which correctly reacts on change', () => { +it(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const now = new Date(); @@ -158,7 +158,7 @@ test(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', now); }); -test(' - renders a input which correctly reacts on change (empty)', () => { +it(' - renders a input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -176,7 +176,7 @@ test(' - renders a input which correctly reacts on change (empty)', ( expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a input which correctly reacts on change (overflow)', () => { +it(' - renders a input which correctly reacts on change (overflow)', () => { const onChange = jest.fn(); const now = new Date(1e5, 0); @@ -195,7 +195,7 @@ test(' - renders a input which correctly reacts on change (overflow)' expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); diff --git a/packages/uniforms-unstyled/__tests__/ErrorField.tsx b/packages/uniforms-unstyled/__tests__/ErrorField.tsx index 6acca1595..d047d867e 100644 --- a/packages/uniforms-unstyled/__tests__/ErrorField.tsx +++ b/packages/uniforms-unstyled/__tests__/ErrorField.tsx @@ -11,14 +11,14 @@ const error = { message: 'X is required [validation-error]', }; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorField)).toHaveLength(1); }); -test(' - renders correct error message (context)', () => { +it(' - renders correct error message (context)', () => { const element = ; const wrapper = mount( element, @@ -29,7 +29,7 @@ test(' - renders correct error message (context)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -test(' - renders correct error message (specified)', () => { +it(' - renders correct error message (specified)', () => { const element = ( - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorsField)).toHaveLength(1); }); -test(' - renders list of correct error messages (context)', () => { +it(' - renders list of correct error messages (context)', () => { const element = ; const wrapper = mount( element, @@ -38,7 +38,7 @@ test(' - renders list of correct error messages (context)', () => { expect(wrapper.find('li').at(2).text()).toBe('Z is required'); }); -test(' - renders children (specified)', () => { +it(' - renders children (specified)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-unstyled/__tests__/HiddenField.tsx b/packages/uniforms-unstyled/__tests__/HiddenField.tsx index 4eff6c61b..3f16dcc65 100644 --- a/packages/uniforms-unstyled/__tests__/HiddenField.tsx +++ b/packages/uniforms-unstyled/__tests__/HiddenField.tsx @@ -4,14 +4,14 @@ import { HiddenField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('hidden'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -62,7 +62,7 @@ test(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input which correctly reacts on model change', () => { +it(' - renders an input which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -76,7 +76,7 @@ test(' - renders an input which correctly reacts on model change', expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders an input which correctly reacts on model change (empty)', () => { +it(' - renders an input which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -90,7 +90,7 @@ test(' - renders an input which correctly reacts on model change (e expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders an input which correctly reacts on model change (same value)', () => { +it(' - renders an input which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -104,14 +104,14 @@ test(' - renders an input which correctly reacts on model change (s expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders nothing', () => { +it(' - renders nothing', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.children()).toHaveLength(0); }); -test(' - renders nothing which correctly reacts on model change', () => { +it(' - renders nothing which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ test(' - renders nothing which correctly reacts on model chan expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders nothing which correctly reacts on model change (empty)', () => { +it(' - renders nothing which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ test(' - renders nothing which correctly reacts on model chan expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders nothing which correctly reacts on model change (same value)', () => { +it(' - renders nothing which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; diff --git a/packages/uniforms-unstyled/__tests__/ListAddField.tsx b/packages/uniforms-unstyled/__tests__/ListAddField.tsx index 59dd9e6e8..46cadff3e 100644 --- a/packages/uniforms-unstyled/__tests__/ListAddField.tsx +++ b/packages/uniforms-unstyled/__tests__/ListAddField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListAddField)).toHaveLength(1); }); -test(' - prevents onClick when disabled', () => { +it(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ test(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when limit reached', () => { +it(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { maxCount: 0 } })); @@ -39,7 +39,7 @@ test(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - correctly reacts on click', () => { +it(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ test(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['y']); }); -test(' - correctly reacts on keyboard enter key', () => { +it(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-unstyled/__tests__/ListDelField.tsx b/packages/uniforms-unstyled/__tests__/ListDelField.tsx index 91703ce84..042a988c5 100644 --- a/packages/uniforms-unstyled/__tests__/ListDelField.tsx +++ b/packages/uniforms-unstyled/__tests__/ListDelField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListDelField)).toHaveLength(1); }); -test(' - prevents onClick when disabled', () => { +it(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ test(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - prevents onClick when limit reached', () => { +it(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { minCount: 3 } })); @@ -39,7 +39,7 @@ test(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - correctly reacts on click', () => { +it(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ test(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['x', 'z']); }); -test(' - correctly reacts on keyboard enter key', () => { +it(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-unstyled/__tests__/ListField.tsx b/packages/uniforms-unstyled/__tests__/ListField.tsx index 44e2ab91d..a651fde09 100644 --- a/packages/uniforms-unstyled/__tests__/ListField.tsx +++ b/packages/uniforms-unstyled/__tests__/ListField.tsx @@ -12,7 +12,7 @@ describe('@RTL - ListField tests', () => { }); }); -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount( element, @@ -22,7 +22,7 @@ test(' - works', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -test(' - renders ListAddField', () => { +it(' - renders ListAddField', () => { const element = ; const wrapper = mount( element, @@ -33,7 +33,7 @@ test(' - renders ListAddField', () => { expect(wrapper.find(ListAddField).prop('name')).toBe('$'); }); -test(' - renders correct label (specified)', () => { +it(' - renders correct label (specified)', () => { const element = ; const wrapper = mount( element, @@ -46,7 +46,7 @@ test(' - renders correct label (specified)', () => { ); }); -test(' - renders correct numer of items with model (specified)', () => { +it(' - renders correct numer of items with model (specified)', () => { const element = ; const wrapper = mount( element, @@ -58,7 +58,7 @@ test(' - renders correct numer of items with model (specified)', () = expect(wrapper.find('input')).toHaveLength(3); }); -test(' - passes itemProps to its children', () => { +it(' - passes itemProps to its children', () => { const element = ; const wrapper = mount( element, @@ -70,7 +70,7 @@ test(' - passes itemProps to its children', () => { expect(wrapper.find(ListItemField).first().prop('data-xyz')).toBe(1); }); -test(' - renders children (specified)', () => { +it(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -89,7 +89,7 @@ test(' - renders children (specified)', () => { expect(Child).toHaveBeenCalledTimes(2); }); -test(' - renders children with correct name (children)', () => { +it(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -108,7 +108,7 @@ test(' - renders children with correct name (children)', () => { expect(wrapper.find(Child).at(1).prop('name')).toBe('1'); }); -test(' - renders children with correct name (value)', () => { +it(' - renders children with correct name (value)', () => { const element = ; const wrapper = mount( element, @@ -121,7 +121,7 @@ test(' - renders children with correct name (value)', () => { expect(wrapper.find(ListItemField).at(1).prop('name')).toBe('1'); }); -test(' - renders proper number of optional values after add new value', () => { +it(' - renders proper number of optional values after add new value', () => { const element = ; const onChange = jest.fn(); const wrapper = mount( diff --git a/packages/uniforms-unstyled/__tests__/ListItemField.tsx b/packages/uniforms-unstyled/__tests__/ListItemField.tsx index 6e9970e9b..eb2b87d32 100644 --- a/packages/uniforms-unstyled/__tests__/ListItemField.tsx +++ b/packages/uniforms-unstyled/__tests__/ListItemField.tsx @@ -4,7 +4,7 @@ import { AutoField, ListDelField, ListItemField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - works', () => { expect(wrapper.find(ListItemField)).toHaveLength(1); }); -test(' - renders ListDelField', () => { +it(' - renders ListDelField', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - renders ListDelField', () => { expect(wrapper.find(ListDelField).childAt(0).prop('name')).toBe('x.1'); }); -test(' - renders AutoField', () => { +it(' - renders AutoField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ test(' - renders AutoField', () => { expect(wrapper.find(AutoField)).toHaveLength(1); }); -test(' - renders children if specified', () => { +it(' - renders children if specified', () => { const Child: () => null = jest.fn(() => null); const element = ( diff --git a/packages/uniforms-unstyled/__tests__/LongTextField.tsx b/packages/uniforms-unstyled/__tests__/LongTextField.tsx index a6e55a0ab..3972fdbdd 100644 --- a/packages/uniforms-unstyled/__tests__/LongTextField.tsx +++ b/packages/uniforms-unstyled/__tests__/LongTextField.tsx @@ -4,14 +4,14 @@ import { LongTextField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a textarea', () => { +it(' - renders a textarea', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('textarea')).toHaveLength(1); }); -test(' - renders a textarea with correct disabled state', () => { +it(' - renders a textarea with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ test(' - renders a textarea with correct disabled state', () => { expect(wrapper.find('textarea').prop('disabled')).toBe(true); }); -test(' - renders a textarea with correct readOnly state', () => { +it(' - renders a textarea with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ test(' - renders a textarea with correct readOnly state', () => { expect(wrapper.find('textarea').prop('readOnly')).toBe(true); }); -test(' - renders a textarea with correct id (inherited)', () => { +it(' - renders a textarea with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ test(' - renders a textarea with correct id (inherited)', () => { expect(wrapper.find('textarea').prop('id')).toBeTruthy(); }); -test(' - renders a textarea with correct id (specified)', () => { +it(' - renders a textarea with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ test(' - renders a textarea with correct id (specified)', () => { expect(wrapper.find('textarea').prop('id')).toBe('y'); }); -test(' - renders a textarea with correct name', () => { +it(' - renders a textarea with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ test(' - renders a textarea with correct name', () => { expect(wrapper.find('textarea').prop('name')).toBe('x'); }); -test(' - renders a textarea with correct placeholder', () => { +it(' - renders a textarea with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -59,7 +59,7 @@ test(' - renders a textarea with correct placeholder', () => { expect(wrapper.find('textarea').prop('placeholder')).toBe('y'); }); -test(' - renders a textarea with correct value (default)', () => { +it(' - renders a textarea with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -67,7 +67,7 @@ test(' - renders a textarea with correct value (default)', () => expect(wrapper.find('textarea').prop('value')).toBe(''); }); -test(' - renders a textarea with correct value (model)', () => { +it(' - renders a textarea with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -78,7 +78,7 @@ test(' - renders a textarea with correct value (model)', () => { expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -test(' - renders a textarea with correct value (specified)', () => { +it(' - renders a textarea with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -86,7 +86,7 @@ test(' - renders a textarea with correct value (specified)', () = expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -test(' - renders a textarea which correctly reacts on change', () => { +it(' - renders a textarea which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -102,7 +102,7 @@ test(' - renders a textarea which correctly reacts on change', () expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a textarea which correctly reacts on change (empty)', () => { +it(' - renders a textarea which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -118,7 +118,7 @@ test(' - renders a textarea which correctly reacts on change (emp expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders a textarea which correctly reacts on change (same value)', () => { +it(' - renders a textarea which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -134,7 +134,7 @@ test(' - renders a textarea which correctly reacts on change (sam expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -145,7 +145,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-unstyled/__tests__/NestField.tsx b/packages/uniforms-unstyled/__tests__/NestField.tsx index 38d6addcb..c02befc56 100644 --- a/packages/uniforms-unstyled/__tests__/NestField.tsx +++ b/packages/uniforms-unstyled/__tests__/NestField.tsx @@ -4,7 +4,7 @@ import { AutoField, NestField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an for each field', () => { +it(' - renders an for each field', () => { const element = ; const wrapper = mount( element, @@ -20,7 +20,7 @@ test(' - renders an for each field', () => { expect(wrapper.find(AutoField).at(1).prop('name')).toBe('b'); }); -test(' - renders custom content if given', () => { +it(' - renders custom content if given', () => { const element = (
@@ -40,7 +40,7 @@ test(' - renders custom content if given', () => { expect(wrapper.find('article').prop('data-test')).toBe('content'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-unstyled/__tests__/NumField.tsx b/packages/uniforms-unstyled/__tests__/NumField.tsx index c3aa4cea2..21f95832a 100644 --- a/packages/uniforms-unstyled/__tests__/NumField.tsx +++ b/packages/uniforms-unstyled/__tests__/NumField.tsx @@ -4,14 +4,14 @@ import { NumField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -19,7 +19,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -27,7 +27,7 @@ test(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -35,7 +35,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -43,7 +43,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct max', () => { +it(' - renders an input with correct max', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -51,7 +51,7 @@ test(' - renders an input with correct max', () => { expect(wrapper.find('input').prop('max')).toBe(10); }); -test(' - renders an input with correct min', () => { +it(' - renders an input with correct min', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -59,7 +59,7 @@ test(' - renders an input with correct min', () => { expect(wrapper.find('input').prop('min')).toBe(10); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -67,7 +67,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct placeholder', () => { +it(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -75,7 +75,7 @@ test(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -test(' - renders an input with correct step (decimal)', () => { +it(' - renders an input with correct step (decimal)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -83,7 +83,7 @@ test(' - renders an input with correct step (decimal)', () => { expect(wrapper.find('input').prop('step')).toBe(0.01); }); -test(' - renders an input with correct step (integer)', () => { +it(' - renders an input with correct step (integer)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -91,7 +91,7 @@ test(' - renders an input with correct step (integer)', () => { expect(wrapper.find('input').prop('step')).toBe(1); }); -test(' - renders an input with correct step (set)', () => { +it(' - renders an input with correct step (set)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -99,7 +99,7 @@ test(' - renders an input with correct step (set)', () => { expect(wrapper.find('input').prop('step')).toBe(3); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -107,7 +107,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('number'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -115,7 +115,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const onChange = jest.fn(); const element = ; @@ -157,7 +157,7 @@ test(' - renders an input with correct value (model)', () => { spy.mockRestore(); }); -test(' - renders an input with correct value (specified)', () => { +it(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -165,7 +165,7 @@ test(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe(2); }); -test(' - renders an input which correctly reacts on change', () => { +it(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -181,7 +181,7 @@ test(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -test(' - renders an input which correctly reacts on change (decimal on decimal)', () => { +it(' - renders an input which correctly reacts on change (decimal on decimal)', () => { const onChange = jest.fn(); const element = ; @@ -197,7 +197,7 @@ test(' - renders an input which correctly reacts on change (decimal on expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); -test(' - renders an input which correctly reacts on change (decimal on integer)', () => { +it(' - renders an input which correctly reacts on change (decimal on integer)', () => { const onChange = jest.fn(); const element = ; @@ -213,7 +213,7 @@ test(' - renders an input which correctly reacts on change (decimal on expect(onChange).toHaveBeenLastCalledWith('x', 2); }); -test(' - renders an input which correctly reacts on change (empty)', () => { +it(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -229,7 +229,7 @@ test(' - renders an input which correctly reacts on change (empty)', ( expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders an input which correctly reacts on change (same value)', () => { +it(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -245,7 +245,7 @@ test(' - renders an input which correctly reacts on change (same value expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -test(' - renders an input which correctly reacts on change (zero)', () => { +it(' - renders an input which correctly reacts on change (zero)', () => { const onChange = jest.fn(); const element = ; @@ -261,7 +261,7 @@ test(' - renders an input which correctly reacts on change (zero)', () expect(onChange).toHaveBeenLastCalledWith('x', 0); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -272,7 +272,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); diff --git a/packages/uniforms-unstyled/__tests__/QuickForm.tsx b/packages/uniforms-unstyled/__tests__/QuickForm.tsx index 4ed2c1b40..97fe0e7ae 100644 --- a/packages/uniforms-unstyled/__tests__/QuickForm.tsx +++ b/packages/uniforms-unstyled/__tests__/QuickForm.tsx @@ -4,7 +4,7 @@ import { QuickForm } from 'uniforms-unstyled'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - renders', () => { +it(' - renders', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-unstyled/__tests__/RadioField.tsx b/packages/uniforms-unstyled/__tests__/RadioField.tsx index 83a465ef8..08d33c933 100644 --- a/packages/uniforms-unstyled/__tests__/RadioField.tsx +++ b/packages/uniforms-unstyled/__tests__/RadioField.tsx @@ -4,7 +4,7 @@ import { RadioField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a set of checkboxes', () => { +it(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -test(' - renders a set of checkboxes with correct disabled state', () => { +it(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -26,7 +26,7 @@ test(' - renders a set of checkboxes with correct disabled state', ( expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -test(' - renders a set of checkboxes with correct readOnly state', () => { +it(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -43,7 +43,7 @@ test(' - renders a set of checkboxes with correct readOnly state', ( expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a set of checkboxes with correct id (inherited)', () => { +it(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ test(' - renders a set of checkboxes with correct id (inherited)', ( expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -test(' - renders a set of checkboxes with correct id (specified)', () => { +it(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -67,7 +67,7 @@ test(' - renders a set of checkboxes with correct id (specified)', ( expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -test(' - renders a set of checkboxes with correct name', () => { +it(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -79,7 +79,7 @@ test(' - renders a set of checkboxes with correct name', () => { expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -test(' - renders a set of checkboxes with correct options', () => { +it(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -91,7 +91,7 @@ test(' - renders a set of checkboxes with correct options', () => { expect(wrapper.find('label').at(1).text()).toBe('b'); }); -test(' - renders a set of checkboxes with correct options (transform)', () => { +it(' - renders a set of checkboxes with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -103,7 +103,7 @@ test(' - renders a set of checkboxes with correct options (transform expect(wrapper.find('label').at(1).text()).toBe('B'); }); -test(' - renders a set of checkboxes with correct value (default)', () => { +it(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -115,7 +115,7 @@ test(' - renders a set of checkboxes with correct value (default)', expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -test(' - renders a set of checkboxes with correct value (model)', () => { +it(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -130,7 +130,7 @@ test(' - renders a set of checkboxes with correct value (model)', () expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes with correct value (specified)', () => { +it(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -142,7 +142,7 @@ test(' - renders a set of checkboxes with correct value (specified)' expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes which correctly reacts on change', () => { +it(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -159,7 +159,7 @@ test(' - renders a set of checkboxes which correctly reacts on chang expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -176,7 +176,7 @@ test(' - renders a set of checkboxes which correctly reacts on chang expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -187,7 +187,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -199,7 +199,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), diff --git a/packages/uniforms-unstyled/__tests__/SelectField.tsx b/packages/uniforms-unstyled/__tests__/SelectField.tsx index 757da8284..a0f2beaa4 100644 --- a/packages/uniforms-unstyled/__tests__/SelectField.tsx +++ b/packages/uniforms-unstyled/__tests__/SelectField.tsx @@ -4,7 +4,7 @@ import { SelectField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders a select', () => { +it(' - renders a select', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ test(' - renders a select', () => { expect(wrapper.find('select')).toHaveLength(1); }); -test(' - renders a select with correct disabled state', () => { +it(' - renders a select with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ test(' - renders a select with correct disabled state', () => { expect(wrapper.find('select').prop('disabled')).toBe(true); }); -test(' - renders a select with correct readOnly state', () => { +it(' - renders a select with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -44,7 +44,7 @@ test(' - renders a select with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a select with correct id (inherited)', () => { +it(' - renders a select with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ test(' - renders a select with correct id (inherited)', () => { expect(wrapper.find('select').prop('id')).toBeTruthy(); }); -test(' - renders a select with correct id (specified)', () => { +it(' - renders a select with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -66,7 +66,7 @@ test(' - renders a select with correct id (specified)', () => { expect(wrapper.find('select').prop('id')).toBe('y'); }); -test(' - renders a select with correct name', () => { +it(' - renders a select with correct name', () => { const element = ; const wrapper = mount( element, @@ -77,7 +77,7 @@ test(' - renders a select with correct name', () => { expect(wrapper.find('select').prop('name')).toBe('x'); }); -test(' - renders a select with correct options', () => { +it(' - renders a select with correct options', () => { const element = ; const wrapper = mount( element, @@ -97,7 +97,7 @@ test(' - renders a select with correct options', () => { }); }); -test(' - renders a select with correct options (transform)', () => { +it(' - renders a select with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -117,7 +117,7 @@ test(' - renders a select with correct options (transform)', () => }); }); -test(' - renders a select with correct placeholder (fallback)', () => { +it(' - renders a select with correct placeholder (fallback)', () => { const element = ; const wrapper = mount( element, @@ -139,7 +139,7 @@ test(' - renders a select with correct placeholder (fallback)', () }); }); -test(' - renders a select with correct placeholder (implicit)', () => { +it(' - renders a select with correct placeholder (implicit)', () => { const element = ; const wrapper = mount( element, @@ -159,7 +159,7 @@ test(' - renders a select with correct placeholder (implicit)', () }); }); -test(' - renders a select with correct value (default)', () => { +it(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -170,7 +170,7 @@ test(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toBe(''); }); -test(' - renders a select with correct value (model)', () => { +it(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -184,7 +184,7 @@ test(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -test(' - renders a select with correct value (specified)', () => { +it(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -195,7 +195,7 @@ test(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -test(' - renders a select which correctly reacts on change', () => { +it(' - renders a select which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -214,7 +214,7 @@ test(' - renders a select which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a select which correctly reacts on change (empty)', () => { +it(' - renders a select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -233,7 +233,7 @@ test(' - renders a select which correctly reacts on change (empty)' expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -test(' - renders a select which correctly reacts on change (same value)', () => { +it(' - renders a select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -252,7 +252,7 @@ test(' - renders a select which correctly reacts on change (same va expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -266,7 +266,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -278,14 +278,14 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -test(' - renders a set of checkboxes', () => { +it(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -295,7 +295,7 @@ test(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -test(' - renders a set of checkboxes with correct disabled state', () => { +it(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -307,7 +307,7 @@ test(' - renders a set of checkboxes with correct disabl expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -test(' - renders a set of checkboxes with correct readOnly state', () => { +it(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -324,7 +324,7 @@ test(' - renders a set of checkboxes with correct readOn expect(onChange).not.toHaveBeenCalled(); }); -test(' - renders a set of checkboxes with correct id (inherited)', () => { +it(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -336,7 +336,7 @@ test(' - renders a set of checkboxes with correct id (in expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -test(' - renders a set of checkboxes with correct id (specified)', () => { +it(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -348,7 +348,7 @@ test(' - renders a set of checkboxes with correct id (sp expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -test(' - renders a set of checkboxes with correct name', () => { +it(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -360,7 +360,7 @@ test(' - renders a set of checkboxes with correct name', expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -test(' - renders a select with correct value (default)', () => { +it(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -374,7 +374,7 @@ test(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual([]); }); -test(' - renders a multiselect with disabled options', () => { +it(' - renders a multiselect with disabled options', () => { const element = value === 'b'} />; const wrapper = mount( element, @@ -390,7 +390,7 @@ test(' - renders a multiselect with disabled options', () => { expect(wrapper.find('option').at(1).prop('disabled')).toBe(true); }); -test(' - renders a select with correct value (model)', () => { +it(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -407,7 +407,7 @@ test(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -test(' - renders a select with correct value (specified)', () => { +it(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -421,7 +421,7 @@ test(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -test(' - renders a select which correctly reacts on change (first value)', () => { +it(' - renders a select which correctly reacts on change (first value)', () => { const onChange = jest.fn(); const element = ; @@ -443,7 +443,7 @@ test(' - renders a select which correctly reacts on change (first v expect(onChange).toHaveBeenLastCalledWith('x', ['a']); }); -test(' - renders a select which correctly reacts on change (next value)', () => { +it(' - renders a select which correctly reacts on change (next value)', () => { const onChange = jest.fn(); const element = ; @@ -465,7 +465,7 @@ test(' - renders a select which correctly reacts on change (next va expect(onChange).toHaveBeenLastCalledWith('x', ['a', 'b']); }); -test(' - renders a select which correctly reacts on change (uncheck) by value', () => { +it(' - renders a select which correctly reacts on change (uncheck) by value', () => { const onChange = jest.fn(); const element = ; @@ -487,7 +487,7 @@ test(' - renders a select which correctly reacts on change (uncheck expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { +it(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { const onChange = jest.fn(); const element = ; @@ -511,7 +511,7 @@ test(' - renders a select which correctly reacts on change (uncheck expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a set of checkboxes with correct options', () => { +it(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -523,7 +523,7 @@ test(' - renders a set of checkboxes with correct option expect(wrapper.find('label').at(1).text()).toBe('b'); }); -test(' - renders a set of checkboxes with correct options (transform)', () => { +it(' - renders a set of checkboxes with correct options (transform)', () => { const element = ( x.toUpperCase()} /> ); @@ -537,7 +537,7 @@ test(' - renders a set of checkboxes with correct option expect(wrapper.find('label').at(1).text()).toBe('B'); }); -test(' - renders a set of checkboxes with correct value (default)', () => { +it(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -549,7 +549,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -test(' - renders a set of checkboxes with correct value (model)', () => { +it(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -564,7 +564,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes with correct value (specified)', () => { +it(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -576,7 +576,7 @@ test(' - renders a set of checkboxes with correct value expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -test(' - renders a set of checkboxes which correctly reacts on change', () => { +it(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -593,7 +593,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -test(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { const onChange = jest.fn(); const element = ; @@ -613,7 +613,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -test(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); const element = ; @@ -633,7 +633,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', []); }); -test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -650,7 +650,7 @@ test(' - renders a set of checkboxes which correctly rea expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -661,7 +661,7 @@ test(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ( ); @@ -675,14 +675,14 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - works with special characters', () => { +it(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -test(' - renders a set of checkboxes with per-item props', () => { +it(' - renders a set of checkboxes with per-item props', () => { const allowedValues = ['a', 'b']; const element = ( diff --git a/packages/uniforms-unstyled/__tests__/SubmitField.tsx b/packages/uniforms-unstyled/__tests__/SubmitField.tsx index 1ce693245..6545e0c40 100644 --- a/packages/uniforms-unstyled/__tests__/SubmitField.tsx +++ b/packages/uniforms-unstyled/__tests__/SubmitField.tsx @@ -4,14 +4,14 @@ import { SubmitField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -test(' - renders', () => { +it(' - renders', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper).toHaveLength(1); }); -test(' - renders disabled if error', () => { +it(' - renders disabled if error', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -19,7 +19,7 @@ test(' - renders disabled if error', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders enabled if error and enabled', () => { +it(' - renders enabled if error and enabled', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -27,7 +27,7 @@ test(' - renders enabled if error and enabled', () => { expect(wrapper.find('input').prop('disabled')).toBe(false); }); -test(' - renders a wrapper with correct value', () => { +it(' - renders a wrapper with correct value', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-unstyled/__tests__/TextField.tsx b/packages/uniforms-unstyled/__tests__/TextField.tsx index 211b73697..eab933163 100644 --- a/packages/uniforms-unstyled/__tests__/TextField.tsx +++ b/packages/uniforms-unstyled/__tests__/TextField.tsx @@ -9,7 +9,7 @@ import mount from './_mount'; describe('@RTL - TextField tests', () => { testTextField(TextField); - test(' - renders a wrapper with unknown props', () => { + it(' - renders a wrapper with unknown props', () => { const props = { 'data-x': 'x', 'data-y': 'y', @@ -24,14 +24,14 @@ describe('@RTL - TextField tests', () => { }); }); -test(' - renders an input', () => { +it(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -test(' - renders an input with correct disabled state', () => { +it(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -39,7 +39,7 @@ test(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -test(' - renders an input with correct readOnly state', () => { +it(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -47,7 +47,7 @@ test(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -test(' - renders an input with correct id (inherited)', () => { +it(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -55,7 +55,7 @@ test(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -test(' - renders an input with correct id (specified)', () => { +it(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -63,7 +63,7 @@ test(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -test(' - renders an input with correct name', () => { +it(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -71,7 +71,7 @@ test(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -test(' - renders an input with correct placeholder', () => { +it(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -79,7 +79,7 @@ test(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -test(' - renders an input with correct type', () => { +it(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -87,7 +87,7 @@ test(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('text'); }); -test(' - renders an input with correct value (default)', () => { +it(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -95,7 +95,7 @@ test(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -test(' - renders an input with correct value (model)', () => { +it(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -106,7 +106,7 @@ test(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input with correct value (specified)', () => { +it(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -114,7 +114,7 @@ test(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -test(' - renders an input which correctly reacts on change', () => { +it(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -130,7 +130,7 @@ test(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders an input which correctly reacts on change (empty)', () => { +it(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -146,7 +146,7 @@ test(' - renders an input which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -test(' - renders an input which correctly reacts on change (same value)', () => { +it(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -162,7 +162,7 @@ test(' - renders an input which correctly reacts on change (same valu expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -test(' - renders a label', () => { +it(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -173,7 +173,7 @@ test(' - renders a label', () => { ); }); -test(' - renders a wrapper with unknown props', () => { +it(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -182,7 +182,7 @@ test(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -test(' - renders an input with autocomplete turned off', () => { +it(' - renders an input with autocomplete turned off', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-unstyled/__tests__/ValidateQuickForm.tsx b/packages/uniforms-unstyled/__tests__/ValidateQuickForm.tsx index 6b0f69eb2..412bd2c51 100644 --- a/packages/uniforms-unstyled/__tests__/ValidateQuickForm.tsx +++ b/packages/uniforms-unstyled/__tests__/ValidateQuickForm.tsx @@ -4,7 +4,7 @@ import { ValidatedQuickForm } from 'uniforms-unstyled'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-unstyled/__tests__/ValidatedForm.tsx b/packages/uniforms-unstyled/__tests__/ValidatedForm.tsx index f4b48cacf..725c955ff 100644 --- a/packages/uniforms-unstyled/__tests__/ValidatedForm.tsx +++ b/packages/uniforms-unstyled/__tests__/ValidatedForm.tsx @@ -4,7 +4,7 @@ import { ValidatedForm } from 'uniforms-unstyled'; import createSchema from './_createSchema'; import mount from './_mount'; -test(' - works', () => { +it(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms/__suites__/ListField.tsx b/packages/uniforms/__suites__/ListField.tsx index 3aec9c993..03e356d02 100644 --- a/packages/uniforms/__suites__/ListField.tsx +++ b/packages/uniforms/__suites__/ListField.tsx @@ -10,7 +10,7 @@ export function testListField( addFieldLocator, }: { addFieldLocator: () => HTMLElement | null | undefined }, ) { - test(' - renders ListAddField', () => { + it(' - renders ListAddField', () => { render(, { x: Array, 'x.$': String, @@ -19,7 +19,7 @@ export function testListField( expect(screen.getByRole('button')).toBeInTheDocument(); }); - test(' - renders correct label (specified)', () => { + it(' - renders correct label (specified)', () => { render(, { x: Array, 'x.$': String, @@ -29,7 +29,7 @@ export function testListField( expect(screen.getByText(/ListFieldLabel.*/)).toBeInTheDocument(); }); - test(' - renders correct numer of items with model (specified)', () => { + it(' - renders correct numer of items with model (specified)', () => { render( , { @@ -43,7 +43,7 @@ export function testListField( expect(screen.getAllByRole('textbox')).toHaveLength(3); }); - test(' - passes itemProps to its children', () => { + it(' - passes itemProps to its children', () => { const itemProps = { 'data-xyz': 1 }; const Child = jest.fn(() =>
) as FC; render( @@ -60,7 +60,7 @@ export function testListField( expect(Child).toHaveBeenNthCalledWith(2, itemProps, {}); }); - test(' - renders children (specified)', () => { + it(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as FC; render( @@ -75,7 +75,7 @@ export function testListField( expect(Child).toHaveBeenCalledTimes(2); }); - test(' - renders children with correct name (children)', () => { + it(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as FC; render( @@ -90,7 +90,7 @@ export function testListField( expect(Child).toHaveBeenNthCalledWith(2, { name: '1' }, {}); }); - test(' - renders children with correct name (value)', () => { + it(' - renders children with correct name (value)', () => { render( , { @@ -106,7 +106,7 @@ export function testListField( expect(inputs[1]).toHaveAttribute('name', 'x.1'); }); - test(' - renders proper number of optional values after add new value', () => { + it(' - renders proper number of optional values after add new value', () => { const onChange = jest.fn(); render( , diff --git a/packages/uniforms/__suites__/TextField.tsx b/packages/uniforms/__suites__/TextField.tsx index 8ab4dc33a..91cd13aa6 100644 --- a/packages/uniforms/__suites__/TextField.tsx +++ b/packages/uniforms/__suites__/TextField.tsx @@ -5,19 +5,19 @@ import React, { ComponentType } from 'react'; import { render } from './render'; export function testTextField(TextField: ComponentType) { - test(' - renders an input with correct disabled state', () => { + it(' - renders an input with correct disabled state', () => { render(, { x: String }); expect(screen.getByRole('textbox')).toBeDisabled(); }); - test(' - renders an input with correct readOnly state', () => { + it(' - renders an input with correct readOnly state', () => { render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('readonly', ''); }); - test(' - renders an input with autocomplete turned off', () => { + it(' - renders an input with autocomplete turned off', () => { render(, { x: String, }); @@ -25,27 +25,27 @@ export function testTextField(TextField: ComponentType) { expect(screen.getByRole('textbox')).toHaveAttribute('autocomplete', 'off'); }); - test(' - renders an input with correct id (inherited)', () => { + it(' - renders an input with correct id (inherited)', () => { render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('id'); }); - test(' - renders an input with correct id (specified)', () => { + it(' - renders an input with correct id (specified)', () => { const id = 'y'; render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('id', id); }); - test(' - renders an input with correct name', () => { + it(' - renders an input with correct name', () => { const name = 'x'; render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('name', name); }); - test(' - renders an input with correct placeholder', () => { + it(' - renders an input with correct placeholder', () => { const placeholder = 'y'; render(, { x: String, @@ -57,25 +57,25 @@ export function testTextField(TextField: ComponentType) { ); }); - test(' - renders an input with correct type', () => { + it(' - renders an input with correct type', () => { render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('type', 'text'); }); - test(' - renders an input with correct type (url)', () => { + it(' - renders an input with correct type (url)', () => { render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('type', 'url'); }); - test(' - renders an input with correct value (default)', () => { + it(' - renders an input with correct value (default)', () => { render(, { x: String }); expect(screen.getByRole('textbox')).toHaveValue(''); }); - test(' - renders an input with correct value (model)', () => { + it(' - renders an input with correct value (model)', () => { const defaultValue = 'y'; render( , @@ -86,7 +86,7 @@ export function testTextField(TextField: ComponentType) { expect(screen.getByRole('textbox')).toHaveValue(defaultValue); }); - test(' - renders an input with correct value (specified)', () => { + it(' - renders an input with correct value (specified)', () => { const defaultValue = 'y'; render(, { x: String, @@ -95,7 +95,7 @@ export function testTextField(TextField: ComponentType) { expect(screen.getByRole('textbox')).toHaveValue(defaultValue); }); - test(' - renders an input which correctly reacts on change', () => { + it(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const name = 'x'; const text = 'y'; @@ -106,7 +106,7 @@ export function testTextField(TextField: ComponentType) { expect(onChange).toHaveBeenLastCalledWith(name, text); }); - test(' - renders an input which correctly reacts on change (empty value)', () => { + it(' - renders an input which correctly reacts on change (empty value)', () => { const onChange = jest.fn(); const name = 'x'; render( @@ -120,7 +120,7 @@ export function testTextField(TextField: ComponentType) { expect(onChange).toHaveBeenLastCalledWith(name, ''); }); - test(' - renders a label', () => { + it(' - renders a label', () => { render(, { x: String }); expect(screen.getByLabelText(/y.*/)).toBeInTheDocument(); diff --git a/packages/uniforms/__tests__/AutoForm.tsx b/packages/uniforms/__tests__/AutoForm.tsx index 4983b12c6..94d47df18 100644 --- a/packages/uniforms/__tests__/AutoForm.tsx +++ b/packages/uniforms/__tests__/AutoForm.tsx @@ -3,7 +3,7 @@ import React from 'react'; import SimpleSchema from 'simpl-schema'; import { AutoForm, connectField, context } from 'uniforms'; import { SimpleSchema2Bridge } from 'uniforms-bridge-simple-schema-2'; -import { AutoField } from 'uniforms-unstyled'; +import { AutoFields } from 'uniforms-unstyled'; import { render } from '../__suites__'; @@ -19,6 +19,7 @@ const onChange = jest.fn(); const onChangeModel = jest.fn(); const onSubmit = jest.fn(); const validator = jest.fn(); +const mockContext = jest.fn(); jest.spyOn(schema.schema, 'validator').mockImplementation(() => validator); @@ -31,14 +32,14 @@ beforeEach(() => { describe('', () => { describe('when changes', () => { - test('updates', () => { + it('updates', () => { render( , { schema: { type: SimpleSchema2Bridge } }, { onChange }, ); }); - test('validates', () => { + it('validates', () => { // FIXME: AutoForm is not a valid Component. render( ', () => { name="form" schema={schema} > - + , { schema: { type: SimpleSchema2Bridge }, @@ -59,15 +60,15 @@ describe('', () => { fireEvent.submit(form); expect(validator).toHaveBeenCalledTimes(1); - expect(validator).toHaveBeenLastCalledWith({ a: '' }); + expect(validator).toHaveBeenLastCalledWith({ a: '', b: '', c: '' }); fireEvent.change(input, { target: { value: '2' } }); expect(validator).toHaveBeenCalledTimes(2); - expect(validator).toHaveBeenLastCalledWith({ a: '2' }); + expect(validator).toHaveBeenLastCalledWith({ a: '2', b: '', c: '' }); }); - test('calls `onChangeModel`', () => { + it('calls `onChangeModel`', () => { // FIXME: AutoForm is not a valid Component. render( ', () => { expect(onChangeModel).toHaveBeenCalledTimes(1); expect(onChangeModel).toHaveBeenLastCalledWith({ a: '2' }); }); - test('updates `changed` and `changedMap`', () => { + it('updates `changed` and `changedMap`', () => { // FIXME: AutoForm is not a valid Component. render( - {context => ( - <> - {context ? ( - <> -

{`${context.changed}`}

-

- {JSON.stringify(context?.changedMap)} -

- - ) : null} - - )} + {context => mockContext(context?.changed, context?.changedMap)}
- +
, { schema: { type: SimpleSchema2Bridge }, }, ); - const changed = screen.getByTestId('changed').innerHTML; - const changedMap = JSON.parse(screen.getByTestId('changedMap').innerHTML); - - expect(changed).toBe('true'); - expect(changedMap).toHaveProperty('b'); - expect(changedMap.b).toBeTruthy(); + expect(mockContext).toHaveBeenLastCalledWith(true, { + a: {}, + b: {}, + c: {}, + }); }); }); describe('when render', () => { - test('calls `onChange` before render', () => { + it('calls `onChange` before render', () => { const field = () => null; const Field = connectField(field); @@ -147,11 +136,11 @@ describe('', () => { expect(onChange.mock.calls[0]).toEqual(expect.arrayContaining(['b', ''])); expect(onChange.mock.calls[1]).toEqual(expect.arrayContaining(['c', ''])); }); - test('skips `onSubmit` until rendered (`autosave` = true)', async () => { + it('skips `onSubmit` until rendered (`autosave` = true)', async () => { // FIXME: AutoForm is not a valid Component. render( - + , { schema: { type: SimpleSchema2Bridge }, @@ -165,29 +154,23 @@ describe('', () => { const input = screen.getByLabelText('A'); expect(onSubmit).toHaveBeenCalledTimes(1); - expect(onSubmit).toHaveBeenLastCalledWith({ a: '' }); + expect(onSubmit).toHaveBeenLastCalledWith({ a: '', b: '', c: '' }); await new Promise(resolve => setTimeout(resolve)); fireEvent.change(input, { target: { value: '1' } }); expect(validator).toHaveBeenCalledTimes(2); - expect(validator).toHaveBeenLastCalledWith({ a: '1' }); + expect(validator).toHaveBeenLastCalledWith({ a: '1', b: '', c: '' }); }); }); describe('when reset', () => { - test('reset `model`', () => { + it('reset `model`', () => { // FIXME: AutoForm is not a valid Component. const Component = () => ( - {context => ( - <> - {context && context.model ? ( -

{JSON.stringify(context.model)}

- ) : null} - - )} + {context => mockContext(context?.model)}
); @@ -196,25 +179,16 @@ describe('', () => { }); rerender(); - const renderedModel = JSON.parse(screen.getByTestId('model').innerHTML); - expect(renderedModel).toEqual(model); + expect(mockContext).toHaveBeenLastCalledWith(model); }); - test('resets state `changedMap`', () => { + it('resets state `changedMap`', () => { // FIXME: AutoForm is not a valid Component. const Component = () => ( - {context => ( - <> - {context && context.changedMap ? ( -

- {JSON.stringify(context.changedMap)} -

- ) : null} - - )} + {context => mockContext(context?.changedMap)}
); @@ -223,23 +197,16 @@ describe('', () => { }); rerender(); - const changedMap = JSON.parse(screen.getByTestId('changedMap').innerHTML); - expect(changedMap).toEqual({}); + expect(mockContext).toHaveBeenLastCalledWith({}); }); - test('resets state `changed`', () => { + it('resets state `changed`', () => { // FIXME: AutoForm is not a valid Component. const Component = () => ( - {context => ( - <> - {context ? ( -

{JSON.stringify(context.changed)}

- ) : null} - - )} + {context => mockContext(context?.changed)}
); @@ -248,24 +215,17 @@ describe('', () => { }); rerender(); - const changed = JSON.parse(screen.getByTestId('changed').innerHTML); - expect(changed).toEqual(false); + expect(mockContext).toHaveBeenLastCalledWith(false); }); }); describe('when update', () => { - test(', updates', () => { + it(', updates', () => { // FIXME: AutoForm is not a valid Component. render( - {context => ( - <> - {context ? ( -

{JSON.stringify(context.model)}

- ) : null} - - )} + {context => mockContext(context?.model)}
, { @@ -273,12 +233,10 @@ describe('', () => { }, ); - const model = JSON.parse(screen.getByTestId('model').innerHTML); - - expect(model).toEqual({}); + expect(mockContext).toHaveBeenLastCalledWith({}); }); - test(', validates', () => { + it(', validates', () => { // FIXME: AutoForm is not a valid Component. const { rerender } = render(, { schema: { type: SimpleSchema2Bridge }, diff --git a/packages/uniforms/__tests__/Bridge.ts b/packages/uniforms/__tests__/Bridge.ts index 98cec0f90..9c0b654f9 100644 --- a/packages/uniforms/__tests__/Bridge.ts +++ b/packages/uniforms/__tests__/Bridge.ts @@ -4,7 +4,7 @@ describe('Bridge', () => { class CustomBridge extends Bridge {} const customBridgeInstance = new CustomBridge(); - test('cannot be instantiated', () => { + it('cannot be instantiated', () => { // @ts-expect-error expect(() => new Bridge()).toThrow(); }); @@ -23,7 +23,7 @@ describe('Bridge', () => { ] as const ).forEach(method => { describe(`#${method}`, () => { - test('throws an unimplemented error', () => { + it('throws an unimplemented error', () => { // @ts-expect-error expect(() => customBridgeInstance[method]()).toThrow(); }); diff --git a/packages/uniforms/__tests__/ValidatedForm.tsx b/packages/uniforms/__tests__/ValidatedForm.tsx index f14d406d4..0681dfc9c 100644 --- a/packages/uniforms/__tests__/ValidatedForm.tsx +++ b/packages/uniforms/__tests__/ValidatedForm.tsx @@ -13,6 +13,7 @@ describe('ValidatedForm', () => { const onValidate = jest.fn((model, error) => error); const validator = jest.fn(); const validatorForSchema = jest.fn(() => validator); + const mockContext = jest.fn(); const error = new Error('test error message'); const model = { a: 1 }; @@ -30,7 +31,7 @@ describe('ValidatedForm', () => { describe('on validation', () => { // FIXME: ValidatedForm is not a valid Component. - test('validates (when `.validate` is called)', () => { + it('validates (when `.validate` is called)', () => { render( { expect(validator).toHaveBeenCalledTimes(1); }); - test('correctly calls `validator`', () => { + it('correctly calls `validator`', () => { render( { expect(validator).toHaveBeenCalledTimes(1); expect(validator).toHaveBeenLastCalledWith(model); }); - test('updates error state with errors from `validator`', async () => { + it('updates error state with errors from `validator`', async () => { render( { expect(onValidate).toHaveBeenLastCalledWith(model, error); }); - test('correctly calls `onValidate` when validation succeeds', () => { + it('correctly calls `onValidate` when validation succeeds', () => { render( { expect(onValidate).toHaveBeenLastCalledWith(model, null); }); - test('correctly calls `onValidate` when validation fails ', () => { + it('correctly calls `onValidate` when validation fails ', () => { render( { expect(onValidate).toHaveBeenLastCalledWith(model, error); }); - test('updates error state with async errors from `onValidate`', async () => { + it('updates error state with async errors from `onValidate`', async () => { render( { validator={validator} > - {context => ( - <> - {context && context.error ? ( -

{context.error.message}

- ) : null} - - )} + {context => mockContext(context?.error)}
, { @@ -179,11 +174,10 @@ describe('ValidatedForm', () => { onValidate.mockImplementationOnce(() => error); fireEvent.submit(form); - const errorElement = screen.getByTestId('error'); - expect(errorElement.innerHTML).toBe('test error message'); + expect(mockContext).toHaveBeenLastCalledWith(error); }); - test('leaves error state alone when `onValidate` suppress `validator` errors', async () => { + it('leaves error state alone when `onValidate` suppress `validator` errors', async () => { render( { validator={validator} > - {context => ( - <> - {context ? ( -

- {JSON.stringify({ error: context.error })} -

- ) : null} - - )} + {context => mockContext(context?.error)}
, { @@ -211,7 +197,6 @@ describe('ValidatedForm', () => { }, ); const form = screen.getByRole('form'); - const errorContext = JSON.parse(screen.getByTestId('error').innerHTML); validator.mockImplementationOnce(() => { throw error; @@ -221,9 +206,9 @@ describe('ValidatedForm', () => { expect(validator).toHaveBeenCalled(); expect(onValidate).toHaveBeenCalled(); - expect(errorContext.error).toBe(null); + expect(mockContext).toHaveBeenLastCalledWith(null); }); - test('has `validating` context variable, default `false`', () => { + it('has `validating` context variable, default `false`', () => { render( { validator={validator} > - {context => ( - <> - {context ? ( -

- {JSON.stringify(context.validating)} -

- ) : null} - - )} + {context => mockContext(context?.validating)}
, { @@ -248,14 +225,10 @@ describe('ValidatedForm', () => { }, ); - const validatingContext = JSON.parse( - screen.getByTestId('validating').innerHTML, - ); - - expect(validatingContext).toBe(false); + expect(mockContext).toHaveBeenCalledWith(false); }); - test('uses `modelTransform`s `validate` mode', () => { + it('uses `modelTransform`s `validate` mode', () => { const transformedModel = { b: 1 }; const modelTransform = (mode: string, model: Record) => mode === 'validate' ? transformedModel : model; @@ -281,7 +254,7 @@ describe('ValidatedForm', () => { }); describe('when submitted', () => { - test('calls `onSubmit` when validation succeeds', async () => { + it('calls `onSubmit` when validation succeeds', async () => { render( // FIXME: ValidatedForm is not a valid Component. { expect(onSubmit).toHaveBeenCalledTimes(1); }); - test('skips `onSubmit` when validation fails', async () => { + it('skips `onSubmit` when validation fails', async () => { render( // FIXME: ValidatedForm is not a valid Component. { expect(onSubmit).not.toBeCalled(); }); - test('sets submitted to true, when form is submitted and validation succeeds', () => { + it('sets submitted to true, when form is submitted and validation succeeds', () => { render( // FIXME: ValidatedForm is not a valid Component. { onSubmit={onSubmit} > - {context => ( - <> - {context ? ( -

- {JSON.stringify(context.submitted)} -

- ) : null} - - )} + {context => mockContext(context?.submitted)}
, { @@ -362,19 +327,15 @@ describe('ValidatedForm', () => { }, ); const form = screen.getByRole('form'); - const getSubmittedContext = () => - JSON.parse(screen.getByTestId('submitted').innerHTML); - let submittedContext = getSubmittedContext(); - expect(submittedContext).toBe(false); + expect(mockContext).toHaveBeenLastCalledWith(false); fireEvent.submit(form); - submittedContext = getSubmittedContext(); - expect(submittedContext).toBe(true); + expect(mockContext).toHaveBeenLastCalledWith(true); }); - test('sets submitted to true, when form is submitted and validation fails', () => { + it('sets submitted to true, when form is submitted and validation fails', () => { render( // FIXME: ValidatedForm is not a valid Component. { onSubmit={onSubmit} > - {context => ( - <> - {context ? ( -

- {JSON.stringify(context.submitted)} -

- ) : null} - - )} + {context => mockContext(context?.submitted)}
, { @@ -408,19 +361,15 @@ describe('ValidatedForm', () => { }); const form = screen.getByRole('form'); - const getSubmittedContext = () => - JSON.parse(screen.getByTestId('submitted').innerHTML); - let submittedContext = getSubmittedContext(); - expect(submittedContext).toBe(false); + expect(mockContext).toHaveBeenLastCalledWith(false); fireEvent.submit(form); - submittedContext = getSubmittedContext(); - expect(submittedContext).toBe(true); + expect(mockContext).toHaveBeenLastCalledWith(true); }); - test('updates error state with async errors from `onSubmit`', async () => { + it('updates error state with async errors from `onSubmit`', async () => { render( // FIXME: ValidatedForm is not a valid Component. { onSubmit={onSubmit} > - {context => ( - <> - {context && context.error ? ( -

{context.error.message}

- ) : null} - - )} + {context => mockContext(context?.error)}
, { @@ -452,13 +395,12 @@ describe('ValidatedForm', () => { fireEvent.submit(form); await new Promise(resolve => process.nextTick(resolve)); - const errorMessage = screen.getByTestId('error').innerHTML; expect(onSubmit).toHaveBeenCalled(); - expect(errorMessage).toBe('test error message'); + expect(mockContext).toHaveBeenLastCalledWith(error); }); - test('works if unmounts on submit', async () => { + it('works if unmounts on submit', async () => { const { unmount } = render( // FIXME: ValidatedForm is not a valid Component. { describe('on change', () => { describe('in `onChange` mode', () => { - test('validates', () => { + it('validates', () => { // FIXME: ValidatedForm is not a valid Component. render( { }); describe('in `onSubmit` mode', () => { - test('does not validate', () => { + it('does not validate', () => { // FIXME: ValidatedForm is not a valid Component. render( @@ -523,7 +465,7 @@ describe('ValidatedForm', () => { }); describe('in `onChangeAfterSubmit` mode', () => { - test('does not validates before submit', () => { + it('does not validates before submit', () => { render( // FIXME: ValidatedForm is not a valid Component. { expect(validator).not.toHaveBeenCalled(); }); - test('validates after submit', async () => { + it('validates after submit', async () => { render( // FIXME: ValidatedForm is not a valid Component. { }); describe('on reset', () => { - test('removes `error`', async () => { + it('removes `error`', async () => { const FormControls = () => { const { formRef } = useForm(); @@ -597,13 +539,7 @@ describe('ValidatedForm', () => { schema={schema} > - {context => ( - <> - {context ? ( -

{context.error?.message}

- ) : null} - - )} + {context => mockContext(context?.error)}
@@ -621,14 +557,12 @@ describe('ValidatedForm', () => { fireEvent.submit(form); await new Promise(resolve => process.nextTick(resolve)); - const errorMessage = screen.getByTestId('error').innerHTML; - expect(errorMessage).toBe('test error message'); + expect(mockContext).toHaveBeenLastCalledWith(error); fireEvent.click(resetButton); await new Promise(resolve => process.nextTick(resolve)); - const errorMessage2 = screen.getByTestId('error').innerHTML; - expect(errorMessage2).toBe(''); + expect(mockContext).toHaveBeenLastCalledWith(null); }); }); @@ -645,7 +579,7 @@ describe('ValidatedForm', () => { /> ); - test('does not revalidate arbitrarily', () => { + it('does not revalidate arbitrarily', () => { const { rerender } = render(, { schema: { type: SimpleSchema2Bridge }, }); @@ -653,7 +587,7 @@ describe('ValidatedForm', () => { expect(validator).not.toBeCalled(); }); - test('revalidates if `model` changes', () => { + it('revalidates if `model` changes', () => { const { rerender } = render(, { schema: { type: SimpleSchema2Bridge }, }); @@ -661,7 +595,7 @@ describe('ValidatedForm', () => { expect(validator).toHaveBeenCalledTimes(1); }); - test('revalidates if `validator` changes', () => { + it('revalidates if `validator` changes', () => { const { rerender } = render(, { schema: { type: SimpleSchema2Bridge }, }); @@ -669,7 +603,7 @@ describe('ValidatedForm', () => { expect(validator).toHaveBeenCalledTimes(1); }); - test('revalidate if `schema` changes', () => { + it('revalidate if `schema` changes', () => { const anotherSchema = new SimpleSchema2Bridge(schema.schema); const { rerender } = render(, { schema: { type: SimpleSchema2Bridge }, @@ -690,7 +624,7 @@ describe('ValidatedForm', () => { /> ); - test('does not revalidate when `model` changes', () => { + it('does not revalidate when `model` changes', () => { const { rerender } = render(, { schema: { type: SimpleSchema2Bridge }, }); @@ -698,7 +632,7 @@ describe('ValidatedForm', () => { expect(validator).not.toBeCalled(); }); - test('does not revalidate when validator `options` change', () => { + it('does not revalidate when validator `options` change', () => { const { rerender } = render(, { schema: { type: SimpleSchema2Bridge }, }); @@ -706,7 +640,7 @@ describe('ValidatedForm', () => { expect(validator).not.toBeCalled(); }); - test('does not revalidate when `schema` changes', () => { + it('does not revalidate when `schema` changes', () => { const anotherSchema = new SimpleSchema2Bridge(schema.schema); const { rerender } = render(, { schema: { type: SimpleSchema2Bridge }, @@ -730,7 +664,7 @@ describe('ValidatedForm', () => {
); - test('reuses the validator between validations', () => { + it('reuses the validator between validations', () => { render(, { schema: { type: SimpleSchema2Bridge }, }); @@ -744,7 +678,7 @@ describe('ValidatedForm', () => { expect(validatorForSchema).toHaveBeenCalledTimes(1); }); - test('uses the new validator settings if `validator` changes', () => { + it('uses the new validator settings if `validator` changes', () => { const validatorA = Symbol(); const validatorB = Symbol(); const { rerender } = render(, { @@ -764,7 +698,7 @@ describe('ValidatedForm', () => { expect(validatorForSchema).toHaveBeenNthCalledWith(4, validatorA); }); - test('uses the new validator if `schema` changes', () => { + it('uses the new validator if `schema` changes', () => { const alternativeValidator = jest.fn(); const alternativeSchema = new SimpleSchema2Bridge(schema.schema); jest diff --git a/packages/uniforms/__tests__/changedKeys.ts b/packages/uniforms/__tests__/changedKeys.ts index 9a4042e11..80e2612fa 100644 --- a/packages/uniforms/__tests__/changedKeys.ts +++ b/packages/uniforms/__tests__/changedKeys.ts @@ -1,30 +1,30 @@ import { changedKeys } from 'uniforms'; describe('changedKeys', () => { - test('is a function', () => { + it('is a function', () => { expect(changedKeys).toBeInstanceOf(Function); }); describe('(==)', () => { - test('works with arrays', () => { + it('works with arrays', () => { expect(changedKeys('a', [], [])).toEqual([]); expect(changedKeys('a', [1], [1])).toEqual([]); expect(changedKeys('a', [1, 2], [1, 2])).toEqual([]); }); - test('works with dates', () => { + it('works with dates', () => { expect(changedKeys('a', new Date(10), new Date(10))).toEqual([]); expect(changedKeys('a', new Date(20), new Date(20))).toEqual([]); expect(changedKeys('a', new Date(30), new Date(30))).toEqual([]); }); - test('works with objects', () => { + it('works with objects', () => { expect(changedKeys('a', {}, {})).toEqual([]); expect(changedKeys('a', { a: 1 }, { a: 1 })).toEqual([]); expect(changedKeys('a', { a: 1, b: 2 }, { a: 1, b: 2 })).toEqual([]); }); - test('works with primitives', () => { + it('works with primitives', () => { expect(changedKeys('a', 1, 1)).toEqual([]); expect(changedKeys('a', null, null)).toEqual([]); expect(changedKeys('a', true, true)).toEqual([]); @@ -33,19 +33,19 @@ describe('changedKeys', () => { }); describe('(++)', () => { - test('works with arrays', () => { + it('works with arrays', () => { expect(changedKeys('a', [], [1])).toEqual(['a', 'a.0']); expect(changedKeys('a', [1], [1, 2])).toEqual(['a', 'a.1']); expect(changedKeys('a', [1, 2], [1, 2, 3])).toEqual(['a', 'a.2']); }); - test('works with dates', () => { + it('works with dates', () => { expect(changedKeys('a', new Date(10), new Date(20))).toEqual(['a']); expect(changedKeys('a', new Date(20), new Date(30))).toEqual(['a']); expect(changedKeys('a', new Date(30), new Date(40))).toEqual(['a']); }); - test('works with objects', () => { + it('works with objects', () => { expect(changedKeys('a', {}, { a: 1 })).toEqual(['a', 'a.a']); expect(changedKeys('a', { a: 1 }, { a: 1, b: 2 })).toEqual(['a', 'a.b']); expect(changedKeys('a', { a: 1, b: 2 }, { a: 1, b: 2, c: 3 })).toEqual([ @@ -54,7 +54,7 @@ describe('changedKeys', () => { ]); }); - test('works with primitives', () => { + it('works with primitives', () => { expect(changedKeys('a', 1, 2)).toEqual(['a']); expect(changedKeys('a', null, true)).toEqual(['a']); expect(changedKeys('a', true, null)).toEqual(['a']); @@ -63,21 +63,21 @@ describe('changedKeys', () => { }); describe('(--)', () => { - test('works with arrays', () => { + it('works with arrays', () => { expect(changedKeys('a', [1])).toEqual(['a', 'a.0']); expect(changedKeys('a', [1], [])).toEqual(['a', 'a.0']); expect(changedKeys('a', [1, 2], [1])).toEqual(['a', 'a.1']); expect(changedKeys('a', [1, 2, 3], [1, 2])).toEqual(['a', 'a.2']); }); - test('works with dates', () => { + it('works with dates', () => { expect(changedKeys('a', new Date(20))).toEqual(['a']); expect(changedKeys('a', new Date(20), new Date(10))).toEqual(['a']); expect(changedKeys('a', new Date(30), new Date(20))).toEqual(['a']); expect(changedKeys('a', new Date(40), new Date(30))).toEqual(['a']); }); - test('works with objects', () => { + it('works with objects', () => { expect(changedKeys('a', { a: 1 })).toEqual(['a', 'a.a']); expect(changedKeys('a', { a: 1 }, {})).toEqual(['a', 'a.a']); expect(changedKeys('a', { a: 1, b: 2 }, { a: 1 })).toEqual(['a', 'a.b']); @@ -87,7 +87,7 @@ describe('changedKeys', () => { ]); }); - test('works with primitives', () => { + it('works with primitives', () => { expect(changedKeys('a', 2)).toEqual(['a']); expect(changedKeys('a', 2, 1)).toEqual(['a']); expect(changedKeys('a', true, null)).toEqual(['a']); @@ -96,7 +96,7 @@ describe('changedKeys', () => { }); }); - test('works with changing value types', () => { + it('works with changing value types', () => { expect(changedKeys('a', '1', 1)).toEqual(['a']); expect(changedKeys('a', 1, '1')).toEqual(['a']); expect(changedKeys('a', 'true', true)).toEqual(['a']); diff --git a/packages/uniforms/__tests__/filterDOMProps.ts b/packages/uniforms/__tests__/filterDOMProps.ts index 9fd9a6161..33ac5980e 100644 --- a/packages/uniforms/__tests__/filterDOMProps.ts +++ b/packages/uniforms/__tests__/filterDOMProps.ts @@ -1,29 +1,29 @@ import { filterDOMProps } from 'uniforms'; describe('joinName', () => { - test('is a function', () => { + it('is a function', () => { expect(filterDOMProps).toBeInstanceOf(Function); }); - test('removes props', () => { + it('removes props', () => { expect(filterDOMProps({ value: 999999 })).toEqual({}); expect(filterDOMProps({ changed: true })).toEqual({}); }); - test('removes registered props', () => { + it('removes registered props', () => { // @ts-expect-error: Do not register its type not to pollute it. filterDOMProps.register('__special__'); expect(filterDOMProps({ __special__: true })).toEqual({}); }); - test('ignores double registers', () => { + it('ignores double registers', () => { const { length } = filterDOMProps.registered; filterDOMProps.register('value'); expect(filterDOMProps.registered).toHaveLength(length); }); - test('omits rest', () => { + it('omits rest', () => { expect(filterDOMProps({ a: 1 })).toEqual({ a: 1 }); expect(filterDOMProps({ b: 2 })).toEqual({ b: 2 }); }); diff --git a/packages/uniforms/__tests__/joinName.ts b/packages/uniforms/__tests__/joinName.ts index 1a520682f..1b8f8a384 100644 --- a/packages/uniforms/__tests__/joinName.ts +++ b/packages/uniforms/__tests__/joinName.ts @@ -15,15 +15,15 @@ function testFn(parts: unknown[], array: string[], string: string) { } describe('joinName', () => { - test('is a function', () => { + it('is a function', () => { expect(joinName).toBeInstanceOf(Function); }); - test('works with empty name', () => { + it('works with empty name', () => { testFn([], [], ''); }); - test('works with arrays', () => { + it('works with arrays', () => { testFn([['a']], ['a'], 'a'); testFn([[['a']]], ['a'], 'a'); testFn([[[['a']]]], ['a'], 'a'); @@ -40,19 +40,19 @@ describe('joinName', () => { testFn(['a', ['b', 'c'], 'd'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); }); - test('works with empty strings', () => { + it('works with empty strings', () => { testFn(['', 'a', 'b'], ['a', 'b'], 'a.b'); testFn(['a', '', 'b'], ['a', 'b'], 'a.b'); testFn(['a', 'b', ''], ['a', 'b'], 'a.b'); }); - test('works with falsy values', () => { + it('works with falsy values', () => { testFn(['a', null, 'b'], ['a', 'b'], 'a.b'); testFn(['a', false, 'b'], ['a', 'b'], 'a.b'); testFn(['a', undefined, 'b'], ['a', 'b'], 'a.b'); }); - test('works with numbers', () => { + it('works with numbers', () => { testFn([0, 'a', 'b'], ['0', 'a', 'b'], '0.a.b'); testFn(['a', 0, 'b'], ['a', '0', 'b'], 'a.0.b'); testFn(['a', 'b', 0], ['a', 'b', '0'], 'a.b.0'); @@ -61,13 +61,13 @@ describe('joinName', () => { testFn(['a', 'b', 1], ['a', 'b', '1'], 'a.b.1'); }); - test('works with partials', () => { + it('works with partials', () => { testFn(['a', 'b.c.d'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); testFn(['a.b', 'c.d'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); testFn(['a.b.c', 'd'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); }); - test('works with subscripts', () => { + it('works with subscripts', () => { testFn(['a["b"]'], ['a', 'b'], 'a.b'); testFn(['a["b"].c'], ['a', 'b', 'c'], 'a.b.c'); testFn(['a["b"].c["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); @@ -95,7 +95,7 @@ describe('joinName', () => { testFn(['["[\\"\\"]"]'], ['["[\\"\\"]"]'], '["[\\"\\"]"]'); }); - test('handles incorrect cases _somehow_', () => { + it('handles incorrect cases _somehow_', () => { // Boolean `true`. testFn([true], ['true'], 'true'); testFn([true, 'a'], ['true', 'a'], 'true.a'); diff --git a/packages/uniforms/__tests__/randomIds.ts b/packages/uniforms/__tests__/randomIds.ts index a025110b8..1243f9d40 100644 --- a/packages/uniforms/__tests__/randomIds.ts +++ b/packages/uniforms/__tests__/randomIds.ts @@ -1,20 +1,20 @@ import { randomIds } from 'uniforms'; describe('randomIds', () => { - test('is a function', () => { + it('is a function', () => { expect(randomIds).toBeInstanceOf(Function); }); - test('returns a function', () => { + it('returns a function', () => { expect(randomIds()).toBeInstanceOf(Function); }); - test('accepts custom prefix', () => { + it('accepts custom prefix', () => { const generator = randomIds('my-id-generator'); expect(generator()).toMatch(/^my-id-generator/); }); - test('generate random id', () => { + it('generate random id', () => { const amount = 100; const generator = randomIds(); diff --git a/packages/uniforms/__tests__/useField.tsx b/packages/uniforms/__tests__/useField.tsx index 9466d4a54..5e6fe448c 100644 --- a/packages/uniforms/__tests__/useField.tsx +++ b/packages/uniforms/__tests__/useField.tsx @@ -39,12 +39,12 @@ const TestComponent = connectField((props: Record) => { }); describe('useField', () => { - test('is a function', () => { + it('is a function', () => { expect(useField).toBeInstanceOf(Function); }); describe('when called with initialValue', () => { - test('applies default value', () => { + it('applies default value', () => { render( @@ -56,7 +56,7 @@ describe('useField', () => { expect(input).toHaveAttribute('value', '4'); }); - test('does not apply default value after first change', () => { + it('does not apply default value after first change', () => { const { getByRole } = render( @@ -73,7 +73,7 @@ describe('useField', () => { }); describe('when called with `absoluteName`', () => { - test('works on top-level', () => { + it('works on top-level', () => { render( @@ -84,7 +84,7 @@ describe('useField', () => { ); }); - test('works nested', () => { + it('works nested', () => { render( From cb32cd0c03e4530e9680ee9db00ce02f7ad09d7e Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Mon, 28 Nov 2022 18:20:30 +0100 Subject: [PATCH 12/27] add rerenderWithProps to render fn --- .../uniforms-antd/__tests__/AutoField.tsx | 26 +-- .../uniforms-antd/__tests__/AutoFields.tsx | 12 +- packages/uniforms-antd/__tests__/AutoForm.tsx | 2 +- packages/uniforms-antd/__tests__/BaseForm.tsx | 2 +- .../uniforms-antd/__tests__/BoolField.tsx | 50 +++--- .../uniforms-antd/__tests__/DateField.tsx | 28 +-- .../uniforms-antd/__tests__/ErrorField.tsx | 10 +- .../uniforms-antd/__tests__/ErrorsField.tsx | 8 +- .../uniforms-antd/__tests__/HiddenField.tsx | 28 +-- .../uniforms-antd/__tests__/ListAddField.tsx | 12 +- .../uniforms-antd/__tests__/ListDelField.tsx | 12 +- .../uniforms-antd/__tests__/ListField.tsx | 26 +-- .../uniforms-antd/__tests__/ListItemField.tsx | 8 +- .../uniforms-antd/__tests__/LongTextField.tsx | 32 ++-- .../uniforms-antd/__tests__/NestField.tsx | 10 +- packages/uniforms-antd/__tests__/NumField.tsx | 46 ++--- .../uniforms-antd/__tests__/QuickForm.tsx | 2 +- .../uniforms-antd/__tests__/RadioField.tsx | 32 ++-- .../uniforms-antd/__tests__/SelectField.tsx | 78 ++++----- .../uniforms-antd/__tests__/SubmitField.tsx | 6 +- .../uniforms-antd/__tests__/TextField.tsx | 38 ++--- .../__tests__/ValidateQuickForm.tsx | 2 +- .../uniforms-antd/__tests__/ValidatedForm.tsx | 2 +- packages/uniforms-antd/__tests__/index.ts | 2 +- .../uniforms-antd/__tests__/wrapField.tsx | 18 +- .../__tests__/AutoField.tsx | 26 +-- .../__tests__/AutoFields.tsx | 12 +- .../__tests__/AutoForm.tsx | 2 +- .../__tests__/BaseForm.tsx | 2 +- .../__tests__/BoolField.tsx | 28 +-- .../__tests__/DateField.tsx | 32 ++-- .../__tests__/ErrorField.tsx | 8 +- .../__tests__/ErrorsField.tsx | 6 +- .../__tests__/HiddenField.tsx | 28 +-- .../__tests__/ListAddField.tsx | 10 +- .../__tests__/ListDelField.tsx | 10 +- .../__tests__/ListField.tsx | 22 +-- .../__tests__/ListItemField.tsx | 8 +- .../__tests__/LongTextField.tsx | 30 ++-- .../__tests__/NestField.tsx | 12 +- .../__tests__/NumField.tsx | 48 +++--- .../__tests__/QuickForm.tsx | 2 +- .../__tests__/RadioField.tsx | 34 ++-- .../__tests__/SelectField.tsx | 94 +++++----- .../__tests__/SubmitField.tsx | 10 +- .../__tests__/TextField.tsx | 36 ++-- .../__tests__/ValidateQuickForm.tsx | 2 +- .../__tests__/ValidatedForm.tsx | 2 +- .../__tests__/gridClassName.ts | 8 +- .../uniforms-bootstrap3/__tests__/index.ts | 2 +- .../__tests__/wrapField.tsx | 16 +- .../__tests__/AutoField.tsx | 26 +-- .../__tests__/AutoFields.tsx | 12 +- .../__tests__/AutoForm.tsx | 2 +- .../__tests__/BaseForm.tsx | 2 +- .../__tests__/BoolField.tsx | 28 +-- .../__tests__/DateField.tsx | 32 ++-- .../__tests__/ErrorField.tsx | 8 +- .../__tests__/ErrorsField.tsx | 6 +- .../__tests__/HiddenField.tsx | 28 +-- .../__tests__/ListAddField.tsx | 10 +- .../__tests__/ListDelField.tsx | 10 +- .../__tests__/ListField.tsx | 22 +-- .../__tests__/ListItemField.tsx | 8 +- .../__tests__/LongTextField.tsx | 30 ++-- .../__tests__/NestField.tsx | 12 +- .../__tests__/NumField.tsx | 48 +++--- .../__tests__/QuickForm.tsx | 2 +- .../__tests__/RadioField.tsx | 34 ++-- .../__tests__/SelectField.tsx | 102 +++++------ .../__tests__/SubmitField.tsx | 10 +- .../__tests__/TextField.tsx | 36 ++-- .../__tests__/ValidateQuickForm.tsx | 2 +- .../__tests__/ValidatedForm.tsx | 2 +- .../__tests__/gridClassName.ts | 8 +- .../uniforms-bootstrap4/__tests__/index.ts | 2 +- .../__tests__/wrapField.tsx | 14 +- .../__tests__/AutoField.tsx | 26 +-- .../__tests__/AutoFields.tsx | 12 +- .../__tests__/AutoForm.tsx | 2 +- .../__tests__/BaseForm.tsx | 2 +- .../__tests__/BoolField.tsx | 28 +-- .../__tests__/DateField.tsx | 32 ++-- .../__tests__/ErrorField.tsx | 8 +- .../__tests__/ErrorsField.tsx | 6 +- .../__tests__/HiddenField.tsx | 28 +-- .../__tests__/ListAddField.tsx | 10 +- .../__tests__/ListDelField.tsx | 10 +- .../__tests__/ListField.tsx | 22 +-- .../__tests__/ListItemField.tsx | 8 +- .../__tests__/LongTextField.tsx | 30 ++-- .../__tests__/NestField.tsx | 12 +- .../__tests__/NumField.tsx | 48 +++--- .../__tests__/QuickForm.tsx | 2 +- .../__tests__/RadioField.tsx | 34 ++-- .../__tests__/SelectField.tsx | 102 +++++------ .../__tests__/SubmitField.tsx | 10 +- .../__tests__/TextField.tsx | 36 ++-- .../__tests__/ValidateQuickForm.tsx | 2 +- .../__tests__/ValidatedForm.tsx | 2 +- .../__tests__/gridClassName.ts | 8 +- .../uniforms-bootstrap5/__tests__/index.ts | 2 +- .../__tests__/wrapField.tsx | 14 +- .../__tests__/GraphQLBridge.ts | 90 +++++----- .../__tests__/index.ts | 2 +- .../__tests__/JSONSchemaBridge.ts | 160 +++++++++--------- .../__tests__/index.ts | 2 +- .../__tests__/SimpleSchema2Bridge.ts | 76 ++++----- .../__tests__/index.ts | 2 +- .../__tests__/SimpleSchemaBridge.ts | 68 ++++---- .../__tests__/index.ts | 2 +- .../__tests__/ZodBridge.ts | 134 +++++++-------- .../uniforms-bridge-zod/__tests__/index.ts | 2 +- .../uniforms-material/__tests__/AutoField.tsx | 26 +-- .../__tests__/AutoFields.tsx | 12 +- .../uniforms-material/__tests__/AutoForm.tsx | 2 +- .../uniforms-material/__tests__/BaseForm.tsx | 2 +- .../uniforms-material/__tests__/BoolField.tsx | 52 +++--- .../uniforms-material/__tests__/DateField.tsx | 36 ++-- .../__tests__/ErrorField.tsx | 12 +- .../__tests__/ErrorsField.tsx | 12 +- .../__tests__/HiddenField.tsx | 28 +-- .../__tests__/ListAddField.tsx | 12 +- .../__tests__/ListDelField.tsx | 12 +- .../uniforms-material/__tests__/ListField.tsx | 18 +- .../__tests__/ListItemField.tsx | 8 +- .../__tests__/LongTextField.tsx | 38 ++--- .../uniforms-material/__tests__/NestField.tsx | 14 +- .../uniforms-material/__tests__/NumField.tsx | 56 +++--- .../uniforms-material/__tests__/QuickForm.tsx | 2 +- .../__tests__/RadioField.tsx | 40 ++--- .../__tests__/SelectField.tsx | 102 +++++------ .../__tests__/SubmitField.tsx | 12 +- .../uniforms-material/__tests__/TextField.tsx | 44 ++--- .../__tests__/ValidateQuickForm.tsx | 2 +- .../__tests__/ValidatedForm.tsx | 2 +- packages/uniforms-material/__tests__/index.ts | 2 +- .../uniforms-material/__tests__/wrapField.tsx | 6 +- packages/uniforms-mui/__tests__/AutoField.tsx | 26 +-- .../uniforms-mui/__tests__/AutoFields.tsx | 12 +- packages/uniforms-mui/__tests__/AutoForm.tsx | 2 +- packages/uniforms-mui/__tests__/BaseForm.tsx | 2 +- packages/uniforms-mui/__tests__/BoolField.tsx | 46 ++--- packages/uniforms-mui/__tests__/DateField.tsx | 32 ++-- .../uniforms-mui/__tests__/ErrorField.tsx | 6 +- .../uniforms-mui/__tests__/ErrorsField.tsx | 6 +- .../uniforms-mui/__tests__/HiddenField.tsx | 28 +-- .../uniforms-mui/__tests__/ListAddField.tsx | 4 +- .../uniforms-mui/__tests__/ListDelField.tsx | 4 +- packages/uniforms-mui/__tests__/ListField.tsx | 16 +- .../uniforms-mui/__tests__/ListItemField.tsx | 8 +- .../uniforms-mui/__tests__/LongTextField.tsx | 32 ++-- packages/uniforms-mui/__tests__/NestField.tsx | 8 +- packages/uniforms-mui/__tests__/NumField.tsx | 50 +++--- packages/uniforms-mui/__tests__/QuickForm.tsx | 2 +- .../uniforms-mui/__tests__/RadioField.tsx | 34 ++-- .../uniforms-mui/__tests__/SelectField.tsx | 94 +++++----- .../uniforms-mui/__tests__/SubmitField.tsx | 6 +- packages/uniforms-mui/__tests__/TextField.tsx | 34 ++-- .../__tests__/ValidateQuickForm.tsx | 2 +- .../uniforms-mui/__tests__/ValidatedForm.tsx | 2 +- packages/uniforms-mui/__tests__/index.ts | 2 +- packages/uniforms-mui/__tests__/wrapField.tsx | 6 +- .../uniforms-semantic/__tests__/AutoField.tsx | 26 +-- .../__tests__/AutoFields.tsx | 12 +- .../uniforms-semantic/__tests__/AutoForm.tsx | 2 +- .../uniforms-semantic/__tests__/BaseForm.tsx | 2 +- .../uniforms-semantic/__tests__/BoolField.tsx | 38 ++--- .../uniforms-semantic/__tests__/DateField.tsx | 42 ++--- .../__tests__/ErrorField.tsx | 8 +- .../__tests__/ErrorsField.tsx | 6 +- .../__tests__/HiddenField.tsx | 28 +-- .../__tests__/ListAddField.tsx | 10 +- .../__tests__/ListDelField.tsx | 10 +- .../uniforms-semantic/__tests__/ListField.tsx | 22 +-- .../__tests__/ListItemField.tsx | 8 +- .../__tests__/LongTextField.tsx | 34 ++-- .../uniforms-semantic/__tests__/NestField.tsx | 12 +- .../uniforms-semantic/__tests__/NumField.tsx | 58 +++---- .../uniforms-semantic/__tests__/QuickForm.tsx | 2 +- .../__tests__/RadioField.tsx | 36 ++-- .../__tests__/SelectField.tsx | 96 +++++------ .../__tests__/SubmitField.tsx | 8 +- .../uniforms-semantic/__tests__/TextField.tsx | 54 +++--- .../__tests__/ValidateQuickForm.tsx | 2 +- .../__tests__/ValidatedForm.tsx | 2 +- packages/uniforms-semantic/__tests__/index.ts | 2 +- .../uniforms-unstyled/__tests__/AutoField.tsx | 26 +-- .../__tests__/AutoFields.tsx | 10 +- .../uniforms-unstyled/__tests__/AutoForm.tsx | 2 +- .../uniforms-unstyled/__tests__/BaseForm.tsx | 2 +- .../uniforms-unstyled/__tests__/BoolField.tsx | 26 +-- .../uniforms-unstyled/__tests__/DateField.tsx | 32 ++-- .../__tests__/ErrorField.tsx | 6 +- .../__tests__/ErrorsField.tsx | 6 +- .../__tests__/HiddenField.tsx | 28 +-- .../__tests__/ListAddField.tsx | 10 +- .../__tests__/ListDelField.tsx | 10 +- .../uniforms-unstyled/__tests__/ListField.tsx | 18 +- .../__tests__/ListItemField.tsx | 8 +- .../__tests__/LongTextField.tsx | 30 ++-- .../uniforms-unstyled/__tests__/NestField.tsx | 8 +- .../uniforms-unstyled/__tests__/NumField.tsx | 48 +++--- .../uniforms-unstyled/__tests__/QuickForm.tsx | 2 +- .../__tests__/RadioField.tsx | 32 ++-- .../__tests__/SelectField.tsx | 92 +++++----- .../__tests__/SubmitField.tsx | 8 +- .../uniforms-unstyled/__tests__/TextField.tsx | 36 ++-- .../__tests__/ValidateQuickForm.tsx | 2 +- .../__tests__/ValidatedForm.tsx | 2 +- packages/uniforms-unstyled/__tests__/index.ts | 2 +- packages/uniforms/__suites__/ListField.tsx | 16 +- packages/uniforms/__suites__/TextField.tsx | 30 ++-- packages/uniforms/__suites__/render.tsx | 18 +- packages/uniforms/__tests__/AutoForm.tsx | 46 ++--- packages/uniforms/__tests__/ValidatedForm.tsx | 119 +++++++------ 216 files changed, 2372 insertions(+), 2351 deletions(-) diff --git a/packages/uniforms-antd/__tests__/AutoField.tsx b/packages/uniforms-antd/__tests__/AutoField.tsx index 82726a49b..a432c2ce5 100644 --- a/packages/uniforms-antd/__tests__/AutoField.tsx +++ b/packages/uniforms-antd/__tests__/AutoField.tsx @@ -14,14 +14,14 @@ import { import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(AutoField)).toHaveLength(1); }); -it(' - detects RadioField', () => { +test(' - detects RadioField', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ it(' - detects RadioField', () => { expect(wrapper.find(RadioField.Component)).toHaveLength(1); }); -it(' - detects SelectField', () => { +test(' - detects SelectField', () => { const element = ; const wrapper = mount( element, @@ -50,14 +50,14 @@ it(' - detects SelectField', () => { expect(wrapper.find(SelectField.Component)).toHaveLength(1); }); -it(' - detects DateField', () => { +test(' - detects DateField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DateField.Component)).toHaveLength(1); }); -it(' - detects ListField', () => { +test(' - detects ListField', () => { const element = ; const wrapper = mount( element, @@ -67,35 +67,35 @@ it(' - detects ListField', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -it(' - detects NumField', () => { +test(' - detects NumField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(NumField.Component)).toHaveLength(1); }); -it(' - detects NestField', () => { +test(' - detects NestField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Object } })); expect(wrapper.find(NestField)).toHaveLength(1); }); -it(' - detects TextField', () => { +test(' - detects TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField.Component)).toHaveLength(1); }); -it(' - detects BoolField', () => { +test(' - detects BoolField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(BoolField.Component)).toHaveLength(1); }); -it(' - uses Component (schema)', () => { +test(' - uses Component (schema)', () => { const Component = jest.fn(() => null); const element = ; @@ -107,7 +107,7 @@ it(' - uses Component (schema)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -it(' - uses Component (props)', () => { +test(' - uses Component (props)', () => { const Component = jest.fn(() => null); const element = ; @@ -116,7 +116,7 @@ it(' - uses Component (props)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -it(' - uses Component (context)', () => { +test(' - uses Component (context)', () => { const FieldA = jest.fn(() => null); const FieldB = jest.fn(() => null); @@ -136,7 +136,7 @@ it(' - uses Component (context)', () => { expect(FieldB).toHaveBeenCalledTimes(1); }); -it(' - uses Component (invalid)', () => { +test(' - uses Component (invalid)', () => { const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {}); expect(() => { const element = ; diff --git a/packages/uniforms-antd/__tests__/AutoFields.tsx b/packages/uniforms-antd/__tests__/AutoFields.tsx index cd07a2aec..0ece5d085 100644 --- a/packages/uniforms-antd/__tests__/AutoFields.tsx +++ b/packages/uniforms-antd/__tests__/AutoFields.tsx @@ -4,14 +4,14 @@ import { AutoField, AutoFields } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('AutoFields')).toHaveLength(1); }); -it(' - render all fields by default', () => { +test(' - render all fields by default', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - render all fields by default', () => { expect(wrapper.find('input')).toHaveLength(3); }); -it(' - renders only specified fields', () => { +test(' - renders only specified fields', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ it(' - renders only specified fields', () => { ); }); -it(' - does not render ommited fields', () => { +test(' - does not render ommited fields', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ it(' - does not render ommited fields', () => { ); }); -it(' - wraps fields in specified element', () => { +test(' - wraps fields in specified element', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ it(' - wraps fields in specified element', () => { expect(wrapper.find('section').find('input')).toHaveLength(3); }); -it(' - pass props to the children', () => { +test(' - pass props to the children', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-antd/__tests__/AutoForm.tsx b/packages/uniforms-antd/__tests__/AutoForm.tsx index 085952dbc..ce87a92b9 100644 --- a/packages/uniforms-antd/__tests__/AutoForm.tsx +++ b/packages/uniforms-antd/__tests__/AutoForm.tsx @@ -4,7 +4,7 @@ import { AutoForm } from 'uniforms-antd'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-antd/__tests__/BaseForm.tsx b/packages/uniforms-antd/__tests__/BaseForm.tsx index 21ff2f290..ee88320c1 100644 --- a/packages/uniforms-antd/__tests__/BaseForm.tsx +++ b/packages/uniforms-antd/__tests__/BaseForm.tsx @@ -4,7 +4,7 @@ import { BaseForm } from 'uniforms-antd'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-antd/__tests__/BoolField.tsx b/packages/uniforms-antd/__tests__/BoolField.tsx index f8877b6c0..50c878bc4 100644 --- a/packages/uniforms-antd/__tests__/BoolField.tsx +++ b/packages/uniforms-antd/__tests__/BoolField.tsx @@ -6,14 +6,14 @@ import { BoolField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a switch input', () => { +test(' - renders a switch input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(Switch)).toHaveLength(1); }); -it(' - default props override', () => { +test(' - default props override', () => { const switchProps = { checkedChildren: , unCheckedChildren: , @@ -27,14 +27,14 @@ it(' - default props override', () => { ); }); -it(' - renders a checkbox input', () => { +test(' - renders a checkbox input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(Checkbox)).toHaveLength(1); }); -it(' - renders a switch input with correct id (inherited)', () => { +test(' - renders a switch input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -42,7 +42,7 @@ it(' - renders a switch input with correct id (inherited)', () => { expect(wrapper.find(Switch).prop('id')).toBeTruthy(); }); -it(' - renders a checkbox input with correct id (inherited)', () => { +test(' - renders a checkbox input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -50,7 +50,7 @@ it(' - renders a checkbox input with correct id (inherited)', () => { expect(wrapper.find(Checkbox).prop('id')).toBeTruthy(); }); -it(' - renders a switch input with correct id (specified)', () => { +test(' - renders a switch input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -58,7 +58,7 @@ it(' - renders a switch input with correct id (specified)', () => { expect(wrapper.find(Switch).prop('id')).toBe('y'); }); -it(' - renders a checkbox input with correct id (specified)', () => { +test(' - renders a checkbox input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -66,7 +66,7 @@ it(' - renders a checkbox input with correct id (specified)', () => { expect(wrapper.find(Checkbox).prop('id')).toBe('y'); }); -it(' - renders a switch input with correct name', () => { +test(' - renders a switch input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -74,7 +74,7 @@ it(' - renders a switch input with correct name', () => { expect(wrapper.find(Switch).prop('name')).toBe('x'); }); -it(' - renders a checkbox input with correct name', () => { +test(' - renders a checkbox input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -82,7 +82,7 @@ it(' - renders a checkbox input with correct name', () => { expect(wrapper.find(Checkbox).prop('name')).toBe('x'); }); -it(' - renders a switch input with correct disabled state', () => { +test(' - renders a switch input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -90,7 +90,7 @@ it(' - renders a switch input with correct disabled state', () => { expect(wrapper.find(Switch).prop('disabled')).toBe(true); }); -it(' - renders a checkbox input with correct disabled state', () => { +test(' - renders a checkbox input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -98,7 +98,7 @@ it(' - renders a checkbox input with correct disabled state', () => { expect(wrapper.find(Checkbox).prop('disabled')).toBe(true); }); -it(' - renders a switch input with correct readOnly state', () => { +test(' - renders a switch input with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -113,7 +113,7 @@ it(' - renders a switch input with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a checkbox input with correct readOnly state', () => { +test(' - renders a checkbox input with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -128,7 +128,7 @@ it(' - renders a checkbox input with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a switch input with correct label (specified)', () => { +test(' - renders a switch input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -136,7 +136,7 @@ it(' - renders a switch input with correct label (specified)', () => expect(wrapper.find('label').text()).toBe('BoolFieldLabel'); // Label is prefixed with a  . }); -it(' - renders a checkbox input with correct label (specified)', () => { +test(' - renders a checkbox input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -144,7 +144,7 @@ it(' - renders a checkbox input with correct label (specified)', () = expect(wrapper.find('label').first().text()).toBe('BoolFieldLabel'); // Label is prefixed with a  . }); -it(' - renders a switch input with correct value (default)', () => { +test(' - renders a switch input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -152,7 +152,7 @@ it(' - renders a switch input with correct value (default)', () => { expect(wrapper.find(Switch).prop('checked')).toBe(false); }); -it(' - renders a checkbox input with correct value (default)', () => { +test(' - renders a checkbox input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -160,7 +160,7 @@ it(' - renders a checkbox input with correct value (default)', () => expect(wrapper.find(Checkbox).prop('checked')).toBe(false); }); -it(' - renders a switch input with correct value (model)', () => { +test(' - renders a switch input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -171,7 +171,7 @@ it(' - renders a switch input with correct value (model)', () => { expect(wrapper.find(Switch).prop('checked')).toBe(true); }); -it(' - renders a checkbox input with correct value (model)', () => { +test(' - renders a checkbox input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -182,7 +182,7 @@ it(' - renders a checkbox input with correct value (model)', () => { expect(wrapper.find(Checkbox).prop('checked')).toBe(true); }); -it(' - renders a switch input with correct value (specified)', () => { +test(' - renders a switch input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -190,7 +190,7 @@ it(' - renders a switch input with correct value (specified)', () => expect(wrapper.find(Switch).prop('checked')).toBe(true); }); -it(' - renders a checkbox input with correct value (specified)', () => { +test(' - renders a checkbox input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -198,7 +198,7 @@ it(' - renders a checkbox input with correct value (specified)', () = expect(wrapper.find(Checkbox).prop('checked')).toBe(true); }); -it(' - renders a switch input which correctly reacts on change', () => { +test(' - renders a switch input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -213,7 +213,7 @@ it(' - renders a switch input which correctly reacts on change', () = expect(onChange).toHaveBeenLastCalledWith('x', true); }); -it(' - renders a checkbox input which correctly reacts on change', () => { +test(' - renders a checkbox input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -228,7 +228,7 @@ it(' - renders a checkbox input which correctly reacts on change', () expect(onChange).toHaveBeenLastCalledWith('x', true); }); -it(' - renders a switch wrapper with unknown props', () => { +test(' - renders a switch wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -237,7 +237,7 @@ it(' - renders a switch wrapper with unknown props', () => { expect(wrapper.find(Switch).prop('data-z')).toBe('z'); }); -it(' - renders a checkbox wrapper with unknown props', () => { +test(' - renders a checkbox wrapper with unknown props', () => { const element = ( ); diff --git a/packages/uniforms-antd/__tests__/DateField.tsx b/packages/uniforms-antd/__tests__/DateField.tsx index 14d8dd9c4..28abf3d5e 100644 --- a/packages/uniforms-antd/__tests__/DateField.tsx +++ b/packages/uniforms-antd/__tests__/DateField.tsx @@ -6,14 +6,14 @@ import { DateField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DatePicker)).toHaveLength(1); }); -it(' - default props override', () => { +test(' - default props override', () => { const pickerProps = { showTime: false, style: {} }; const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -23,7 +23,7 @@ it(' - default props override', () => { ); }); -it(' - renders a input with correct id (inherited)', () => { +test(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -31,7 +31,7 @@ it(' - renders a input with correct id (inherited)', () => { expect(wrapper.find(DatePicker).prop('id')).toBeTruthy(); }); -it(' - renders a input with correct id (specified)', () => { +test(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -39,7 +39,7 @@ it(' - renders a input with correct id (specified)', () => { expect(wrapper.find(DatePicker).prop('id')).toBe('y'); }); -it(' - renders a input with correct name', () => { +test(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -47,7 +47,7 @@ it(' - renders a input with correct name', () => { expect(wrapper.find(DatePicker).prop('name')).toBe('x'); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -55,7 +55,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find(DatePicker).prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const onChange = jest.fn(); const now = moment(); @@ -71,7 +71,7 @@ it(' - renders an input with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a input with correct label (specified)', () => { +test(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -79,7 +79,7 @@ it(' - renders a input with correct label (specified)', () => { expect(wrapper.find('label').text()).toBe('DateFieldLabel'); }); -it(' - renders a input with correct value (default)', () => { +test(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -87,7 +87,7 @@ it(' - renders a input with correct value (default)', () => { expect(wrapper.find(DatePicker).prop('value')).toBe(undefined); }); -it(' - renders a input with correct value (model)', () => { +test(' - renders a input with correct value (model)', () => { const now = moment(); const element = ; const wrapper = mount( @@ -99,7 +99,7 @@ it(' - renders a input with correct value (model)', () => { expect(wrapper.find(DatePicker).prop('value')).toEqual(now); }); -it(' - renders a input with correct value (specified)', () => { +test(' - renders a input with correct value (specified)', () => { const now = moment(); const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -108,7 +108,7 @@ it(' - renders a input with correct value (specified)', () => { expect(wrapper.find(DatePicker).prop('value')).toEqual(now); }); -it(' - renders a input which correctly reacts on change', () => { +test(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const now = moment(); @@ -124,7 +124,7 @@ it(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', now.toDate()); }); -it(' - renders a input which correctly reacts on change (empty)', () => { +test(' - renders a input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ it(' - renders a input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); diff --git a/packages/uniforms-antd/__tests__/ErrorField.tsx b/packages/uniforms-antd/__tests__/ErrorField.tsx index 0ee7eabb5..2f24d091a 100644 --- a/packages/uniforms-antd/__tests__/ErrorField.tsx +++ b/packages/uniforms-antd/__tests__/ErrorField.tsx @@ -11,14 +11,14 @@ const error = { message: 'X is required [validation-error]', }; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorField)).toHaveLength(1); }); -it(' - default props override', () => { +test(' - default props override', () => { const divProps = { style: {} }; const element = ; @@ -29,7 +29,7 @@ it(' - default props override', () => { ); }); -it(' - renders correct error message (context)', () => { +test(' - renders correct error message (context)', () => { const element = ; const wrapper = mount( element, @@ -40,7 +40,7 @@ it(' - renders correct error message (context)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -it(' - renders correct error message (specified)', () => { +test(' - renders correct error message (specified)', () => { const element = ( - renders correct error message (specified)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -it(' - renders correct children if specified', () => { +test(' - renders correct children if specified', () => { const element = Error; const wrapper = mount( element, diff --git a/packages/uniforms-antd/__tests__/ErrorsField.tsx b/packages/uniforms-antd/__tests__/ErrorsField.tsx index 64a552426..7576b2305 100644 --- a/packages/uniforms-antd/__tests__/ErrorsField.tsx +++ b/packages/uniforms-antd/__tests__/ErrorsField.tsx @@ -15,14 +15,14 @@ const error = { message: 'X is required [validation-error]', }; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorsField)).toHaveLength(1); }); -it(' - default props override', () => { +test(' - default props override', () => { const divProps = { style: {} }; const element = ; @@ -33,7 +33,7 @@ it(' - default props override', () => { ); }); -it(' - renders list of correct error messages (context)', () => { +test(' - renders list of correct error messages (context)', () => { const element = ; const wrapper = mount( element, @@ -49,7 +49,7 @@ it(' - renders list of correct error messages (context)', () => { expect(wrapper.find('li').at(2).text()).toBe('Z is required'); }); -it(' - renders children (specified)', () => { +test(' - renders children (specified)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-antd/__tests__/HiddenField.tsx b/packages/uniforms-antd/__tests__/HiddenField.tsx index 44521d155..5850a1f5a 100644 --- a/packages/uniforms-antd/__tests__/HiddenField.tsx +++ b/packages/uniforms-antd/__tests__/HiddenField.tsx @@ -4,14 +4,14 @@ import { HiddenField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('hidden'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -62,7 +62,7 @@ it(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input which correctly reacts on model change', () => { +test(' - renders an input which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -76,7 +76,7 @@ it(' - renders an input which correctly reacts on model change', () expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders an input which correctly reacts on model change (empty)', () => { +test(' - renders an input which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -90,7 +90,7 @@ it(' - renders an input which correctly reacts on model change (emp expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders an input which correctly reacts on model change (same value)', () => { +test(' - renders an input which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -104,14 +104,14 @@ it(' - renders an input which correctly reacts on model change (sam expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders nothing', () => { +test(' - renders nothing', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.children()).toHaveLength(0); }); -it(' - renders nothing which correctly reacts on model change', () => { +test(' - renders nothing which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ it(' - renders nothing which correctly reacts on model change expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders nothing which correctly reacts on model change (empty)', () => { +test(' - renders nothing which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ it(' - renders nothing which correctly reacts on model change expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders nothing which correctly reacts on model change (same value)', () => { +test(' - renders nothing which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; diff --git a/packages/uniforms-antd/__tests__/ListAddField.tsx b/packages/uniforms-antd/__tests__/ListAddField.tsx index 8b7d58f44..de619524b 100644 --- a/packages/uniforms-antd/__tests__/ListAddField.tsx +++ b/packages/uniforms-antd/__tests__/ListAddField.tsx @@ -17,14 +17,14 @@ beforeEach(() => { onChange.mockClear(); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListAddField)).toHaveLength(1); }); -it(' - default props override', () => { +test(' - default props override', () => { const buttonProps = { icon: , size: 'large' as const, @@ -40,7 +40,7 @@ it(' - default props override', () => { ); }); -it(' - prevents onClick when disabled', () => { +test(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -48,7 +48,7 @@ it(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when readOnly', () => { +test(' - prevents onClick when readOnly', () => { const element = ; const wrapper = mount(element, context()); @@ -56,7 +56,7 @@ it(' - prevents onClick when readOnly', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when limit reached', () => { +test(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { maxCount: 0 } })); @@ -64,7 +64,7 @@ it(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - correctly reacts on click', () => { +test(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-antd/__tests__/ListDelField.tsx b/packages/uniforms-antd/__tests__/ListDelField.tsx index 49d42c45e..75f6a79dd 100644 --- a/packages/uniforms-antd/__tests__/ListDelField.tsx +++ b/packages/uniforms-antd/__tests__/ListDelField.tsx @@ -17,14 +17,14 @@ beforeEach(() => { onChange.mockClear(); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListDelField)).toHaveLength(1); }); -it(' - default props override', () => { +test(' - default props override', () => { const buttonProps = { icon: , size: 'large' as const, @@ -41,7 +41,7 @@ it(' - default props override', () => { ); }); -it(' - prevents onClick when disabled', () => { +test(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -49,7 +49,7 @@ it(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when readOnly', () => { +test(' - prevents onClick when readOnly', () => { const element = ; const wrapper = mount(element, context()); @@ -57,7 +57,7 @@ it(' - prevents onClick when readOnly', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when limit reached', () => { +test(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { minCount: 3 } })); @@ -65,7 +65,7 @@ it(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - correctly reacts on click', () => { +test(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-antd/__tests__/ListField.tsx b/packages/uniforms-antd/__tests__/ListField.tsx index 0ff03b3e6..d0ec65e89 100644 --- a/packages/uniforms-antd/__tests__/ListField.tsx +++ b/packages/uniforms-antd/__tests__/ListField.tsx @@ -12,7 +12,7 @@ describe('@RTL - ListField tests', () => { addFieldLocator: () => screen.queryAllByRole('img').pop(), }); - it(' - works', () => { + test(' - works', () => { const element = ; const wrapper = mount( element, @@ -23,7 +23,7 @@ describe('@RTL - ListField tests', () => { }); }); -it(' - renders ListAddField', () => { +test(' - renders ListAddField', () => { const element = ; const wrapper = mount( element, @@ -34,7 +34,7 @@ it(' - renders ListAddField', () => { expect(wrapper.find(ListAddField).prop('name')).toBe('$'); }); -it(' - renders correct label and info (specified)', () => { +test(' - renders correct label and info (specified)', () => { const element = ( ); @@ -47,7 +47,7 @@ it(' - renders correct label and info (specified)', () => { expect(wrapper.find(Tooltip).prop('title')).toBe('ListFieldInfo'); }); -it(' - renders correct label (specified)', () => { +test(' - renders correct label (specified)', () => { const element = ; const wrapper = mount( element, @@ -59,7 +59,7 @@ it(' - renders correct label (specified)', () => { ); }); -it(' - renders correct numer of items with model (specified)', () => { +test(' - renders correct numer of items with model (specified)', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ it(' - renders correct numer of items with model (specified)', () => expect(wrapper.find('input')).toHaveLength(3); }); -it(' - passes itemProps to its children', () => { +test(' - passes itemProps to its children', () => { const element = ; const wrapper = mount( element, @@ -83,7 +83,7 @@ it(' - passes itemProps to its children', () => { expect(wrapper.find(ListItemField).first().prop('data-xyz')).toBe(1); }); -it(' - renders children (specified)', () => { +test(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -102,7 +102,7 @@ it(' - renders children (specified)', () => { expect(Child).toHaveBeenCalledTimes(2); }); -it(' - renders children with correct name (children)', () => { +test(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -121,7 +121,7 @@ it(' - renders children with correct name (children)', () => { expect(wrapper.find(Child).at(1).prop('name')).toBe('1'); }); -it(' - renders children with correct name (value)', () => { +test(' - renders children with correct name (value)', () => { const element = ; const wrapper = mount( element, @@ -134,7 +134,7 @@ it(' - renders children with correct name (value)', () => { expect(wrapper.find(ListItemField).at(1).prop('name')).toBe('1'); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -147,7 +147,7 @@ it(' - renders correct error text (specified)', () => { expect(wrapper.find('div > div').at(0).text()).toBe('Error'); }); -it(' - renders correct error style', () => { +test(' - renders correct error style', () => { const error = new Error(); const element = ; const wrapper = mount( @@ -161,7 +161,7 @@ it(' - renders correct error style', () => { ); }); -it(' - renders correct error style (with specified style prop)', () => { +test(' - renders correct error style (with specified style prop)', () => { const error = new Error(); const element = ( @@ -177,7 +177,7 @@ it(' - renders correct error style (with specified style prop)', () = ); }); -it(' - renders proper number of optional values after add new value', () => { +test(' - renders proper number of optional values after add new value', () => { const element = ; const onChange = jest.fn(); const wrapper = mount( diff --git a/packages/uniforms-antd/__tests__/ListItemField.tsx b/packages/uniforms-antd/__tests__/ListItemField.tsx index 4a9c5cb3f..1a68cea18 100644 --- a/packages/uniforms-antd/__tests__/ListItemField.tsx +++ b/packages/uniforms-antd/__tests__/ListItemField.tsx @@ -4,7 +4,7 @@ import { AutoField, ListDelField, ListItemField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - works', () => { expect(wrapper.find(ListItemField)).toHaveLength(1); }); -it(' - renders ListDelField', () => { +test(' - renders ListDelField', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - renders ListDelField', () => { expect(wrapper.find(ListDelField).childAt(0).prop('name')).toBe('x.1'); }); -it(' - renders AutoField', () => { +test(' - renders AutoField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ it(' - renders AutoField', () => { expect(wrapper.find(AutoField)).toHaveLength(1); }); -it(' - renders children if specified', () => { +test(' - renders children if specified', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( diff --git a/packages/uniforms-antd/__tests__/LongTextField.tsx b/packages/uniforms-antd/__tests__/LongTextField.tsx index 9156d5408..c59e5d39a 100644 --- a/packages/uniforms-antd/__tests__/LongTextField.tsx +++ b/packages/uniforms-antd/__tests__/LongTextField.tsx @@ -5,14 +5,14 @@ import { LongTextField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a textarea', () => { +test(' - renders a textarea', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextArea)).toHaveLength(1); }); -it(' - default props override', () => { +test(' - default props override', () => { const textareaProps = { rows: 1 }; const element = ; @@ -23,7 +23,7 @@ it(' - default props override', () => { ); }); -it(' - renders a textarea with correct disabled state', () => { +test(' - renders a textarea with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -31,7 +31,7 @@ it(' - renders a textarea with correct disabled state', () => { expect(wrapper.find(TextArea).prop('disabled')).toBe(true); }); -it(' - renders a textarea with correct readOnly state', () => { +test(' - renders a textarea with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -39,7 +39,7 @@ it(' - renders a textarea with correct readOnly state', () => { expect(wrapper.find(TextArea).prop('readOnly')).toBe(true); }); -it(' - renders a textarea with correct id (inherited)', () => { +test(' - renders a textarea with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -47,7 +47,7 @@ it(' - renders a textarea with correct id (inherited)', () => { expect(wrapper.find(TextArea).prop('id')).toBeTruthy(); }); -it(' - renders a textarea with correct id (specified)', () => { +test(' - renders a textarea with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -55,7 +55,7 @@ it(' - renders a textarea with correct id (specified)', () => { expect(wrapper.find(TextArea).prop('id')).toBe('y'); }); -it(' - renders a textarea with correct name', () => { +test(' - renders a textarea with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -63,7 +63,7 @@ it(' - renders a textarea with correct name', () => { expect(wrapper.find(TextArea).prop('name')).toBe('x'); }); -it(' - renders a textarea with correct placeholder', () => { +test(' - renders a textarea with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -71,7 +71,7 @@ it(' - renders a textarea with correct placeholder', () => { expect(wrapper.find(TextArea).prop('placeholder')).toBe('y'); }); -it(' - renders a textarea with correct value (default)', () => { +test(' - renders a textarea with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -79,7 +79,7 @@ it(' - renders a textarea with correct value (default)', () => { expect(wrapper.find(TextArea).prop('value')).toBe(''); }); -it(' - renders a textarea with correct value (model)', () => { +test(' - renders a textarea with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -90,7 +90,7 @@ it(' - renders a textarea with correct value (model)', () => { expect(wrapper.find(TextArea).prop('value')).toBe('y'); }); -it(' - renders a textarea with correct value (specified)', () => { +test(' - renders a textarea with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -98,7 +98,7 @@ it(' - renders a textarea with correct value (specified)', () => expect(wrapper.find(TextArea).prop('value')).toBe('y'); }); -it(' - renders a textarea which correctly reacts on change', () => { +test(' - renders a textarea which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -114,7 +114,7 @@ it(' - renders a textarea which correctly reacts on change', () = expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a textarea which correctly reacts on change (empty)', () => { +test(' - renders a textarea which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -130,7 +130,7 @@ it(' - renders a textarea which correctly reacts on change (empty expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders a textarea which correctly reacts on change (same value)', () => { +test(' - renders a textarea which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -146,7 +146,7 @@ it(' - renders a textarea which correctly reacts on change (same expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -154,7 +154,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-antd/__tests__/NestField.tsx b/packages/uniforms-antd/__tests__/NestField.tsx index 656c26bed..f4ad8182d 100644 --- a/packages/uniforms-antd/__tests__/NestField.tsx +++ b/packages/uniforms-antd/__tests__/NestField.tsx @@ -4,7 +4,7 @@ import { AutoField, NestField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an for each field', () => { +test(' - renders an for each field', () => { const element = ; const wrapper = mount( element, @@ -20,7 +20,7 @@ it(' - renders an for each field', () => { expect(wrapper.find(AutoField).at(1).prop('name')).toBe('b'); }); -it(' - renders custom content if given', () => { +test(' - renders custom content if given', () => { const element = (
@@ -40,7 +40,7 @@ it(' - renders custom content if given', () => { expect(wrapper.find('article').prop('data-test')).toBe('content'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( diff --git a/packages/uniforms-antd/__tests__/NumField.tsx b/packages/uniforms-antd/__tests__/NumField.tsx index 9fdcf8ede..b6f279309 100644 --- a/packages/uniforms-antd/__tests__/NumField.tsx +++ b/packages/uniforms-antd/__tests__/NumField.tsx @@ -5,14 +5,14 @@ import { NumField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an InputNumber', () => { +test(' - renders an InputNumber', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(InputNumber)).toHaveLength(1); }); -it(' - renders an InputNumber with correct disabled state', () => { +test(' - renders an InputNumber with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -20,7 +20,7 @@ it(' - renders an InputNumber with correct disabled state', () => { expect(wrapper.find(InputNumber).prop('disabled')).toBe(true); }); -it(' - renders an InputNumber with correct readOnly state', () => { +test(' - renders an InputNumber with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -28,7 +28,7 @@ it(' - renders an InputNumber with correct readOnly state', () => { expect(wrapper.find(InputNumber).prop('readOnly')).toBe(true); }); -it(' - renders an InputNumber with correct id (inherited)', () => { +test(' - renders an InputNumber with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -36,7 +36,7 @@ it(' - renders an InputNumber with correct id (inherited)', () => { expect(wrapper.find(InputNumber).prop('id')).toBeTruthy(); }); -it(' - renders an InputNumber with correct id (specified)', () => { +test(' - renders an InputNumber with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -44,7 +44,7 @@ it(' - renders an InputNumber with correct id (specified)', () => { expect(wrapper.find(InputNumber).prop('id')).toBe('y'); }); -it(' - renders an InputNumber with correct max', () => { +test(' - renders an InputNumber with correct max', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -52,7 +52,7 @@ it(' - renders an InputNumber with correct max', () => { expect(wrapper.find(InputNumber).prop('max')).toBe(10); }); -it(' - renders an InputNumber with correct min', () => { +test(' - renders an InputNumber with correct min', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -60,7 +60,7 @@ it(' - renders an InputNumber with correct min', () => { expect(wrapper.find(InputNumber).prop('min')).toBe(10); }); -it(' - renders an InputNumber with correct name', () => { +test(' - renders an InputNumber with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -68,7 +68,7 @@ it(' - renders an InputNumber with correct name', () => { expect(wrapper.find(InputNumber).prop('name')).toBe('x'); }); -it(' - renders an InputNumber with correct placeholder', () => { +test(' - renders an InputNumber with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -76,7 +76,7 @@ it(' - renders an InputNumber with correct placeholder', () => { expect(wrapper.find(InputNumber).prop('placeholder')).toBe('y'); }); -it(' - renders an InputNumber with correct step (decimal)', () => { +test(' - renders an InputNumber with correct step (decimal)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -84,7 +84,7 @@ it(' - renders an InputNumber with correct step (decimal)', () => { expect(wrapper.find(InputNumber).prop('step')).toBe(0.01); }); -it(' - renders an InputNumber with correct step (integer)', () => { +test(' - renders an InputNumber with correct step (integer)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -92,7 +92,7 @@ it(' - renders an InputNumber with correct step (integer)', () => { expect(wrapper.find(InputNumber).prop('step')).toBe(1); }); -it(' - renders an InputNumber with correct step (set)', () => { +test(' - renders an InputNumber with correct step (set)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -100,7 +100,7 @@ it(' - renders an InputNumber with correct step (set)', () => { expect(wrapper.find(InputNumber).prop('step')).toBe(3); }); -it(' - renders an InputNumber with correct value (default)', () => { +test(' - renders an InputNumber with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -108,7 +108,7 @@ it(' - renders an InputNumber with correct value (default)', () => { expect(wrapper.find(InputNumber).prop('value')).toBe(undefined); }); -it(' - renders an InputNumber with correct value (model)', () => { +test(' - renders an InputNumber with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -119,7 +119,7 @@ it(' - renders an InputNumber with correct value (model)', () => { expect(wrapper.find(InputNumber).prop('value')).toBe(1); }); -it(' - renders an InputNumber with correct value (specified)', () => { +test(' - renders an InputNumber with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -127,7 +127,7 @@ it(' - renders an InputNumber with correct value (specified)', () => { expect(wrapper.find(InputNumber).prop('value')).toBe(2); }); -it(' - renders an InputNumber which correctly reacts on change', () => { +test(' - renders an InputNumber which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -143,7 +143,7 @@ it(' - renders an InputNumber which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -it(' - renders an InputNumber which correctly reacts on change (decimal on decimal)', () => { +test(' - renders an InputNumber which correctly reacts on change (decimal on decimal)', () => { const onChange = jest.fn(); const element = ; @@ -159,7 +159,7 @@ it(' - renders an InputNumber which correctly reacts on change (decima expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); -it(' - renders an InputNumber which correctly reacts on change (decimal on integer)', () => { +test(' - renders an InputNumber which correctly reacts on change (decimal on integer)', () => { const onChange = jest.fn(); const element = ; @@ -175,7 +175,7 @@ it(' - renders an InputNumber which correctly reacts on change (decima expect(onChange).toHaveBeenLastCalledWith('x', 2); }); -it(' - renders an InputNumber which correctly reacts on change (empty)', () => { +test(' - renders an InputNumber which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -191,7 +191,7 @@ it(' - renders an InputNumber which correctly reacts on change (empty) expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders an InputNumber which correctly reacts on change (same value)', () => { +test(' - renders an InputNumber which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -207,7 +207,7 @@ it(' - renders an InputNumber which correctly reacts on change (same v expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -it(' - renders an InputNumber which correctly reacts on change (zero)', () => { +test(' - renders an InputNumber which correctly reacts on change (zero)', () => { const onChange = jest.fn(); const element = ; @@ -223,7 +223,7 @@ it(' - renders an InputNumber which correctly reacts on change (zero)' expect(onChange).toHaveBeenLastCalledWith('x', 0); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -231,7 +231,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); diff --git a/packages/uniforms-antd/__tests__/QuickForm.tsx b/packages/uniforms-antd/__tests__/QuickForm.tsx index de5cdf1e4..4f1342e29 100644 --- a/packages/uniforms-antd/__tests__/QuickForm.tsx +++ b/packages/uniforms-antd/__tests__/QuickForm.tsx @@ -4,7 +4,7 @@ import { QuickForm } from 'uniforms-antd'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - renders', () => { +test(' - renders', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-antd/__tests__/RadioField.tsx b/packages/uniforms-antd/__tests__/RadioField.tsx index 9db041f35..da7420ff4 100644 --- a/packages/uniforms-antd/__tests__/RadioField.tsx +++ b/packages/uniforms-antd/__tests__/RadioField.tsx @@ -5,7 +5,7 @@ import { RadioField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a set of checkboxes', () => { +test(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -15,7 +15,7 @@ it(' - renders a set of checkboxes', () => { expect(wrapper.find(Radio)).toHaveLength(2); }); -it(' - renders a set of checkboxes with correct disabled state', () => { +test(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -26,7 +26,7 @@ it(' - renders a set of checkboxes with correct disabled state', () expect(wrapper.find(Radio.Group).prop('disabled')).toBe(true); }); -it(' - renders a set of checkboxes with correct readOnly state', () => { +test(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -46,7 +46,7 @@ it(' - renders a set of checkboxes with correct readOnly state', () expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a set of checkboxes with correct id (inherited)', () => { +test(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ it(' - renders a set of checkboxes with correct id (inherited)', () expect(wrapper.find(Radio.Group).prop('id')).toBeTruthy(); }); -it(' - renders a set of checkboxes with correct id (specified)', () => { +test(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -68,7 +68,7 @@ it(' - renders a set of checkboxes with correct id (specified)', () expect(wrapper.find(Radio.Group).prop('id')).toBe('y'); }); -it(' - renders a set of checkboxes with correct name', () => { +test(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -79,7 +79,7 @@ it(' - renders a set of checkboxes with correct name', () => { expect(wrapper.find(Radio.Group).prop('name')).toBe('x'); }); -it(' - renders a set of checkboxes with correct options', () => { +test(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -91,7 +91,7 @@ it(' - renders a set of checkboxes with correct options', () => { expect(wrapper.find('label').at(1).text()).toBe('b'); }); -it(' - renders a set of checkboxes with correct options (transform)', () => { +test(' - renders a set of checkboxes with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -103,7 +103,7 @@ it(' - renders a set of checkboxes with correct options (transform)' expect(wrapper.find('label').at(1).text()).toBe('B'); }); -it(' - renders a set of checkboxes with correct value (default)', () => { +test(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -114,7 +114,7 @@ it(' - renders a set of checkboxes with correct value (default)', () expect(wrapper.find(Radio.Group).prop('value')).toBe(''); }); -it(' - renders a set of checkboxes with correct value (model)', () => { +test(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -128,7 +128,7 @@ it(' - renders a set of checkboxes with correct value (model)', () = expect(wrapper.find(Radio.Group).prop('value')).toBe('b'); }); -it(' - renders a set of checkboxes with correct value (specified)', () => { +test(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -139,7 +139,7 @@ it(' - renders a set of checkboxes with correct value (specified)', expect(wrapper.find(Radio.Group).prop('value')).toBe('b'); }); -it(' - renders a set of checkboxes which correctly reacts on change', () => { +test(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -159,7 +159,7 @@ it(' - renders a set of checkboxes which correctly reacts on change' expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -179,7 +179,7 @@ it(' - renders a set of checkboxes which correctly reacts on change expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -190,7 +190,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -202,7 +202,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find(Radio.Group).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), diff --git a/packages/uniforms-antd/__tests__/SelectField.tsx b/packages/uniforms-antd/__tests__/SelectField.tsx index 7056f11cb..c07cc2db1 100644 --- a/packages/uniforms-antd/__tests__/SelectField.tsx +++ b/packages/uniforms-antd/__tests__/SelectField.tsx @@ -6,7 +6,7 @@ import { SelectField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a select', () => { +test(' - renders a select', () => { const element = ; const wrapper = mount( element, @@ -16,7 +16,7 @@ it(' - renders a select', () => { expect(wrapper.find(Select)).toHaveLength(1); }); -it(' - renders a select with correct disabled state', () => { +test(' - renders a select with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -27,7 +27,7 @@ it(' - renders a select with correct disabled state', () => { expect(wrapper.find(Select).prop('disabled')).toBe(true); }); -it(' - renders a select with correct readOnly state', () => { +test(' - renders a select with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -45,7 +45,7 @@ it(' - renders a select with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a select with correct id (inherited)', () => { +test(' - renders a select with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -56,7 +56,7 @@ it(' - renders a select with correct id (inherited)', () => { expect(wrapper.find(Select).prop('id')).toBeTruthy(); }); -it(' - renders a select with correct id (specified)', () => { +test(' - renders a select with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -67,7 +67,7 @@ it(' - renders a select with correct id (specified)', () => { expect(wrapper.find(Select).prop('id')).toBe('y'); }); -it(' - renders a select with correct name', () => { +test(' - renders a select with correct name', () => { const element = ; const wrapper = mount( element, @@ -78,7 +78,7 @@ it(' - renders a select with correct name', () => { expect(wrapper.find(Select).prop('name')).toBe('x'); }); -it(' - renders a select with correct options', () => { +test(' - renders a select with correct options', () => { const element = ; const wrapper = mount( element, @@ -97,7 +97,7 @@ it(' - renders a select with correct options', () => { expect(wrapper.find(Select).prop('children')[1].props.children).toBe('b'); }); -it(' - renders a select with correct options (transform)', () => { +test(' - renders a select with correct options (transform)', () => { const element = ( x.toUpperCase()} /> ); @@ -118,7 +118,7 @@ it(' - renders a select with correct options (transform)', () => { expect(wrapper.find(Select).prop('children')[1].props.children).toBe('B'); }); -it(' - renders a select with correct placeholder (implicit)', () => { +test(' - renders a select with correct placeholder (implicit)', () => { const element = ; const wrapper = mount( element, @@ -130,7 +130,7 @@ it(' - renders a select with correct placeholder (implicit)', () => expect(wrapper.find(Select).prop('value')).toBe(undefined); }); -it(' - renders a select with correct value (default)', () => { +test(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -141,7 +141,7 @@ it(' - renders a select with correct value (default)', () => { expect(wrapper.find(Select).prop('value')).toBe(undefined); }); -it(' - renders a select with correct value (model)', () => { +test(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -155,7 +155,7 @@ it(' - renders a select with correct value (model)', () => { expect(wrapper.find(Select).prop('value')).toBe('b'); }); -it(' - renders a select with correct value (specified)', () => { +test(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -166,7 +166,7 @@ it(' - renders a select with correct value (specified)', () => { expect(wrapper.find(Select).prop('value')).toBe('b'); }); -it(' - renders a select which correctly reacts on change', () => { +test(' - renders a select which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -184,7 +184,7 @@ it(' - renders a select which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a select which correctly reacts on change (array)', () => { +test(' - renders a select which correctly reacts on change (array)', () => { const onChange = jest.fn(); const element = ; @@ -207,7 +207,7 @@ it(' - renders a select which correctly reacts on change (array)', expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -it(' - renders a select (undefined values)', () => { +test(' - renders a select (undefined values)', () => { const element = ; const wrapper = mount( element, @@ -222,7 +222,7 @@ it(' - renders a select (undefined values)', () => { expect(wrapper.find(Select).prop('value')).toContain('a'); }); -it(' - renders a select which correctly reacts on change (empty)', () => { +test(' - renders a select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -240,7 +240,7 @@ it(' - renders a select which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders a select which correctly reacts on change (same value)', () => { +test(' - renders a select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -258,7 +258,7 @@ it(' - renders a select which correctly reacts on change (same valu expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -270,14 +270,14 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find(Select).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -it(' - disabled items (options) based on predicate', () => { +test(' - disabled items (options) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( @@ -298,7 +298,7 @@ it(' - disabled items (options) based on predicate', () => { expect(children[1].props.disabled).toBe(false); }); -it(' - renders a set of checkboxes', () => { +test(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -310,7 +310,7 @@ it(' - renders a set of checkboxes', () => { expect(wrapper.find(Radio).at(1).prop('value')).toBe('b'); }); -it(' - renders a set of checkboxes with correct disabled state', () => { +test(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -321,7 +321,7 @@ it(' - renders a set of checkboxes with correct disabled expect(wrapper.find(Radio.Group).prop('disabled')).toBe(true); }); -it(' - renders a set of checkboxes with correct readOnly state', () => { +test(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -338,7 +338,7 @@ it(' - renders a set of checkboxes with correct readOnly expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a set of checkboxes with correct id (inherited)', () => { +test(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -349,7 +349,7 @@ it(' - renders a set of checkboxes with correct id (inhe expect(wrapper.find(Radio.Group).prop('id')).toBeTruthy(); }); -it(' - renders a set of checkboxes with correct id (specified)', () => { +test(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -360,7 +360,7 @@ it(' - renders a set of checkboxes with correct id (spec expect(wrapper.find(Radio.Group).prop('id')).toBe('y'); }); -it(' - renders a set of checkboxes with correct name', () => { +test(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -371,7 +371,7 @@ it(' - renders a set of checkboxes with correct name', ( expect(wrapper.find(Radio.Group).prop('name')).toBe('x'); }); -it(' - renders a set of checkboxes with correct options', () => { +test(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -383,7 +383,7 @@ it(' - renders a set of checkboxes with correct options' expect(wrapper.find('label').at(1).text()).toBe('b'); }); -it(' - renders a set of checkboxes with correct options (transform)', () => { +test(' - renders a set of checkboxes with correct options (transform)', () => { const element = ( - renders a set of checkboxes with correct options expect(wrapper.find('label').at(1).text()).toBe('B'); }); -it(' - renders a set of checkboxes with correct value (default)', () => { +test(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -413,7 +413,7 @@ it(' - renders a set of checkboxes with correct value (d expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -it(' - renders a set of checkboxes with correct value (model)', () => { +test(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -428,7 +428,7 @@ it(' - renders a set of checkboxes with correct value (m expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes with correct value (specified)', () => { +test(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -440,7 +440,7 @@ it(' - renders a set of checkboxes with correct value (s expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes which correctly reacts on change', () => { +test(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -457,7 +457,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { const onChange = jest.fn(); const element = ; @@ -477,7 +477,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -it(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); const element = ; @@ -497,7 +497,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -514,7 +514,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -525,7 +525,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ( ); @@ -539,14 +539,14 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find(Radio.Group).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -it(' - disabled items (checkboxes) based on predicate', () => { +test(' - disabled items (checkboxes) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( diff --git a/packages/uniforms-antd/__tests__/SubmitField.tsx b/packages/uniforms-antd/__tests__/SubmitField.tsx index 2f7f07406..5cc3a94db 100644 --- a/packages/uniforms-antd/__tests__/SubmitField.tsx +++ b/packages/uniforms-antd/__tests__/SubmitField.tsx @@ -5,14 +5,14 @@ import { SubmitField } from 'uniforms-antd'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders', () => { +test(' - renders', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper).toHaveLength(1); }); -it(' - renders disabled if error', () => { +test(' - renders disabled if error', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -20,7 +20,7 @@ it(' - renders disabled if error', () => { expect(wrapper.find(Button).prop('disabled')).toBe(true); }); -it(' - renders enabled if error and enabled', () => { +test(' - renders enabled if error and enabled', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); diff --git a/packages/uniforms-antd/__tests__/TextField.tsx b/packages/uniforms-antd/__tests__/TextField.tsx index a9e40ccb6..56ff900fd 100644 --- a/packages/uniforms-antd/__tests__/TextField.tsx +++ b/packages/uniforms-antd/__tests__/TextField.tsx @@ -10,7 +10,7 @@ import mount from './_mount'; describe('@RTL - TextField tests', () => { testTextField(TextField); - it(' - renders component with unknown props', () => { + test(' - renders component with unknown props', () => { const props = { 'data-x': 'x', 'data-y': 'y', @@ -25,14 +25,14 @@ describe('@RTL - TextField tests', () => { }); }); -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(Input)).toHaveLength(1); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -40,7 +40,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find(Input).prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -48,7 +48,7 @@ it(' - renders an input with correct readOnly state', () => { expect(wrapper.find(Input).prop('readOnly')).toBe(true); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -56,7 +56,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find(Input).prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -64,7 +64,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find(Input).prop('id')).toBe('y'); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -72,7 +72,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find(Input).prop('name')).toBe('x'); }); -it(' - renders an input with correct placeholder', () => { +test(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -80,7 +80,7 @@ it(' - renders an input with correct placeholder', () => { expect(wrapper.find(Input).prop('placeholder')).toBe('y'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -88,7 +88,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find(Input).prop('type')).toBe('text'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -96,7 +96,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find(Input).prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -107,7 +107,7 @@ it(' - renders an input with correct value (model)', () => { expect(wrapper.find(Input).prop('value')).toBe('y'); }); -it(' - renders an input with correct value (specified)', () => { +test(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -115,7 +115,7 @@ it(' - renders an input with correct value (specified)', () => { expect(wrapper.find(Input).prop('value')).toBe('y'); }); -it(' - renders an input which correctly reacts on change', () => { +test(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -131,7 +131,7 @@ it(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders an input which correctly reacts on change (empty)', () => { +test(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -147,7 +147,7 @@ it(' - renders an input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders an input which correctly reacts on change (same value)', () => { +test(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -163,7 +163,7 @@ it(' - renders an input which correctly reacts on change (same value) expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -171,7 +171,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -180,14 +180,14 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find(Input).prop('data-z')).toBe('z'); }); -it(' - renders a input with correct type prop', () => { +test(' - renders a input with correct type prop', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(Input).prop('type')).toBe('password'); }); -it(' - renders a input with autocomplete turned off', () => { +test(' - renders a input with autocomplete turned off', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-antd/__tests__/ValidateQuickForm.tsx b/packages/uniforms-antd/__tests__/ValidateQuickForm.tsx index 402c98cc9..80a2d7d75 100644 --- a/packages/uniforms-antd/__tests__/ValidateQuickForm.tsx +++ b/packages/uniforms-antd/__tests__/ValidateQuickForm.tsx @@ -4,7 +4,7 @@ import { ValidatedQuickForm } from 'uniforms-antd'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-antd/__tests__/ValidatedForm.tsx b/packages/uniforms-antd/__tests__/ValidatedForm.tsx index 34f5fad78..c27171e6b 100644 --- a/packages/uniforms-antd/__tests__/ValidatedForm.tsx +++ b/packages/uniforms-antd/__tests__/ValidatedForm.tsx @@ -4,7 +4,7 @@ import { ValidatedForm } from 'uniforms-antd'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-antd/__tests__/index.ts b/packages/uniforms-antd/__tests__/index.ts index d87b61151..75a72ad82 100644 --- a/packages/uniforms-antd/__tests__/index.ts +++ b/packages/uniforms-antd/__tests__/index.ts @@ -1,6 +1,6 @@ import * as antd from 'uniforms-antd'; -it('exports everything', () => { +test('exports everything', () => { expect(antd).toEqual({ AutoFields: expect.any(Function), AutoField: expect.any(Function), diff --git a/packages/uniforms-antd/__tests__/wrapField.tsx b/packages/uniforms-antd/__tests__/wrapField.tsx index f6b427998..4039b8930 100644 --- a/packages/uniforms-antd/__tests__/wrapField.tsx +++ b/packages/uniforms-antd/__tests__/wrapField.tsx @@ -5,7 +5,7 @@ import { wrapField } from 'uniforms-antd'; import mount from './_mount'; -it(' - renders wrapper with label', () => { +test(' - renders wrapper with label', () => { const element = wrapField({ label: 'Label' },
); const wrapper = mount(element); @@ -13,14 +13,14 @@ it(' - renders wrapper with label', () => { expect(wrapper.find(Form.Item).prop('label').props.children[0]).toBe('Label'); }); -it(' - renders wrapper with label and info', () => { +test(' - renders wrapper with label and info', () => { const element = wrapField({ label: 'Label', info: 'Info' },
); const wrapper = mount(element); expect(wrapper.find(Tooltip).prop('title')).toBe('Info'); }); -it(' - renders wrapper with an error message', () => { +test(' - renders wrapper with an error message', () => { const error = new Error(); const element = wrapField( { error, showInlineError: true, errorMessage: 'Error' }, @@ -31,14 +31,14 @@ it(' - renders wrapper with an error message', () => { expect(wrapper.find(Form.Item).prop('help')).toBe('Error'); }); -it(' - renders wrapper with an error status', () => { +test(' - renders wrapper with an error status', () => { const element = wrapField({},
); const wrapper = mount(element); expect(wrapper.find(Form.Item).prop('validateStatus')).toBe(undefined); }); -it(' - renders wrapper with an error status (error)', () => { +test(' - renders wrapper with an error status (error)', () => { const error = new Error(); const element = wrapField({ error },
); const wrapper = mount(element); @@ -46,28 +46,28 @@ it(' - renders wrapper with an error status (error)', () => { expect(wrapper.find(Form.Item).prop('validateStatus')).toBe('error'); }); -it(' - renders wrapper with help text', () => { +test(' - renders wrapper with help text', () => { const element = wrapField({ help: 'Help' },
); const wrapper = mount(element); expect(wrapper.find(Form.Item).prop('help')).toBe('Help'); }); -it(' - renders wrapper with extra text', () => { +test(' - renders wrapper with extra text', () => { const element = wrapField({ extra: 'Extra' },
); const wrapper = mount(element); expect(wrapper.find(Form.Item).prop('extra')).toBe('Extra'); }); -it(' - renders wrapper with extra style', () => { +test(' - renders wrapper with extra style', () => { const element = wrapField({ wrapperStyle: {} },
); const wrapper = mount(element); expect(wrapper.find(Form.Item).prop('style')).toEqual({}); }); -it(' - renders wrapper with a custom validateStatus', () => { +test(' - renders wrapper with a custom validateStatus', () => { const element = wrapField({ validateStatus: 'success' },
); const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap3/__tests__/AutoField.tsx b/packages/uniforms-bootstrap3/__tests__/AutoField.tsx index 1854ca326..d26e7a3f7 100644 --- a/packages/uniforms-bootstrap3/__tests__/AutoField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/AutoField.tsx @@ -14,14 +14,14 @@ import { import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(AutoField)).toHaveLength(1); }); -it(' - detects RadioField', () => { +test(' - detects RadioField', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ it(' - detects RadioField', () => { expect(wrapper.find(RadioField.Component)).toHaveLength(1); }); -it(' - detects SelectField', () => { +test(' - detects SelectField', () => { const element = ; const wrapper = mount( element, @@ -50,14 +50,14 @@ it(' - detects SelectField', () => { expect(wrapper.find(SelectField.Component)).toHaveLength(1); }); -it(' - detects DateField', () => { +test(' - detects DateField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DateField.Component)).toHaveLength(1); }); -it(' - detects ListField', () => { +test(' - detects ListField', () => { const element = ; const wrapper = mount( element, @@ -67,35 +67,35 @@ it(' - detects ListField', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -it(' - detects NumField', () => { +test(' - detects NumField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(NumField.Component)).toHaveLength(1); }); -it(' - detects NestField', () => { +test(' - detects NestField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Object } })); expect(wrapper.find(NestField)).toHaveLength(1); }); -it(' - detects TextField', () => { +test(' - detects TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField.Component)).toHaveLength(1); }); -it(' - detects BoolField', () => { +test(' - detects BoolField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(BoolField.Component)).toHaveLength(1); }); -it(' - uses Component (schema)', () => { +test(' - uses Component (schema)', () => { const Component = jest.fn(() => null); const element = ; @@ -107,7 +107,7 @@ it(' - uses Component (schema)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -it(' - uses Component (props)', () => { +test(' - uses Component (props)', () => { const Component = jest.fn(() => null); const element = ; @@ -116,7 +116,7 @@ it(' - uses Component (props)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -it(' - uses Component (context)', () => { +test(' - uses Component (context)', () => { const FieldA = jest.fn(() => null); const FieldB = jest.fn(() => null); @@ -136,7 +136,7 @@ it(' - uses Component (context)', () => { expect(FieldB).toHaveBeenCalledTimes(1); }); -it(' - uses Component (invalid)', () => { +test(' - uses Component (invalid)', () => { const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {}); expect(() => { const element = ; diff --git a/packages/uniforms-bootstrap3/__tests__/AutoFields.tsx b/packages/uniforms-bootstrap3/__tests__/AutoFields.tsx index 6315c5f2c..86f1d1db4 100644 --- a/packages/uniforms-bootstrap3/__tests__/AutoFields.tsx +++ b/packages/uniforms-bootstrap3/__tests__/AutoFields.tsx @@ -4,14 +4,14 @@ import { AutoFields, AutoField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('AutoFields')).toHaveLength(1); }); -it(' - render all fields by default', () => { +test(' - render all fields by default', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - render all fields by default', () => { expect(wrapper.find('input')).toHaveLength(3); }); -it(' - renders only specified fields', () => { +test(' - renders only specified fields', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ it(' - renders only specified fields', () => { ); }); -it(' - does not render ommited fields', () => { +test(' - does not render ommited fields', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ it(' - does not render ommited fields', () => { ); }); -it(' - wraps fields in specified element', () => { +test(' - wraps fields in specified element', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ it(' - wraps fields in specified element', () => { expect(wrapper.find('section').find('input')).toHaveLength(3); }); -it(' - pass props to the children', () => { +test(' - pass props to the children', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap3/__tests__/AutoForm.tsx b/packages/uniforms-bootstrap3/__tests__/AutoForm.tsx index baf84d4e1..e34a1daaa 100644 --- a/packages/uniforms-bootstrap3/__tests__/AutoForm.tsx +++ b/packages/uniforms-bootstrap3/__tests__/AutoForm.tsx @@ -4,7 +4,7 @@ import { AutoForm } from 'uniforms-bootstrap3'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap3/__tests__/BaseForm.tsx b/packages/uniforms-bootstrap3/__tests__/BaseForm.tsx index 91fd239f2..05dcf396b 100644 --- a/packages/uniforms-bootstrap3/__tests__/BaseForm.tsx +++ b/packages/uniforms-bootstrap3/__tests__/BaseForm.tsx @@ -4,7 +4,7 @@ import { BaseForm } from 'uniforms-bootstrap3'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap3/__tests__/BoolField.tsx b/packages/uniforms-bootstrap3/__tests__/BoolField.tsx index 2331190da..3fd395fc9 100644 --- a/packages/uniforms-bootstrap3/__tests__/BoolField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/BoolField.tsx @@ -4,14 +4,14 @@ import { BoolField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an inline input', () => { +test(' - renders an inline input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -19,7 +19,7 @@ it(' - renders an inline input', () => { expect(wrapper.find('.checkbox-inline')).toHaveLength(1); }); -it(' - renders a input with correct id (inherited)', () => { +test(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -27,7 +27,7 @@ it(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders a input with correct id (specified)', () => { +test(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -35,7 +35,7 @@ it(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders a input with correct name', () => { +test(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -43,7 +43,7 @@ it(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('checkbox'); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -59,7 +59,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -73,7 +73,7 @@ it(' - renders an input with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a input with correct label (specified)', () => { +test(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -84,7 +84,7 @@ it(' - renders a input with correct label (specified)', () => { ); }); -it(' - renders a input with correct value (default)', () => { +test(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -92,7 +92,7 @@ it(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('checked')).toBe(false); }); -it(' - renders a input with correct value (model)', () => { +test(' - renders a input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -103,7 +103,7 @@ it(' - renders a input with correct value (model)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -it(' - renders a input with correct value (specified)', () => { +test(' - renders a input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -111,7 +111,7 @@ it(' - renders a input with correct value (specified)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -it(' - renders a input which correctly reacts on change', () => { +test(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ it(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', true); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); diff --git a/packages/uniforms-bootstrap3/__tests__/DateField.tsx b/packages/uniforms-bootstrap3/__tests__/DateField.tsx index 04ba5c1d8..dff9e15fd 100644 --- a/packages/uniforms-bootstrap3/__tests__/DateField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/DateField.tsx @@ -8,7 +8,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - DateField tests', () => { - it(' - handles "date" type correctly', () => { + test(' - handles "date" type correctly', () => { const onChange = jest.fn(); const initialDate = new Date(Date.UTC(2020, 0, 1)); @@ -29,14 +29,14 @@ describe('@RTL - DateField tests', () => { }); }); -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders a input with correct id (inherited)', () => { +test(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -44,7 +44,7 @@ it(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders a input with correct id (specified)', () => { +test(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -52,7 +52,7 @@ it(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders a input with correct name', () => { +test(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -60,7 +60,7 @@ it(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -68,7 +68,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('datetime-local'); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -87,7 +87,7 @@ test.each(['date', 'datetime-local'] as const)( }, ); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -95,7 +95,7 @@ it(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -it(' - renders a input with correct label (specified)', () => { +test(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -106,7 +106,7 @@ it(' - renders a input with correct label (specified)', () => { ); }); -it(' - renders a input with correct value (default)', () => { +test(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -114,7 +114,7 @@ it(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders a input with correct value (model)', () => { +test(' - renders a input with correct value (model)', () => { const now = new Date(); const element = ; const wrapper = mount( @@ -128,7 +128,7 @@ it(' - renders a input with correct value (model)', () => { ); }); -it(' - renders a input with correct value (specified)', () => { +test(' - renders a input with correct value (specified)', () => { const now = new Date(); const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -139,7 +139,7 @@ it(' - renders a input with correct value (specified)', () => { ); }); -it(' - renders a input which correctly reacts on change', () => { +test(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const now = new Date(); @@ -158,7 +158,7 @@ it(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', now); }); -it(' - renders a input which correctly reacts on change (empty)', () => { +test(' - renders a input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -176,7 +176,7 @@ it(' - renders a input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a input which correctly reacts on change (overflow)', () => { +test(' - renders a input which correctly reacts on change (overflow)', () => { const onChange = jest.fn(); const now = new Date(1e5, 0); @@ -195,7 +195,7 @@ it(' - renders a input which correctly reacts on change (overflow)', expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); diff --git a/packages/uniforms-bootstrap3/__tests__/ErrorField.tsx b/packages/uniforms-bootstrap3/__tests__/ErrorField.tsx index c66b6b831..b7b5745d6 100644 --- a/packages/uniforms-bootstrap3/__tests__/ErrorField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/ErrorField.tsx @@ -11,14 +11,14 @@ const error = { message: 'X is required [validation-error]', }; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorField)).toHaveLength(1); }); -it(' - renders correct error message (context)', () => { +test(' - renders correct error message (context)', () => { const element = ; const wrapper = mount( element, @@ -29,7 +29,7 @@ it(' - renders correct error message (context)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -it(' - renders correct error message (specified)', () => { +test(' - renders correct error message (specified)', () => { const element = ( - renders correct error message (specified)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -it(' - renders correct children if specified', () => { +test(' - renders correct children if specified', () => { const element = Error; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap3/__tests__/ErrorsField.tsx b/packages/uniforms-bootstrap3/__tests__/ErrorsField.tsx index b4980975c..c2ed3ee01 100644 --- a/packages/uniforms-bootstrap3/__tests__/ErrorsField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/ErrorsField.tsx @@ -15,14 +15,14 @@ const error = { message: 'X is required [validation-error]', }; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorsField)).toHaveLength(1); }); -it(' - renders list of correct error messages (context)', () => { +test(' - renders list of correct error messages (context)', () => { const element = ; const wrapper = mount( element, @@ -38,7 +38,7 @@ it(' - renders list of correct error messages (context)', () => { expect(wrapper.find('.panel-body > div').at(2).text()).toBe('Z is required'); }); -it(' - renders children (specified)', () => { +test(' - renders children (specified)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap3/__tests__/HiddenField.tsx b/packages/uniforms-bootstrap3/__tests__/HiddenField.tsx index bd9846896..bd6edef8c 100644 --- a/packages/uniforms-bootstrap3/__tests__/HiddenField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/HiddenField.tsx @@ -4,14 +4,14 @@ import { HiddenField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('hidden'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -62,7 +62,7 @@ it(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input which correctly reacts on model change', () => { +test(' - renders an input which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -76,7 +76,7 @@ it(' - renders an input which correctly reacts on model change', () expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders an input which correctly reacts on model change (empty)', () => { +test(' - renders an input which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -90,7 +90,7 @@ it(' - renders an input which correctly reacts on model change (emp expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders an input which correctly reacts on model change (same value)', () => { +test(' - renders an input which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -104,14 +104,14 @@ it(' - renders an input which correctly reacts on model change (sam expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders nothing', () => { +test(' - renders nothing', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.children()).toHaveLength(0); }); -it(' - renders nothing which correctly reacts on model change', () => { +test(' - renders nothing which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ it(' - renders nothing which correctly reacts on model change expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders nothing which correctly reacts on model change (empty)', () => { +test(' - renders nothing which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ it(' - renders nothing which correctly reacts on model change expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders nothing which correctly reacts on model change (same value)', () => { +test(' - renders nothing which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; diff --git a/packages/uniforms-bootstrap3/__tests__/ListAddField.tsx b/packages/uniforms-bootstrap3/__tests__/ListAddField.tsx index b16f8d8d4..a922f12be 100644 --- a/packages/uniforms-bootstrap3/__tests__/ListAddField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/ListAddField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListAddField)).toHaveLength(1); }); -it(' - prevents onClick when disabled', () => { +test(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ it(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when limit reached', () => { +test(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { maxCount: 0 } })); @@ -39,7 +39,7 @@ it(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - correctly reacts on click', () => { +test(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ it(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['y']); }); -it(' - correctly reacts on keyboard enter key', () => { +test(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-bootstrap3/__tests__/ListDelField.tsx b/packages/uniforms-bootstrap3/__tests__/ListDelField.tsx index e34de84f5..83ee440d5 100644 --- a/packages/uniforms-bootstrap3/__tests__/ListDelField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/ListDelField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListDelField)).toHaveLength(1); }); -it(' - prevents onClick when disabled', () => { +test(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ it(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when limit reached', () => { +test(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { minCount: 3 } })); @@ -39,7 +39,7 @@ it(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - correctly reacts on click', () => { +test(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ it(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['x', 'z']); }); -it(' - correctly reacts on keyboard enter key', () => { +test(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-bootstrap3/__tests__/ListField.tsx b/packages/uniforms-bootstrap3/__tests__/ListField.tsx index 763db6167..39f8754e8 100644 --- a/packages/uniforms-bootstrap3/__tests__/ListField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/ListField.tsx @@ -12,7 +12,7 @@ describe('@RTL - ListField tests', () => { }); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount( element, @@ -22,7 +22,7 @@ it(' - works', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -it(' - renders ListAddField', () => { +test(' - renders ListAddField', () => { const element = ; const wrapper = mount( element, @@ -33,7 +33,7 @@ it(' - renders ListAddField', () => { expect(wrapper.find(ListAddField).prop('name')).toBe('$'); }); -it(' - renders correct label (specified)', () => { +test(' - renders correct label (specified)', () => { const element = ; const wrapper = mount( element, @@ -46,7 +46,7 @@ it(' - renders correct label (specified)', () => { ); }); -it(' - renders correct numer of items with model (specified)', () => { +test(' - renders correct numer of items with model (specified)', () => { const element = ; const wrapper = mount( element, @@ -58,7 +58,7 @@ it(' - renders correct numer of items with model (specified)', () => expect(wrapper.find('input')).toHaveLength(3); }); -it(' - passes itemProps to its children', () => { +test(' - passes itemProps to its children', () => { const element = ; const wrapper = mount( element, @@ -70,7 +70,7 @@ it(' - passes itemProps to its children', () => { expect(wrapper.find(ListItemField).first().prop('data-xyz')).toBe(1); }); -it(' - renders children (specified)', () => { +test(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -89,7 +89,7 @@ it(' - renders children (specified)', () => { expect(Child).toHaveBeenCalledTimes(2); }); -it(' - renders children with correct name (children)', () => { +test(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -108,7 +108,7 @@ it(' - renders children with correct name (children)', () => { expect(wrapper.find(Child).at(1).prop('name')).toBe('1'); }); -it(' - renders children with correct name (value)', () => { +test(' - renders children with correct name (value)', () => { const element = ; const wrapper = mount( element, @@ -121,7 +121,7 @@ it(' - renders children with correct name (value)', () => { expect(wrapper.find(ListItemField).at(1).prop('name')).toBe('1'); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( - renders correct error text (specified)', () => { expect(wrapper.find('.help-block').text()).toBe('Error'); }); -it(' - renders correct error text (showInlineError=false)', () => { +test(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.find('.help-block')).toHaveLength(0); }); -it(' - renders proper number of optional values after add new value', () => { +test(' - renders proper number of optional values after add new value', () => { const element = ; const onChange = jest.fn(); const wrapper = mount( diff --git a/packages/uniforms-bootstrap3/__tests__/ListItemField.tsx b/packages/uniforms-bootstrap3/__tests__/ListItemField.tsx index 8e3249a4b..b8f55cafb 100644 --- a/packages/uniforms-bootstrap3/__tests__/ListItemField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/ListItemField.tsx @@ -4,7 +4,7 @@ import { AutoField, ListDelField, ListItemField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - works', () => { expect(wrapper.find(ListItemField)).toHaveLength(1); }); -it(' - renders ListDelField', () => { +test(' - renders ListDelField', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - renders ListDelField', () => { expect(wrapper.find(ListDelField).childAt(0).prop('name')).toBe('x.1'); }); -it(' - renders AutoField', () => { +test(' - renders AutoField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ it(' - renders AutoField', () => { expect(wrapper.find(AutoField)).toHaveLength(1); }); -it(' - renders children if specified', () => { +test(' - renders children if specified', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( diff --git a/packages/uniforms-bootstrap3/__tests__/LongTextField.tsx b/packages/uniforms-bootstrap3/__tests__/LongTextField.tsx index 118f8c657..6eb99efb9 100644 --- a/packages/uniforms-bootstrap3/__tests__/LongTextField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/LongTextField.tsx @@ -4,14 +4,14 @@ import { LongTextField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a textarea', () => { +test(' - renders a textarea', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('textarea')).toHaveLength(1); }); -it(' - renders a textarea with correct disabled state', () => { +test(' - renders a textarea with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ it(' - renders a textarea with correct disabled state', () => { expect(wrapper.find('textarea').prop('disabled')).toBe(true); }); -it(' - renders a textarea with correct readOnly state', () => { +test(' - renders a textarea with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ it(' - renders a textarea with correct readOnly state', () => { expect(wrapper.find('textarea').prop('readOnly')).toBe(true); }); -it(' - renders a textarea with correct id (inherited)', () => { +test(' - renders a textarea with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ it(' - renders a textarea with correct id (inherited)', () => { expect(wrapper.find('textarea').prop('id')).toBeTruthy(); }); -it(' - renders a textarea with correct id (specified)', () => { +test(' - renders a textarea with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ it(' - renders a textarea with correct id (specified)', () => { expect(wrapper.find('textarea').prop('id')).toBe('y'); }); -it(' - renders a textarea with correct name', () => { +test(' - renders a textarea with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ it(' - renders a textarea with correct name', () => { expect(wrapper.find('textarea').prop('name')).toBe('x'); }); -it(' - renders a textarea with correct placeholder', () => { +test(' - renders a textarea with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -59,7 +59,7 @@ it(' - renders a textarea with correct placeholder', () => { expect(wrapper.find('textarea').prop('placeholder')).toBe('y'); }); -it(' - renders a textarea with correct value (default)', () => { +test(' - renders a textarea with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -67,7 +67,7 @@ it(' - renders a textarea with correct value (default)', () => { expect(wrapper.find('textarea').prop('value')).toBe(''); }); -it(' - renders a textarea with correct value (model)', () => { +test(' - renders a textarea with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -78,7 +78,7 @@ it(' - renders a textarea with correct value (model)', () => { expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -it(' - renders a textarea with correct value (specified)', () => { +test(' - renders a textarea with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -86,7 +86,7 @@ it(' - renders a textarea with correct value (specified)', () => expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -it(' - renders a textarea which correctly reacts on change', () => { +test(' - renders a textarea which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -102,7 +102,7 @@ it(' - renders a textarea which correctly reacts on change', () = expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a textarea which correctly reacts on change (empty)', () => { +test(' - renders a textarea which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -118,7 +118,7 @@ it(' - renders a textarea which correctly reacts on change (empty expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders a textarea which correctly reacts on change (same value)', () => { +test(' - renders a textarea which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -134,7 +134,7 @@ it(' - renders a textarea which correctly reacts on change (same expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -145,7 +145,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-bootstrap3/__tests__/NestField.tsx b/packages/uniforms-bootstrap3/__tests__/NestField.tsx index e79e3913e..793418a7f 100644 --- a/packages/uniforms-bootstrap3/__tests__/NestField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/NestField.tsx @@ -4,7 +4,7 @@ import { AutoField, NestField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an for each field', () => { +test(' - renders an for each field', () => { const element = ; const wrapper = mount( element, @@ -20,7 +20,7 @@ it(' - renders an for each field', () => { expect(wrapper.find(AutoField).at(1).prop('name')).toBe('b'); }); -it(' - renders custom content if given', () => { +test(' - renders custom content if given', () => { const element = (
@@ -40,7 +40,7 @@ it(' - renders custom content if given', () => { expect(wrapper.find('article').prop('data-test')).toBe('content'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -88,7 +88,7 @@ it(' - renders correct error text (specified)', () => { expect(wrapper.find('.help-block').text()).toBe('Error'); }); -it(' - renders correct error text (showInlineError=false)', () => { +test(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -19,7 +19,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -27,7 +27,7 @@ it(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -35,7 +35,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -43,7 +43,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct max', () => { +test(' - renders an input with correct max', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct max', () => { expect(wrapper.find('input').prop('max')).toBe(10); }); -it(' - renders an input with correct min', () => { +test(' - renders an input with correct min', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -59,7 +59,7 @@ it(' - renders an input with correct min', () => { expect(wrapper.find('input').prop('min')).toBe(10); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -67,7 +67,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct placeholder', () => { +test(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -75,7 +75,7 @@ it(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -it(' - renders an input with correct step (decimal)', () => { +test(' - renders an input with correct step (decimal)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -83,7 +83,7 @@ it(' - renders an input with correct step (decimal)', () => { expect(wrapper.find('input').prop('step')).toBe(0.01); }); -it(' - renders an input with correct step (integer)', () => { +test(' - renders an input with correct step (integer)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -91,7 +91,7 @@ it(' - renders an input with correct step (integer)', () => { expect(wrapper.find('input').prop('step')).toBe(1); }); -it(' - renders an input with correct step (set)', () => { +test(' - renders an input with correct step (set)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -99,7 +99,7 @@ it(' - renders an input with correct step (set)', () => { expect(wrapper.find('input').prop('step')).toBe(3); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -107,7 +107,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('number'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -115,7 +115,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const onChange = jest.fn(); const element = ; @@ -157,7 +157,7 @@ it(' - renders an input with correct value (model)', () => { spy.mockRestore(); }); -it(' - renders an input with correct value (specified)', () => { +test(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -165,7 +165,7 @@ it(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe(2); }); -it(' - renders an input which correctly reacts on change', () => { +test(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -181,7 +181,7 @@ it(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -it(' - renders an input which correctly reacts on change (decimal on decimal)', () => { +test(' - renders an input which correctly reacts on change (decimal on decimal)', () => { const onChange = jest.fn(); const element = ; @@ -197,7 +197,7 @@ it(' - renders an input which correctly reacts on change (decimal on d expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); -it(' - renders an input which correctly reacts on change (decimal on integer)', () => { +test(' - renders an input which correctly reacts on change (decimal on integer)', () => { const onChange = jest.fn(); const element = ; @@ -213,7 +213,7 @@ it(' - renders an input which correctly reacts on change (decimal on i expect(onChange).toHaveBeenLastCalledWith('x', 2); }); -it(' - renders an input which correctly reacts on change (empty)', () => { +test(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -229,7 +229,7 @@ it(' - renders an input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders an input which correctly reacts on change (same value)', () => { +test(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -245,7 +245,7 @@ it(' - renders an input which correctly reacts on change (same value)' expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -it(' - renders an input which correctly reacts on change (zero)', () => { +test(' - renders an input which correctly reacts on change (zero)', () => { const onChange = jest.fn(); const element = ; @@ -261,7 +261,7 @@ it(' - renders an input which correctly reacts on change (zero)', () = expect(onChange).toHaveBeenLastCalledWith('x', 0); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -272,7 +272,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); diff --git a/packages/uniforms-bootstrap3/__tests__/QuickForm.tsx b/packages/uniforms-bootstrap3/__tests__/QuickForm.tsx index 2dcd57204..13417500e 100644 --- a/packages/uniforms-bootstrap3/__tests__/QuickForm.tsx +++ b/packages/uniforms-bootstrap3/__tests__/QuickForm.tsx @@ -4,7 +4,7 @@ import { QuickForm } from 'uniforms-bootstrap3'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - renders', () => { +test(' - renders', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap3/__tests__/RadioField.tsx b/packages/uniforms-bootstrap3/__tests__/RadioField.tsx index 6f4b55c5c..891ffcead 100644 --- a/packages/uniforms-bootstrap3/__tests__/RadioField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/RadioField.tsx @@ -4,7 +4,7 @@ import { RadioField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a set of checkboxes', () => { +test(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -it(' - renders a set of inline checkboxes', () => { +test(' - renders a set of inline checkboxes', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - renders a set of inline checkboxes', () => { expect(wrapper.find('.radio-inline')).toHaveLength(2); }); -it(' - renders a set of checkboxes with correct disabled state', () => { +test(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ it(' - renders a set of checkboxes with correct disabled state', () expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -it(' - renders a set of checkboxes with correct readOnly state', () => { +test(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -54,7 +54,7 @@ it(' - renders a set of checkboxes with correct readOnly state', () expect(onChange).not.toBeCalled(); }); -it(' - renders a set of checkboxes with correct id (inherited)', () => { +test(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -66,7 +66,7 @@ it(' - renders a set of checkboxes with correct id (inherited)', () expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -it(' - renders a set of checkboxes with correct id (specified)', () => { +test(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -78,7 +78,7 @@ it(' - renders a set of checkboxes with correct id (specified)', () expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -it(' - renders a set of checkboxes with correct name', () => { +test(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -90,7 +90,7 @@ it(' - renders a set of checkboxes with correct name', () => { expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -it(' - renders a set of checkboxes with correct options', () => { +test(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -102,7 +102,7 @@ it(' - renders a set of checkboxes with correct options', () => { expect(wrapper.find('label').at(1).text()).toBe('b'); }); -it(' - renders a set of checkboxes with correct options (transform)', () => { +test(' - renders a set of checkboxes with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -114,7 +114,7 @@ it(' - renders a set of checkboxes with correct options (transform)' expect(wrapper.find('label').at(1).text()).toBe('B'); }); -it(' - renders a set of checkboxes with correct value (default)', () => { +test(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -126,7 +126,7 @@ it(' - renders a set of checkboxes with correct value (default)', () expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -it(' - renders a set of checkboxes with correct value (model)', () => { +test(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -141,7 +141,7 @@ it(' - renders a set of checkboxes with correct value (model)', () = expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes with correct value (specified)', () => { +test(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -153,7 +153,7 @@ it(' - renders a set of checkboxes with correct value (specified)', expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes which correctly reacts on change', () => { +test(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -170,7 +170,7 @@ it(' - renders a set of checkboxes which correctly reacts on change' expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -187,7 +187,7 @@ it(' - renders a set of checkboxes which correctly reacts on change expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -198,7 +198,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -210,7 +210,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), diff --git a/packages/uniforms-bootstrap3/__tests__/SelectField.tsx b/packages/uniforms-bootstrap3/__tests__/SelectField.tsx index 35dc35f4b..73ffe5620 100644 --- a/packages/uniforms-bootstrap3/__tests__/SelectField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/SelectField.tsx @@ -4,7 +4,7 @@ import { SelectField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a select', () => { +test(' - renders a select', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - renders a select', () => { expect(wrapper.find('select')).toHaveLength(1); }); -it(' - renders a select with correct disabled state', () => { +test(' - renders a select with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - renders a select with correct disabled state', () => { expect(wrapper.find('select').prop('disabled')).toBe(true); }); -it(' - renders a select with correct readOnly state', () => { +test(' - renders a select with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -44,7 +44,7 @@ it(' - renders a select with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a select with correct id (inherited)', () => { +test(' - renders a select with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ it(' - renders a select with correct id (inherited)', () => { expect(wrapper.find('select').prop('id')).toBeTruthy(); }); -it(' - renders a select with correct id (specified)', () => { +test(' - renders a select with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -66,7 +66,7 @@ it(' - renders a select with correct id (specified)', () => { expect(wrapper.find('select').prop('id')).toBe('y'); }); -it(' - renders a select with correct name', () => { +test(' - renders a select with correct name', () => { const element = ; const wrapper = mount( element, @@ -77,7 +77,7 @@ it(' - renders a select with correct name', () => { expect(wrapper.find('select').prop('name')).toBe('x'); }); -it(' - renders a select with correct options', () => { +test(' - renders a select with correct options', () => { const element = ; const wrapper = mount( element, @@ -97,7 +97,7 @@ it(' - renders a select with correct options', () => { }); }); -it(' - renders a select with correct options (transform)', () => { +test(' - renders a select with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -117,7 +117,7 @@ it(' - renders a select with correct options (transform)', () => { }); }); -it(' - renders a select with correct placeholder (fallback)', () => { +test(' - renders a select with correct placeholder (fallback)', () => { const element = ; const wrapper = mount( element, @@ -139,7 +139,7 @@ it(' - renders a select with correct placeholder (fallback)', () => }); }); -it(' - renders a select with correct placeholder (implicit)', () => { +test(' - renders a select with correct placeholder (implicit)', () => { const element = ; const wrapper = mount( element, @@ -159,7 +159,7 @@ it(' - renders a select with correct placeholder (implicit)', () => }); }); -it(' - renders a select with correct value (default)', () => { +test(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -170,7 +170,7 @@ it(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toBe(''); }); -it(' - renders a select with correct value (model)', () => { +test(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -184,7 +184,7 @@ it(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -it(' - renders a select with correct value (specified)', () => { +test(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -195,7 +195,7 @@ it(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -it(' - renders a select which correctly reacts on change', () => { +test(' - renders a select which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -214,7 +214,7 @@ it(' - renders a select which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a select which correctly reacts on change (empty)', () => { +test(' - renders a select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -233,7 +233,7 @@ it(' - renders a select which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a select which correctly reacts on change (same value)', () => { +test(' - renders a select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -252,7 +252,7 @@ it(' - renders a select which correctly reacts on change (same valu expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -266,7 +266,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -278,14 +278,14 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -it(' - disabled items (options) based on predicate', () => { +test(' - disabled items (options) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( @@ -301,7 +301,7 @@ it(' - disabled items (options) based on predicate', () => { expect(wrapper.find('option[value="b"]').at(0).prop('disabled')).toBe(false); }); -it(' - renders a set of checkboxes', () => { +test(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -311,7 +311,7 @@ it(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -it(' - renders a set of inline checkboxes', () => { +test(' - renders a set of inline checkboxes', () => { const element = ; const wrapper = mount( element, @@ -322,7 +322,7 @@ it(' - renders a set of inline checkboxes', () => { expect(wrapper.find('.checkbox-inline')).toHaveLength(2); }); -it(' - renders a set of checkboxes with correct disabled state', () => { +test(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -334,7 +334,7 @@ it(' - renders a set of checkboxes with correct disabled expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -it(' - renders a set of checkboxes with correct readOnly state', () => { +test(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -351,7 +351,7 @@ it(' - renders a set of checkboxes with correct readOnly expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a set of checkboxes with correct id (inherited)', () => { +test(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -363,7 +363,7 @@ it(' - renders a set of checkboxes with correct id (inhe expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -it(' - renders a select with correct value (default)', () => { +test(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -377,7 +377,7 @@ it(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual([]); }); -it(' - renders a select with correct value (model)', () => { +test(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -394,7 +394,7 @@ it(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -it(' - renders a select with correct value (specified)', () => { +test(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -408,7 +408,7 @@ it(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -it(' - renders a select which correctly reacts on change (first value)', () => { +test(' - renders a select which correctly reacts on change (first value)', () => { const onChange = jest.fn(); const element = ; @@ -430,7 +430,7 @@ it(' - renders a select which correctly reacts on change (first val expect(onChange).toHaveBeenLastCalledWith('x', ['a']); }); -it(' - renders a select which correctly reacts on change (next value)', () => { +test(' - renders a select which correctly reacts on change (next value)', () => { const onChange = jest.fn(); const element = ; @@ -452,7 +452,7 @@ it(' - renders a select which correctly reacts on change (next valu expect(onChange).toHaveBeenLastCalledWith('x', ['a', 'b']); }); -it(' - renders a select which correctly reacts on change (uncheck) by value', () => { +test(' - renders a select which correctly reacts on change (uncheck) by value', () => { const onChange = jest.fn(); const element = ; @@ -474,7 +474,7 @@ it(' - renders a select which correctly reacts on change (uncheck) expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { +test(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { const onChange = jest.fn(); const element = ; @@ -498,7 +498,7 @@ it(' - renders a select which correctly reacts on change (uncheck) expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a set of checkboxes with correct id (specified)', () => { +test(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -510,7 +510,7 @@ it(' - renders a set of checkboxes with correct id (spec expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -it(' - renders a set of checkboxes with correct name', () => { +test(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -522,7 +522,7 @@ it(' - renders a set of checkboxes with correct name', ( expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -it(' - renders a set of checkboxes with correct options', () => { +test(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -534,7 +534,7 @@ it(' - renders a set of checkboxes with correct options' expect(wrapper.find('label').at(1).text()).toBe('b'); }); -it(' - renders a set of checkboxes with correct options (transform)', () => { +test(' - renders a set of checkboxes with correct options (transform)', () => { const element = ( x.toUpperCase()} /> ); @@ -548,7 +548,7 @@ it(' - renders a set of checkboxes with correct options expect(wrapper.find('label').at(1).text()).toBe('B'); }); -it(' - renders a set of checkboxes with correct value (default)', () => { +test(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -560,7 +560,7 @@ it(' - renders a set of checkboxes with correct value (d expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -it(' - renders a set of checkboxes with correct value (model)', () => { +test(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -575,7 +575,7 @@ it(' - renders a set of checkboxes with correct value (m expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes with correct value (specified)', () => { +test(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -587,7 +587,7 @@ it(' - renders a set of checkboxes with correct value (s expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes which correctly reacts on change', () => { +test(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -604,7 +604,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { const onChange = jest.fn(); const element = ; @@ -624,7 +624,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -it(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); const element = ; @@ -644,7 +644,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -661,7 +661,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -672,7 +672,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ( ); @@ -686,14 +686,14 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -it(' - disabled items (checkboxes) based on predicate', () => { +test(' - disabled items (checkboxes) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( diff --git a/packages/uniforms-bootstrap3/__tests__/SubmitField.tsx b/packages/uniforms-bootstrap3/__tests__/SubmitField.tsx index 031566f68..ba7300491 100644 --- a/packages/uniforms-bootstrap3/__tests__/SubmitField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/SubmitField.tsx @@ -4,14 +4,14 @@ import { SubmitField } from 'uniforms-bootstrap3'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders', () => { +test(' - renders', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper).toHaveLength(1); }); -it(' - renders disabled if error', () => { +test(' - renders disabled if error', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -19,7 +19,7 @@ it(' - renders disabled if error', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders enabled if error and enabled', () => { +test(' - renders enabled if error and enabled', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -27,7 +27,7 @@ it(' - renders enabled if error and enabled', () => { expect(wrapper.find('input').prop('disabled')).toBe(false); }); -it(' - renders a wrapper with correct class', () => { +test(' - renders a wrapper with correct class', () => { const element = ; const wrapper = mount(element, createContext()); @@ -35,7 +35,7 @@ it(' - renders a wrapper with correct class', () => { expect(wrapper.find('.container')).toHaveLength(1); }); -it(' - renders a wrapper with correct value', () => { +test(' - renders a wrapper with correct value', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-bootstrap3/__tests__/TextField.tsx b/packages/uniforms-bootstrap3/__tests__/TextField.tsx index a49cdfefd..1e097f0ba 100644 --- a/packages/uniforms-bootstrap3/__tests__/TextField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/TextField.tsx @@ -9,7 +9,7 @@ import mount from './_mount'; describe('@RTL - TextField tests', () => { testTextField(TextField); - it(' - renders a wrapper with unknown props', () => { + test(' - renders a wrapper with unknown props', () => { const props = { 'data-x': 'x', 'data-y': 'y', @@ -24,14 +24,14 @@ describe('@RTL - TextField tests', () => { }); }); -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -39,7 +39,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -47,7 +47,7 @@ it(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -55,7 +55,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -63,7 +63,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -71,7 +71,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct placeholder', () => { +test(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -79,7 +79,7 @@ it(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -87,7 +87,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('text'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -95,7 +95,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -106,7 +106,7 @@ it(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input with correct value (specified)', () => { +test(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -114,7 +114,7 @@ it(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input which correctly reacts on change', () => { +test(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -130,7 +130,7 @@ it(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders an input which correctly reacts on change (empty)', () => { +test(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -146,7 +146,7 @@ it(' - renders an input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders an input which correctly reacts on change (same value)', () => { +test(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -162,7 +162,7 @@ it(' - renders an input which correctly reacts on change (same value) expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -173,7 +173,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -182,7 +182,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - renders a input with autocomplete turned off', () => { +test(' - renders a input with autocomplete turned off', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-bootstrap3/__tests__/ValidateQuickForm.tsx b/packages/uniforms-bootstrap3/__tests__/ValidateQuickForm.tsx index 88146511d..c51f578c9 100644 --- a/packages/uniforms-bootstrap3/__tests__/ValidateQuickForm.tsx +++ b/packages/uniforms-bootstrap3/__tests__/ValidateQuickForm.tsx @@ -4,7 +4,7 @@ import { ValidatedQuickForm } from 'uniforms-bootstrap3'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap3/__tests__/ValidatedForm.tsx b/packages/uniforms-bootstrap3/__tests__/ValidatedForm.tsx index 652f1c84c..94a79ddef 100644 --- a/packages/uniforms-bootstrap3/__tests__/ValidatedForm.tsx +++ b/packages/uniforms-bootstrap3/__tests__/ValidatedForm.tsx @@ -4,7 +4,7 @@ import { ValidatedForm } from 'uniforms-bootstrap3'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap3/__tests__/gridClassName.ts b/packages/uniforms-bootstrap3/__tests__/gridClassName.ts index dab1c3937..1af0c5192 100644 --- a/packages/uniforms-bootstrap3/__tests__/gridClassName.ts +++ b/packages/uniforms-bootstrap3/__tests__/gridClassName.ts @@ -1,6 +1,6 @@ import { gridClassName } from 'uniforms-bootstrap3'; -it('gridClassName - object', () => { +test('gridClassName - object', () => { expect(gridClassName({ md: 3 }, 'input')).toBe('col-md-9'); expect(gridClassName({ md: 5 }, 'input')).toBe('col-md-7'); expect(gridClassName({ md: 7 }, 'input')).toBe('col-md-5'); @@ -20,21 +20,21 @@ it('gridClassName - object', () => { expect(gridClassName({ md: 9, xs: 8 }, 'label')).toBe('col-md-9 col-xs-8'); }); -it('gridClassName - number', () => { +test('gridClassName - number', () => { expect(gridClassName(3, 'input')).toBe('col-sm-9'); expect(gridClassName(3, 'label')).toBe('col-sm-3'); expect(gridClassName(5, 'input')).toBe('col-sm-7'); expect(gridClassName(5, 'label')).toBe('col-sm-5'); }); -it('gridClassName - number (string)', () => { +test('gridClassName - number (string)', () => { expect(gridClassName('3', 'input')).toBe('col-sm-9'); expect(gridClassName('3', 'label')).toBe('col-sm-3'); expect(gridClassName('5', 'input')).toBe('col-sm-7'); expect(gridClassName('5', 'label')).toBe('col-sm-5'); }); -it('gridClassName - string', () => { +test('gridClassName - string', () => { expect(gridClassName('col-md-9')).toBe('col-md-9'); expect(gridClassName('col-md-3')).toBe('col-md-3'); expect(gridClassName('col-md-7')).toBe('col-md-7'); diff --git a/packages/uniforms-bootstrap3/__tests__/index.ts b/packages/uniforms-bootstrap3/__tests__/index.ts index d9254222a..1ee7bde25 100644 --- a/packages/uniforms-bootstrap3/__tests__/index.ts +++ b/packages/uniforms-bootstrap3/__tests__/index.ts @@ -1,6 +1,6 @@ import * as bootstrap3 from 'uniforms-bootstrap3'; -it('exports everything', () => { +test('exports everything', () => { expect(bootstrap3).toEqual({ AutoFields: expect.any(Function), AutoField: expect.any(Function), diff --git a/packages/uniforms-bootstrap3/__tests__/wrapField.tsx b/packages/uniforms-bootstrap3/__tests__/wrapField.tsx index cbf51a578..9089eec21 100644 --- a/packages/uniforms-bootstrap3/__tests__/wrapField.tsx +++ b/packages/uniforms-bootstrap3/__tests__/wrapField.tsx @@ -3,21 +3,21 @@ import { wrapField } from 'uniforms-bootstrap3'; import mount from './_mount'; -it(' - renders wrapper with correct class', () => { +test(' - renders wrapper with correct class', () => { const element = wrapField({ wrapClassName: 'container' },
); const wrapper = mount(element); expect(wrapper.find('.container')).toHaveLength(1); }); -it(' - renders help block', () => { +test(' - renders help block', () => { const element = wrapField({ help: 'Hint' },
); const wrapper = mount(element); expect(wrapper.find('.help-block').text()).toBe('Hint'); }); -it(' - renders help block with specified class', () => { +test(' - renders help block with specified class', () => { const element = wrapField( { help: 'Hint', helpClassName: 'text-hint' },
, @@ -27,7 +27,7 @@ it(' - renders help block with specified class', () => { expect(wrapper.find('.help-block.text-hint')).toHaveLength(1); }); -it(' - renders error block', () => { +test(' - renders error block', () => { const error = new Error(); const element = wrapField( { error, showInlineError: true, errorMessage: 'Error' }, @@ -38,7 +38,7 @@ it(' - renders error block', () => { expect(wrapper.find('.help-block').text()).toBe('Error'); }); -it(' - renders error block (feedbackable)', () => { +test(' - renders error block (feedbackable)', () => { const error = new Error(); const element = wrapField({ error, feedbackable: true },
); const wrapper = mount(element); @@ -46,7 +46,7 @@ it(' - renders error block (feedbackable)', () => { expect(wrapper.find('.form-control-feedback')).toHaveLength(1); }); -it(' - renders error block (showInlineError=false)', () => { +test(' - renders error block (showInlineError=false)', () => { const error = new Error(); const element = wrapField( { error, showInlineError: false, errorMessage: 'Error' }, @@ -57,7 +57,7 @@ it(' - renders error block (showInlineError=false)', () => { expect(wrapper.find('.help-block')).toHaveLength(0); }); -it(' - label has custom class (String)', () => { +test(' - label has custom class (String)', () => { const element = wrapField( { label: 'A field label', @@ -70,7 +70,7 @@ it(' - label has custom class (String)', () => { expect(wrapper.find('label.custom-label-class')).toHaveLength(1); }); -it(' - label has custom class (Array[String])', () => { +test(' - label has custom class (Array[String])', () => { const element = wrapField( { label: 'A field label', diff --git a/packages/uniforms-bootstrap4/__tests__/AutoField.tsx b/packages/uniforms-bootstrap4/__tests__/AutoField.tsx index a70adc958..dd8ba92f3 100644 --- a/packages/uniforms-bootstrap4/__tests__/AutoField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/AutoField.tsx @@ -14,14 +14,14 @@ import { import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(AutoField)).toHaveLength(1); }); -it(' - detects RadioField', () => { +test(' - detects RadioField', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ it(' - detects RadioField', () => { expect(wrapper.find(RadioField.Component)).toHaveLength(1); }); -it(' - detects SelectField', () => { +test(' - detects SelectField', () => { const element = ; const wrapper = mount( element, @@ -50,14 +50,14 @@ it(' - detects SelectField', () => { expect(wrapper.find(SelectField.Component)).toHaveLength(1); }); -it(' - detects DateField', () => { +test(' - detects DateField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DateField.Component)).toHaveLength(1); }); -it(' - detects ListField', () => { +test(' - detects ListField', () => { const element = ; const wrapper = mount( element, @@ -67,35 +67,35 @@ it(' - detects ListField', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -it(' - detects NumField', () => { +test(' - detects NumField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(NumField.Component)).toHaveLength(1); }); -it(' - detects NestField', () => { +test(' - detects NestField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Object } })); expect(wrapper.find(NestField)).toHaveLength(1); }); -it(' - detects TextField', () => { +test(' - detects TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField.Component)).toHaveLength(1); }); -it(' - detects BoolField', () => { +test(' - detects BoolField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(BoolField.Component)).toHaveLength(1); }); -it(' - uses Component (schema)', () => { +test(' - uses Component (schema)', () => { const Component = jest.fn(() => null); const element = ; @@ -107,7 +107,7 @@ it(' - uses Component (schema)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -it(' - uses Component (props)', () => { +test(' - uses Component (props)', () => { const Component = jest.fn(() => null); const element = ; @@ -116,7 +116,7 @@ it(' - uses Component (props)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -it(' - uses Component (context)', () => { +test(' - uses Component (context)', () => { const FieldA = jest.fn(() => null); const FieldB = jest.fn(() => null); @@ -136,7 +136,7 @@ it(' - uses Component (context)', () => { expect(FieldB).toHaveBeenCalledTimes(1); }); -it(' - uses Component (invalid)', () => { +test(' - uses Component (invalid)', () => { const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {}); expect(() => { const element = ; diff --git a/packages/uniforms-bootstrap4/__tests__/AutoFields.tsx b/packages/uniforms-bootstrap4/__tests__/AutoFields.tsx index a1d601c5a..a9b06ef63 100644 --- a/packages/uniforms-bootstrap4/__tests__/AutoFields.tsx +++ b/packages/uniforms-bootstrap4/__tests__/AutoFields.tsx @@ -4,14 +4,14 @@ import { AutoFields, AutoField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('AutoFields')).toHaveLength(1); }); -it(' - render all fields by default', () => { +test(' - render all fields by default', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - render all fields by default', () => { expect(wrapper.find('input')).toHaveLength(3); }); -it(' - renders only specified fields', () => { +test(' - renders only specified fields', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ it(' - renders only specified fields', () => { ); }); -it(' - does not render ommited fields', () => { +test(' - does not render ommited fields', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ it(' - does not render ommited fields', () => { ); }); -it(' - wraps fields in specified element', () => { +test(' - wraps fields in specified element', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ it(' - wraps fields in specified element', () => { expect(wrapper.find('section').find('input')).toHaveLength(3); }); -it(' - pass props to the child AutoField', () => { +test(' - pass props to the child AutoField', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap4/__tests__/AutoForm.tsx b/packages/uniforms-bootstrap4/__tests__/AutoForm.tsx index dcdba5235..d6e6f8605 100644 --- a/packages/uniforms-bootstrap4/__tests__/AutoForm.tsx +++ b/packages/uniforms-bootstrap4/__tests__/AutoForm.tsx @@ -4,7 +4,7 @@ import { AutoForm } from 'uniforms-bootstrap4'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap4/__tests__/BaseForm.tsx b/packages/uniforms-bootstrap4/__tests__/BaseForm.tsx index 7d9e01996..ac215765b 100644 --- a/packages/uniforms-bootstrap4/__tests__/BaseForm.tsx +++ b/packages/uniforms-bootstrap4/__tests__/BaseForm.tsx @@ -4,7 +4,7 @@ import { BaseForm } from 'uniforms-bootstrap4'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap4/__tests__/BoolField.tsx b/packages/uniforms-bootstrap4/__tests__/BoolField.tsx index e5fa513bf..6e2bd031b 100644 --- a/packages/uniforms-bootstrap4/__tests__/BoolField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/BoolField.tsx @@ -4,14 +4,14 @@ import { BoolField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an inline input', () => { +test(' - renders an inline input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -20,7 +20,7 @@ it(' - renders an inline input', () => { expect(wrapper.find('.custom-control-inline')).toHaveLength(1); }); -it(' - renders a input with correct id (inherited)', () => { +test(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -28,7 +28,7 @@ it(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders a input with correct id (specified)', () => { +test(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -36,7 +36,7 @@ it(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders a input with correct name', () => { +test(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -44,7 +44,7 @@ it(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -52,7 +52,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('checkbox'); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -60,7 +60,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -74,7 +74,7 @@ it(' - renders an input with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a input with correct label (specified)', () => { +test(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -85,7 +85,7 @@ it(' - renders a input with correct label (specified)', () => { ); }); -it(' - renders a input with correct value (default)', () => { +test(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -93,7 +93,7 @@ it(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('checked')).toBe(false); }); -it(' - renders a input with correct value (model)', () => { +test(' - renders a input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -104,7 +104,7 @@ it(' - renders a input with correct value (model)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -it(' - renders a input with correct value (specified)', () => { +test(' - renders a input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -112,7 +112,7 @@ it(' - renders a input with correct value (specified)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -it(' - renders a input which correctly reacts on change', () => { +test(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -126,7 +126,7 @@ it(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', true); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); diff --git a/packages/uniforms-bootstrap4/__tests__/DateField.tsx b/packages/uniforms-bootstrap4/__tests__/DateField.tsx index 0898672fd..1678cc2fb 100644 --- a/packages/uniforms-bootstrap4/__tests__/DateField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/DateField.tsx @@ -8,7 +8,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - DateField tests', () => { - it(' - handles "date" type correctly', () => { + test(' - handles "date" type correctly', () => { const onChange = jest.fn(); const initialDate = new Date(Date.UTC(2020, 0, 1)); @@ -29,14 +29,14 @@ describe('@RTL - DateField tests', () => { }); }); -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders a input with correct id (inherited)', () => { +test(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -44,7 +44,7 @@ it(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders a input with correct id (specified)', () => { +test(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -52,7 +52,7 @@ it(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders a input with correct name', () => { +test(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -60,7 +60,7 @@ it(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -79,7 +79,7 @@ test.each(['datetime-local', 'date'] as const)( }, ); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -87,7 +87,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -95,7 +95,7 @@ it(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -it(' - renders a input with correct label (specified)', () => { +test(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -106,7 +106,7 @@ it(' - renders a input with correct label (specified)', () => { ); }); -it(' - renders a input with correct value (default)', () => { +test(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -114,7 +114,7 @@ it(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders a input with correct value (model)', () => { +test(' - renders a input with correct value (model)', () => { const now = new Date(); const element = ; const wrapper = mount( @@ -128,7 +128,7 @@ it(' - renders a input with correct value (model)', () => { ); }); -it(' - renders a input with correct value (specified)', () => { +test(' - renders a input with correct value (specified)', () => { const now = new Date(); const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -139,7 +139,7 @@ it(' - renders a input with correct value (specified)', () => { ); }); -it(' - renders a input which correctly reacts on change', () => { +test(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const now = new Date(); @@ -158,7 +158,7 @@ it(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', now); }); -it(' - renders a input which correctly reacts on change (empty)', () => { +test(' - renders a input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -176,7 +176,7 @@ it(' - renders a input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a input which correctly reacts on change (overflow)', () => { +test(' - renders a input which correctly reacts on change (overflow)', () => { const onChange = jest.fn(); const now = new Date(1e5, 0); @@ -195,7 +195,7 @@ it(' - renders a input which correctly reacts on change (overflow)', expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); diff --git a/packages/uniforms-bootstrap4/__tests__/ErrorField.tsx b/packages/uniforms-bootstrap4/__tests__/ErrorField.tsx index 56d052213..e0e525b59 100644 --- a/packages/uniforms-bootstrap4/__tests__/ErrorField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/ErrorField.tsx @@ -11,14 +11,14 @@ const error = { message: 'X is required [validation-error]', }; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorField)).toHaveLength(1); }); -it(' - renders correct error message (context)', () => { +test(' - renders correct error message (context)', () => { const element = ; const wrapper = mount( element, @@ -29,7 +29,7 @@ it(' - renders correct error message (context)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -it(' - renders correct error message (specified)', () => { +test(' - renders correct error message (specified)', () => { const element = ( - renders correct error message (specified)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -it(' - renders correct children if specified', () => { +test(' - renders correct children if specified', () => { const element = Error; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap4/__tests__/ErrorsField.tsx b/packages/uniforms-bootstrap4/__tests__/ErrorsField.tsx index c6d90a048..e30f69e7b 100644 --- a/packages/uniforms-bootstrap4/__tests__/ErrorsField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/ErrorsField.tsx @@ -15,14 +15,14 @@ const error = { message: 'X is required [validation-error]', }; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorsField)).toHaveLength(1); }); -it(' - renders list of correct error messages (context)', () => { +test(' - renders list of correct error messages (context)', () => { const element = ; const wrapper = mount( element, @@ -38,7 +38,7 @@ it(' - renders list of correct error messages (context)', () => { expect(wrapper.find('.card-body > div').at(2).text()).toBe('Z is required'); }); -it(' - renders children (specified)', () => { +test(' - renders children (specified)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap4/__tests__/HiddenField.tsx b/packages/uniforms-bootstrap4/__tests__/HiddenField.tsx index 2ca9e063e..29953c05f 100644 --- a/packages/uniforms-bootstrap4/__tests__/HiddenField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/HiddenField.tsx @@ -4,14 +4,14 @@ import { HiddenField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('hidden'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -62,7 +62,7 @@ it(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input which correctly reacts on model change', () => { +test(' - renders an input which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -76,7 +76,7 @@ it(' - renders an input which correctly reacts on model change', () expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders an input which correctly reacts on model change (empty)', () => { +test(' - renders an input which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -90,7 +90,7 @@ it(' - renders an input which correctly reacts on model change (emp expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders an input which correctly reacts on model change (same value)', () => { +test(' - renders an input which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -104,14 +104,14 @@ it(' - renders an input which correctly reacts on model change (sam expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders nothing', () => { +test(' - renders nothing', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.children()).toHaveLength(0); }); -it(' - renders nothing which correctly reacts on model change', () => { +test(' - renders nothing which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ it(' - renders nothing which correctly reacts on model change expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders nothing which correctly reacts on model change (empty)', () => { +test(' - renders nothing which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ it(' - renders nothing which correctly reacts on model change expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders nothing which correctly reacts on model change (same value)', () => { +test(' - renders nothing which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; diff --git a/packages/uniforms-bootstrap4/__tests__/ListAddField.tsx b/packages/uniforms-bootstrap4/__tests__/ListAddField.tsx index 3a5094a39..3ff8d18fb 100644 --- a/packages/uniforms-bootstrap4/__tests__/ListAddField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/ListAddField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListAddField)).toHaveLength(1); }); -it(' - prevents onClick when disabled', () => { +test(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ it(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when limit reached', () => { +test(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { maxCount: 0 } })); @@ -39,7 +39,7 @@ it(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - correctly reacts on click', () => { +test(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ it(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['y']); }); -it(' - correctly reacts on keyboard enter key', () => { +test(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-bootstrap4/__tests__/ListDelField.tsx b/packages/uniforms-bootstrap4/__tests__/ListDelField.tsx index 5824830b3..4623ec05e 100644 --- a/packages/uniforms-bootstrap4/__tests__/ListDelField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/ListDelField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListDelField)).toHaveLength(1); }); -it(' - prevents onClick when disabled', () => { +test(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ it(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when limit reached', () => { +test(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { minCount: 3 } })); @@ -39,7 +39,7 @@ it(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - correctly reacts on click', () => { +test(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ it(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['x', 'z']); }); -it(' - correctly reacts on keyboard enter key', () => { +test(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-bootstrap4/__tests__/ListField.tsx b/packages/uniforms-bootstrap4/__tests__/ListField.tsx index b62f86f5f..57333b06d 100644 --- a/packages/uniforms-bootstrap4/__tests__/ListField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/ListField.tsx @@ -12,7 +12,7 @@ describe('@RTL - ListField tests', () => { }); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount( element, @@ -22,7 +22,7 @@ it(' - works', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -it(' - renders ListAddField', () => { +test(' - renders ListAddField', () => { const element = ; const wrapper = mount( element, @@ -33,7 +33,7 @@ it(' - renders ListAddField', () => { expect(wrapper.find(ListAddField).prop('name')).toBe('$'); }); -it(' - renders correct label (specified)', () => { +test(' - renders correct label (specified)', () => { const element = ; const wrapper = mount( element, @@ -46,7 +46,7 @@ it(' - renders correct label (specified)', () => { ); }); -it(' - renders correct numer of items with model (specified)', () => { +test(' - renders correct numer of items with model (specified)', () => { const element = ; const wrapper = mount( element, @@ -58,7 +58,7 @@ it(' - renders correct numer of items with model (specified)', () => expect(wrapper.find('input')).toHaveLength(3); }); -it(' - passes itemProps to its children', () => { +test(' - passes itemProps to its children', () => { const element = ; const wrapper = mount( element, @@ -70,7 +70,7 @@ it(' - passes itemProps to its children', () => { expect(wrapper.find(ListItemField).first().prop('data-xyz')).toBe(1); }); -it(' - renders children (specified)', () => { +test(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -89,7 +89,7 @@ it(' - renders children (specified)', () => { expect(Child).toHaveBeenCalledTimes(2); }); -it(' - renders children with correct name (children)', () => { +test(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -108,7 +108,7 @@ it(' - renders children with correct name (children)', () => { expect(wrapper.find(Child).at(1).prop('name')).toBe('1'); }); -it(' - renders children with correct name (value)', () => { +test(' - renders children with correct name (value)', () => { const element = ; const wrapper = mount( element, @@ -121,7 +121,7 @@ it(' - renders children with correct name (value)', () => { expect(wrapper.find(ListItemField).at(1).prop('name')).toBe('1'); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( - renders correct error text (specified)', () => { expect(wrapper.find('.text-danger').text()).toBe('Error'); }); -it(' - renders correct error text (showInlineError=false)', () => { +test(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.find('.text-danger')).toHaveLength(0); }); -it(' - renders proper number of optional values after add new value', () => { +test(' - renders proper number of optional values after add new value', () => { const element = ; const onChange = jest.fn(); const wrapper = mount( diff --git a/packages/uniforms-bootstrap4/__tests__/ListItemField.tsx b/packages/uniforms-bootstrap4/__tests__/ListItemField.tsx index 69a1e70d4..3bc76866e 100644 --- a/packages/uniforms-bootstrap4/__tests__/ListItemField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/ListItemField.tsx @@ -4,7 +4,7 @@ import { AutoField, ListDelField, ListItemField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - works', () => { expect(wrapper.find(ListItemField)).toHaveLength(1); }); -it(' - renders ListDelField', () => { +test(' - renders ListDelField', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - renders ListDelField', () => { expect(wrapper.find(ListDelField).childAt(0).prop('name')).toBe('x.1'); }); -it(' - renders AutoField', () => { +test(' - renders AutoField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ it(' - renders AutoField', () => { expect(wrapper.find(AutoField)).toHaveLength(1); }); -it(' - renders children if specified', () => { +test(' - renders children if specified', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( diff --git a/packages/uniforms-bootstrap4/__tests__/LongTextField.tsx b/packages/uniforms-bootstrap4/__tests__/LongTextField.tsx index 58dc6a35b..14ddda3f3 100644 --- a/packages/uniforms-bootstrap4/__tests__/LongTextField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/LongTextField.tsx @@ -4,14 +4,14 @@ import { LongTextField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a textarea', () => { +test(' - renders a textarea', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('textarea')).toHaveLength(1); }); -it(' - renders a textarea with correct disabled state', () => { +test(' - renders a textarea with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ it(' - renders a textarea with correct disabled state', () => { expect(wrapper.find('textarea').prop('disabled')).toBe(true); }); -it(' - renders a textarea with correct readOnly state', () => { +test(' - renders a textarea with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ it(' - renders a textarea with correct readOnly state', () => { expect(wrapper.find('textarea').prop('readOnly')).toBe(true); }); -it(' - renders a textarea with correct id (inherited)', () => { +test(' - renders a textarea with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ it(' - renders a textarea with correct id (inherited)', () => { expect(wrapper.find('textarea').prop('id')).toBeTruthy(); }); -it(' - renders a textarea with correct id (specified)', () => { +test(' - renders a textarea with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ it(' - renders a textarea with correct id (specified)', () => { expect(wrapper.find('textarea').prop('id')).toBe('y'); }); -it(' - renders a textarea with correct name', () => { +test(' - renders a textarea with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ it(' - renders a textarea with correct name', () => { expect(wrapper.find('textarea').prop('name')).toBe('x'); }); -it(' - renders a textarea with correct placeholder', () => { +test(' - renders a textarea with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -59,7 +59,7 @@ it(' - renders a textarea with correct placeholder', () => { expect(wrapper.find('textarea').prop('placeholder')).toBe('y'); }); -it(' - renders a textarea with correct value (default)', () => { +test(' - renders a textarea with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -67,7 +67,7 @@ it(' - renders a textarea with correct value (default)', () => { expect(wrapper.find('textarea').prop('value')).toBe(''); }); -it(' - renders a textarea with correct value (model)', () => { +test(' - renders a textarea with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -78,7 +78,7 @@ it(' - renders a textarea with correct value (model)', () => { expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -it(' - renders a textarea with correct value (specified)', () => { +test(' - renders a textarea with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -86,7 +86,7 @@ it(' - renders a textarea with correct value (specified)', () => expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -it(' - renders a textarea which correctly reacts on change', () => { +test(' - renders a textarea which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -102,7 +102,7 @@ it(' - renders a textarea which correctly reacts on change', () = expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a textarea which correctly reacts on change (empty)', () => { +test(' - renders a textarea which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -118,7 +118,7 @@ it(' - renders a textarea which correctly reacts on change (empty expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders a textarea which correctly reacts on change (same value)', () => { +test(' - renders a textarea which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -134,7 +134,7 @@ it(' - renders a textarea which correctly reacts on change (same expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -145,7 +145,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-bootstrap4/__tests__/NestField.tsx b/packages/uniforms-bootstrap4/__tests__/NestField.tsx index acd562a22..c1606ba7c 100644 --- a/packages/uniforms-bootstrap4/__tests__/NestField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/NestField.tsx @@ -4,7 +4,7 @@ import { AutoField, NestField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an for each field', () => { +test(' - renders an for each field', () => { const element = ; const wrapper = mount( element, @@ -20,7 +20,7 @@ it(' - renders an for each field', () => { expect(wrapper.find(AutoField).at(1).prop('name')).toBe('b'); }); -it(' - renders custom content if given', () => { +test(' - renders custom content if given', () => { const element = (
@@ -40,7 +40,7 @@ it(' - renders custom content if given', () => { expect(wrapper.find('article').prop('data-test')).toBe('content'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -88,7 +88,7 @@ it(' - renders correct error text (specified)', () => { expect(wrapper.find('.text-danger').text()).toBe('Error'); }); -it(' - renders correct error text (showInlineError=false)', () => { +test(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -19,7 +19,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -27,7 +27,7 @@ it(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -35,7 +35,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -43,7 +43,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct max', () => { +test(' - renders an input with correct max', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct max', () => { expect(wrapper.find('input').prop('max')).toBe(10); }); -it(' - renders an input with correct min', () => { +test(' - renders an input with correct min', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -59,7 +59,7 @@ it(' - renders an input with correct min', () => { expect(wrapper.find('input').prop('min')).toBe(10); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -67,7 +67,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct placeholder', () => { +test(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -75,7 +75,7 @@ it(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -it(' - renders an input with correct step (decimal)', () => { +test(' - renders an input with correct step (decimal)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -83,7 +83,7 @@ it(' - renders an input with correct step (decimal)', () => { expect(wrapper.find('input').prop('step')).toBe(0.01); }); -it(' - renders an input with correct step (integer)', () => { +test(' - renders an input with correct step (integer)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -91,7 +91,7 @@ it(' - renders an input with correct step (integer)', () => { expect(wrapper.find('input').prop('step')).toBe(1); }); -it(' - renders an input with correct step (set)', () => { +test(' - renders an input with correct step (set)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -99,7 +99,7 @@ it(' - renders an input with correct step (set)', () => { expect(wrapper.find('input').prop('step')).toBe(3); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -107,7 +107,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('number'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -115,7 +115,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const onChange = jest.fn(); const element = ; @@ -157,7 +157,7 @@ it(' - renders an input with correct value (model)', () => { spy.mockRestore(); }); -it(' - renders an input with correct value (specified)', () => { +test(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -165,7 +165,7 @@ it(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe(2); }); -it(' - renders an input which correctly reacts on change', () => { +test(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -181,7 +181,7 @@ it(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -it(' - renders an input which correctly reacts on change (decimal on decimal)', () => { +test(' - renders an input which correctly reacts on change (decimal on decimal)', () => { const onChange = jest.fn(); const element = ; @@ -197,7 +197,7 @@ it(' - renders an input which correctly reacts on change (decimal on d expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); -it(' - renders an input which correctly reacts on change (decimal on integer)', () => { +test(' - renders an input which correctly reacts on change (decimal on integer)', () => { const onChange = jest.fn(); const element = ; @@ -213,7 +213,7 @@ it(' - renders an input which correctly reacts on change (decimal on i expect(onChange).toHaveBeenLastCalledWith('x', 2); }); -it(' - renders an input which correctly reacts on change (empty)', () => { +test(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -229,7 +229,7 @@ it(' - renders an input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders an input which correctly reacts on change (same value)', () => { +test(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -245,7 +245,7 @@ it(' - renders an input which correctly reacts on change (same value)' expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -it(' - renders an input which correctly reacts on change (zero)', () => { +test(' - renders an input which correctly reacts on change (zero)', () => { const onChange = jest.fn(); const element = ; @@ -261,7 +261,7 @@ it(' - renders an input which correctly reacts on change (zero)', () = expect(onChange).toHaveBeenLastCalledWith('x', 0); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -272,7 +272,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); diff --git a/packages/uniforms-bootstrap4/__tests__/QuickForm.tsx b/packages/uniforms-bootstrap4/__tests__/QuickForm.tsx index 5890fb6a8..2255dce6d 100644 --- a/packages/uniforms-bootstrap4/__tests__/QuickForm.tsx +++ b/packages/uniforms-bootstrap4/__tests__/QuickForm.tsx @@ -4,7 +4,7 @@ import { QuickForm } from 'uniforms-bootstrap4'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - renders', () => { +test(' - renders', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap4/__tests__/RadioField.tsx b/packages/uniforms-bootstrap4/__tests__/RadioField.tsx index 0a2916a11..cd77ce09c 100644 --- a/packages/uniforms-bootstrap4/__tests__/RadioField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/RadioField.tsx @@ -4,7 +4,7 @@ import { RadioField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a set of checkboxes', () => { +test(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -it(' - renders a set of inline checkboxes', () => { +test(' - renders a set of inline checkboxes', () => { const element = ; const wrapper = mount( element, @@ -26,7 +26,7 @@ it(' - renders a set of inline checkboxes', () => { expect(wrapper.find('.custom-control-inline')).toHaveLength(2); }); -it(' - renders a set of checkboxes with correct disabled state', () => { +test(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -38,7 +38,7 @@ it(' - renders a set of checkboxes with correct disabled state', () expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -it(' - renders a set of checkboxes with correct readOnly state', () => { +test(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -55,7 +55,7 @@ it(' - renders a set of checkboxes with correct readOnly state', () expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a set of checkboxes with correct id (inherited)', () => { +test(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -67,7 +67,7 @@ it(' - renders a set of checkboxes with correct id (inherited)', () expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -it(' - renders a set of checkboxes with correct id (specified)', () => { +test(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -79,7 +79,7 @@ it(' - renders a set of checkboxes with correct id (specified)', () expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -it(' - renders a set of checkboxes with correct name', () => { +test(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -91,7 +91,7 @@ it(' - renders a set of checkboxes with correct name', () => { expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -it(' - renders a set of checkboxes with correct options', () => { +test(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -103,7 +103,7 @@ it(' - renders a set of checkboxes with correct options', () => { expect(wrapper.find('label').at(1).text()).toBe(' b'); }); -it(' - renders a set of checkboxes with correct options (transform)', () => { +test(' - renders a set of checkboxes with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -115,7 +115,7 @@ it(' - renders a set of checkboxes with correct options (transform)' expect(wrapper.find('label').at(1).text()).toBe(' B'); }); -it(' - renders a set of checkboxes with correct value (default)', () => { +test(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -127,7 +127,7 @@ it(' - renders a set of checkboxes with correct value (default)', () expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -it(' - renders a set of checkboxes with correct value (model)', () => { +test(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -142,7 +142,7 @@ it(' - renders a set of checkboxes with correct value (model)', () = expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes with correct value (specified)', () => { +test(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -154,7 +154,7 @@ it(' - renders a set of checkboxes with correct value (specified)', expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes which correctly reacts on change', () => { +test(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -171,7 +171,7 @@ it(' - renders a set of checkboxes which correctly reacts on change' expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -188,7 +188,7 @@ it(' - renders a set of checkboxes which correctly reacts on change expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -199,7 +199,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -211,7 +211,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), diff --git a/packages/uniforms-bootstrap4/__tests__/SelectField.tsx b/packages/uniforms-bootstrap4/__tests__/SelectField.tsx index de94cfcd2..a6f577752 100644 --- a/packages/uniforms-bootstrap4/__tests__/SelectField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/SelectField.tsx @@ -4,7 +4,7 @@ import { SelectField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a select', () => { +test(' - renders a select', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - renders a select', () => { expect(wrapper.find('select')).toHaveLength(1); }); -it(' - renders a select with correct disabled state', () => { +test(' - renders a select with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - renders a select with correct disabled state', () => { expect(wrapper.find('select').prop('disabled')).toBe(true); }); -it(' - renders a select with correct readOnly state', () => { +test(' - renders a select with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -44,7 +44,7 @@ it(' - renders a select with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a select with correct id (inherited)', () => { +test(' - renders a select with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ it(' - renders a select with correct id (inherited)', () => { expect(wrapper.find('select').prop('id')).toBeTruthy(); }); -it(' - renders a select with correct id (specified)', () => { +test(' - renders a select with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -66,7 +66,7 @@ it(' - renders a select with correct id (specified)', () => { expect(wrapper.find('select').prop('id')).toBe('y'); }); -it(' - renders a select with correct name', () => { +test(' - renders a select with correct name', () => { const element = ; const wrapper = mount( element, @@ -77,7 +77,7 @@ it(' - renders a select with correct name', () => { expect(wrapper.find('select').prop('name')).toBe('x'); }); -it(' - renders a select with correct options', () => { +test(' - renders a select with correct options', () => { const element = ; const wrapper = mount( element, @@ -97,7 +97,7 @@ it(' - renders a select with correct options', () => { }); }); -it(' - renders a select with correct options (transform)', () => { +test(' - renders a select with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -117,7 +117,7 @@ it(' - renders a select with correct options (transform)', () => { }); }); -it(' - renders a select with correct placeholder (fallback)', () => { +test(' - renders a select with correct placeholder (fallback)', () => { const element = ; const wrapper = mount( element, @@ -139,7 +139,7 @@ it(' - renders a select with correct placeholder (fallback)', () => }); }); -it(' - renders a select with correct placeholder (implicit)', () => { +test(' - renders a select with correct placeholder (implicit)', () => { const element = ; const wrapper = mount( element, @@ -159,7 +159,7 @@ it(' - renders a select with correct placeholder (implicit)', () => }); }); -it(' - renders a select with correct value (default)', () => { +test(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -170,7 +170,7 @@ it(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toBe(''); }); -it(' - renders a select with correct value (model)', () => { +test(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -184,7 +184,7 @@ it(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -it(' - renders a select with correct value (specified)', () => { +test(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -195,7 +195,7 @@ it(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -it(' - renders a select which correctly reacts on change', () => { +test(' - renders a select which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -214,7 +214,7 @@ it(' - renders a select which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a select which correctly reacts on change (empty)', () => { +test(' - renders a select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -233,7 +233,7 @@ it(' - renders a select which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a select which correctly reacts on change (same value)', () => { +test(' - renders a select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -252,7 +252,7 @@ it(' - renders a select which correctly reacts on change (same valu expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -266,7 +266,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a select with class "bg-red" beside "form-group"', () => { +test(' - renders a select with class "bg-red" beside "form-group"', () => { const element = ; const wrapper = mount( element, @@ -275,7 +275,7 @@ it(' - renders a select with class "bg-red" beside "form-group"', ( expect(wrapper.find('.bg-red.form-group')).toHaveLength(1); }); -it(' - renders a disabled select', () => { +test(' - renders a disabled select', () => { const element = ; const wrapper = mount( element, @@ -284,7 +284,7 @@ it(' - renders a disabled select', () => { expect(wrapper.find('select').prop('disabled')).toEqual(true); }); -it(' - renders a required select', () => { +test(' - renders a required select', () => { const element = ; const wrapper = mount( element, @@ -293,7 +293,7 @@ it(' - renders a required select', () => { expect(wrapper.find('.form-group.required')).toHaveLength(1); }); -it(' - renders am error massge in select', () => { +test(' - renders am error massge in select', () => { const element = ( - renders am error massge in select', () => { expect(wrapper.find('.form-text.text-danger')).toHaveLength(1); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -321,14 +321,14 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -it(' - disabled items (options) based on predicate', () => { +test(' - disabled items (options) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( @@ -344,7 +344,7 @@ it(' - disabled items (options) based on predicate', () => { expect(wrapper.find('option[value="b"]').at(0).prop('disabled')).toBe(false); }); -it(' - renders a select with correct value (default)', () => { +test(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -358,7 +358,7 @@ it(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual([]); }); -it(' - renders a select with correct value (model)', () => { +test(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -375,7 +375,7 @@ it(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -it(' - renders a select with correct value (specified)', () => { +test(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -389,7 +389,7 @@ it(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -it(' - renders a select which correctly reacts on change (first value)', () => { +test(' - renders a select which correctly reacts on change (first value)', () => { const onChange = jest.fn(); const element = ; @@ -411,7 +411,7 @@ it(' - renders a select which correctly reacts on change (first val expect(onChange).toHaveBeenLastCalledWith('x', ['a']); }); -it(' - renders a select which correctly reacts on change (next value)', () => { +test(' - renders a select which correctly reacts on change (next value)', () => { const onChange = jest.fn(); const element = ; @@ -433,7 +433,7 @@ it(' - renders a select which correctly reacts on change (next valu expect(onChange).toHaveBeenLastCalledWith('x', ['a', 'b']); }); -it(' - renders a select which correctly reacts on change (uncheck) by value', () => { +test(' - renders a select which correctly reacts on change (uncheck) by value', () => { const onChange = jest.fn(); const element = ; @@ -455,7 +455,7 @@ it(' - renders a select which correctly reacts on change (uncheck) expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { +test(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { const onChange = jest.fn(); const element = ; @@ -479,7 +479,7 @@ it(' - renders a select which correctly reacts on change (uncheck) expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a set of checkboxes', () => { +test(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -489,7 +489,7 @@ it(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -it(' - renders a set of inline checkboxes', () => { +test(' - renders a set of inline checkboxes', () => { const element = ; const wrapper = mount( element, @@ -500,7 +500,7 @@ it(' - renders a set of inline checkboxes', () => { expect(wrapper.find('.checkbox-inline')).toHaveLength(2); }); -it(' - renders a set of checkboxes with correct disabled state', () => { +test(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -512,7 +512,7 @@ it(' - renders a set of checkboxes with correct disabled expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -it(' - renders a set of checkboxes with correct readOnly state', () => { +test(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -529,7 +529,7 @@ it(' - renders a set of checkboxes with correct readOnly expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a set of checkboxes with correct id (inherited)', () => { +test(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -541,7 +541,7 @@ it(' - renders a set of checkboxes with correct id (inhe expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -it(' - renders a set of checkboxes with correct id (specified)', () => { +test(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -553,7 +553,7 @@ it(' - renders a set of checkboxes with correct id (spec expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -it(' - renders a set of checkboxes with correct name', () => { +test(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -565,7 +565,7 @@ it(' - renders a set of checkboxes with correct name', ( expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -it(' - renders a set of checkboxes with correct options', () => { +test(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -577,7 +577,7 @@ it(' - renders a set of checkboxes with correct options' expect(wrapper.find('label').at(1).text()).toBe('b'); }); -it(' - renders a set of checkboxes with correct options (transform)', () => { +test(' - renders a set of checkboxes with correct options (transform)', () => { const element = ( x.toUpperCase()} /> ); @@ -591,7 +591,7 @@ it(' - renders a set of checkboxes with correct options expect(wrapper.find('label').at(1).text()).toBe('B'); }); -it(' - renders a set of checkboxes with correct value (default)', () => { +test(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -603,7 +603,7 @@ it(' - renders a set of checkboxes with correct value (d expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -it(' - renders a set of checkboxes with correct value (model)', () => { +test(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -618,7 +618,7 @@ it(' - renders a set of checkboxes with correct value (m expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes with correct value (specified)', () => { +test(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -630,7 +630,7 @@ it(' - renders a set of checkboxes with correct value (s expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes which correctly reacts on change', () => { +test(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -647,7 +647,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { const onChange = jest.fn(); const element = ; @@ -667,7 +667,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -it(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); const element = ; @@ -687,7 +687,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -704,7 +704,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -715,7 +715,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ( ); @@ -729,14 +729,14 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -it(' - disabled items (checkboxes) based on predicate', () => { +test(' - disabled items (checkboxes) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( diff --git a/packages/uniforms-bootstrap4/__tests__/SubmitField.tsx b/packages/uniforms-bootstrap4/__tests__/SubmitField.tsx index 45097b974..afacdc06e 100644 --- a/packages/uniforms-bootstrap4/__tests__/SubmitField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/SubmitField.tsx @@ -4,14 +4,14 @@ import { SubmitField } from 'uniforms-bootstrap4'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders', () => { +test(' - renders', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper).toHaveLength(1); }); -it(' - renders disabled if error', () => { +test(' - renders disabled if error', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -19,7 +19,7 @@ it(' - renders disabled if error', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders enabled if error and enabled', () => { +test(' - renders enabled if error and enabled', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -27,7 +27,7 @@ it(' - renders enabled if error and enabled', () => { expect(wrapper.find('input').prop('disabled')).toBe(false); }); -it(' - renders a wrapper with correct class', () => { +test(' - renders a wrapper with correct class', () => { const element = ; const wrapper = mount(element, createContext()); @@ -35,7 +35,7 @@ it(' - renders a wrapper with correct class', () => { expect(wrapper.find('.container')).toHaveLength(1); }); -it(' - renders a wrapper with correct value', () => { +test(' - renders a wrapper with correct value', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-bootstrap4/__tests__/TextField.tsx b/packages/uniforms-bootstrap4/__tests__/TextField.tsx index b9abcc95b..9993d2a32 100644 --- a/packages/uniforms-bootstrap4/__tests__/TextField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/TextField.tsx @@ -9,7 +9,7 @@ import mount from './_mount'; describe('@RTL - TextField tests', () => { testTextField(TextField); - it(' - renders a wrapper with unknown props', () => { + test(' - renders a wrapper with unknown props', () => { const props = { 'data-x': 'x', 'data-y': 'y', @@ -24,14 +24,14 @@ describe('@RTL - TextField tests', () => { }); }); -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -39,7 +39,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -47,7 +47,7 @@ it(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -55,7 +55,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -63,7 +63,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -71,7 +71,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct placeholder', () => { +test(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -79,7 +79,7 @@ it(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -87,7 +87,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('text'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -95,7 +95,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -106,7 +106,7 @@ it(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input with correct value (specified)', () => { +test(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -114,7 +114,7 @@ it(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input which correctly reacts on change', () => { +test(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -130,7 +130,7 @@ it(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders an input which correctly reacts on change (empty)', () => { +test(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -146,7 +146,7 @@ it(' - renders an input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders an input which correctly reacts on change (same value)', () => { +test(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -162,7 +162,7 @@ it(' - renders an input which correctly reacts on change (same value) expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -173,7 +173,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -182,7 +182,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - renders a input with autocomplete turned off', () => { +test(' - renders a input with autocomplete turned off', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-bootstrap4/__tests__/ValidateQuickForm.tsx b/packages/uniforms-bootstrap4/__tests__/ValidateQuickForm.tsx index 78ae6908e..49bf9a9cb 100644 --- a/packages/uniforms-bootstrap4/__tests__/ValidateQuickForm.tsx +++ b/packages/uniforms-bootstrap4/__tests__/ValidateQuickForm.tsx @@ -4,7 +4,7 @@ import { ValidatedQuickForm } from 'uniforms-bootstrap4'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap4/__tests__/ValidatedForm.tsx b/packages/uniforms-bootstrap4/__tests__/ValidatedForm.tsx index b889067f9..ae097857c 100644 --- a/packages/uniforms-bootstrap4/__tests__/ValidatedForm.tsx +++ b/packages/uniforms-bootstrap4/__tests__/ValidatedForm.tsx @@ -4,7 +4,7 @@ import { ValidatedForm } from 'uniforms-bootstrap4'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap4/__tests__/gridClassName.ts b/packages/uniforms-bootstrap4/__tests__/gridClassName.ts index 2e89a0027..0a1bd7e8d 100644 --- a/packages/uniforms-bootstrap4/__tests__/gridClassName.ts +++ b/packages/uniforms-bootstrap4/__tests__/gridClassName.ts @@ -1,6 +1,6 @@ import { gridClassName } from 'uniforms-bootstrap4'; -it('gridClassName - object', () => { +test('gridClassName - object', () => { expect(gridClassName({ md: 3 }, 'input')).toBe('col-9 col-md-9'); expect(gridClassName({ md: 5 }, 'input')).toBe('col-7 col-md-7'); expect(gridClassName({ md: 7 }, 'input')).toBe('col-5 col-md-5'); @@ -54,21 +54,21 @@ it('gridClassName - object', () => { expect(gridClassName({ xl: 9 }, 'label')).toBe('col-9 col-xl-9'); }); -it('gridClassName - number', () => { +test('gridClassName - number', () => { expect(gridClassName(3, 'input')).toBe('col-9'); expect(gridClassName(3, 'label')).toBe('col-3'); expect(gridClassName(5, 'input')).toBe('col-7'); expect(gridClassName(5, 'label')).toBe('col-5'); }); -it('gridClassName - number (string)', () => { +test('gridClassName - number (string)', () => { expect(gridClassName('3', 'input')).toBe('col-9'); expect(gridClassName('3', 'label')).toBe('col-3'); expect(gridClassName('5', 'input')).toBe('col-7'); expect(gridClassName('5', 'label')).toBe('col-5'); }); -it('gridClassName - string', () => { +test('gridClassName - string', () => { expect(gridClassName('col-9 col-md-9')).toBe('col-9 col-md-9'); expect(gridClassName('col-3 col-md-3')).toBe('col-3 col-md-3'); expect(gridClassName('col-7 col-md-7')).toBe('col-7 col-md-7'); diff --git a/packages/uniforms-bootstrap4/__tests__/index.ts b/packages/uniforms-bootstrap4/__tests__/index.ts index ba3902224..47d79f1c0 100644 --- a/packages/uniforms-bootstrap4/__tests__/index.ts +++ b/packages/uniforms-bootstrap4/__tests__/index.ts @@ -1,6 +1,6 @@ import * as bootstrap4 from 'uniforms-bootstrap4'; -it('exports everything', () => { +test('exports everything', () => { expect(bootstrap4).toEqual({ AutoFields: expect.any(Function), AutoField: expect.any(Function), diff --git a/packages/uniforms-bootstrap4/__tests__/wrapField.tsx b/packages/uniforms-bootstrap4/__tests__/wrapField.tsx index e245da212..ec97accf1 100644 --- a/packages/uniforms-bootstrap4/__tests__/wrapField.tsx +++ b/packages/uniforms-bootstrap4/__tests__/wrapField.tsx @@ -3,21 +3,21 @@ import { wrapField } from 'uniforms-bootstrap4'; import mount from './_mount'; -it(' - renders wrapper with correct class', () => { +test(' - renders wrapper with correct class', () => { const element = wrapField({ wrapClassName: 'container' },
); const wrapper = mount(element); expect(wrapper.find('.container')).toHaveLength(1); }); -it(' - renders help block', () => { +test(' - renders help block', () => { const element = wrapField({ help: 'Hint' },
); const wrapper = mount(element); expect(wrapper.find('.form-text').text()).toBe('Hint'); }); -it(' - renders help block with specified class', () => { +test(' - renders help block with specified class', () => { const element = wrapField( { help: 'Hint', helpClassName: 'text-hint' },
, @@ -27,7 +27,7 @@ it(' - renders help block with specified class', () => { expect(wrapper.find('.form-text.text-hint')).toHaveLength(1); }); -it(' - renders error block', () => { +test(' - renders error block', () => { const error = new Error(); const element = wrapField( { error, showInlineError: true, errorMessage: 'Error' }, @@ -38,7 +38,7 @@ it(' - renders error block', () => { expect(wrapper.find('.text-danger').text()).toBe('Error'); }); -it(' - renders error block (showInlineError=false)', () => { +test(' - renders error block (showInlineError=false)', () => { const error = new Error(); const element = wrapField( { error, showInlineError: false, errorMessage: 'Error' }, @@ -49,7 +49,7 @@ it(' - renders error block (showInlineError=false)', () => { expect(wrapper.find('.text-danger')).toHaveLength(0); }); -it(' - label has custom class (String)', () => { +test(' - label has custom class (String)', () => { const element = wrapField( { label: 'A field label', @@ -62,7 +62,7 @@ it(' - label has custom class (String)', () => { expect(wrapper.find('label.custom-label-class')).toHaveLength(1); }); -it(' - label has custom class (Array[String])', () => { +test(' - label has custom class (Array[String])', () => { const element = wrapField( { label: 'A field label', diff --git a/packages/uniforms-bootstrap5/__tests__/AutoField.tsx b/packages/uniforms-bootstrap5/__tests__/AutoField.tsx index 6a08c4bbd..4b3b49d58 100644 --- a/packages/uniforms-bootstrap5/__tests__/AutoField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/AutoField.tsx @@ -14,14 +14,14 @@ import { import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(AutoField)).toHaveLength(1); }); -it(' - detects RadioField', () => { +test(' - detects RadioField', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ it(' - detects RadioField', () => { expect(wrapper.find(RadioField.Component)).toHaveLength(1); }); -it(' - detects SelectField', () => { +test(' - detects SelectField', () => { const element = ; const wrapper = mount( element, @@ -50,14 +50,14 @@ it(' - detects SelectField', () => { expect(wrapper.find(SelectField.Component)).toHaveLength(1); }); -it(' - detects DateField', () => { +test(' - detects DateField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DateField.Component)).toHaveLength(1); }); -it(' - detects ListField', () => { +test(' - detects ListField', () => { const element = ; const wrapper = mount( element, @@ -67,35 +67,35 @@ it(' - detects ListField', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -it(' - detects NumField', () => { +test(' - detects NumField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(NumField.Component)).toHaveLength(1); }); -it(' - detects NestField', () => { +test(' - detects NestField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Object } })); expect(wrapper.find(NestField)).toHaveLength(1); }); -it(' - detects TextField', () => { +test(' - detects TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField.Component)).toHaveLength(1); }); -it(' - detects BoolField', () => { +test(' - detects BoolField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(BoolField.Component)).toHaveLength(1); }); -it(' - uses Component (schema)', () => { +test(' - uses Component (schema)', () => { const Component = jest.fn(() => null); const element = ; @@ -107,7 +107,7 @@ it(' - uses Component (schema)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -it(' - uses Component (props)', () => { +test(' - uses Component (props)', () => { const Component = jest.fn(() => null); const element = ; @@ -116,7 +116,7 @@ it(' - uses Component (props)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -it(' - uses Component (context)', () => { +test(' - uses Component (context)', () => { const FieldA = jest.fn(() => null); const FieldB = jest.fn(() => null); @@ -136,7 +136,7 @@ it(' - uses Component (context)', () => { expect(FieldB).toHaveBeenCalledTimes(1); }); -it(' - uses Component (invalid)', () => { +test(' - uses Component (invalid)', () => { const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {}); expect(() => { const element = ; diff --git a/packages/uniforms-bootstrap5/__tests__/AutoFields.tsx b/packages/uniforms-bootstrap5/__tests__/AutoFields.tsx index 3458d0394..ccf6a542f 100644 --- a/packages/uniforms-bootstrap5/__tests__/AutoFields.tsx +++ b/packages/uniforms-bootstrap5/__tests__/AutoFields.tsx @@ -4,14 +4,14 @@ import { AutoFields, AutoField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('AutoFields')).toHaveLength(1); }); -it(' - render all fields by default', () => { +test(' - render all fields by default', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - render all fields by default', () => { expect(wrapper.find('input')).toHaveLength(3); }); -it(' - renders only specified fields', () => { +test(' - renders only specified fields', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ it(' - renders only specified fields', () => { ); }); -it(' - does not render ommited fields', () => { +test(' - does not render ommited fields', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ it(' - does not render ommited fields', () => { ); }); -it(' - wraps fields in specified element', () => { +test(' - wraps fields in specified element', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ it(' - wraps fields in specified element', () => { expect(wrapper.find('section').find('input')).toHaveLength(3); }); -it(' - pass props to the children', () => { +test(' - pass props to the children', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap5/__tests__/AutoForm.tsx b/packages/uniforms-bootstrap5/__tests__/AutoForm.tsx index f99bddb35..d781907d0 100644 --- a/packages/uniforms-bootstrap5/__tests__/AutoForm.tsx +++ b/packages/uniforms-bootstrap5/__tests__/AutoForm.tsx @@ -4,7 +4,7 @@ import { AutoForm } from 'uniforms-bootstrap5'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap5/__tests__/BaseForm.tsx b/packages/uniforms-bootstrap5/__tests__/BaseForm.tsx index a7815b94d..093839796 100644 --- a/packages/uniforms-bootstrap5/__tests__/BaseForm.tsx +++ b/packages/uniforms-bootstrap5/__tests__/BaseForm.tsx @@ -4,7 +4,7 @@ import { BaseForm } from 'uniforms-bootstrap5'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap5/__tests__/BoolField.tsx b/packages/uniforms-bootstrap5/__tests__/BoolField.tsx index 8ece193e9..58671202e 100644 --- a/packages/uniforms-bootstrap5/__tests__/BoolField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/BoolField.tsx @@ -4,14 +4,14 @@ import { BoolField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an inline input', () => { +test(' - renders an inline input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -19,7 +19,7 @@ it(' - renders an inline input', () => { expect(wrapper.find('.form-check-inline')).toHaveLength(1); }); -it(' - renders a input with correct id (inherited)', () => { +test(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -27,7 +27,7 @@ it(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders a input with correct id (specified)', () => { +test(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -35,7 +35,7 @@ it(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders a input with correct name', () => { +test(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -43,7 +43,7 @@ it(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('checkbox'); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -59,7 +59,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -73,7 +73,7 @@ it(' - renders an input with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a input with correct label (specified)', () => { +test(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -84,7 +84,7 @@ it(' - renders a input with correct label (specified)', () => { ); }); -it(' - renders a input with correct value (default)', () => { +test(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -92,7 +92,7 @@ it(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('checked')).toBe(false); }); -it(' - renders a input with correct value (model)', () => { +test(' - renders a input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -103,7 +103,7 @@ it(' - renders a input with correct value (model)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -it(' - renders a input with correct value (specified)', () => { +test(' - renders a input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -111,7 +111,7 @@ it(' - renders a input with correct value (specified)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -it(' - renders a input which correctly reacts on change', () => { +test(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ it(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', true); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); diff --git a/packages/uniforms-bootstrap5/__tests__/DateField.tsx b/packages/uniforms-bootstrap5/__tests__/DateField.tsx index 66c2fcaff..95c0efc58 100644 --- a/packages/uniforms-bootstrap5/__tests__/DateField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/DateField.tsx @@ -8,7 +8,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - DateField tests', () => { - it(' - handles "date" type correctly', () => { + test(' - handles "date" type correctly', () => { const onChange = jest.fn(); const initialDate = new Date(Date.UTC(2020, 0, 1)); @@ -29,14 +29,14 @@ describe('@RTL - DateField tests', () => { }); }); -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders a input with correct id (inherited)', () => { +test(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -44,7 +44,7 @@ it(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders a input with correct id (specified)', () => { +test(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -52,7 +52,7 @@ it(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders a input with correct name', () => { +test(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -60,7 +60,7 @@ it(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -79,7 +79,7 @@ test.each(['datetime-local', 'date'] as const)( }, ); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -87,7 +87,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -95,7 +95,7 @@ it(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -it(' - renders a input with correct label (specified)', () => { +test(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -106,7 +106,7 @@ it(' - renders a input with correct label (specified)', () => { ); }); -it(' - renders a input with correct value (default)', () => { +test(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -114,7 +114,7 @@ it(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders a input with correct value (model)', () => { +test(' - renders a input with correct value (model)', () => { const now = new Date(); const element = ; const wrapper = mount( @@ -128,7 +128,7 @@ it(' - renders a input with correct value (model)', () => { ); }); -it(' - renders a input with correct value (specified)', () => { +test(' - renders a input with correct value (specified)', () => { const now = new Date(); const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -139,7 +139,7 @@ it(' - renders a input with correct value (specified)', () => { ); }); -it(' - renders a input which correctly reacts on change', () => { +test(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const now = new Date(); @@ -158,7 +158,7 @@ it(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', now); }); -it(' - renders a input which correctly reacts on change (empty)', () => { +test(' - renders a input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -176,7 +176,7 @@ it(' - renders a input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a input which correctly reacts on change (overflow)', () => { +test(' - renders a input which correctly reacts on change (overflow)', () => { const onChange = jest.fn(); const now = new Date(1e5, 0); @@ -195,7 +195,7 @@ it(' - renders a input which correctly reacts on change (overflow)', expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); diff --git a/packages/uniforms-bootstrap5/__tests__/ErrorField.tsx b/packages/uniforms-bootstrap5/__tests__/ErrorField.tsx index 2ac5204e6..f778281bc 100644 --- a/packages/uniforms-bootstrap5/__tests__/ErrorField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/ErrorField.tsx @@ -11,14 +11,14 @@ const error = { message: 'X is required [validation-error]', }; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorField)).toHaveLength(1); }); -it(' - renders correct error message (context)', () => { +test(' - renders correct error message (context)', () => { const element = ; const wrapper = mount( element, @@ -29,7 +29,7 @@ it(' - renders correct error message (context)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -it(' - renders correct error message (specified)', () => { +test(' - renders correct error message (specified)', () => { const element = ( - renders correct error message (specified)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -it(' - renders correct children if specified', () => { +test(' - renders correct children if specified', () => { const element = Error; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap5/__tests__/ErrorsField.tsx b/packages/uniforms-bootstrap5/__tests__/ErrorsField.tsx index 871f68a7a..096ac27a4 100644 --- a/packages/uniforms-bootstrap5/__tests__/ErrorsField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/ErrorsField.tsx @@ -15,14 +15,14 @@ const error = { message: 'X is required [validation-error]', }; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorsField)).toHaveLength(1); }); -it(' - renders list of correct error messages (context)', () => { +test(' - renders list of correct error messages (context)', () => { const element = ; const wrapper = mount( element, @@ -38,7 +38,7 @@ it(' - renders list of correct error messages (context)', () => { expect(wrapper.find('.card-body > div').at(2).text()).toBe('Z is required'); }); -it(' - renders children (specified)', () => { +test(' - renders children (specified)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-bootstrap5/__tests__/HiddenField.tsx b/packages/uniforms-bootstrap5/__tests__/HiddenField.tsx index 0fad71f31..460baa415 100644 --- a/packages/uniforms-bootstrap5/__tests__/HiddenField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/HiddenField.tsx @@ -4,14 +4,14 @@ import { HiddenField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('hidden'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -62,7 +62,7 @@ it(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input which correctly reacts on model change', () => { +test(' - renders an input which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -76,7 +76,7 @@ it(' - renders an input which correctly reacts on model change', () expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders an input which correctly reacts on model change (empty)', () => { +test(' - renders an input which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -90,7 +90,7 @@ it(' - renders an input which correctly reacts on model change (emp expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders an input which correctly reacts on model change (same value)', () => { +test(' - renders an input which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -104,14 +104,14 @@ it(' - renders an input which correctly reacts on model change (sam expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders nothing', () => { +test(' - renders nothing', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.children()).toHaveLength(0); }); -it(' - renders nothing which correctly reacts on model change', () => { +test(' - renders nothing which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ it(' - renders nothing which correctly reacts on model change expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders nothing which correctly reacts on model change (empty)', () => { +test(' - renders nothing which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ it(' - renders nothing which correctly reacts on model change expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders nothing which correctly reacts on model change (same value)', () => { +test(' - renders nothing which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; diff --git a/packages/uniforms-bootstrap5/__tests__/ListAddField.tsx b/packages/uniforms-bootstrap5/__tests__/ListAddField.tsx index 7bc0b187d..698b5a2cf 100644 --- a/packages/uniforms-bootstrap5/__tests__/ListAddField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/ListAddField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListAddField)).toHaveLength(1); }); -it(' - prevents onClick when disabled', () => { +test(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ it(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when limit reached', () => { +test(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { maxCount: 0 } })); @@ -39,7 +39,7 @@ it(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - correctly reacts on click', () => { +test(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ it(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['y']); }); -it(' - correctly reacts on keyboard enter key', () => { +test(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-bootstrap5/__tests__/ListDelField.tsx b/packages/uniforms-bootstrap5/__tests__/ListDelField.tsx index 841099fb2..3d7bbe1ee 100644 --- a/packages/uniforms-bootstrap5/__tests__/ListDelField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/ListDelField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListDelField)).toHaveLength(1); }); -it(' - prevents onClick when disabled', () => { +test(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ it(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when limit reached', () => { +test(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { minCount: 3 } })); @@ -39,7 +39,7 @@ it(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - correctly reacts on click', () => { +test(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ it(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['x', 'z']); }); -it(' - correctly reacts on keyboard enter key', () => { +test(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-bootstrap5/__tests__/ListField.tsx b/packages/uniforms-bootstrap5/__tests__/ListField.tsx index 78d6657b4..d1d9dca44 100644 --- a/packages/uniforms-bootstrap5/__tests__/ListField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/ListField.tsx @@ -12,7 +12,7 @@ describe('@RTL - ListField tests', () => { }); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount( element, @@ -22,7 +22,7 @@ it(' - works', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -it(' - renders ListAddField', () => { +test(' - renders ListAddField', () => { const element = ; const wrapper = mount( element, @@ -33,7 +33,7 @@ it(' - renders ListAddField', () => { expect(wrapper.find(ListAddField).prop('name')).toBe('$'); }); -it(' - renders correct label (specified)', () => { +test(' - renders correct label (specified)', () => { const element = ; const wrapper = mount( element, @@ -46,7 +46,7 @@ it(' - renders correct label (specified)', () => { ); }); -it(' - renders correct numer of items with model (specified)', () => { +test(' - renders correct numer of items with model (specified)', () => { const element = ; const wrapper = mount( element, @@ -58,7 +58,7 @@ it(' - renders correct numer of items with model (specified)', () => expect(wrapper.find('input')).toHaveLength(3); }); -it(' - passes itemProps to its children', () => { +test(' - passes itemProps to its children', () => { const element = ; const wrapper = mount( element, @@ -70,7 +70,7 @@ it(' - passes itemProps to its children', () => { expect(wrapper.find(ListItemField).first().prop('data-xyz')).toBe(1); }); -it(' - renders children (specified)', () => { +test(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -89,7 +89,7 @@ it(' - renders children (specified)', () => { expect(Child).toHaveBeenCalledTimes(2); }); -it(' - renders children with correct name (children)', () => { +test(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -108,7 +108,7 @@ it(' - renders children with correct name (children)', () => { expect(wrapper.find(Child).at(1).prop('name')).toBe('1'); }); -it(' - renders children with correct name (value)', () => { +test(' - renders children with correct name (value)', () => { const element = ; const wrapper = mount( element, @@ -121,7 +121,7 @@ it(' - renders children with correct name (value)', () => { expect(wrapper.find(ListItemField).at(1).prop('name')).toBe('1'); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( - renders correct error text (specified)', () => { expect(wrapper.find('.text-danger').text()).toBe('Error'); }); -it(' - renders correct error text (showInlineError=false)', () => { +test(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.find('.text-danger')).toHaveLength(0); }); -it(' - renders proper number of optional values after add new value', () => { +test(' - renders proper number of optional values after add new value', () => { const element = ; const onChange = jest.fn(); const wrapper = mount( diff --git a/packages/uniforms-bootstrap5/__tests__/ListItemField.tsx b/packages/uniforms-bootstrap5/__tests__/ListItemField.tsx index a285acaaa..c105a0ba2 100644 --- a/packages/uniforms-bootstrap5/__tests__/ListItemField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/ListItemField.tsx @@ -4,7 +4,7 @@ import { AutoField, ListDelField, ListItemField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - works', () => { expect(wrapper.find(ListItemField)).toHaveLength(1); }); -it(' - renders ListDelField', () => { +test(' - renders ListDelField', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - renders ListDelField', () => { expect(wrapper.find(ListDelField).childAt(0).prop('name')).toBe('x.1'); }); -it(' - renders AutoField', () => { +test(' - renders AutoField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ it(' - renders AutoField', () => { expect(wrapper.find(AutoField)).toHaveLength(1); }); -it(' - renders children if specified', () => { +test(' - renders children if specified', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( diff --git a/packages/uniforms-bootstrap5/__tests__/LongTextField.tsx b/packages/uniforms-bootstrap5/__tests__/LongTextField.tsx index 16a713738..a08565c9b 100644 --- a/packages/uniforms-bootstrap5/__tests__/LongTextField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/LongTextField.tsx @@ -4,14 +4,14 @@ import { LongTextField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a textarea', () => { +test(' - renders a textarea', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('textarea')).toHaveLength(1); }); -it(' - renders a textarea with correct disabled state', () => { +test(' - renders a textarea with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ it(' - renders a textarea with correct disabled state', () => { expect(wrapper.find('textarea').prop('disabled')).toBe(true); }); -it(' - renders a textarea with correct readOnly state', () => { +test(' - renders a textarea with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ it(' - renders a textarea with correct readOnly state', () => { expect(wrapper.find('textarea').prop('readOnly')).toBe(true); }); -it(' - renders a textarea with correct id (inherited)', () => { +test(' - renders a textarea with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ it(' - renders a textarea with correct id (inherited)', () => { expect(wrapper.find('textarea').prop('id')).toBeTruthy(); }); -it(' - renders a textarea with correct id (specified)', () => { +test(' - renders a textarea with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ it(' - renders a textarea with correct id (specified)', () => { expect(wrapper.find('textarea').prop('id')).toBe('y'); }); -it(' - renders a textarea with correct name', () => { +test(' - renders a textarea with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ it(' - renders a textarea with correct name', () => { expect(wrapper.find('textarea').prop('name')).toBe('x'); }); -it(' - renders a textarea with correct placeholder', () => { +test(' - renders a textarea with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -59,7 +59,7 @@ it(' - renders a textarea with correct placeholder', () => { expect(wrapper.find('textarea').prop('placeholder')).toBe('y'); }); -it(' - renders a textarea with correct value (default)', () => { +test(' - renders a textarea with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -67,7 +67,7 @@ it(' - renders a textarea with correct value (default)', () => { expect(wrapper.find('textarea').prop('value')).toBe(''); }); -it(' - renders a textarea with correct value (model)', () => { +test(' - renders a textarea with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -78,7 +78,7 @@ it(' - renders a textarea with correct value (model)', () => { expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -it(' - renders a textarea with correct value (specified)', () => { +test(' - renders a textarea with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -86,7 +86,7 @@ it(' - renders a textarea with correct value (specified)', () => expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -it(' - renders a textarea which correctly reacts on change', () => { +test(' - renders a textarea which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -102,7 +102,7 @@ it(' - renders a textarea which correctly reacts on change', () = expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a textarea which correctly reacts on change (empty)', () => { +test(' - renders a textarea which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -118,7 +118,7 @@ it(' - renders a textarea which correctly reacts on change (empty expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders a textarea which correctly reacts on change (same value)', () => { +test(' - renders a textarea which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -134,7 +134,7 @@ it(' - renders a textarea which correctly reacts on change (same expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -145,7 +145,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-bootstrap5/__tests__/NestField.tsx b/packages/uniforms-bootstrap5/__tests__/NestField.tsx index a7dff2e1a..fb1948e5b 100644 --- a/packages/uniforms-bootstrap5/__tests__/NestField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/NestField.tsx @@ -4,7 +4,7 @@ import { AutoField, NestField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an for each field', () => { +test(' - renders an for each field', () => { const element = ; const wrapper = mount( element, @@ -20,7 +20,7 @@ it(' - renders an for each field', () => { expect(wrapper.find(AutoField).at(1).prop('name')).toBe('b'); }); -it(' - renders custom content if given', () => { +test(' - renders custom content if given', () => { const element = (
@@ -40,7 +40,7 @@ it(' - renders custom content if given', () => { expect(wrapper.find('article').prop('data-test')).toBe('content'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -88,7 +88,7 @@ it(' - renders correct error text (specified)', () => { expect(wrapper.find('.text-danger').text()).toBe('Error'); }); -it(' - renders correct error text (showInlineError=false)', () => { +test(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -19,7 +19,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -27,7 +27,7 @@ it(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -35,7 +35,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -43,7 +43,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct max', () => { +test(' - renders an input with correct max', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct max', () => { expect(wrapper.find('input').prop('max')).toBe(10); }); -it(' - renders an input with correct min', () => { +test(' - renders an input with correct min', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -59,7 +59,7 @@ it(' - renders an input with correct min', () => { expect(wrapper.find('input').prop('min')).toBe(10); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -67,7 +67,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct placeholder', () => { +test(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -75,7 +75,7 @@ it(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -it(' - renders an input with correct step (decimal)', () => { +test(' - renders an input with correct step (decimal)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -83,7 +83,7 @@ it(' - renders an input with correct step (decimal)', () => { expect(wrapper.find('input').prop('step')).toBe(0.01); }); -it(' - renders an input with correct step (integer)', () => { +test(' - renders an input with correct step (integer)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -91,7 +91,7 @@ it(' - renders an input with correct step (integer)', () => { expect(wrapper.find('input').prop('step')).toBe(1); }); -it(' - renders an input with correct step (set)', () => { +test(' - renders an input with correct step (set)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -99,7 +99,7 @@ it(' - renders an input with correct step (set)', () => { expect(wrapper.find('input').prop('step')).toBe(3); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -107,7 +107,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('number'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -115,7 +115,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const onChange = jest.fn(); const element = ; @@ -157,7 +157,7 @@ it(' - renders an input with correct value (model)', () => { spy.mockRestore(); }); -it(' - renders an input with correct value (specified)', () => { +test(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -165,7 +165,7 @@ it(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe(2); }); -it(' - renders an input which correctly reacts on change', () => { +test(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -181,7 +181,7 @@ it(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -it(' - renders an input which correctly reacts on change (decimal on decimal)', () => { +test(' - renders an input which correctly reacts on change (decimal on decimal)', () => { const onChange = jest.fn(); const element = ; @@ -197,7 +197,7 @@ it(' - renders an input which correctly reacts on change (decimal on d expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); -it(' - renders an input which correctly reacts on change (decimal on integer)', () => { +test(' - renders an input which correctly reacts on change (decimal on integer)', () => { const onChange = jest.fn(); const element = ; @@ -213,7 +213,7 @@ it(' - renders an input which correctly reacts on change (decimal on i expect(onChange).toHaveBeenLastCalledWith('x', 2); }); -it(' - renders an input which correctly reacts on change (empty)', () => { +test(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -229,7 +229,7 @@ it(' - renders an input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders an input which correctly reacts on change (same value)', () => { +test(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -245,7 +245,7 @@ it(' - renders an input which correctly reacts on change (same value)' expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -it(' - renders an input which correctly reacts on change (zero)', () => { +test(' - renders an input which correctly reacts on change (zero)', () => { const onChange = jest.fn(); const element = ; @@ -261,7 +261,7 @@ it(' - renders an input which correctly reacts on change (zero)', () = expect(onChange).toHaveBeenLastCalledWith('x', 0); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -272,7 +272,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); diff --git a/packages/uniforms-bootstrap5/__tests__/QuickForm.tsx b/packages/uniforms-bootstrap5/__tests__/QuickForm.tsx index 4b01a3818..4da914435 100644 --- a/packages/uniforms-bootstrap5/__tests__/QuickForm.tsx +++ b/packages/uniforms-bootstrap5/__tests__/QuickForm.tsx @@ -4,7 +4,7 @@ import { QuickForm } from 'uniforms-bootstrap5'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - renders', () => { +test(' - renders', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap5/__tests__/RadioField.tsx b/packages/uniforms-bootstrap5/__tests__/RadioField.tsx index 4e870c26e..b132acdd6 100644 --- a/packages/uniforms-bootstrap5/__tests__/RadioField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/RadioField.tsx @@ -4,7 +4,7 @@ import { RadioField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a set of checkboxes', () => { +test(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -it(' - renders a set of inline checkboxes', () => { +test(' - renders a set of inline checkboxes', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - renders a set of inline checkboxes', () => { expect(wrapper.find('.form-check-inline')).toHaveLength(2); }); -it(' - renders a set of checkboxes with correct disabled state', () => { +test(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ it(' - renders a set of checkboxes with correct disabled state', () expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -it(' - renders a set of checkboxes with correct readOnly state', () => { +test(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -54,7 +54,7 @@ it(' - renders a set of checkboxes with correct readOnly state', () expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a set of checkboxes with correct id (inherited)', () => { +test(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -66,7 +66,7 @@ it(' - renders a set of checkboxes with correct id (inherited)', () expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -it(' - renders a set of checkboxes with correct id (specified)', () => { +test(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -78,7 +78,7 @@ it(' - renders a set of checkboxes with correct id (specified)', () expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -it(' - renders a set of checkboxes with correct name', () => { +test(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -90,7 +90,7 @@ it(' - renders a set of checkboxes with correct name', () => { expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -it(' - renders a set of checkboxes with correct options', () => { +test(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -102,7 +102,7 @@ it(' - renders a set of checkboxes with correct options', () => { expect(wrapper.find('label').at(1).text()).toBe(' b'); }); -it(' - renders a set of checkboxes with correct options (transform)', () => { +test(' - renders a set of checkboxes with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -114,7 +114,7 @@ it(' - renders a set of checkboxes with correct options (transform)' expect(wrapper.find('label').at(1).text()).toBe(' B'); }); -it(' - renders a set of checkboxes with correct value (default)', () => { +test(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -126,7 +126,7 @@ it(' - renders a set of checkboxes with correct value (default)', () expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -it(' - renders a set of checkboxes with correct value (model)', () => { +test(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -141,7 +141,7 @@ it(' - renders a set of checkboxes with correct value (model)', () = expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes with correct value (specified)', () => { +test(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -153,7 +153,7 @@ it(' - renders a set of checkboxes with correct value (specified)', expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes which correctly reacts on change', () => { +test(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -170,7 +170,7 @@ it(' - renders a set of checkboxes which correctly reacts on change' expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -187,7 +187,7 @@ it(' - renders a set of checkboxes which correctly reacts on change expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -198,7 +198,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -210,7 +210,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), diff --git a/packages/uniforms-bootstrap5/__tests__/SelectField.tsx b/packages/uniforms-bootstrap5/__tests__/SelectField.tsx index f5d9fb576..353eba951 100644 --- a/packages/uniforms-bootstrap5/__tests__/SelectField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/SelectField.tsx @@ -4,7 +4,7 @@ import { SelectField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a select', () => { +test(' - renders a select', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - renders a select', () => { expect(wrapper.find('select')).toHaveLength(1); }); -it(' - renders a select with correct disabled state', () => { +test(' - renders a select with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - renders a select with correct disabled state', () => { expect(wrapper.find('select').prop('disabled')).toBe(true); }); -it(' - renders a select with correct readOnly state', () => { +test(' - renders a select with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -44,7 +44,7 @@ it(' - renders a select with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a select with correct id (inherited)', () => { +test(' - renders a select with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ it(' - renders a select with correct id (inherited)', () => { expect(wrapper.find('select').prop('id')).toBeTruthy(); }); -it(' - renders a select with correct id (specified)', () => { +test(' - renders a select with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -66,7 +66,7 @@ it(' - renders a select with correct id (specified)', () => { expect(wrapper.find('select').prop('id')).toBe('y'); }); -it(' - renders a select with correct name', () => { +test(' - renders a select with correct name', () => { const element = ; const wrapper = mount( element, @@ -77,7 +77,7 @@ it(' - renders a select with correct name', () => { expect(wrapper.find('select').prop('name')).toBe('x'); }); -it(' - renders a select with correct options', () => { +test(' - renders a select with correct options', () => { const element = ; const wrapper = mount( element, @@ -97,7 +97,7 @@ it(' - renders a select with correct options', () => { }); }); -it(' - renders a select with correct options (transform)', () => { +test(' - renders a select with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -117,7 +117,7 @@ it(' - renders a select with correct options (transform)', () => { }); }); -it(' - renders a select with correct placeholder (fallback)', () => { +test(' - renders a select with correct placeholder (fallback)', () => { const element = ; const wrapper = mount( element, @@ -139,7 +139,7 @@ it(' - renders a select with correct placeholder (fallback)', () => }); }); -it(' - renders a select with correct placeholder (implicit)', () => { +test(' - renders a select with correct placeholder (implicit)', () => { const element = ; const wrapper = mount( element, @@ -159,7 +159,7 @@ it(' - renders a select with correct placeholder (implicit)', () => }); }); -it(' - renders a select with correct value (default)', () => { +test(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -170,7 +170,7 @@ it(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toBe(''); }); -it(' - renders a select with correct value (model)', () => { +test(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -184,7 +184,7 @@ it(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -it(' - renders a select with correct value (specified)', () => { +test(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -195,7 +195,7 @@ it(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -it(' - renders a select which correctly reacts on change', () => { +test(' - renders a select which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -214,7 +214,7 @@ it(' - renders a select which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a select which correctly reacts on change (empty)', () => { +test(' - renders a select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -233,7 +233,7 @@ it(' - renders a select which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a select which correctly reacts on change (same value)', () => { +test(' - renders a select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -252,7 +252,7 @@ it(' - renders a select which correctly reacts on change (same valu expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -266,7 +266,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a select with class "bg-red" beside "mb-3"', () => { +test(' - renders a select with class "bg-red" beside "mb-3"', () => { const element = ; const wrapper = mount( element, @@ -275,7 +275,7 @@ it(' - renders a select with class "bg-red" beside "mb-3"', () => { expect(wrapper.find('.bg-red.mb-3')).toHaveLength(1); }); -it(' - renders a disabled select', () => { +test(' - renders a disabled select', () => { const element = ; const wrapper = mount( element, @@ -284,7 +284,7 @@ it(' - renders a disabled select', () => { expect(wrapper.find('select').prop('disabled')).toEqual(true); }); -it(' - renders a required select', () => { +test(' - renders a required select', () => { const element = ; const wrapper = mount( element, @@ -293,7 +293,7 @@ it(' - renders a required select', () => { expect(wrapper.find('.mb-3.required')).toHaveLength(1); }); -it(' - renders am error massge in select', () => { +test(' - renders am error massge in select', () => { const element = ( - renders am error massge in select', () => { expect(wrapper.find('.form-text.text-danger')).toHaveLength(1); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -321,14 +321,14 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -it(' - disabled items (options) based on predicate', () => { +test(' - disabled items (options) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( @@ -344,7 +344,7 @@ it(' - disabled items (options) based on predicate', () => { expect(wrapper.find('option[value="b"]').at(0).prop('disabled')).toBe(false); }); -it(' - renders a select with correct value (default)', () => { +test(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -358,7 +358,7 @@ it(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual([]); }); -it(' - renders a select with correct value (model)', () => { +test(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -375,7 +375,7 @@ it(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -it(' - renders a select with correct value (specified)', () => { +test(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -389,7 +389,7 @@ it(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -it(' - renders a select which correctly reacts on change (first value)', () => { +test(' - renders a select which correctly reacts on change (first value)', () => { const onChange = jest.fn(); const element = ; @@ -411,7 +411,7 @@ it(' - renders a select which correctly reacts on change (first val expect(onChange).toHaveBeenLastCalledWith('x', ['a']); }); -it(' - renders a select which correctly reacts on change (next value)', () => { +test(' - renders a select which correctly reacts on change (next value)', () => { const onChange = jest.fn(); const element = ; @@ -433,7 +433,7 @@ it(' - renders a select which correctly reacts on change (next valu expect(onChange).toHaveBeenLastCalledWith('x', ['a', 'b']); }); -it(' - renders a select which correctly reacts on change (uncheck) by value', () => { +test(' - renders a select which correctly reacts on change (uncheck) by value', () => { const onChange = jest.fn(); const element = ; @@ -455,7 +455,7 @@ it(' - renders a select which correctly reacts on change (uncheck) expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { +test(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { const onChange = jest.fn(); const element = ; @@ -479,7 +479,7 @@ it(' - renders a select which correctly reacts on change (uncheck) expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a set of checkboxes', () => { +test(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -489,7 +489,7 @@ it(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -it(' - renders a set of inline checkboxes', () => { +test(' - renders a set of inline checkboxes', () => { const element = ; const wrapper = mount( element, @@ -501,7 +501,7 @@ it(' - renders a set of inline checkboxes', () => { expect(wrapper.find('.form-check-inline')).toHaveLength(2); }); -it(' - renders a set of checkboxes with correct disabled state', () => { +test(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -513,7 +513,7 @@ it(' - renders a set of checkboxes with correct disabled expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -it(' - renders a set of checkboxes with correct readOnly state', () => { +test(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -530,7 +530,7 @@ it(' - renders a set of checkboxes with correct readOnly expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a set of checkboxes with correct id (inherited)', () => { +test(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -542,7 +542,7 @@ it(' - renders a set of checkboxes with correct id (inhe expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -it(' - renders a set of checkboxes with correct id (specified)', () => { +test(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -554,7 +554,7 @@ it(' - renders a set of checkboxes with correct id (spec expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -it(' - renders a set of checkboxes with correct name', () => { +test(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -566,7 +566,7 @@ it(' - renders a set of checkboxes with correct name', ( expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -it(' - renders a set of checkboxes with correct options', () => { +test(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -578,7 +578,7 @@ it(' - renders a set of checkboxes with correct options' expect(wrapper.find('label').at(1).text()).toBe('b'); }); -it(' - renders a set of checkboxes with correct options (transform)', () => { +test(' - renders a set of checkboxes with correct options (transform)', () => { const element = ( x.toUpperCase()} /> ); @@ -592,7 +592,7 @@ it(' - renders a set of checkboxes with correct options expect(wrapper.find('label').at(1).text()).toBe('B'); }); -it(' - renders a set of checkboxes with correct value (default)', () => { +test(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -604,7 +604,7 @@ it(' - renders a set of checkboxes with correct value (d expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -it(' - renders a set of checkboxes with correct value (model)', () => { +test(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -619,7 +619,7 @@ it(' - renders a set of checkboxes with correct value (m expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes with correct value (specified)', () => { +test(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -631,7 +631,7 @@ it(' - renders a set of checkboxes with correct value (s expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes which correctly reacts on change', () => { +test(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -648,7 +648,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { const onChange = jest.fn(); const element = ; @@ -668,7 +668,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -it(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); const element = ; @@ -688,7 +688,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -705,7 +705,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -716,7 +716,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ( ); @@ -730,14 +730,14 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -it(' - disabled items (checkboxes) based on predicate', () => { +test(' - disabled items (checkboxes) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( diff --git a/packages/uniforms-bootstrap5/__tests__/SubmitField.tsx b/packages/uniforms-bootstrap5/__tests__/SubmitField.tsx index 90ae16eb1..d629c76d1 100644 --- a/packages/uniforms-bootstrap5/__tests__/SubmitField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/SubmitField.tsx @@ -4,14 +4,14 @@ import { SubmitField } from 'uniforms-bootstrap5'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders', () => { +test(' - renders', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper).toHaveLength(1); }); -it(' - renders disabled if error', () => { +test(' - renders disabled if error', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -19,7 +19,7 @@ it(' - renders disabled if error', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders enabled if error and enabled', () => { +test(' - renders enabled if error and enabled', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -27,7 +27,7 @@ it(' - renders enabled if error and enabled', () => { expect(wrapper.find('input').prop('disabled')).toBe(false); }); -it(' - renders a wrapper with correct class', () => { +test(' - renders a wrapper with correct class', () => { const element = ; const wrapper = mount(element, createContext()); @@ -35,7 +35,7 @@ it(' - renders a wrapper with correct class', () => { expect(wrapper.find('.container')).toHaveLength(1); }); -it(' - renders a wrapper with correct value', () => { +test(' - renders a wrapper with correct value', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-bootstrap5/__tests__/TextField.tsx b/packages/uniforms-bootstrap5/__tests__/TextField.tsx index 3b18bb1cc..43ccd04c2 100644 --- a/packages/uniforms-bootstrap5/__tests__/TextField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/TextField.tsx @@ -9,7 +9,7 @@ import mount from './_mount'; describe('@RTL - TextField tests', () => { testTextField(TextField); - it(' - renders a wrapper with unknown props', () => { + test(' - renders a wrapper with unknown props', () => { const props = { 'data-x': 'x', 'data-y': 'y', @@ -24,14 +24,14 @@ describe('@RTL - TextField tests', () => { }); }); -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -39,7 +39,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -47,7 +47,7 @@ it(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -55,7 +55,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -63,7 +63,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -71,7 +71,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct placeholder', () => { +test(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -79,7 +79,7 @@ it(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -87,7 +87,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('text'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -95,7 +95,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -106,7 +106,7 @@ it(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input with correct value (specified)', () => { +test(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -114,7 +114,7 @@ it(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input which correctly reacts on change', () => { +test(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -130,7 +130,7 @@ it(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders an input which correctly reacts on change (empty)', () => { +test(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -146,7 +146,7 @@ it(' - renders an input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders an input which correctly reacts on change (same value)', () => { +test(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -162,7 +162,7 @@ it(' - renders an input which correctly reacts on change (same value) expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -173,7 +173,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -182,7 +182,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - renders a input with autocomplete turned off', () => { +test(' - renders a input with autocomplete turned off', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-bootstrap5/__tests__/ValidateQuickForm.tsx b/packages/uniforms-bootstrap5/__tests__/ValidateQuickForm.tsx index cb69f05f7..bb4128046 100644 --- a/packages/uniforms-bootstrap5/__tests__/ValidateQuickForm.tsx +++ b/packages/uniforms-bootstrap5/__tests__/ValidateQuickForm.tsx @@ -4,7 +4,7 @@ import { ValidatedQuickForm } from 'uniforms-bootstrap5'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap5/__tests__/ValidatedForm.tsx b/packages/uniforms-bootstrap5/__tests__/ValidatedForm.tsx index a6c950010..80ac93702 100644 --- a/packages/uniforms-bootstrap5/__tests__/ValidatedForm.tsx +++ b/packages/uniforms-bootstrap5/__tests__/ValidatedForm.tsx @@ -4,7 +4,7 @@ import { ValidatedForm } from 'uniforms-bootstrap5'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-bootstrap5/__tests__/gridClassName.ts b/packages/uniforms-bootstrap5/__tests__/gridClassName.ts index af0587ea0..fed2b2d9b 100644 --- a/packages/uniforms-bootstrap5/__tests__/gridClassName.ts +++ b/packages/uniforms-bootstrap5/__tests__/gridClassName.ts @@ -1,6 +1,6 @@ import { gridClassName } from 'uniforms-bootstrap5'; -it('gridClassName - object', () => { +test('gridClassName - object', () => { expect(gridClassName({ md: 3 }, 'input')).toBe('col-9 col-md-9'); expect(gridClassName({ md: 5 }, 'input')).toBe('col-7 col-md-7'); expect(gridClassName({ md: 7 }, 'input')).toBe('col-5 col-md-5'); @@ -59,21 +59,21 @@ it('gridClassName - object', () => { expect(gridClassName({ xxl: 9 }, 'label')).toBe('col-9 col-xxl-9'); }); -it('gridClassName - number', () => { +test('gridClassName - number', () => { expect(gridClassName(3, 'input')).toBe('col-9'); expect(gridClassName(3, 'label')).toBe('col-3'); expect(gridClassName(5, 'input')).toBe('col-7'); expect(gridClassName(5, 'label')).toBe('col-5'); }); -it('gridClassName - number (string)', () => { +test('gridClassName - number (string)', () => { expect(gridClassName('3', 'input')).toBe('col-9'); expect(gridClassName('3', 'label')).toBe('col-3'); expect(gridClassName('5', 'input')).toBe('col-7'); expect(gridClassName('5', 'label')).toBe('col-5'); }); -it('gridClassName - string', () => { +test('gridClassName - string', () => { expect(gridClassName('col-9 col-md-9')).toBe('col-9 col-md-9'); expect(gridClassName('col-3 col-md-3')).toBe('col-3 col-md-3'); expect(gridClassName('col-7 col-md-7')).toBe('col-7 col-md-7'); diff --git a/packages/uniforms-bootstrap5/__tests__/index.ts b/packages/uniforms-bootstrap5/__tests__/index.ts index a4a541cc9..b54aa3aea 100644 --- a/packages/uniforms-bootstrap5/__tests__/index.ts +++ b/packages/uniforms-bootstrap5/__tests__/index.ts @@ -1,6 +1,6 @@ import * as bootstrap5 from 'uniforms-bootstrap5'; -it('exports everything', () => { +test('exports everything', () => { expect(bootstrap5).toEqual({ AutoFields: expect.any(Function), AutoField: expect.any(Function), diff --git a/packages/uniforms-bootstrap5/__tests__/wrapField.tsx b/packages/uniforms-bootstrap5/__tests__/wrapField.tsx index 1d150d210..88b7b8bbd 100644 --- a/packages/uniforms-bootstrap5/__tests__/wrapField.tsx +++ b/packages/uniforms-bootstrap5/__tests__/wrapField.tsx @@ -3,21 +3,21 @@ import { wrapField } from 'uniforms-bootstrap5'; import mount from './_mount'; -it(' - renders wrapper with correct class', () => { +test(' - renders wrapper with correct class', () => { const element = wrapField({ wrapClassName: 'container' },
); const wrapper = mount(element); expect(wrapper.find('.container')).toHaveLength(1); }); -it(' - renders help block', () => { +test(' - renders help block', () => { const element = wrapField({ help: 'Hint' },
); const wrapper = mount(element); expect(wrapper.find('.form-text').text()).toBe('Hint'); }); -it(' - renders help block with specified class', () => { +test(' - renders help block with specified class', () => { const element = wrapField( { help: 'Hint', helpClassName: 'text-hint' },
, @@ -27,7 +27,7 @@ it(' - renders help block with specified class', () => { expect(wrapper.find('.form-text.text-hint')).toHaveLength(1); }); -it(' - renders error block', () => { +test(' - renders error block', () => { const error = new Error(); const element = wrapField( { error, showInlineError: true, errorMessage: 'Error' }, @@ -38,7 +38,7 @@ it(' - renders error block', () => { expect(wrapper.find('.text-danger').text()).toBe('Error'); }); -it(' - renders error block (showInlineError=false)', () => { +test(' - renders error block (showInlineError=false)', () => { const error = new Error(); const element = wrapField( { error, showInlineError: false, errorMessage: 'Error' }, @@ -49,7 +49,7 @@ it(' - renders error block (showInlineError=false)', () => { expect(wrapper.find('.text-danger')).toHaveLength(0); }); -it(' - label has custom class (String)', () => { +test(' - label has custom class (String)', () => { const element = wrapField( { label: 'A field label', @@ -62,7 +62,7 @@ it(' - label has custom class (String)', () => { expect(wrapper.find('label.custom-label-class')).toHaveLength(1); }); -it(' - label has custom class (Array[String])', () => { +test(' - label has custom class (Array[String])', () => { const element = wrapField( { label: 'A field label', diff --git a/packages/uniforms-bridge-graphql/__tests__/GraphQLBridge.ts b/packages/uniforms-bridge-graphql/__tests__/GraphQLBridge.ts index 5b4af28eb..d7e512fe5 100644 --- a/packages/uniforms-bridge-graphql/__tests__/GraphQLBridge.ts +++ b/packages/uniforms-bridge-graphql/__tests__/GraphQLBridge.ts @@ -85,23 +85,23 @@ describe('GraphQLBridge', () => { ); describe('#constructor()', () => { - it('always ensures `extras`', () => { + test('always ensures `extras`', () => { const bridge = new GraphQLBridge(astI.getType('Post')!, schemaValidator); expect(bridge.extras).toEqual({}); }); }); describe('#getError', () => { - it('works without error', () => { + test('works without error', () => { expect(bridgeI.getError('title', undefined)).toBe(null); }); - it('works with invalid error', () => { + test('works with invalid error', () => { expect(bridgeI.getError('title', {})).toBe(null); expect(bridgeI.getError('title', { invalid: true })).toBe(null); }); - it('works with correct error', () => { + test('works with correct error', () => { expect( bridgeI.getError('title', { details: [{ name: 'title' }] }), ).toEqual({ name: 'title' }); @@ -112,16 +112,16 @@ describe('GraphQLBridge', () => { }); describe('#getErrorMessage', () => { - it('works without error', () => { + test('works without error', () => { expect(bridgeI.getErrorMessage('title', undefined)).toBe(''); }); - it('works with invalid error', () => { + test('works with invalid error', () => { expect(bridgeI.getErrorMessage('title', {})).toBe(''); expect(bridgeI.getErrorMessage('title', { invalid: true })).toBe(''); }); - it('works with correct error', () => { + test('works with correct error', () => { expect( bridgeI.getErrorMessage('title', { details: [{ name: 'title', message: '!' }], @@ -136,23 +136,23 @@ describe('GraphQLBridge', () => { }); describe('#getErrorMessages', () => { - it('works without error', () => { + test('works without error', () => { expect(bridgeI.getErrorMessages(null)).toEqual([]); expect(bridgeI.getErrorMessages(undefined)).toEqual([]); }); - it('works with other errors', () => { + test('works with other errors', () => { expect(bridgeI.getErrorMessages('correct')).toEqual(['correct']); expect(bridgeI.getErrorMessages(999999999)).toEqual([999999999]); }); - it('works with Error', () => { + test('works with Error', () => { expect(bridgeI.getErrorMessages(new Error('correct'))).toEqual([ 'correct', ]); }); - it('works with ValidationError', () => { + test('works with ValidationError', () => { expect( bridgeI.getErrorMessages({ details: [{ name: 'title', message: '!' }], @@ -167,7 +167,7 @@ describe('GraphQLBridge', () => { }); describe('#getField', () => { - it('return correct definition (input)', () => { + test('return correct definition (input)', () => { expect(bridgeI.getField('author.firstName')).toEqual({ astNode: expect.objectContaining({}), defaultValue: 'John', @@ -177,7 +177,7 @@ describe('GraphQLBridge', () => { }); }); - it('return correct definition (type)', () => { + test('return correct definition (type)', () => { expect(bridgeT.getField('author.firstName')).toEqual({ args: [], astNode: expect.objectContaining({}), @@ -189,7 +189,7 @@ describe('GraphQLBridge', () => { }); }); - it('throws on not found field', () => { + test('throws on not found field', () => { const error = /Field not found in schema/; expect(() => bridgeI.getField('x')).toThrow(error); expect(() => bridgeI.getField('author.x')).toThrow(error); @@ -198,11 +198,11 @@ describe('GraphQLBridge', () => { }); describe('#getInitialValue', () => { - it('works with arrays', () => { + test('works with arrays', () => { expect(bridgeI.getInitialValue('author.tags')).toEqual([]); }); - it('works with objects', () => { + test('works with objects', () => { expect(bridgeI.getInitialValue('author')).toEqual({ firstName: 'John', lastName: 'Doe', @@ -210,15 +210,15 @@ describe('GraphQLBridge', () => { }); }); - it('works with undefined primitives', () => { + test('works with undefined primitives', () => { expect(bridgeI.getInitialValue('id')).toBe(undefined); }); - it('works with defined primitives', () => { + test('works with defined primitives', () => { expect(bridgeI.getInitialValue('votes')).toBe(44); }); - it('works with default values', () => { + test('works with default values', () => { expect(bridgeI.getInitialValue('author.firstName')).toBe('John'); }); }); @@ -227,7 +227,7 @@ describe('GraphQLBridge', () => { describe('labels are derived properly', () => { describe('when props.label is undefined or true', () => { describe('and no extra data is passed', () => { - it('should use AST field name', () => { + test('should use AST field name', () => { expect(bridgeT.getProps('title')).toEqual({ allowedValues: ['a', 'b', 'Some Title'], label: false, @@ -253,7 +253,7 @@ describe('GraphQLBridge', () => { }); describe('and extra data is present', () => { - it('should use extra data', () => { + test('should use extra data', () => { expect(bridgeT.getProps('id')).toEqual({ allowedValues: [1, 2, 3], label: 'Post ID', @@ -271,7 +271,7 @@ describe('GraphQLBridge', () => { }); describe('when props.label is a string', () => { - it('should use label from props', () => { + test('should use label from props', () => { expect(bridgeT.getProps('title', { label: 'Overriden' })).toEqual({ allowedValues: ['a', 'b', 'Some Title'], label: false, @@ -300,7 +300,7 @@ describe('GraphQLBridge', () => { }); describe('when props.label is false or null (unset)', () => { - it('should display empty label', () => { + test('should display empty label', () => { expect(bridgeT.getProps('id', { label: false })).toEqual({ allowedValues: [1, 2, 3], label: 'Post ID', @@ -318,7 +318,7 @@ describe('GraphQLBridge', () => { }); }); - it('works with allowedValues', () => { + test('works with allowedValues', () => { expect(bridgeI.getProps('id')).toEqual({ label: 'Post ID', placeholder: 'Post ID', @@ -327,7 +327,7 @@ describe('GraphQLBridge', () => { }); }); - it('works with allowedValues from props', () => { + test('works with allowedValues from props', () => { expect(bridgeI.getProps('id', { allowedValues: [1] })).toEqual({ label: 'Post ID', placeholder: 'Post ID', @@ -336,7 +336,7 @@ describe('GraphQLBridge', () => { }); }); - it('works with custom component', () => { + test('works with custom component', () => { expect(bridgeI.getProps('author')).toEqual({ label: 'Author', required: true, @@ -344,7 +344,7 @@ describe('GraphQLBridge', () => { }); }); - it('works with label (custom)', () => { + test('works with label (custom)', () => { expect(bridgeI.getProps('id', { label: 'ID' })).toEqual({ label: 'Post ID', placeholder: 'Post ID', @@ -353,7 +353,7 @@ describe('GraphQLBridge', () => { }); }); - it('works with label (true)', () => { + test('works with label (true)', () => { expect(bridgeI.getProps('id', { label: true })).toEqual({ label: 'Post ID', placeholder: 'Post ID', @@ -362,7 +362,7 @@ describe('GraphQLBridge', () => { }); }); - it('works with label (falsy)', () => { + test('works with label (falsy)', () => { expect(bridgeI.getProps('id', { label: null })).toEqual({ label: 'Post ID', placeholder: 'Post ID', @@ -371,7 +371,7 @@ describe('GraphQLBridge', () => { }); }); - it('works with placeholder (custom)', () => { + test('works with placeholder (custom)', () => { expect(bridgeI.getProps('id', { placeholder: 'Post ID' })).toEqual({ label: 'Post ID', placeholder: 'Post ID', @@ -380,7 +380,7 @@ describe('GraphQLBridge', () => { }); }); - it('works with placeholder (true)', () => { + test('works with placeholder (true)', () => { expect(bridgeI.getProps('id', { placeholder: true })).toEqual({ label: 'Post ID', placeholder: 'Post ID', @@ -389,7 +389,7 @@ describe('GraphQLBridge', () => { }); }); - it('works with placeholder (falsy)', () => { + test('works with placeholder (falsy)', () => { expect(bridgeI.getProps('id', { placeholder: null })).toEqual({ label: 'Post ID', placeholder: 'Post ID', @@ -398,7 +398,7 @@ describe('GraphQLBridge', () => { }); }); - it('works with placeholder (extra.placeholder === undefined)', () => { + test('works with placeholder (extra.placeholder === undefined)', () => { expect(bridgeI.getProps('title', { placeholder: true })).toEqual({ allowedValues: ['a', 'b', 'Some Title'], label: false, @@ -413,7 +413,7 @@ describe('GraphQLBridge', () => { }); }); - it('works with Number type', () => { + test('works with Number type', () => { expect(bridgeI.getProps('author.decimal1')).toEqual({ label: 'Decimal 1', required: false, @@ -427,21 +427,21 @@ describe('GraphQLBridge', () => { }); }); - it('works with options (array)', () => { + test('works with options (array)', () => { expect(bridgeI.getProps('title').transform('a')).toBe(1); expect(bridgeI.getProps('title').transform('b')).toBe(2); expect(bridgeI.getProps('title').allowedValues[0]).toBe('a'); expect(bridgeI.getProps('title').allowedValues[1]).toBe('b'); }); - it('works with options (object)', () => { + test('works with options (object)', () => { expect(bridgeI.getProps('votes').transform('a')).toBe(1); expect(bridgeI.getProps('votes').transform('b')).toBe(2); expect(bridgeI.getProps('votes').allowedValues[0]).toBe('a'); expect(bridgeI.getProps('votes').allowedValues[1]).toBe('b'); }); - it('works with options from props', () => { + test('works with options from props', () => { expect( bridgeI.getProps('votes', { options: { c: 1, d: 2 } }).transform('c'), ).toBe(1); @@ -456,7 +456,7 @@ describe('GraphQLBridge', () => { ).toBe('d'); }); - it('works with other props', () => { + test('works with other props', () => { expect(bridgeI.getProps('category', { x: 1, y: 1 })).toEqual({ label: 'Category', required: true, @@ -464,19 +464,19 @@ describe('GraphQLBridge', () => { }); describe('when enum', () => { - it('should return possibleValues', () => { + test('should return possibleValues', () => { expect(bridgeI.getProps('author.level').allowedValues).toEqual([ 'Admin', 'User', ]); }); - it('should transform the value to the name', () => { + test('should transform the value to the name', () => { const transform = bridgeI.getProps('author.level').transform; expect(transform('Admin')).toBe('Admin'); }); - it('should prefer options over enum', () => { + test('should prefer options over enum', () => { const bridge = new GraphQLBridge( astI.getType('Post')!, schemaValidator, @@ -499,7 +499,7 @@ describe('GraphQLBridge', () => { }); describe('#getSubfields', () => { - it('works on top level', () => { + test('works on top level', () => { expect(bridgeI.getSubfields()).toEqual([ 'id', 'author', @@ -511,7 +511,7 @@ describe('GraphQLBridge', () => { ]); }); - it('works with nested types', () => { + test('works with nested types', () => { expect(bridgeI.getSubfields('author')).toEqual([ 'id', 'confirmed', @@ -524,7 +524,7 @@ describe('GraphQLBridge', () => { ]); }); - it('works with primitives', () => { + test('works with primitives', () => { expect(bridgeI.getSubfields('id')).toEqual([]); expect(bridgeI.getSubfields('author.id')).toEqual([]); }); @@ -574,7 +574,7 @@ describe('GraphQLBridge', () => { }); describe('#getValidator', () => { - it('calls correct validator', () => { + test('calls correct validator', () => { expect(bridgeI.getValidator()).toBe(schemaValidator); }); }); diff --git a/packages/uniforms-bridge-graphql/__tests__/index.ts b/packages/uniforms-bridge-graphql/__tests__/index.ts index ae697b630..ba49a47a0 100644 --- a/packages/uniforms-bridge-graphql/__tests__/index.ts +++ b/packages/uniforms-bridge-graphql/__tests__/index.ts @@ -1,6 +1,6 @@ import * as uniformsGraphQL from 'uniforms-bridge-graphql'; -it('exports everything', () => { +test('exports everything', () => { expect(uniformsGraphQL).toEqual({ default: expect.any(Function), GraphQLBridge: expect.any(Function), diff --git a/packages/uniforms-bridge-json-schema/__tests__/JSONSchemaBridge.ts b/packages/uniforms-bridge-json-schema/__tests__/JSONSchemaBridge.ts index 22d6962f6..c5b09b725 100644 --- a/packages/uniforms-bridge-json-schema/__tests__/JSONSchemaBridge.ts +++ b/packages/uniforms-bridge-json-schema/__tests__/JSONSchemaBridge.ts @@ -221,11 +221,11 @@ describe('JSONSchemaBridge', () => { const bridge = new JSONSchemaBridge(schema, validator); describe('#constructor()', () => { - it('sets schema correctly when has top level type of object', () => { + test('sets schema correctly when has top level type of object', () => { expect(bridge.schema).toEqual(schema); }); - it('sets schema correctly when has top level $ref', () => { + test('sets schema correctly when has top level $ref', () => { const localSchema = { definitions: schema.definitions, $ref: '#/definitions/personalData', @@ -241,7 +241,7 @@ describe('JSONSchemaBridge', () => { expect(localBridge.schema).toEqual(resolvedSchema); }); - it('falls back to input schema', () => { + test('falls back to input schema', () => { const localSchema = { definitions: schema.definitions }; const localBridge = new JSONSchemaBridge(localSchema, validator); expect(localBridge.schema).toEqual(localSchema); @@ -249,28 +249,28 @@ describe('JSONSchemaBridge', () => { }); describe('#getError', () => { - it('works without error', () => { + test('works without error', () => { expect(bridge.getError('age', undefined)).toEqual(null); }); - it('works with invalid error', () => { + test('works with invalid error', () => { expect(bridge.getError('age', {})).toEqual(null); expect(bridge.getError('age', { invalid: true })).toEqual(null); }); - it('works with correct error (data path)', () => { + test('works with correct error (data path)', () => { const error = { details: [{ dataPath: '.x' }] }; expect(bridge.getError('x', error)).toEqual(error.details[0]); expect(bridge.getError('y', error)).toEqual(null); }); - it('works with correct error (instance path)', () => { + test('works with correct error (instance path)', () => { const error = { details: [{ instancePath: '.x' }] }; expect(bridge.getError('x', error)).toEqual(error.details[0]); expect(bridge.getError('y', error)).toEqual(null); }); - it('works with correct error (data path at root)', () => { + test('works with correct error (data path at root)', () => { const error = { details: [ { @@ -287,7 +287,7 @@ describe('JSONSchemaBridge', () => { expect(bridge.getError('y', error)).toEqual(null); }); - it('works with correct error (instance path at root)', () => { + test('works with correct error (instance path at root)', () => { const error = { details: [ { @@ -304,7 +304,7 @@ describe('JSONSchemaBridge', () => { expect(bridge.getError('y', error)).toEqual(null); }); - it('works with correct error (data path of parent)', () => { + test('works with correct error (data path of parent)', () => { const error = { details: [ { @@ -322,7 +322,7 @@ describe('JSONSchemaBridge', () => { expect(bridge.getError('y.x', error)).toEqual(null); }); - it('works with correct error (instance path of parent)', () => { + test('works with correct error (instance path of parent)', () => { const error = { details: [ { @@ -340,7 +340,7 @@ describe('JSONSchemaBridge', () => { expect(bridge.getError('y.x', error)).toEqual(null); }); - it('works with correct error (complex data paths)', () => { + test('works with correct error (complex data paths)', () => { const pairs = [ ["a.0.b.c-d.0.f/'g", ".a[0].b['c-d'][0]['f/\\'g']"], ['a.0.b.c-d.0.h/"i', ".a[0].b['c-d'][0]['h/\"i']"], @@ -354,7 +354,7 @@ describe('JSONSchemaBridge', () => { }); }); - it('works with correct error (complex instance paths)', () => { + test('works with correct error (complex instance paths)', () => { const pairs = [ ["a.0.b.c-d.0.f/'g", ".a[0].b['c-d'][0]['f/\\'g']"], ['a.0.b.c-d.0.h/"i', ".a[0].b['c-d'][0]['h/\"i']"], @@ -368,7 +368,7 @@ describe('JSONSchemaBridge', () => { }); }); - it('works with correct error (complex data paths - JSON pointers)', () => { + test('works with correct error (complex data paths - JSON pointers)', () => { const pairs = [ ["a.0.b.c-d.0.f/'g", "/a/0/b/c-d/0/f~1'g"], ['a.0.b.c-d.0.h/"i', '/a/0/b/c-d/0/h~1"i'], @@ -382,7 +382,7 @@ describe('JSONSchemaBridge', () => { }); }); - it('works with correct error (complex instance paths - JSON pointers)', () => { + test('works with correct error (complex instance paths - JSON pointers)', () => { const pairs = [ ["a.0.b.c-d.0.f/'g", "/a/0/b/c-d/0/f~1'g"], ['a.0.b.c-d.0.h/"i', '/a/0/b/c-d/0/h~1"i'], @@ -396,7 +396,7 @@ describe('JSONSchemaBridge', () => { }); }); - it('works with correct error (complex instance paths - dots in names)', () => { + test('works with correct error (complex instance paths - dots in names)', () => { const pairs = [ ['["a.b.c"].["d.e/f"].g', '/a.b.c/d.e~1f/g'], ['a.["b"]', '/a/b'], @@ -415,16 +415,16 @@ describe('JSONSchemaBridge', () => { }); describe('#getErrorMessage', () => { - it('works without error', () => { + test('works without error', () => { expect(bridge.getErrorMessage('age', undefined)).toBe(''); }); - it('works with invalid error', () => { + test('works with invalid error', () => { expect(bridge.getErrorMessage('age', {})).toBe(''); expect(bridge.getErrorMessage('age', { invalid: true })).toBe(''); }); - it('works with correct error', () => { + test('works with correct error', () => { expect( bridge.getErrorMessage('age', { details: [{ dataPath: '.age', message: 'Zing!' }], @@ -437,7 +437,7 @@ describe('JSONSchemaBridge', () => { ).toBe(''); }); - it('works with correct error (instance path)', () => { + test('works with correct error (instance path)', () => { expect( bridge.getErrorMessage('age', { details: [{ instancePath: '.age', message: 'Zing!' }], @@ -452,23 +452,23 @@ describe('JSONSchemaBridge', () => { }); describe('#getErrorMessages', () => { - it('works without error', () => { + test('works without error', () => { expect(bridge.getErrorMessages(null)).toEqual([]); expect(bridge.getErrorMessages(undefined)).toEqual([]); }); - it('works with other errors', () => { + test('works with other errors', () => { expect(bridge.getErrorMessages('correct')).toEqual(['correct']); expect(bridge.getErrorMessages(999999999)).toEqual([999999999]); }); - it('works with Error', () => { + test('works with Error', () => { expect(bridge.getErrorMessages(new Error('correct'))).toEqual([ 'correct', ]); }); - it('works with ValidationError', () => { + test('works with ValidationError', () => { expect( bridge.getErrorMessages({ details: [{ dataPath: '.age', message: 'Zing!' }], @@ -481,7 +481,7 @@ describe('JSONSchemaBridge', () => { ).toEqual(['Ignore!']); }); - it('works with ValidationError (instance path)', () => { + test('works with ValidationError (instance path)', () => { expect( bridge.getErrorMessages({ details: [{ instancePath: '.age', message: 'Zing!' }], @@ -496,7 +496,7 @@ describe('JSONSchemaBridge', () => { }); describe('#getField', () => { - it('returns correct definition (flat)', () => { + test('returns correct definition (flat)', () => { expect(bridge.getField('age')).toEqual({ type: 'integer', default: 24, @@ -504,7 +504,7 @@ describe('JSONSchemaBridge', () => { }); }); - it('returns correct definition (flat with $ref)', () => { + test('returns correct definition (flat with $ref)', () => { expect(bridge.getField('billingAddress')).toEqual({ properties: expect.objectContaining({ city: { type: 'string', uniforms: { label: false, required: false } }, @@ -523,18 +523,18 @@ describe('JSONSchemaBridge', () => { }); }); - it('returns correct definition (nested)', () => { + test('returns correct definition (nested)', () => { expect(bridge.getField('email.work')).toEqual({ type: 'string' }); }); - it('returns correct definition (nested with $ref)', () => { + test('returns correct definition (nested with $ref)', () => { expect(bridge.getField('personalData.firstName')).toEqual({ default: 'John', type: 'string', }); }); - it('returns correct definition (dots in name)', () => { + test('returns correct definition (dots in name)', () => { expect(bridge.getField('["path.with.a.dot"]')).toMatchObject({ type: 'object', }); @@ -556,30 +556,30 @@ describe('JSONSchemaBridge', () => { }); }); - it('returns correct definition ($ref pointing to $ref)', () => { + test('returns correct definition ($ref pointing to $ref)', () => { expect(bridge.getField('personalData.middleName')).toEqual({ type: 'string', }); }); - it('returns correct definition (array tuple)', () => { + test('returns correct definition (array tuple)', () => { expect(bridge.getField('dateOfBirthTuple.1')).toEqual({ type: 'string' }); }); - it('returns correct definition (array flat $ref)', () => { + test('returns correct definition (array flat $ref)', () => { expect(bridge.getField('friends.$')).toEqual( expect.objectContaining({ type: expect.any(String) }), ); }); - it('returns correct definition (array flat $ref, nested property)', () => { + test('returns correct definition (array flat $ref, nested property)', () => { expect(bridge.getField('friends.$.firstName')).toEqual({ default: 'John', type: 'string', }); }); - it('returns correct definition when schema has top level $ref', () => { + test('returns correct definition when schema has top level $ref', () => { const localBridge = new JSONSchemaBridge( { definitions: schema.definitions, $ref: '#/definitions/personalData' }, validator, @@ -591,7 +591,7 @@ describe('JSONSchemaBridge', () => { }); }); - it('throws when resolving field schema is not possible', () => { + test('throws when resolving field schema is not possible', () => { const localBridge = new JSONSchemaBridge( { definitions: schema.definitions, $ref: '#/definitions/personalData' }, validator, @@ -602,13 +602,13 @@ describe('JSONSchemaBridge', () => { ); }); - it('throws when resolving field schema is not possible (with allOf with $ref field)', () => { + test('throws when resolving field schema is not possible (with allOf with $ref field)', () => { expect(() => bridge.getField('shippingAddress.street.invalid')).toThrow( /Field not found in schema/, ); }); - it('throws when resolving field schema is not possible (with allOf with $ref field without properties prop)', () => { + test('throws when resolving field schema is not possible (with allOf with $ref field without properties prop)', () => { const localBridge = new JSONSchemaBridge( { definitions: schema.definitions, @@ -630,7 +630,7 @@ describe('JSONSchemaBridge', () => { ); }); - it('returns correct definition (allOf with $ref)', () => { + test('returns correct definition (allOf with $ref)', () => { expect(bridge.getField('shippingAddress.street')).toEqual({ type: 'string', }); @@ -638,7 +638,7 @@ describe('JSONSchemaBridge', () => { }); describe('#getInitialValue', () => { - it('works with arrays', () => { + test('works with arrays', () => { expect(bridge.getInitialValue('friends')).toEqual([]); expect(bridge.getInitialValue('friendsMinCount')).toEqual([ { firstName: 'John', lastName: 'John' }, @@ -647,25 +647,25 @@ describe('JSONSchemaBridge', () => { ]); }); - it('works with objects', () => { + test('works with objects', () => { expect(bridge.getInitialValue('billingAddress')).toEqual({}); }); - it('works with undefined primitives', () => { + test('works with undefined primitives', () => { expect(bridge.getInitialValue('salary')).toBe(undefined); }); - it('works with defined primitives', () => { + test('works with defined primitives', () => { expect(bridge.getInitialValue('age')).toBe(24); }); - it('works with default values', () => { + test('works with default values', () => { expect(bridge.getInitialValue('personalData.firstName')).toBe('John'); }); }); describe('#getProps', () => { - it('works with allowedValues', () => { + test('works with allowedValues', () => { expect(bridge.getProps('shippingAddress.type')).toEqual({ allowedValues: ['residential', 'business'], label: 'Type', @@ -673,7 +673,7 @@ describe('JSONSchemaBridge', () => { }); }); - it('works with allowedValues from props', () => { + test('works with allowedValues from props', () => { expect( bridge.getProps('shippingAddress.type', { allowedValues: [1] }), ).toEqual({ @@ -683,14 +683,14 @@ describe('JSONSchemaBridge', () => { }); }); - it('works with allowedValues from props', () => { + test('works with allowedValues from props', () => { expect(bridge.getProps('forcedRequired')).toEqual({ label: 'Forced required', required: true, }); }); - it('works with custom component', () => { + test('works with custom component', () => { expect(bridge.getProps('age')).toEqual({ component: 'span', label: 'Age', @@ -698,28 +698,28 @@ describe('JSONSchemaBridge', () => { }); }); - it('works with label (default)', () => { + test('works with label (default)', () => { expect(bridge.getProps('withLabel')).toEqual({ label: 'Example', required: false, }); }); - it('works with label (custom)', () => { + test('works with label (custom)', () => { expect(bridge.getProps('dateOfBirth', { label: 'Death' })).toEqual({ label: 'Date of birth', required: true, }); }); - it('works with label (true)', () => { + test('works with label (true)', () => { expect(bridge.getProps('dateOfBirth', { label: true })).toEqual({ label: 'Date of birth', required: true, }); }); - it('works with property title as default label', () => { + test('works with property title as default label', () => { expect(bridge.getProps('hasAJob', { label: true })).toEqual({ allowedValues: undefined, label: 'Currently Employed', @@ -729,28 +729,28 @@ describe('JSONSchemaBridge', () => { }); }); - it('works with placeholder (custom)', () => { + test('works with placeholder (custom)', () => { expect(bridge.getProps('email.work', { placeholder: 'Email' })).toEqual({ label: 'Work', required: true, }); }); - it('works with placeholder (true)', () => { + test('works with placeholder (true)', () => { expect(bridge.getProps('email.work', { placeholder: true })).toEqual({ label: 'Work', required: true, }); }); - it('works with placeholder (falsy)', () => { + test('works with placeholder (falsy)', () => { expect(bridge.getProps('email.work', { placeholder: null })).toEqual({ label: 'Work', required: true, }); }); - it('works with placeholder (label falsy)', () => { + test('works with placeholder (label falsy)', () => { expect( bridge.getProps('email.work', { label: null, placeholder: true }), ).toEqual({ @@ -766,7 +766,7 @@ describe('JSONSchemaBridge', () => { }); }); - it('works with Number type', () => { + test('works with Number type', () => { expect(bridge.getProps('salary')).toEqual({ allowedValues: ['low', 'medium', 'height'], decimal: true, @@ -777,7 +777,7 @@ describe('JSONSchemaBridge', () => { }); }); - it('works with options (array)', () => { + test('works with options (array)', () => { expect(bridge.getProps('billingAddress.state').transform('AL')).toBe( 'Alabama', ); @@ -792,14 +792,14 @@ describe('JSONSchemaBridge', () => { ); }); - it('works with options (object)', () => { + test('works with options (object)', () => { expect(bridge.getProps('salary').transform('low')).toBe(6000); expect(bridge.getProps('salary').transform('medium')).toBe(12000); expect(bridge.getProps('salary').allowedValues[0]).toBe('low'); expect(bridge.getProps('salary').allowedValues[1]).toBe('medium'); }); - it('works with options from props', () => { + test('works with options from props', () => { const props = { options: { minimal: 4000, avarage: 8000 } }; expect(bridge.getProps('salary', props).transform('minimal')).toBe(4000); expect(bridge.getProps('salary', props).transform('avarage')).toBe(8000); @@ -807,7 +807,7 @@ describe('JSONSchemaBridge', () => { expect(bridge.getProps('salary', props).allowedValues[1]).toBe('avarage'); }); - it('works with type', () => { + test('works with type', () => { expect(bridge.getProps('password')).toEqual({ label: 'Password', required: false, @@ -825,7 +825,7 @@ describe('JSONSchemaBridge', () => { }); }); - it('works with other props', () => { + test('works with other props', () => { expect(bridge.getProps('personalData.firstName', { x: 1, y: 1 })).toEqual( { label: 'First name', @@ -834,57 +834,57 @@ describe('JSONSchemaBridge', () => { ); }); - it('works with allOf in items', () => { + test('works with allOf in items', () => { expect(bridge.getProps('arrayWithAllOf.0.child')).toEqual({ label: 'Child', required: true, }); }); - it('works with anyOf for a non-object computed property (required default value)', () => { + test('works with anyOf for a non-object computed property (required default value)', () => { expect(bridge.getProps('nonObjectAnyOf')).toHaveProperty( 'required', false, ); }); - it('works with anyOf for a non-object computed property (required)', () => { + test('works with anyOf for a non-object computed property (required)', () => { expect(bridge.getProps('nonObjectAnyOfRequired')).toHaveProperty( 'required', true, ); }); - it('works with anyOf for a non-object computed property (properties not defined)', () => { + test('works with anyOf for a non-object computed property (properties not defined)', () => { expect(bridge.getProps('nonObjectAnyOf')).toHaveProperty( 'properties', undefined, ); }); - it('works with maxItems in props', () => { + test('works with maxItems in props', () => { expect(bridge.getProps('arrayWithAllOf')).toHaveProperty('maxCount', 3); }); - it('works with minItems in props', () => { + test('works with minItems in props', () => { expect(bridge.getProps('arrayWithAllOf')).toHaveProperty('minCount', 1); }); - it('works with maximum in props', () => { + test('works with maximum in props', () => { expect(bridge.getProps('passwordNumeric')).toHaveProperty('max', 9999); }); - it('works with minimum in props', () => { + test('works with minimum in props', () => { expect(bridge.getProps('passwordNumeric')).toHaveProperty('min', 1000); }); - it('works with multipleOf in props', () => { + test('works with multipleOf in props', () => { expect(bridge.getProps('passwordNumeric')).toHaveProperty('step', 3); }); }); describe('#getSubfields', () => { - it('works on top level', () => { + test('works on top level', () => { expect(bridge.getSubfields()).toEqual([ 'age', 'billingAddress', @@ -914,7 +914,7 @@ describe('JSONSchemaBridge', () => { ]); }); - it('works with nested types', () => { + test('works with nested types', () => { expect(bridge.getSubfields('arrayWithAllOf.0')).toEqual(['child']); expect(bridge.getSubfields('shippingAddress')).toEqual([ 'city', @@ -924,7 +924,7 @@ describe('JSONSchemaBridge', () => { ]); }); - it('works with recursive types', () => { + test('works with recursive types', () => { expect(bridge.getSubfields('recursive')).toEqual(['field', 'recursive']); expect(bridge.getSubfields('recursive.recursive')).toEqual([ 'field', @@ -932,12 +932,12 @@ describe('JSONSchemaBridge', () => { ]); }); - it('works with primitives', () => { + test('works with primitives', () => { expect(bridge.getSubfields('personalData.firstName')).toEqual([]); expect(bridge.getSubfields('age')).toEqual([]); }); - it('works when schema has top level $ref', () => { + test('works when schema has top level $ref', () => { const localBridge = new JSONSchemaBridge( { definitions: schema.definitions, $ref: '#/definitions/address' }, validator, @@ -946,11 +946,11 @@ describe('JSONSchemaBridge', () => { expect(localBridge.getSubfields()).toEqual(['city', 'state', 'street']); }); - it('works when an object does not have properties', () => { + test('works when an object does not have properties', () => { expect(bridge.getSubfields('objectWithoutProperties')).toEqual([]); }); - it('works on top level when schema does not have properties', () => { + test('works on top level when schema does not have properties', () => { const localBridge = new JSONSchemaBridge( { definitions: schema.definitions, $ref: '#/definitions/lastName' }, validator, @@ -961,7 +961,7 @@ describe('JSONSchemaBridge', () => { }); describe('#getType', () => { - it('works with any type', () => { + test('works with any type', () => { expect(bridge.getType('age')).toBe(Number); expect(bridge.getType('billingAddress')).toBe(Object); expect(bridge.getType('billingAddress.city')).toBe(String); @@ -988,7 +988,7 @@ describe('JSONSchemaBridge', () => { }); describe('#getValidator', () => { - it('calls correct validator', () => { + test('calls correct validator', () => { expect(bridge.getValidator()).toBe(validator); }); }); diff --git a/packages/uniforms-bridge-json-schema/__tests__/index.ts b/packages/uniforms-bridge-json-schema/__tests__/index.ts index 2b90e331f..fbd5a9dbe 100644 --- a/packages/uniforms-bridge-json-schema/__tests__/index.ts +++ b/packages/uniforms-bridge-json-schema/__tests__/index.ts @@ -1,6 +1,6 @@ import * as uniformsJSONSchema from 'uniforms-bridge-json-schema'; -it('exports everything', () => { +test('exports everything', () => { expect(uniformsJSONSchema).toEqual({ default: expect.any(Function), JSONSchemaBridge: expect.any(Function), diff --git a/packages/uniforms-bridge-simple-schema-2/__tests__/SimpleSchema2Bridge.ts b/packages/uniforms-bridge-simple-schema-2/__tests__/SimpleSchema2Bridge.ts index c054b13ec..cc277de52 100644 --- a/packages/uniforms-bridge-simple-schema-2/__tests__/SimpleSchema2Bridge.ts +++ b/packages/uniforms-bridge-simple-schema-2/__tests__/SimpleSchema2Bridge.ts @@ -54,16 +54,16 @@ describe('SimpleSchema2Bridge', () => { const bridge = new SimpleSchema2Bridge(schema); describe('#getError', () => { - it('works without error', () => { + test('works without error', () => { expect(bridge.getError('a', undefined)).toBe(null); }); - it('works with invalid error', () => { + test('works with invalid error', () => { expect(bridge.getError('a', {})).toBe(null); expect(bridge.getError('a', { invalid: true })).toBe(null); }); - it('works with correct error', () => { + test('works with correct error', () => { expect(bridge.getError('a', { details: [{ name: 'a' }] })).toEqual({ name: 'a', }); @@ -72,16 +72,16 @@ describe('SimpleSchema2Bridge', () => { }); describe('#getErrorMessage', () => { - it('works without error', () => { + test('works without error', () => { expect(bridge.getErrorMessage('a', undefined)).toBe(''); }); - it('works with invalid error', () => { + test('works with invalid error', () => { expect(bridge.getErrorMessage('a', {})).toBe(''); expect(bridge.getErrorMessage('a', { invalid: true })).toBe(''); }); - it('works with correct error', () => { + test('works with correct error', () => { expect( bridge.getErrorMessage('a', { details: [{ name: 'a', details: { value: 1 } }], @@ -96,23 +96,23 @@ describe('SimpleSchema2Bridge', () => { }); describe('#getErrorMessages', () => { - it('works without error', () => { + test('works without error', () => { expect(bridge.getErrorMessages(null)).toEqual([]); expect(bridge.getErrorMessages(undefined)).toEqual([]); }); - it('works with other errors', () => { + test('works with other errors', () => { expect(bridge.getErrorMessages('correct')).toEqual(['correct']); expect(bridge.getErrorMessages(999999999)).toEqual([999999999]); }); - it('works with Error', () => { + test('works with Error', () => { expect(bridge.getErrorMessages(new Error('correct'))).toEqual([ 'correct', ]); }); - it('works with ValidationError', () => { + test('works with ValidationError', () => { expect( bridge.getErrorMessages({ details: [{ name: 'a', details: { value: 1 } }], @@ -127,14 +127,14 @@ describe('SimpleSchema2Bridge', () => { }); describe('#getField', () => { - it('return correct definition', () => { + test('return correct definition', () => { const definition = schema.getDefinition('a'); const definitionComposed = { ...definition, ...definition.type[0] }; expect(bridge.getField('a')).toEqual(definitionComposed); }); - it('return correct definition (`autoValue` hack)', () => { + test('return correct definition (`autoValue` hack)', () => { const definition = schema.getDefinition('x'); const definitionComposed = { ...definition, @@ -145,17 +145,17 @@ describe('SimpleSchema2Bridge', () => { expect(bridge.getField('x')).toEqual(definitionComposed); }); - it('throws on not found field', () => { + test('throws on not found field', () => { expect(() => bridge.getField('xxx')).toThrow(/Field not found in schema/); }); }); describe('#getInitialValue', () => { - it('works with arrays', () => { + test('works with arrays', () => { expect(bridge.getInitialValue('k')).toEqual([]); }); - it('works with arrays (minCount)', () => { + test('works with arrays (minCount)', () => { expect(bridge.getInitialValue('j')).toEqual([ { a: 'x' }, { a: 'x' }, @@ -163,25 +163,25 @@ describe('SimpleSchema2Bridge', () => { ]); }); - it('works with arrays (defaultValue)', () => { + test('works with arrays (defaultValue)', () => { expect(bridge.getInitialValue('y')).toEqual(['y']); }); - it('works with arrays of objects (defaultValue)', () => { + test('works with arrays of objects (defaultValue)', () => { expect(bridge.getInitialValue('zs')).toEqual([{ a: 'a' }]); }); - it('works with objects', () => { + test('works with objects', () => { expect(bridge.getInitialValue('a')).toEqual({ b: {} }); }); - it('works with objects (defaultValue)', () => { + test('works with objects (defaultValue)', () => { expect(bridge.getInitialValue('z')).toEqual({ a: 'a' }); }); }); describe('#getProps', () => { - it('works with allowedValues', () => { + test('works with allowedValues', () => { expect(bridge.getProps('o')).toEqual({ label: 'O', required: true, @@ -189,14 +189,14 @@ describe('SimpleSchema2Bridge', () => { }); }); - it('works with allowedValues from props', () => { + test('works with allowedValues from props', () => { expect(bridge.getProps('o', { allowedValues: ['O'] })).toEqual({ label: 'O', required: true, }); }); - it('works with custom component', () => { + test('works with custom component', () => { expect(bridge.getProps('l')).toEqual({ label: 'L', required: true, @@ -209,7 +209,7 @@ describe('SimpleSchema2Bridge', () => { }); }); - it('works with custom component (field)', () => { + test('works with custom component (field)', () => { expect(bridge.getProps('n')).toEqual({ label: 'N', required: true, @@ -217,7 +217,7 @@ describe('SimpleSchema2Bridge', () => { }); }); - it('works with Number type', () => { + test('works with Number type', () => { expect(bridge.getProps('h')).toEqual({ label: 'H', required: true, @@ -225,28 +225,28 @@ describe('SimpleSchema2Bridge', () => { }); }); - it('works with options (array)', () => { + test('works with options (array)', () => { expect(bridge.getProps('s').transform('a')).toBe(1); expect(bridge.getProps('s').transform('b')).toBe(2); expect(bridge.getProps('s').allowedValues[0]).toBe('a'); expect(bridge.getProps('s').allowedValues[1]).toBe('b'); }); - it('works with options (function)', () => { + test('works with options (function)', () => { expect(bridge.getProps('t').transform('a')).toBe(1); expect(bridge.getProps('t').transform('b')).toBe(2); expect(bridge.getProps('t').allowedValues[0]).toBe('a'); expect(bridge.getProps('t').allowedValues[1]).toBe('b'); }); - it('works with options (object)', () => { + test('works with options (object)', () => { expect(bridge.getProps('r').transform('a')).toBe(1); expect(bridge.getProps('r').transform('b')).toBe(2); expect(bridge.getProps('r').allowedValues[0]).toBe('a'); expect(bridge.getProps('r').allowedValues[1]).toBe('b'); }); - it('works with options from props', () => { + test('works with options from props', () => { expect( bridge.getProps('s', { options: { c: 1, d: 2 } }).transform('c'), ).toBe(1); @@ -261,7 +261,7 @@ describe('SimpleSchema2Bridge', () => { ).toBe('d'); }); - it('works with transform', () => { + test('works with transform', () => { expect(bridge.getProps('p')).toEqual({ label: 'P', required: true, @@ -269,14 +269,14 @@ describe('SimpleSchema2Bridge', () => { }); }); - it('works with transform from props', () => { + test('works with transform from props', () => { expect(bridge.getProps('p', { transform: () => {} })).toEqual({ label: 'P', required: true, }); }); - it('works with type', () => { + test('works with type', () => { expect(bridge.getProps('aa')).toEqual({ label: 'Aa', type: 'password', @@ -284,7 +284,7 @@ describe('SimpleSchema2Bridge', () => { }); }); - it('returns no field type', () => { + test('returns no field type', () => { expect(bridge.getProps('a')).not.toHaveProperty('type'); expect(bridge.getProps('j')).not.toHaveProperty('type'); expect(bridge.getProps('d')).not.toHaveProperty('type'); @@ -294,7 +294,7 @@ describe('SimpleSchema2Bridge', () => { }); describe('#getSubfields', () => { - it('works on top level', () => { + test('works on top level', () => { expect(bridge.getSubfields()).toEqual([ 'a', 'aa', @@ -323,23 +323,23 @@ describe('SimpleSchema2Bridge', () => { ]); }); - it('works with nested schemas', () => { + test('works with nested schemas', () => { expect(bridge.getSubfields('w')).toEqual(['x']); }); - it('works with objects', () => { + test('works with objects', () => { expect(bridge.getSubfields('a')).toEqual(['b']); expect(bridge.getSubfields('a.b')).toEqual(['c']); }); - it('works with primitives', () => { + test('works with primitives', () => { expect(bridge.getSubfields('d')).toEqual([]); expect(bridge.getSubfields('e')).toEqual([]); }); }); describe('#getType', () => { - it('works with any type', () => { + test('works with any type', () => { expect(bridge.getType('a')).toBe(Object); expect(bridge.getType('j')).toBe(Array); expect(bridge.getType('d')).toBe(String); @@ -351,7 +351,7 @@ describe('SimpleSchema2Bridge', () => { }); describe('#getValidator', () => { - it('calls correct validator', () => { + test('calls correct validator', () => { const schema = new SimpleSchema({ x: { type: Number } }); const bridge = new SimpleSchema2Bridge(schema); diff --git a/packages/uniforms-bridge-simple-schema-2/__tests__/index.ts b/packages/uniforms-bridge-simple-schema-2/__tests__/index.ts index c96aa3e7e..81a65f651 100644 --- a/packages/uniforms-bridge-simple-schema-2/__tests__/index.ts +++ b/packages/uniforms-bridge-simple-schema-2/__tests__/index.ts @@ -1,6 +1,6 @@ import * as uniformsSimpleSchema2 from 'uniforms-bridge-simple-schema-2'; -it('exports everything', () => { +test('exports everything', () => { expect(uniformsSimpleSchema2).toEqual({ default: expect.any(Function), SimpleSchema2Bridge: expect.any(Function), diff --git a/packages/uniforms-bridge-simple-schema/__tests__/SimpleSchemaBridge.ts b/packages/uniforms-bridge-simple-schema/__tests__/SimpleSchemaBridge.ts index f93c0eea3..a4626c201 100644 --- a/packages/uniforms-bridge-simple-schema/__tests__/SimpleSchemaBridge.ts +++ b/packages/uniforms-bridge-simple-schema/__tests__/SimpleSchemaBridge.ts @@ -93,16 +93,16 @@ describe('SimpleSchemaBridge', () => { const bridge = new SimpleSchemaBridge(schema); describe('#getError', () => { - it('works without error', () => { + test('works without error', () => { expect(bridge.getError('a', null)).toBe(null); }); - it('works with invalid error', () => { + test('works with invalid error', () => { expect(bridge.getError('a', {})).toBe(null); expect(bridge.getError('a', { invalid: true })).toBe(null); }); - it('works with correct error', () => { + test('works with correct error', () => { expect(bridge.getError('a', { details: [{ name: 'a' }] })).toEqual({ name: 'a', }); @@ -111,16 +111,16 @@ describe('SimpleSchemaBridge', () => { }); describe('#getErrorMessage', () => { - it('works without error', () => { + test('works without error', () => { expect(bridge.getErrorMessage('a', undefined)).toBe(''); }); - it('works with invalid error', () => { + test('works with invalid error', () => { expect(bridge.getErrorMessage('a', {})).toBe(''); expect(bridge.getErrorMessage('a', { invalid: true })).toBe(''); }); - it('works with correct error', () => { + test('works with correct error', () => { expect( bridge.getErrorMessage('a', { details: [{ name: 'a', details: { value: 1 } }], @@ -135,23 +135,23 @@ describe('SimpleSchemaBridge', () => { }); describe('#getErrorMessages', () => { - it('works without error', () => { + test('works without error', () => { expect(bridge.getErrorMessages(null)).toEqual([]); expect(bridge.getErrorMessages(undefined)).toEqual([]); }); - it('works with other errors', () => { + test('works with other errors', () => { expect(bridge.getErrorMessages('correct')).toEqual(['correct']); expect(bridge.getErrorMessages(999999999)).toEqual([999999999]); }); - it('works with Error', () => { + test('works with Error', () => { expect(bridge.getErrorMessages(new Error('correct'))).toEqual([ 'correct', ]); }); - it('works with ValidationError', () => { + test('works with ValidationError', () => { expect( bridge.getErrorMessages({ details: [{ name: 'a', details: { value: 1 } }], @@ -166,21 +166,21 @@ describe('SimpleSchemaBridge', () => { }); describe('#getField', () => { - it('return correct definition', () => { + test('return correct definition', () => { expect(bridge.getField('a')).toEqual(schema.getDefinition('a')); }); - it('throws on not found field', () => { + test('throws on not found field', () => { expect(() => bridge.getField('x')).toThrow(/Field not found in schema/); }); }); describe('#getInitialValue', () => { - it('works with arrays', () => { + test('works with arrays', () => { expect(bridge.getInitialValue('k')).toEqual([]); }); - it('works with arrays (minCount)', () => { + test('works with arrays (minCount)', () => { expect(bridge.getInitialValue('j')).toEqual([ { a: 'x' }, { a: 'x' }, @@ -188,25 +188,25 @@ describe('SimpleSchemaBridge', () => { ]); }); - it('works with arrays (defaultValue)', () => { + test('works with arrays (defaultValue)', () => { expect(bridge.getInitialValue('u')).toEqual(['u']); }); - it('works with arrays of objects (defaultValue)', () => { + test('works with arrays of objects (defaultValue)', () => { expect(bridge.getInitialValue('w')).toEqual([{ a: 'a' }]); }); - it('works with objects', () => { + test('works with objects', () => { expect(bridge.getInitialValue('a')).toEqual({ b: {} }); }); - it('works with objects (defaultValue)', () => { + test('works with objects (defaultValue)', () => { expect(bridge.getInitialValue('v')).toEqual({ a: 'a' }); }); }); describe('#getProps', () => { - it('works with allowedValues', () => { + test('works with allowedValues', () => { expect(bridge.getProps('o')).toEqual({ label: 'O', required: true, @@ -214,14 +214,14 @@ describe('SimpleSchemaBridge', () => { }); }); - it('works with allowedValues from props', () => { + test('works with allowedValues from props', () => { expect(bridge.getProps('o', { allowedValues: ['O'] })).toEqual({ label: 'O', required: true, }); }); - it('works with custom component', () => { + test('works with custom component', () => { expect(bridge.getProps('l')).toEqual({ label: 'L', required: true, @@ -234,7 +234,7 @@ describe('SimpleSchemaBridge', () => { }); }); - it('works with custom component (field)', () => { + test('works with custom component (field)', () => { expect(bridge.getProps('n')).toEqual({ label: 'N', required: true, @@ -242,28 +242,28 @@ describe('SimpleSchemaBridge', () => { }); }); - it('works with options (array)', () => { + test('works with options (array)', () => { expect(bridge.getProps('s').transform('a')).toBe(1); expect(bridge.getProps('s').transform('b')).toBe(2); expect(bridge.getProps('s').allowedValues[0]).toBe('a'); expect(bridge.getProps('s').allowedValues[1]).toBe('b'); }); - it('works with options (function)', () => { + test('works with options (function)', () => { expect(bridge.getProps('t').transform('a')).toBe(1); expect(bridge.getProps('t').transform('b')).toBe(2); expect(bridge.getProps('t').allowedValues[0]).toBe('a'); expect(bridge.getProps('t').allowedValues[1]).toBe('b'); }); - it('works with options (object)', () => { + test('works with options (object)', () => { expect(bridge.getProps('r').transform('a')).toBe(1); expect(bridge.getProps('r').transform('b')).toBe(2); expect(bridge.getProps('r').allowedValues[0]).toBe('a'); expect(bridge.getProps('r').allowedValues[1]).toBe('b'); }); - it('works with options from props', () => { + test('works with options from props', () => { expect( bridge.getProps('s', { options: { c: 1, d: 2 } }).transform('c'), ).toBe(1); @@ -278,7 +278,7 @@ describe('SimpleSchemaBridge', () => { ).toBe('d'); }); - it('works with transform', () => { + test('works with transform', () => { expect(bridge.getProps('p')).toEqual({ label: 'P', required: true, @@ -286,14 +286,14 @@ describe('SimpleSchemaBridge', () => { }); }); - it('works with transform from props', () => { + test('works with transform from props', () => { expect(bridge.getProps('p', { transform: () => {} })).toEqual({ label: 'P', required: true, }); }); - it('works with type', () => { + test('works with type', () => { expect(bridge.getProps('aa')).toEqual({ label: 'AA', type: 'password', @@ -301,7 +301,7 @@ describe('SimpleSchemaBridge', () => { }); }); - it('returns no field type', () => { + test('returns no field type', () => { expect(bridge.getProps('a')).not.toHaveProperty('type'); expect(bridge.getProps('j')).not.toHaveProperty('type'); expect(bridge.getProps('d')).not.toHaveProperty('type'); @@ -311,19 +311,19 @@ describe('SimpleSchemaBridge', () => { }); describe('#getSubfields', () => { - it('works with objects', () => { + test('works with objects', () => { expect(bridge.getSubfields('a')).toEqual(['b']); expect(bridge.getSubfields('a.b')).toEqual(['c']); }); - it('works with primitives', () => { + test('works with primitives', () => { expect(bridge.getSubfields('d')).toEqual([]); expect(bridge.getSubfields('e')).toEqual([]); }); }); describe('#getType', () => { - it('works with any type', () => { + test('works with any type', () => { expect(bridge.getType('a')).toBe(Object); expect(bridge.getType('j')).toBe(Array); expect(bridge.getType('d')).toBe(String); @@ -333,7 +333,7 @@ describe('SimpleSchemaBridge', () => { }); describe('#getValidator', () => { - it('calls correct validator', () => { + test('calls correct validator', () => { const bridge = new SimpleSchemaBridge({ ...schema, validator() { diff --git a/packages/uniforms-bridge-simple-schema/__tests__/index.ts b/packages/uniforms-bridge-simple-schema/__tests__/index.ts index 1c1b5ef31..b1aa4b935 100644 --- a/packages/uniforms-bridge-simple-schema/__tests__/index.ts +++ b/packages/uniforms-bridge-simple-schema/__tests__/index.ts @@ -1,6 +1,6 @@ import * as uniformsSimpleSchema from 'uniforms-bridge-simple-schema'; -it('exports everything', () => { +test('exports everything', () => { expect(uniformsSimpleSchema).toEqual({ default: expect.any(Function), SimpleSchemaBridge: expect.any(Function), diff --git a/packages/uniforms-bridge-zod/__tests__/ZodBridge.ts b/packages/uniforms-bridge-zod/__tests__/ZodBridge.ts index 5ee9546f7..2b907df48 100644 --- a/packages/uniforms-bridge-zod/__tests__/ZodBridge.ts +++ b/packages/uniforms-bridge-zod/__tests__/ZodBridge.ts @@ -32,14 +32,14 @@ import { describe('ZodBridge', () => { describe('#getError', () => { - it('works without error', () => { + test('works without error', () => { const schema = object({ a: string() }); const bridge = new ZodBridge(schema); expect(bridge.getError('a', null)).toBe(null); expect(bridge.getError('a', undefined)).toBe(null); }); - it('works with simple types', () => { + test('works with simple types', () => { const schema = object({ a: string(), b: number() }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({}); @@ -48,7 +48,7 @@ describe('ZodBridge', () => { expect(bridge.getError('b', error)).toBe(issues?.[1]); }); - it('works with arrays', () => { + test('works with arrays', () => { const schema = object({ a: array(array(string())) }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({ a: [['x', 'y', 0], [1]] }); @@ -61,7 +61,7 @@ describe('ZodBridge', () => { expect(bridge.getError('a.1.0', error)).toBe(issues?.[1]); }); - it('works with nested objects', () => { + test('works with nested objects', () => { const schema = object({ a: object({ b: object({ c: string() }) }) }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({ a: { b: { c: 1 } } }); @@ -73,14 +73,14 @@ describe('ZodBridge', () => { }); describe('#getErrorMessage', () => { - it('works without error', () => { + test('works without error', () => { const schema = object({ a: string() }); const bridge = new ZodBridge(schema); expect(bridge.getErrorMessage('a', null)).toBe(''); expect(bridge.getErrorMessage('a', undefined)).toBe(''); }); - it('works with simple types', () => { + test('works with simple types', () => { const schema = object({ a: string(), b: number() }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({}); @@ -89,7 +89,7 @@ describe('ZodBridge', () => { expect(bridge.getErrorMessage('b', error)).toBe(issues?.[1].message); }); - it('works with arrays', () => { + test('works with arrays', () => { const schema = object({ a: array(array(string())) }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({ a: [['x', 'y', 0], [1]] }); @@ -102,7 +102,7 @@ describe('ZodBridge', () => { expect(bridge.getErrorMessage('a.1.0', error)).toBe(issues?.[1].message); }); - it('works with nested objects', () => { + test('works with nested objects', () => { const schema = object({ a: object({ b: object({ c: string() }) }) }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({ a: { b: { c: 1 } } }); @@ -114,20 +114,20 @@ describe('ZodBridge', () => { }); describe('#getErrorMessages', () => { - it('works without error', () => { + test('works without error', () => { const schema = object({ a: string() }); const bridge = new ZodBridge(schema); expect(bridge.getErrorMessages(null)).toEqual([]); expect(bridge.getErrorMessages(undefined)).toEqual([]); }); - it('works with generic error', () => { + test('works with generic error', () => { const schema = object({ a: string() }); const bridge = new ZodBridge(schema); expect(bridge.getErrorMessages(new Error('Error'))).toEqual(['Error']); }); - it('works with simple types', () => { + test('works with simple types', () => { const schema = object({ a: string(), b: number() }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({}); @@ -135,7 +135,7 @@ describe('ZodBridge', () => { expect(bridge.getErrorMessages(error)).toEqual(messages); }); - it('works with arrays', () => { + test('works with arrays', () => { const schema = object({ a: array(array(string())) }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({ a: [['x', 'y', 0], [1]] }); @@ -143,7 +143,7 @@ describe('ZodBridge', () => { expect(bridge.getErrorMessages(error)).toEqual(messages); }); - it('works with nested objects', () => { + test('works with nested objects', () => { const schema = object({ a: object({ b: object({ c: string() }) }) }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({ a: { b: { c: 1 } } }); @@ -153,20 +153,20 @@ describe('ZodBridge', () => { }); describe('#getField', () => { - it('works with root schema', () => { + test('works with root schema', () => { const schema = object({}); const bridge = new ZodBridge(schema); expect(bridge.getField('')).toBe(schema); }); - it('works with simple types', () => { + test('works with simple types', () => { const schema = object({ a: string(), b: number() }); const bridge = new ZodBridge(schema); expect(bridge.getField('a')).toBe(schema.shape.a); expect(bridge.getField('b')).toBe(schema.shape.b); }); - it('works with arrays', () => { + test('works with arrays', () => { const schema = object({ a: array(array(string())) }); const bridge = new ZodBridge(schema); expect(bridge.getField('a')).toBe(schema.shape.a); @@ -174,7 +174,7 @@ describe('ZodBridge', () => { expect(bridge.getField('a.$.$')).toBe(schema.shape.a.element.element); }); - it('works with nested objects', () => { + test('works with nested objects', () => { const schema = object({ a: object({ b: object({ c: string() }) }) }); const bridge = new ZodBridge(schema); expect(bridge.getField('a')).toBe(schema.shape.a); @@ -182,7 +182,7 @@ describe('ZodBridge', () => { expect(bridge.getField('a.b.c')).toBe(schema.shape.a.shape.b.shape.c); }); - it('works with default', () => { + test('works with default', () => { const schema = object({ a: object({ b: string() }).default({ b: 'x' }) }); const bridge = new ZodBridge(schema); expect(bridge.getField('a')).toBe(schema.shape.a); @@ -191,7 +191,7 @@ describe('ZodBridge', () => { ); }); - it('works with optional', () => { + test('works with optional', () => { const schema = object({ a: optional(object({ b: string() })) }); const bridge = new ZodBridge(schema); expect(bridge.getField('a')).toBe(schema.shape.a); @@ -200,7 +200,7 @@ describe('ZodBridge', () => { }); describe('#getInitialValue', () => { - it('works with array', () => { + test('works with array', () => { const schema = object({ a: array(array(string())) }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual([]); @@ -208,7 +208,7 @@ describe('ZodBridge', () => { expect(bridge.getInitialValue('a.0.0')).toEqual(undefined); }); - it('works with array (min length)', () => { + test('works with array (min length)', () => { const schema = object({ a: array(array(string()).min(1)).min(2) }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual([[], []]); @@ -216,25 +216,25 @@ describe('ZodBridge', () => { expect(bridge.getInitialValue('a.0.0')).toEqual(undefined); }); - it('works with boolean', () => { + test('works with boolean', () => { const schema = object({ a: boolean() }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual(undefined); }); - it('works with date', () => { + test('works with date', () => { const schema = object({ a: date() }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual(undefined); }); - it('works with enum (array)', () => { + test('works with enum (array)', () => { const schema = object({ a: enum_(['x', 'y', 'z']) }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual('x'); }); - it('works with enum (native, numbers)', () => { + test('works with enum (native, numbers)', () => { enum Test { x, y, @@ -246,7 +246,7 @@ describe('ZodBridge', () => { expect(bridge.getInitialValue('a')).toEqual(0); }); - it('works with enum (native, string)', () => { + test('works with enum (native, string)', () => { enum Test { x = 'x', y = 'y', @@ -258,13 +258,13 @@ describe('ZodBridge', () => { expect(bridge.getInitialValue('a')).toEqual('x'); }); - it('works with number', () => { + test('works with number', () => { const schema = object({ a: number() }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual(undefined); }); - it('works with object', () => { + test('works with object', () => { const schema = object({ a: object({ b: object({ c: string() }) }) }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual({ b: {} }); @@ -272,19 +272,19 @@ describe('ZodBridge', () => { expect(bridge.getInitialValue('a.b.c')).toEqual(undefined); }); - it('works with default', () => { + test('works with default', () => { const schema = object({ a: string().default('x') }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual('x'); }); - it('works with optional', () => { + test('works with optional', () => { const schema = object({ a: optional(string()) }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual(undefined); }); - it('works with string', () => { + test('works with string', () => { const schema = object({ a: string() }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual(undefined); @@ -292,7 +292,7 @@ describe('ZodBridge', () => { }); describe('#getProps', () => { - it('works with array', () => { + test('works with array', () => { const schema = object({ a: array(array(string())) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ label: 'A', required: true }); @@ -300,7 +300,7 @@ describe('ZodBridge', () => { expect(bridge.getProps('a.0.0')).toEqual({ label: '0', required: true }); }); - it('works with array (maxCount)', () => { + test('works with array (maxCount)', () => { const schema = object({ a: array(array(string())).max(1) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ @@ -310,7 +310,7 @@ describe('ZodBridge', () => { }); }); - it('works with array (minCount)', () => { + test('works with array (minCount)', () => { const schema = object({ a: array(array(string())).min(1) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ @@ -320,19 +320,19 @@ describe('ZodBridge', () => { }); }); - it('works with boolean', () => { + test('works with boolean', () => { const schema = object({ a: boolean() }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ label: 'A', required: true }); }); - it('works with date', () => { + test('works with date', () => { const schema = object({ a: date() }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ label: 'A', required: true }); }); - it('works with enum (array)', () => { + test('works with enum (array)', () => { const schema = object({ a: enum_(['x', 'y', 'z']) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ @@ -342,7 +342,7 @@ describe('ZodBridge', () => { }); }); - it('works with enum (native, number)', () => { + test('works with enum (native, number)', () => { enum Test { x, y, @@ -358,7 +358,7 @@ describe('ZodBridge', () => { }); }); - it('works with enum (native, string)', () => { + test('works with enum (native, string)', () => { enum Test { x = 'x', y = 'y', @@ -374,7 +374,7 @@ describe('ZodBridge', () => { }); }); - it('works with number', () => { + test('works with number', () => { const schema = object({ a: number() }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ @@ -384,13 +384,13 @@ describe('ZodBridge', () => { }); }); - it('works with number (int)', () => { + test('works with number (int)', () => { const schema = object({ a: number().int() }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ label: 'A', required: true }); }); - it('works with number (max)', () => { + test('works with number (max)', () => { const schema = object({ a: number().max(1) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ @@ -401,7 +401,7 @@ describe('ZodBridge', () => { }); }); - it('works with number (min)', () => { + test('works with number (min)', () => { const schema = object({ a: number().min(1) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ @@ -412,7 +412,7 @@ describe('ZodBridge', () => { }); }); - it('works with number (multipleOf)', () => { + test('works with number (multipleOf)', () => { const schema = object({ a: number().int().multipleOf(7) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ @@ -422,7 +422,7 @@ describe('ZodBridge', () => { }); }); - it('works with object', () => { + test('works with object', () => { const schema = object({ a: object({ b: object({ c: string() }) }) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ label: 'A', required: true }); @@ -430,19 +430,19 @@ describe('ZodBridge', () => { expect(bridge.getProps('a.b.c')).toEqual({ label: 'C', required: true }); }); - it('works with default', () => { + test('works with default', () => { const schema = object({ a: string().default('x') }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ label: 'A', required: false }); }); - it('works with optional', () => { + test('works with optional', () => { const schema = object({ a: optional(string()) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ label: 'A', required: false }); }); - it('works with string', () => { + test('works with string', () => { const schema = object({ a: string() }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ label: 'A', required: true }); @@ -450,26 +450,26 @@ describe('ZodBridge', () => { }); describe('#getSubfields', () => { - it('works with empty objects', () => { + test('works with empty objects', () => { const schema = object({}); const bridge = new ZodBridge(schema); expect(bridge.getSubfields()).toEqual([]); }); - it('works with non-empty objects', () => { + test('works with non-empty objects', () => { const schema = object({ a: string(), b: number() }); const bridge = new ZodBridge(schema); expect(bridge.getSubfields()).toEqual(['a', 'b']); }); - it('works with simple types', () => { + test('works with simple types', () => { const schema = object({ a: string(), b: number() }); const bridge = new ZodBridge(schema); expect(bridge.getSubfields('a')).toEqual([]); expect(bridge.getSubfields('b')).toEqual([]); }); - it('works with arrays', () => { + test('works with arrays', () => { const schema = object({ a: array(array(string())) }); const bridge = new ZodBridge(schema); expect(bridge.getSubfields('a')).toEqual(['$']); @@ -477,7 +477,7 @@ describe('ZodBridge', () => { expect(bridge.getSubfields('a.$.$')).toEqual([]); }); - it('works with nested objects', () => { + test('works with nested objects', () => { const schema = object({ a: object({ b: object({ c: string() }) }) }); const bridge = new ZodBridge(schema); expect(bridge.getSubfields('a')).toEqual(['b']); @@ -485,14 +485,14 @@ describe('ZodBridge', () => { expect(bridge.getSubfields('a.b.c')).toEqual([]); }); - it('works with optional', () => { + test('works with optional', () => { const schema = object({ a: object({ b: string() }).default({ b: 'x' }) }); const bridge = new ZodBridge(schema); expect(bridge.getSubfields('a')).toEqual(['b']); expect(bridge.getSubfields('a.b')).toEqual([]); }); - it('works with optional', () => { + test('works with optional', () => { const schema = object({ a: optional(object({ b: string() })) }); const bridge = new ZodBridge(schema); expect(bridge.getSubfields('a')).toEqual(['b']); @@ -501,31 +501,31 @@ describe('ZodBridge', () => { }); describe('#getType', () => { - it('works with array', () => { + test('works with array', () => { const schema = object({ a: array(array(string())) }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(Array); }); - it('works with boolean', () => { + test('works with boolean', () => { const schema = object({ a: boolean() }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(Boolean); }); - it('works with date', () => { + test('works with date', () => { const schema = object({ a: date() }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(Date); }); - it('works with enum (array)', () => { + test('works with enum (array)', () => { const schema = object({ a: enum_(['x', 'y', 'z']) }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(String); }); - it('works with enum (native, number)', () => { + test('works with enum (native, number)', () => { enum Test { x, y, @@ -537,7 +537,7 @@ describe('ZodBridge', () => { expect(bridge.getType('a')).toBe(Number); }); - it('works with enum (native, string)', () => { + test('works with enum (native, string)', () => { enum Test { x = 'x', y = 'y', @@ -549,31 +549,31 @@ describe('ZodBridge', () => { expect(bridge.getType('a')).toBe(String); }); - it('works with number', () => { + test('works with number', () => { const schema = object({ a: number() }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(Number); }); - it('works with object', () => { + test('works with object', () => { const schema = object({ a: object({ b: object({ c: string() }) }) }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(Object); }); - it('works with default', () => { + test('works with default', () => { const schema = object({ a: string().default('x') }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(String); }); - it('works with optional', () => { + test('works with optional', () => { const schema = object({ a: optional(string()) }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(String); }); - it('works with string', () => { + test('works with string', () => { const schema = object({ a: string() }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(String); @@ -614,7 +614,7 @@ describe('ZodBridge', () => { }); describe('#getValidator', () => { - it('return a function', () => { + test('return a function', () => { const schema = object({}); const bridge = new ZodBridge(schema); const validator = bridge.getValidator(); diff --git a/packages/uniforms-bridge-zod/__tests__/index.ts b/packages/uniforms-bridge-zod/__tests__/index.ts index 5bd69d955..80a00251b 100644 --- a/packages/uniforms-bridge-zod/__tests__/index.ts +++ b/packages/uniforms-bridge-zod/__tests__/index.ts @@ -1,6 +1,6 @@ import * as uniformsZod from 'uniforms-bridge-zod'; -it('exports everything', () => { +test('exports everything', () => { expect(uniformsZod).toEqual({ default: expect.any(Function), ZodBridge: expect.any(Function), diff --git a/packages/uniforms-material/__tests__/AutoField.tsx b/packages/uniforms-material/__tests__/AutoField.tsx index 5d39d0d79..02d0e3d47 100644 --- a/packages/uniforms-material/__tests__/AutoField.tsx +++ b/packages/uniforms-material/__tests__/AutoField.tsx @@ -14,14 +14,14 @@ import { import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(AutoField)).toHaveLength(1); }); -it(' - detects RadioField', () => { +test(' - detects RadioField', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ it(' - detects RadioField', () => { expect(wrapper.find(RadioField.Component)).toHaveLength(1); }); -it(' - detects SelectField', () => { +test(' - detects SelectField', () => { const element = ; const wrapper = mount( element, @@ -50,14 +50,14 @@ it(' - detects SelectField', () => { expect(wrapper.find(SelectField.Component)).toHaveLength(1); }); -it(' - detects DateField', () => { +test(' - detects DateField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DateField.Component)).toHaveLength(1); }); -it(' - detects ListField', () => { +test(' - detects ListField', () => { const element = ; const wrapper = mount( element, @@ -67,35 +67,35 @@ it(' - detects ListField', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -it(' - detects NumField', () => { +test(' - detects NumField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(NumField.Component)).toHaveLength(1); }); -it(' - detects NestField', () => { +test(' - detects NestField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Object } })); expect(wrapper.find(NestField)).toHaveLength(1); }); -it(' - detects TextField', () => { +test(' - detects TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField.Component)).toHaveLength(1); }); -it(' - detects BoolField', () => { +test(' - detects BoolField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(BoolField.Component)).toHaveLength(1); }); -it(' - uses Component (schema)', () => { +test(' - uses Component (schema)', () => { const Component = jest.fn(() => null); const element = ; @@ -107,7 +107,7 @@ it(' - uses Component (schema)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -it(' - uses Component (props)', () => { +test(' - uses Component (props)', () => { const Component = jest.fn(() => null); const element = ; @@ -116,7 +116,7 @@ it(' - uses Component (props)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -it(' - uses Component (context)', () => { +test(' - uses Component (context)', () => { const FieldA = jest.fn(() => null); const FieldB = jest.fn(() => null); @@ -136,7 +136,7 @@ it(' - uses Component (context)', () => { expect(FieldB).toHaveBeenCalledTimes(1); }); -it(' - uses Component (invalid)', () => { +test(' - uses Component (invalid)', () => { const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {}); expect(() => { const element = ; diff --git a/packages/uniforms-material/__tests__/AutoFields.tsx b/packages/uniforms-material/__tests__/AutoFields.tsx index 3047a901b..87a716af2 100644 --- a/packages/uniforms-material/__tests__/AutoFields.tsx +++ b/packages/uniforms-material/__tests__/AutoFields.tsx @@ -4,14 +4,14 @@ import { AutoField, AutoFields } from 'uniforms-material'; import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('AutoFields')).toHaveLength(1); }); -it(' - render all fields by default', () => { +test(' - render all fields by default', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - render all fields by default', () => { expect(wrapper.find('input')).toHaveLength(3); }); -it(' - renders only specified fields', () => { +test(' - renders only specified fields', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ it(' - renders only specified fields', () => { ); }); -it(' - does not render ommited fields', () => { +test(' - does not render ommited fields', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ it(' - does not render ommited fields', () => { ); }); -it(' - wraps fields in specified element', () => { +test(' - wraps fields in specified element', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ it(' - wraps fields in specified element', () => { expect(wrapper.find('section').find('input')).toHaveLength(3); }); -it(' - pass props to the children', () => { +test(' - pass props to the children', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-material/__tests__/AutoForm.tsx b/packages/uniforms-material/__tests__/AutoForm.tsx index 6b6f4f134..ad19f360c 100644 --- a/packages/uniforms-material/__tests__/AutoForm.tsx +++ b/packages/uniforms-material/__tests__/AutoForm.tsx @@ -5,7 +5,7 @@ import createContext from './_createContext'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-material/__tests__/BaseForm.tsx b/packages/uniforms-material/__tests__/BaseForm.tsx index 2a4cf5c4d..ae68898b5 100644 --- a/packages/uniforms-material/__tests__/BaseForm.tsx +++ b/packages/uniforms-material/__tests__/BaseForm.tsx @@ -5,7 +5,7 @@ import createContext from './_createContext'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-material/__tests__/BoolField.tsx b/packages/uniforms-material/__tests__/BoolField.tsx index a14e1bbd9..e6f6b4fdb 100644 --- a/packages/uniforms-material/__tests__/BoolField.tsx +++ b/packages/uniforms-material/__tests__/BoolField.tsx @@ -13,7 +13,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - BoolField tests', () => { - it(' - default props are not passed when MUI theme props are specified', () => { + test(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: false, margin: 'normal' } }, }); @@ -33,7 +33,7 @@ describe('@RTL - BoolField tests', () => { ); }); - it(' - default props are passed when MUI theme props are absent', () => { + test(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -51,7 +51,7 @@ describe('@RTL - BoolField tests', () => { ); }); - it(' - explicit props are passed when MUI theme props are specified', () => { + test(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: true, margin: 'dense' } }, }); @@ -77,14 +77,14 @@ describe('@RTL - BoolField tests', () => { }); }); -it(' - renders an Checkbox', () => { +test(' - renders an Checkbox', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(Checkbox)).toHaveLength(1); }); -it(' - renders a Checkbox with correct id (inherited)', () => { +test(' - renders a Checkbox with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -92,7 +92,7 @@ it(' - renders a Checkbox with correct id (inherited)', () => { expect(wrapper.find(Checkbox).prop('id')).toBeTruthy(); }); -it(' - renders a Checkbox with correct id (specified)', () => { +test(' - renders a Checkbox with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -100,7 +100,7 @@ it(' - renders a Checkbox with correct id (specified)', () => { expect(wrapper.find(Checkbox).prop('id')).toBe('y'); }); -it(' - renders a Checkbox with correct name', () => { +test(' - renders a Checkbox with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -108,7 +108,7 @@ it(' - renders a Checkbox with correct name', () => { expect(wrapper.find(Checkbox).prop('name')).toBe('x'); }); -it(' - renders an Checkbox with correct disabled state', () => { +test(' - renders an Checkbox with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -116,7 +116,7 @@ it(' - renders an Checkbox with correct disabled state', () => { expect(wrapper.find(Checkbox).prop('disabled')).toBe(true); }); -it(' - renders a Checkbox with correct label (specified)', () => { +test(' - renders a Checkbox with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -124,7 +124,7 @@ it(' - renders a Checkbox with correct label (specified)', () => { expect(wrapper.find(FormControlLabel).prop('label')).toBe('BoolFieldLabel'); }); -it(' - renders a Checkbox with correct value (default)', () => { +test(' - renders a Checkbox with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -132,7 +132,7 @@ it(' - renders a Checkbox with correct value (default)', () => { expect(wrapper.find(Checkbox).prop('checked')).toBe(false); }); -it(' - renders a Checkbox with correct value (model)', () => { +test(' - renders a Checkbox with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -143,7 +143,7 @@ it(' - renders a Checkbox with correct value (model)', () => { expect(wrapper.find(Checkbox).prop('checked')).toBe(true); }); -it(' - renders a Checkbox with correct value (specified)', () => { +test(' - renders a Checkbox with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -151,7 +151,7 @@ it(' - renders a Checkbox with correct value (specified)', () => { expect(wrapper.find(Checkbox).prop('checked')).toBe(true); }); -it(' - renders a Checkbox which correctly reacts on change', () => { +test(' - renders a Checkbox which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -165,14 +165,14 @@ it(' - renders a Checkbox which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', false); }); -it(' - renders an Switch', () => { +test(' - renders an Switch', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(Switch)).toHaveLength(1); }); -it(' - renders a Switch with correct id (inherited)', () => { +test(' - renders a Switch with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -180,7 +180,7 @@ it(' - renders a Switch with correct id (inherited)', () => { expect(wrapper.find(Switch).prop('id')).toBeTruthy(); }); -it(' - renders a Switch with correct id (specified)', () => { +test(' - renders a Switch with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -188,7 +188,7 @@ it(' - renders a Switch with correct id (specified)', () => { expect(wrapper.find(Switch).prop('id')).toBe('y'); }); -it(' - renders a Switch with correct name', () => { +test(' - renders a Switch with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -196,7 +196,7 @@ it(' - renders a Switch with correct name', () => { expect(wrapper.find(Switch).prop('name')).toBe('x'); }); -it(' - renders an Switch with correct disabled state', () => { +test(' - renders an Switch with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -204,7 +204,7 @@ it(' - renders an Switch with correct disabled state', () => { expect(wrapper.find(Switch).prop('disabled')).toBe(true); }); -it(' - renders a Switch with correct label (specified)', () => { +test(' - renders a Switch with correct label (specified)', () => { const element = ( ); @@ -214,7 +214,7 @@ it(' - renders a Switch with correct label (specified)', () => { expect(wrapper.find(FormControlLabel).prop('label')).toBe('BoolFieldLabel'); }); -it(' - renders a Switch with correct label (transform)', () => { +test(' - renders a Switch with correct label (transform)', () => { const element = ( - renders a Switch with correct label (transform)', () => { expect(wrapper.find(FormControlLabel).prop('label')).toBe('BOOLFIELDLABEL'); }); -it(' - renders a Switch with correct legend (specified)', () => { +test(' - renders a Switch with correct legend (specified)', () => { const element = ( ); @@ -239,7 +239,7 @@ it(' - renders a Switch with correct legend (specified)', () => { expect(wrapper.find(FormLabel).text()).toBe('BoolFieldLegend *'); }); -it(' - renders a Switch with correct value (default)', () => { +test(' - renders a Switch with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -247,7 +247,7 @@ it(' - renders a Switch with correct value (default)', () => { expect(wrapper.find(Switch).prop('checked')).toBe(false); }); -it(' - renders a Switch with correct value (model)', () => { +test(' - renders a Switch with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -258,7 +258,7 @@ it(' - renders a Switch with correct value (model)', () => { expect(wrapper.find(Switch).prop('checked')).toBe(true); }); -it(' - renders a Switch with correct value (specified)', () => { +test(' - renders a Switch with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -266,7 +266,7 @@ it(' - renders a Switch with correct value (specified)', () => { expect(wrapper.find(Switch).prop('checked')).toBe(true); }); -it(' - renders a Switch which correctly reacts on change', () => { +test(' - renders a Switch which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -280,7 +280,7 @@ it(' - renders a Switch which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', false); }); -it(' - renders a helperText', () => { +test(' - renders a helperText', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); diff --git a/packages/uniforms-material/__tests__/DateField.tsx b/packages/uniforms-material/__tests__/DateField.tsx index 0df7166de..fcd15f1dc 100644 --- a/packages/uniforms-material/__tests__/DateField.tsx +++ b/packages/uniforms-material/__tests__/DateField.tsx @@ -14,7 +14,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - DateField tests', () => { - it(' - handles "date" type correctly', () => { + test(' - handles "date" type correctly', () => { const onChange = jest.fn(); const initialDate = new Date(Date.UTC(2020, 0, 1)); @@ -36,7 +36,7 @@ describe('@RTL - DateField tests', () => { }); describe('@RTL - DateField tests', () => { - it(' - default props are not passed when MUI theme props are specified', () => { + test(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: false, margin: 'normal' } }, }); @@ -56,7 +56,7 @@ describe('@RTL - DateField tests', () => { ); }); - it(' - default props are passed when MUI theme props are absent', () => { + test(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -74,7 +74,7 @@ describe('@RTL - DateField tests', () => { ); }); - it(' - explicit props are passed when MUI theme props are specified', () => { + test(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: true, margin: 'dense' } }, }); @@ -100,56 +100,56 @@ describe('@RTL - DateField tests', () => { }); }); -it(' - renders Input', () => { +test(' - renders Input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(Input)).toHaveLength(1); }); -it(' - renders a Input with correct id (inherited)', () => { +test(' - renders a Input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(Input).prop('id')).toBeTruthy(); }); -it(' - renders a Input with correct id (specified)', () => { +test(' - renders a Input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(Input).prop('id')).toBe('y'); }); -it(' - renders a Input with correct name', () => { +test(' - renders a Input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(Input).prop('name')).toBe('x'); }); -it(' - renders an Input with correct disabled state', () => { +test(' - renders an Input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(FormControl).prop('disabled')).toBe(true); }); -it(' - renders an Input with correct readOnly state', () => { +test(' - renders an Input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(Input).prop('inputProps')!.readOnly).toBe(true); }); -it(' - renders a Input with correct label (specified)', () => { +test(' - renders a Input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(FormLabel).text()).toBe('DateFieldLabel *'); }); -it(' - renders a Input with correct value (default)', () => { +test(' - renders a Input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -173,7 +173,7 @@ test.each(['datetime-local', 'date'] as const)( }, ); -it(' - renders a Input with correct value (specified)', () => { +test(' - renders a Input with correct value (specified)', () => { const now = new Date(); const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -183,7 +183,7 @@ it(' - renders a Input with correct value (specified)', () => { ); }); -it(' - renders a Input which correctly reacts on change', () => { +test(' - renders a Input which correctly reacts on change', () => { const onChange = jest.fn(); const now = new Date(); @@ -198,7 +198,7 @@ it(' - renders a Input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', now); }); -it(' - renders a Input which correctly reacts on change (empty)', () => { +test(' - renders a Input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -214,7 +214,7 @@ it(' - renders a Input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a Input which correctly reacts on change (overflow)', () => { +test(' - renders a Input which correctly reacts on change (overflow)', () => { const onChange = jest.fn(); const now = new Date(1e5, 0); @@ -229,7 +229,7 @@ it(' - renders a Input which correctly reacts on change (overflow)', expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a Input with correct error text (specified)', () => { +test(' - renders a Input with correct error text (specified)', () => { const error = new Error(); const element = ( @@ -239,7 +239,7 @@ it(' - renders a Input with correct error text (specified)', () => { expect(wrapper.find(FormHelperText).text()).toBe('Error'); }); -it(' - renders a Input with correct error text (showInlineError=false)', () => { +test(' - renders a Input with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( { - it(' - default props are not passed when MUI theme props are specified', () => { + test(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { @@ -45,7 +45,7 @@ describe('@RTL - ErrorField tests', () => { ).toHaveLength(1); }); - it(' - default props are passed when MUI theme props are absent', () => { + test(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -67,7 +67,7 @@ describe('@RTL - ErrorField tests', () => { ).toHaveLength(0); }); - it(' - explicit props are passed when MUI theme props are specified', () => { + test(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: true, margin: 'dense', variant: 'filled' }, @@ -100,14 +100,14 @@ describe('@RTL - ErrorField tests', () => { }); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorField)).toHaveLength(1); }); -it(' - renders correct error message (context)', () => { +test(' - renders correct error message (context)', () => { const element = ; const wrapper = mount( element, @@ -118,7 +118,7 @@ it(' - renders correct error message (context)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -it(' - renders correct error message (specified)', () => { +test(' - renders correct error message (specified)', () => { const element = ( { - it(' - default props are not passed when MUI theme props are specified', () => { + test(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { @@ -50,7 +50,7 @@ describe('@RTL - ErrorsField tests', () => { ).toHaveLength(3); }); - it(' - default props are passed when MUI theme props are absent', () => { + test(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -72,7 +72,7 @@ describe('@RTL - ErrorsField tests', () => { ).toHaveLength(0); }); - it(' - explicit props are passed when MUI theme props are specified', () => { + test(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: true, margin: 'dense', variant: 'filled' }, @@ -105,14 +105,14 @@ describe('@RTL - ErrorsField tests', () => { }); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorsField)).toHaveLength(1); }); -it(' - renders list of correct error messages (context)', () => { +test(' - renders list of correct error messages (context)', () => { const element = ; const wrapper = mount( element, @@ -128,7 +128,7 @@ it(' - renders list of correct error messages (context)', () => { expect(wrapper.find(FormHelperText).at(2).text()).toBe('Z is required'); }); -it(' - renders children (specified)', () => { +test(' - renders children (specified)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-material/__tests__/HiddenField.tsx b/packages/uniforms-material/__tests__/HiddenField.tsx index c0258a9f4..6f0ad02d0 100644 --- a/packages/uniforms-material/__tests__/HiddenField.tsx +++ b/packages/uniforms-material/__tests__/HiddenField.tsx @@ -4,14 +4,14 @@ import { HiddenField } from 'uniforms-material'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('hidden'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -62,7 +62,7 @@ it(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input which correctly reacts on model change', () => { +test(' - renders an input which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -76,7 +76,7 @@ it(' - renders an input which correctly reacts on model change', () expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders an input which correctly reacts on model change (empty)', () => { +test(' - renders an input which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -90,7 +90,7 @@ it(' - renders an input which correctly reacts on model change (emp expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders an input which correctly reacts on model change (same value)', () => { +test(' - renders an input which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -104,14 +104,14 @@ it(' - renders an input which correctly reacts on model change (sam expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders nothing', () => { +test(' - renders nothing', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.children()).toHaveLength(0); }); -it(' - renders nothing which correctly reacts on model change', () => { +test(' - renders nothing which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ it(' - renders nothing which correctly reacts on model change expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders nothing which correctly reacts on model change (empty)', () => { +test(' - renders nothing which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ it(' - renders nothing which correctly reacts on model change expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders nothing which correctly reacts on model change (same value)', () => { +test(' - renders nothing which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; diff --git a/packages/uniforms-material/__tests__/ListAddField.tsx b/packages/uniforms-material/__tests__/ListAddField.tsx index d7037f519..a7455f9ba 100644 --- a/packages/uniforms-material/__tests__/ListAddField.tsx +++ b/packages/uniforms-material/__tests__/ListAddField.tsx @@ -14,14 +14,14 @@ const context = (schema?: object) => { onChange, model: { x: [] } }, ); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListAddField)).toHaveLength(1); }); -it(' - prevents onClick when disabled', () => { +test(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -29,7 +29,7 @@ it(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when readOnly', () => { +test(' - prevents onClick when readOnly', () => { const element = ; const wrapper = mount(element, context()); @@ -37,7 +37,7 @@ it(' - prevents onClick when readOnly', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when limit reached', () => { +test(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { maxCount: 0 } })); @@ -45,7 +45,7 @@ it(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - correctly reacts on click', () => { +test(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -53,7 +53,7 @@ it(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['y']); }); -it(' - renders correct icon', () => { +test(' - renders correct icon', () => { const element = } />; const wrapper = mount(element, context()); diff --git a/packages/uniforms-material/__tests__/ListDelField.tsx b/packages/uniforms-material/__tests__/ListDelField.tsx index fad6e45ea..58dc59433 100644 --- a/packages/uniforms-material/__tests__/ListDelField.tsx +++ b/packages/uniforms-material/__tests__/ListDelField.tsx @@ -14,14 +14,14 @@ const context = (schema?: object) => { onChange, model: { x: ['x', 'y', 'z'] } }, ); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListDelField)).toHaveLength(1); }); -it(' - prevents onClick when disabled', () => { +test(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -29,7 +29,7 @@ it(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when readOnly', () => { +test(' - prevents onClick when readOnly', () => { const element = ; const wrapper = mount(element, context()); @@ -37,7 +37,7 @@ it(' - prevents onClick when readOnly', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when limit reached', () => { +test(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { minCount: 3 } })); @@ -45,7 +45,7 @@ it(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - correctly reacts on click', () => { +test(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -53,7 +53,7 @@ it(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['x', 'z']); }); -it(' - renders correct icon', () => { +test(' - renders correct icon', () => { const element = } />; const wrapper = mount(element, context()); diff --git a/packages/uniforms-material/__tests__/ListField.tsx b/packages/uniforms-material/__tests__/ListField.tsx index a8738c8a3..0756ca02c 100644 --- a/packages/uniforms-material/__tests__/ListField.tsx +++ b/packages/uniforms-material/__tests__/ListField.tsx @@ -14,7 +14,7 @@ describe('@RTL - ListField tests', () => { }); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount( element, @@ -24,7 +24,7 @@ it(' - works', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -it(' - renders ListAddField', () => { +test(' - renders ListAddField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ it(' - renders ListAddField', () => { expect(wrapper.find(ListAddField).prop('name')).toBe('$'); }); -it(' - renders correct label (specified)', () => { +test(' - renders correct label (specified)', () => { const element = ; const wrapper = mount( element, @@ -46,7 +46,7 @@ it(' - renders correct label (specified)', () => { expect(wrapper.find(ListSubheader).text()).toBe('ListFieldLabel'); }); -it(' - renders correct number of items with model', () => { +test(' - renders correct number of items with model', () => { const element = ; const wrapper = mount( element, @@ -58,7 +58,7 @@ it(' - renders correct number of items with model', () => { expect(wrapper.find(ListItemField)).toHaveLength(3); }); -it(' - passes itemProps to its children', () => { +test(' - passes itemProps to its children', () => { const element = ; const wrapper = mount( element, @@ -70,7 +70,7 @@ it(' - passes itemProps to its children', () => { expect(wrapper.find(ListItemField).first().prop('data-xyz')).toBe(1); }); -it(' - renders children (specified)', () => { +test(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -89,7 +89,7 @@ it(' - renders children (specified)', () => { expect(Child).toHaveBeenCalledTimes(2); }); -it(' - renders children with correct name (children)', () => { +test(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -108,7 +108,7 @@ it(' - renders children with correct name (children)', () => { expect(wrapper.find(Child).at(1).prop('name')).toBe('1'); }); -it(' - renders children with correct name (value)', () => { +test(' - renders children with correct name (value)', () => { const element = ; const wrapper = mount( element, @@ -121,7 +121,7 @@ it(' - renders children with correct name (value)', () => { expect(wrapper.find(ListItemField).at(1).prop('name')).toBe('1'); }); -it(' - renders proper number of optional values after add new value', () => { +test(' - renders proper number of optional values after add new value', () => { const element = ; const onChange = jest.fn(); const wrapper = mount( diff --git a/packages/uniforms-material/__tests__/ListItemField.tsx b/packages/uniforms-material/__tests__/ListItemField.tsx index 1bb1091e9..996d39dbb 100644 --- a/packages/uniforms-material/__tests__/ListItemField.tsx +++ b/packages/uniforms-material/__tests__/ListItemField.tsx @@ -4,7 +4,7 @@ import { AutoField, ListDelField, ListItemField } from 'uniforms-material'; import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - works', () => { expect(wrapper.find(ListItemField)).toHaveLength(1); }); -it(' - renders ListDelField', () => { +test(' - renders ListDelField', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - renders ListDelField', () => { expect(wrapper.find(ListDelField).childAt(0).prop('name')).toBe('x.1'); }); -it(' - renders AutoField', () => { +test(' - renders AutoField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ it(' - renders AutoField', () => { expect(wrapper.find(AutoField)).toHaveLength(1); }); -it(' - renders children if specified', () => { +test(' - renders children if specified', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( diff --git a/packages/uniforms-material/__tests__/LongTextField.tsx b/packages/uniforms-material/__tests__/LongTextField.tsx index c4cdd93f0..ad45237f4 100644 --- a/packages/uniforms-material/__tests__/LongTextField.tsx +++ b/packages/uniforms-material/__tests__/LongTextField.tsx @@ -9,7 +9,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - LongTextField tests', () => { - it(' - default props are not passed when MUI theme props are specified', () => { + test(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: false, margin: 'normal' } }, }); @@ -29,7 +29,7 @@ describe('@RTL - LongTextField tests', () => { ); }); - it(' - default props are passed when MUI theme props are absent', () => { + test(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -47,7 +47,7 @@ describe('@RTL - LongTextField tests', () => { ); }); - it(' - explicit props are passed when MUI theme props are specified', () => { + test(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: true, margin: 'dense' } }, }); @@ -73,14 +73,14 @@ describe('@RTL - LongTextField tests', () => { }); }); -it(' - renders a TextField', () => { +test(' - renders a TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField)).toHaveLength(1); }); -it(' - renders a TextField with correct disabled state', () => { +test(' - renders a TextField with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -88,7 +88,7 @@ it(' - renders a TextField with correct disabled state', () => { expect(wrapper.find(TextField).prop('disabled')).toBe(true); }); -it(' - renders a TextField with correct readOnly state', () => { +test(' - renders a TextField with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -96,7 +96,7 @@ it(' - renders a TextField with correct readOnly state', () => { expect(wrapper.find(TextField).prop('inputProps')!.readOnly).toBe(true); }); -it(' - renders a TextField with correct id (inherited)', () => { +test(' - renders a TextField with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -104,7 +104,7 @@ it(' - renders a TextField with correct id (inherited)', () => { expect(wrapper.find(TextField).prop('id')).toBeTruthy(); }); -it(' - renders a TextField with correct id (specified)', () => { +test(' - renders a TextField with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -112,7 +112,7 @@ it(' - renders a TextField with correct id (specified)', () => { expect(wrapper.find(TextField).prop('id')).toBe('y'); }); -it(' - renders a TextField with correct name', () => { +test(' - renders a TextField with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -120,7 +120,7 @@ it(' - renders a TextField with correct name', () => { expect(wrapper.find(TextField).prop('name')).toBe('x'); }); -it(' - renders a TextField with correct placeholder', () => { +test(' - renders a TextField with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -128,7 +128,7 @@ it(' - renders a TextField with correct placeholder', () => { expect(wrapper.find(TextField).prop('placeholder')).toBe('y'); }); -it(' - renders a TextField with correct value (default)', () => { +test(' - renders a TextField with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -136,7 +136,7 @@ it(' - renders a TextField with correct value (default)', () => { expect(wrapper.find(TextField).prop('value')).toBe(''); }); -it(' - renders a TextField with correct value (model)', () => { +test(' - renders a TextField with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -147,7 +147,7 @@ it(' - renders a TextField with correct value (model)', () => { expect(wrapper.find(TextField).prop('value')).toBe('y'); }); -it(' - renders a TextField with correct value (specified)', () => { +test(' - renders a TextField with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -155,7 +155,7 @@ it(' - renders a TextField with correct value (specified)', () => expect(wrapper.find(TextField).prop('value')).toBe('y'); }); -it(' - renders a TextField which correctly reacts on change', () => { +test(' - renders a TextField which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -170,7 +170,7 @@ it(' - renders a TextField which correctly reacts on change', () expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a TextField which correctly reacts on change (empty)', () => { +test(' - renders a TextField which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -185,7 +185,7 @@ it(' - renders a TextField which correctly reacts on change (empt expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders a TextField which correctly reacts on change (same value)', () => { +test(' - renders a TextField which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -200,14 +200,14 @@ it(' - renders a TextField which correctly reacts on change (same expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField).prop('label')).toBe('y'); }); -it(' - renders a TextField with correct error text (specified)', () => { +test(' - renders a TextField with correct error text (specified)', () => { const error = new Error(); const element = ( - renders a TextField with correct error text (specified)', expect(wrapper.find(TextField).prop('helperText')).toBe('Error'); }); -it(' - renders a TextField with correct error text (showInlineError=false)', () => { +test(' - renders a TextField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( { - it(' - default props are not passed when MUI theme props are specified', () => { + test(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: false, margin: 'normal' } }, }); @@ -30,7 +30,7 @@ describe('@RTL - NestField tests', () => { ); }); - it(' - default props are passed when MUI theme props are absent', () => { + test(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -48,7 +48,7 @@ describe('@RTL - NestField tests', () => { ); }); - it(' - explicit props are passed when MUI theme props are specified', () => { + test(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: true, margin: 'dense' } }, }); @@ -74,7 +74,7 @@ describe('@RTL - NestField tests', () => { }); }); -it(' - renders an for each field', () => { +test(' - renders an for each field', () => { const element = ; const wrapper = mount( element, @@ -90,7 +90,7 @@ it(' - renders an for each field', () => { expect(wrapper.find(AutoField).at(1).prop('name')).toBe('b'); }); -it(' - renders custom content if given', () => { +test(' - renders custom content if given', () => { const element = (
@@ -110,7 +110,7 @@ it(' - renders custom content if given', () => { expect(wrapper.find('article').prop('data-test')).toBe('content'); }); -it(' - renders a Subheader', () => { +test(' - renders a Subheader', () => { const element = ; const wrapper = mount( element, @@ -124,7 +124,7 @@ it(' - renders a Subheader', () => { expect(wrapper.find(FormLabel).at(0).text()).toBe('y *'); }); -it(' - renders a helperText', () => { +test(' - renders a helperText', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-material/__tests__/NumField.tsx b/packages/uniforms-material/__tests__/NumField.tsx index e0eccbe0b..c8f73349c 100644 --- a/packages/uniforms-material/__tests__/NumField.tsx +++ b/packages/uniforms-material/__tests__/NumField.tsx @@ -9,7 +9,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - NumField tests', () => { - it(' - default props are not passed when MUI theme props are specified', () => { + test(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: false, margin: 'normal' } }, }); @@ -29,7 +29,7 @@ describe('@RTL - NumField tests', () => { ); }); - it(' - default props are passed when MUI theme props are absent', () => { + test(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -47,7 +47,7 @@ describe('@RTL - NumField tests', () => { ); }); - it(' - explicit props are passed when MUI theme props are specified', () => { + test(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: true, margin: 'dense' } }, }); @@ -73,14 +73,14 @@ describe('@RTL - NumField tests', () => { }); }); -it(' - renders a TextField', () => { +test(' - renders a TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(TextField)).toHaveLength(1); }); -it(' - renders a TextField with correct disabled state', () => { +test(' - renders a TextField with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -88,7 +88,7 @@ it(' - renders a TextField with correct disabled state', () => { expect(wrapper.find(TextField).prop('disabled')).toBe(true); }); -it(' - renders a TextField with correct readOnly state', () => { +test(' - renders a TextField with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -96,7 +96,7 @@ it(' - renders a TextField with correct readOnly state', () => { expect(wrapper.find(TextField).prop('inputProps')!.readOnly).toBe(true); }); -it(' - renders a TextField with correct id (inherited)', () => { +test(' - renders a TextField with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -104,7 +104,7 @@ it(' - renders a TextField with correct id (inherited)', () => { expect(wrapper.find(TextField).prop('id')).toBeTruthy(); }); -it(' - renders a TextField with correct id (specified)', () => { +test(' - renders a TextField with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -112,7 +112,7 @@ it(' - renders a TextField with correct id (specified)', () => { expect(wrapper.find(TextField).prop('id')).toBe('y'); }); -it(' - renders a TextField with correct max', () => { +test(' - renders a TextField with correct max', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -120,7 +120,7 @@ it(' - renders a TextField with correct max', () => { expect(wrapper.find('input').prop('max')).toBe(10); }); -it(' - renders a TextField with correct min', () => { +test(' - renders a TextField with correct min', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -128,7 +128,7 @@ it(' - renders a TextField with correct min', () => { expect(wrapper.find('input').prop('min')).toBe(10); }); -it(' - renders a TextField with correct name', () => { +test(' - renders a TextField with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -136,7 +136,7 @@ it(' - renders a TextField with correct name', () => { expect(wrapper.find(TextField).prop('name')).toBe('x'); }); -it(' - renders a TextField with correct placeholder', () => { +test(' - renders a TextField with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -144,7 +144,7 @@ it(' - renders a TextField with correct placeholder', () => { expect(wrapper.find(TextField).prop('placeholder')).toBe('y'); }); -it(' - renders a TextField with correct step (decimal)', () => { +test(' - renders a TextField with correct step (decimal)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -152,7 +152,7 @@ it(' - renders a TextField with correct step (decimal)', () => { expect(wrapper.find('input').prop('step')).toBe(0.01); }); -it(' - renders a TextField with correct step (integer)', () => { +test(' - renders a TextField with correct step (integer)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -160,7 +160,7 @@ it(' - renders a TextField with correct step (integer)', () => { expect(wrapper.find('input').prop('step')).toBe(1); }); -it(' - renders a TextField with correct step (set)', () => { +test(' - renders a TextField with correct step (set)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -168,7 +168,7 @@ it(' - renders a TextField with correct step (set)', () => { expect(wrapper.find('input').prop('step')).toBe(3); }); -it(' - renders a TextField with correct type', () => { +test(' - renders a TextField with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -176,7 +176,7 @@ it(' - renders a TextField with correct type', () => { expect(wrapper.find(TextField).prop('type')).toBe('number'); }); -it(' - renders a TextField with correct value (default)', () => { +test(' - renders a TextField with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -184,7 +184,7 @@ it(' - renders a TextField with correct value (default)', () => { expect(wrapper.find(TextField).prop('value')).toBe(''); }); -it(' - renders a TextField with correct value (model)', () => { +test(' - renders a TextField with correct value (model)', () => { const onChange = jest.fn(); const element = ; @@ -226,7 +226,7 @@ it(' - renders a TextField with correct value (model)', () => { spy.mockRestore(); }); -it(' - renders a TextField with correct value (specified)', () => { +test(' - renders a TextField with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -234,7 +234,7 @@ it(' - renders a TextField with correct value (specified)', () => { expect(wrapper.find(TextField).prop('value')).toBe(2); }); -it(' - renders a TextField which correctly reacts on change', () => { +test(' - renders a TextField which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -249,7 +249,7 @@ it(' - renders a TextField which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -it(' - renders a TextField which correctly reacts on change (decimal on decimal)', () => { +test(' - renders a TextField which correctly reacts on change (decimal on decimal)', () => { const onChange = jest.fn(); const element = ; @@ -264,7 +264,7 @@ it(' - renders a TextField which correctly reacts on change (decimal o expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); -it(' - renders a TextField which correctly reacts on change (decimal on integer)', () => { +test(' - renders a TextField which correctly reacts on change (decimal on integer)', () => { const onChange = jest.fn(); const element = ; @@ -279,7 +279,7 @@ it(' - renders a TextField which correctly reacts on change (decimal o expect(onChange).toHaveBeenLastCalledWith('x', 2); }); -it(' - renders a TextField which correctly reacts on change (empty)', () => { +test(' - renders a TextField which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -294,7 +294,7 @@ it(' - renders a TextField which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a TextField which correctly reacts on change (same value)', () => { +test(' - renders a TextField which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -309,7 +309,7 @@ it(' - renders a TextField which correctly reacts on change (same valu expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -it(' - renders a TextField which correctly reacts on change (zero)', () => { +test(' - renders a TextField which correctly reacts on change (zero)', () => { const onChange = jest.fn(); const element = ; @@ -324,7 +324,7 @@ it(' - renders a TextField which correctly reacts on change (zero)', ( expect(onChange).toHaveBeenLastCalledWith('x', 0); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -332,7 +332,7 @@ it(' - renders a label', () => { expect(wrapper.find(TextField).prop('label')).toBe('y'); }); -it(' - renders a TextField with correct error text (specified)', () => { +test(' - renders a TextField with correct error text (specified)', () => { const error = new Error(); const element = ( @@ -342,7 +342,7 @@ it(' - renders a TextField with correct error text (specified)', () => expect(wrapper.find(TextField).prop('helperText')).toBe('Error'); }); -it(' - renders a TextField with correct error text (showInlineError=false)', () => { +test(' - renders a TextField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-material/__tests__/RadioField.tsx b/packages/uniforms-material/__tests__/RadioField.tsx index 3beaa6ffd..3476330c6 100644 --- a/packages/uniforms-material/__tests__/RadioField.tsx +++ b/packages/uniforms-material/__tests__/RadioField.tsx @@ -14,7 +14,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - RadioField tests', () => { - it(' - default props are not passed when MUI theme props are specified', () => { + test(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: false, margin: 'normal' } }, }); @@ -34,7 +34,7 @@ describe('@RTL - RadioField tests', () => { ); }); - it(' - default props are passed when MUI theme props are absent', () => { + test(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -52,7 +52,7 @@ describe('@RTL - RadioField tests', () => { ); }); - it(' - explicit props are passed when MUI theme props are specified', () => { + test(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: true, margin: 'dense' } }, }); @@ -78,7 +78,7 @@ describe('@RTL - RadioField tests', () => { }); }); -it(' - renders a set of Radio buttons', () => { +test(' - renders a set of Radio buttons', () => { const element = ; const wrapper = mount( element, @@ -88,7 +88,7 @@ it(' - renders a set of Radio buttons', () => { expect(wrapper.find(Radio)).toHaveLength(2); }); -it(' - renders a set of Radio buttons wrapped with RadioGroup', () => { +test(' - renders a set of Radio buttons wrapped with RadioGroup', () => { const element = ; const wrapper = mount( element, @@ -99,7 +99,7 @@ it(' - renders a set of Radio buttons wrapped with RadioGroup', () = expect(wrapper.find(RadioGroup).find(Radio)).toHaveLength(2); }); -it(' - renders a set of Radio buttons with correct disabled state', () => { +test(' - renders a set of Radio buttons with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -109,7 +109,7 @@ it(' - renders a set of Radio buttons with correct disabled state', expect(wrapper.find(FormControl).prop('disabled')).toBe(true); }); -it(' - renders a RadioGroup with correct id (inherited)', () => { +test(' - renders a RadioGroup with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -120,7 +120,7 @@ it(' - renders a RadioGroup with correct id (inherited)', () => { expect(wrapper.find(RadioGroup).prop('id')).toBeTruthy(); }); -it(' - renders a RadioGroup with correct id (specified)', () => { +test(' - renders a RadioGroup with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -131,7 +131,7 @@ it(' - renders a RadioGroup with correct id (specified)', () => { expect(wrapper.find(RadioGroup).prop('id')).toBe('y'); }); -it(' - renders a RadioGroup with correct name', () => { +test(' - renders a RadioGroup with correct name', () => { const element = ; const wrapper = mount( element, @@ -142,7 +142,7 @@ it(' - renders a RadioGroup with correct name', () => { expect(wrapper.find(RadioGroup).prop('name')).toBe('x'); }); -it(' - renders a set of Radio buttons with correct options', () => { +test(' - renders a set of Radio buttons with correct options', () => { const element = ; const wrapper = mount( element, @@ -154,7 +154,7 @@ it(' - renders a set of Radio buttons with correct options', () => { expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('b'); }); -it(' - renders a set of Radio buttons with correct options (transform)', () => { +test(' - renders a set of Radio buttons with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -166,7 +166,7 @@ it(' - renders a set of Radio buttons with correct options (transfor expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('B'); }); -it(' - renders a RadioGroup with correct value (default)', () => { +test(' - renders a RadioGroup with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -177,7 +177,7 @@ it(' - renders a RadioGroup with correct value (default)', () => { expect(wrapper.find(RadioGroup).prop('value')).toBeFalsy(); }); -it(' - renders a RadioGroup with correct value (model)', () => { +test(' - renders a RadioGroup with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -191,7 +191,7 @@ it(' - renders a RadioGroup with correct value (model)', () => { expect(wrapper.find(RadioGroup).prop('value')).toBe('b'); }); -it(' - renders a RadioGroup with correct value (specified)', () => { +test(' - renders a RadioGroup with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -202,7 +202,7 @@ it(' - renders a RadioGroup with correct value (specified)', () => { expect(wrapper.find(RadioGroup).prop('value')).toBe('b'); }); -it(' - renders a RadioGroup which correctly reacts on change', () => { +test(' - renders a RadioGroup which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -220,7 +220,7 @@ it(' - renders a RadioGroup which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a RadioGroup which correctly reacts on change (same value)', () => { +test(' - renders a RadioGroup which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -238,7 +238,7 @@ it(' - renders a RadioGroup which correctly reacts on change (same v expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -249,7 +249,7 @@ it(' - renders a label', () => { expect(wrapper.find(FormLabel).text()).toBe('y *'); }); -it(' - renders a helperText', () => { +test(' - renders a helperText', () => { const element = ; const wrapper = mount( element, @@ -260,7 +260,7 @@ it(' - renders a helperText', () => { expect(wrapper.find(FormHelperText).text()).toBe('Helper'); }); -it(' - renders a TextField with correct error text (specified)', () => { +test(' - renders a TextField with correct error text (specified)', () => { const error = new Error(); const element = ( @@ -273,7 +273,7 @@ it(' - renders a TextField with correct error text (specified)', () expect(wrapper.find(FormHelperText).text()).toBe('Error'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), diff --git a/packages/uniforms-material/__tests__/SelectField.tsx b/packages/uniforms-material/__tests__/SelectField.tsx index 632e868a0..3d4c87aa6 100644 --- a/packages/uniforms-material/__tests__/SelectField.tsx +++ b/packages/uniforms-material/__tests__/SelectField.tsx @@ -18,7 +18,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - SelectField tests', () => { - it(' - default props are not passed when MUI theme props are specified', () => { + test(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: false, margin: 'normal' } }, }); @@ -38,7 +38,7 @@ describe('@RTL - SelectField tests', () => { ); }); - it(' - default props are passed when MUI theme props are absent', () => { + test(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -56,7 +56,7 @@ describe('@RTL - SelectField tests', () => { ); }); - it(' - explicit props are passed when MUI theme props are specified', () => { + test(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: true, margin: 'dense' } }, }); @@ -81,7 +81,7 @@ describe('@RTL - SelectField tests', () => { ); }); - it(' - MUI theme props are passed', () => { + test(' - MUI theme props are passed', () => { const theme = createMuiTheme({ props: { MuiFormControl: { fullWidth: false, margin: 'normal' } }, }); @@ -102,7 +102,7 @@ describe('@RTL - SelectField tests', () => { }); }); -it(' - renders a Select', () => { +test(' - renders a Select', () => { const element = ; const wrapper = mount( element, @@ -112,7 +112,7 @@ it(' - renders a Select', () => { expect(wrapper.find(Select)).toHaveLength(1); }); -it(' - renders a Select with correct disabled state', () => { +test(' - renders a Select with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -123,7 +123,7 @@ it(' - renders a Select with correct disabled state', () => { expect(wrapper.find(FormControl).prop('disabled')).toBe(true); }); -it(' - renders a Select with correct required state', () => { +test(' - renders a Select with correct required state', () => { const element = ; const wrapper = mount( element, @@ -134,7 +134,7 @@ it(' - renders a Select with correct required state', () => { expect(wrapper.find(TextField).prop('required')).toBe(true); }); -it(' - renders a Select with correct id (inherited)', () => { +test(' - renders a Select with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -146,7 +146,7 @@ it(' - renders a Select with correct id (inherited)', () => { expect(wrapper.find(Select).prop('inputProps')!.id).toBeTruthy(); }); -it(' - renders a Select with correct id (specified)', () => { +test(' - renders a Select with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -158,7 +158,7 @@ it(' - renders a Select with correct id (specified)', () => { expect(wrapper.find(Select).prop('inputProps')!.id).toBe('y'); }); -it(' - renders a Select with correct name', () => { +test(' - renders a Select with correct name', () => { const element = ; const wrapper = mount( element, @@ -170,7 +170,7 @@ it(' - renders a Select with correct name', () => { expect(wrapper.find(Select).prop('inputProps')!.name).toBe('x'); }); -it(' - renders a Select with correct options', () => { +test(' - renders a Select with correct options', () => { const element = ; const wrapper = mount( element, @@ -190,7 +190,7 @@ it(' - renders a Select with correct options', () => { }); }); -it(' - renders a Select with correct options (transform)', () => { +test(' - renders a Select with correct options (transform)', () => { const element = ( x.toUpperCase()} native /> ); @@ -212,7 +212,7 @@ it(' - renders a Select with correct options (transform)', () => { }); }); -it(' - renders a Select with correct placeholder (implicit)', () => { +test(' - renders a Select with correct placeholder (implicit)', () => { const element = ; const wrapper = mount( element, @@ -232,7 +232,7 @@ it(' - renders a Select with correct placeholder (implicit)', () => }); }); -it(' - renders a Select with correct value (default)', () => { +test(' - renders a Select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -243,7 +243,7 @@ it(' - renders a Select with correct value (default)', () => { expect(wrapper.find(Select).prop('value')).toBe(''); }); -it(' - renders a Select with correct value (model)', () => { +test(' - renders a Select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -257,7 +257,7 @@ it(' - renders a Select with correct value (model)', () => { expect(wrapper.find(Select).prop('value')).toBe('b'); }); -it(' - renders a Select with correct value (specified)', () => { +test(' - renders a Select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -268,7 +268,7 @@ it(' - renders a Select with correct value (specified)', () => { expect(wrapper.find(Select).prop('value')).toBe('b'); }); -it(' - renders a Select which correctly reacts on change', () => { +test(' - renders a Select which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -286,7 +286,7 @@ it(' - renders a Select which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a Select which correctly reacts on change (empty)', () => { +test(' - renders a Select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -304,7 +304,7 @@ it(' - renders a Select which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a Select which correctly reacts on change (same value)', () => { +test(' - renders a Select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -322,7 +322,7 @@ it(' - renders a Select which correctly reacts on change (same valu expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -333,7 +333,7 @@ it(' - renders a label', () => { expect(wrapper.find(TextField).prop('label')).toBe('y'); }); -it(' - renders a SelectField with correct error text (showInlineError=true)', () => { +test(' - renders a SelectField with correct error text (showInlineError=true)', () => { const error = new Error(); const element = ( @@ -346,7 +346,7 @@ it(' - renders a SelectField with correct error text (showInlineErr expect(wrapper.find(FormHelperText).text()).toBe('Error'); }); -it(' - renders a SelectField with correct error text (showInlineError=false)', () => { +test(' - renders a SelectField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders a SelectField with correct error text (showInlineErr expect(wrapper.find(FormHelperText)).toHaveLength(0); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -it(' - disabled items (options) based on predicate', () => { +test(' - disabled items (options) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( @@ -394,7 +394,7 @@ it(' - disabled items (options) based on predicate', () => { expect(wrapper.find('option').at(1).prop('disabled')).toBe(false); }); -it(' - renders with correct classnames', () => { +test(' - renders with correct classnames', () => { const wrapper = mount( , createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), @@ -405,7 +405,7 @@ it(' - renders with correct classnames', () => { ); }); -it(' - renders a multiselect with correct value (default)', () => { +test(' - renders a multiselect with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -419,7 +419,7 @@ it(' - renders a multiselect with correct value (default)', () => { expect(wrapper.find(Select).prop('value')).toStrictEqual([]); }); -it(' - renders a multiselect with correct value (model)', () => { +test(' - renders a multiselect with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -436,7 +436,7 @@ it(' - renders a multiselect with correct value (model)', () => { expect(wrapper.find(Select).prop('value')).toStrictEqual(['b']); }); -it(' - renders a multiselect with correct value (specified)', () => { +test(' - renders a multiselect with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -450,7 +450,7 @@ it(' - renders a multiselect with correct value (specified)', () => expect(wrapper.find(Select).prop('value')).toStrictEqual(['b']); }); -it(' - renders a set of Radio buttons', () => { +test(' - renders a set of Radio buttons', () => { const element = ; const wrapper = mount( element, @@ -460,7 +460,7 @@ it(' - renders a set of Radio buttons', () => { expect(wrapper.find(Radio)).toHaveLength(2); }); -it(' - renders a set of Radio buttons with correct disabled state', () => { +test(' - renders a set of Radio buttons with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -472,7 +472,7 @@ it(' - renders a set of Radio buttons with correct disab expect(wrapper.find(Radio).at(1).prop('disabled')).toBe(true); }); -it(' - renders a set of Radio buttons with correct id (inherited)', () => { +test(' - renders a set of Radio buttons with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -484,7 +484,7 @@ it(' - renders a set of Radio buttons with correct id (i expect(wrapper.find(Radio).at(1).prop('id')).toBeTruthy(); }); -it(' - renders a set of Radio buttons with correct id (specified)', () => { +test(' - renders a set of Radio buttons with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -496,7 +496,7 @@ it(' - renders a set of Radio buttons with correct id (s expect(wrapper.find(Radio).at(1).prop('id')).toBe('y-Yg'); }); -it(' - renders a set of Radio buttons with correct name', () => { +test(' - renders a set of Radio buttons with correct name', () => { const element = ; const wrapper = mount( element, @@ -508,7 +508,7 @@ it(' - renders a set of Radio buttons with correct name' expect(wrapper.find(Radio).at(1).find('input').prop('name')).toBe('x'); }); -it(' - renders a set of Radio buttons with correct options', () => { +test(' - renders a set of Radio buttons with correct options', () => { const element = ; const wrapper = mount( element, @@ -520,7 +520,7 @@ it(' - renders a set of Radio buttons with correct optio expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('b'); }); -it(' - renders a set of Radio buttons with correct options (transform)', () => { +test(' - renders a set of Radio buttons with correct options (transform)', () => { const element = ( x.toUpperCase()} /> ); @@ -534,7 +534,7 @@ it(' - renders a set of Radio buttons with correct optio expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('B'); }); -it(' - renders a set of Radio buttons with correct value (default)', () => { +test(' - renders a set of Radio buttons with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -546,7 +546,7 @@ it(' - renders a set of Radio buttons with correct value expect(wrapper.find(Radio).at(1).find('input').prop('checked')).toBe(false); }); -it(' - renders a set of Radio buttons with correct value (model)', () => { +test(' - renders a set of Radio buttons with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -561,7 +561,7 @@ it(' - renders a set of Radio buttons with correct value expect(wrapper.find(Radio).at(1).find('input').prop('checked')).toBe(true); }); -it(' - renders a set of Radio buttons with correct value (specified)', () => { +test(' - renders a set of Radio buttons with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -573,7 +573,7 @@ it(' - renders a set of Radio buttons with correct value expect(wrapper.find(Radio).at(1).find('input').prop('checked')).toBe(true); }); -it(' - renders a set of Radio buttons which correctly reacts on change', () => { +test(' - renders a set of Radio buttons which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -591,7 +591,7 @@ it(' - renders a set of Radio buttons which correctly re expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a set of Checkboxes which correctly reacts on change (array check)', () => { +test(' - renders a set of Checkboxes which correctly reacts on change (array check)', () => { const onChange = jest.fn(); const element = ; @@ -611,7 +611,7 @@ it(' - renders a set of Checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -it(' - renders a set of Checkboxes which correctly reacts on change (array uncheck)', () => { +test(' - renders a set of Checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); const element = ; const wrapper = mount( @@ -630,7 +630,7 @@ it(' - renders a set of Checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a set of Checkboxes with correct labels', () => { +test(' - renders a set of Checkboxes with correct labels', () => { const onChange = jest.fn(); const element = ; const wrapper = mount( @@ -649,7 +649,7 @@ it(' - renders a set of Checkboxes with correct labels', expect(wrapper.find(FormControlLabel).at(1).text()).toBe('b'); }); -it(' - renders a set of Checkboxes which correct labels (transform)', () => { +test(' - renders a set of Checkboxes which correct labels (transform)', () => { const onChange = jest.fn(); const element = ( x.toUpperCase()} /> @@ -670,7 +670,7 @@ it(' - renders a set of Checkboxes which correct labels expect(wrapper.find(FormControlLabel).at(1).text()).toBe('B'); }); -it(' - renders a set of Radio buttons which correctly reacts on change (same value)', () => { +test(' - renders a set of Radio buttons which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -690,7 +690,7 @@ it(' - renders a set of Radio buttons which correctly re expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -700,7 +700,7 @@ it(' - renders a label', () => { expect(wrapper.find(FormLabel).text()).toBe('y *'); }); -it(' - renders a SelectField with correct error text (showInlineError=true)', () => { +test(' - renders a SelectField with correct error text (showInlineError=true)', () => { const error = new Error(); const element = ( - renders a SelectField with correct error text (sh expect(wrapper.find(FormHelperText).text()).toBe('Error'); }); -it(' - renders a SelectField with correct error text (showInlineError=false)', () => { +test(' - renders a SelectField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders a SelectField with correct error text (sh expect(wrapper.find(FormHelperText)).toHaveLength(0); }); -it(' - renders Checkbox with appearance=checkbox', () => { +test(' - renders Checkbox with appearance=checkbox', () => { const element = ; const wrapper = mount( element, @@ -752,7 +752,7 @@ it(' - renders Checkbox with appearance=checkbox', () => expect(wrapper.find(Switch)).toHaveLength(0); }); -it(' - renders Switch with appearance=switch', () => { +test(' - renders Switch with appearance=switch', () => { const element = ; const wrapper = mount( element, @@ -766,14 +766,14 @@ it(' - renders Switch with appearance=switch', () => { expect(wrapper.find(Switch)).toHaveLength(2); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -it(' - disabled items (checkboxes) based on predicate', () => { +test(' - disabled items (checkboxes) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( diff --git a/packages/uniforms-material/__tests__/SubmitField.tsx b/packages/uniforms-material/__tests__/SubmitField.tsx index 824c4fcc2..720b639f4 100644 --- a/packages/uniforms-material/__tests__/SubmitField.tsx +++ b/packages/uniforms-material/__tests__/SubmitField.tsx @@ -8,7 +8,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - SubmitField tests', () => { - it(' - default props are not passed when MUI theme props are specified', () => { + test(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiButton: { variant: 'outlined' } }, }); @@ -23,7 +23,7 @@ describe('@RTL - SubmitField tests', () => { expect(elements).toHaveLength(1); }); - it(' - default props are passed when MUI theme props are absent', () => { + test(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -36,7 +36,7 @@ describe('@RTL - SubmitField tests', () => { expect(elements).toHaveLength(1); }); - it(' - explicit props are passed when MUI theme props are specified', () => { + test(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiButton: { variant: 'outlined' } }, }); @@ -56,21 +56,21 @@ describe('@RTL - SubmitField tests', () => { }); }); -it(' - renders', () => { +test(' - renders', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper).toHaveLength(1); }); -it(' - renders SubmitField with correct disabled state', () => { +test(' - renders SubmitField with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper.children().first().prop('disabled')).toBe(true); }); -it(' - renders SubmitField with correct disabled state when error (context)', () => { +test(' - renders SubmitField with correct disabled state when error (context)', () => { const error = new Error(); const element = ; const wrapper = mount(element, createContext({}, { error })); diff --git a/packages/uniforms-material/__tests__/TextField.tsx b/packages/uniforms-material/__tests__/TextField.tsx index f472b0939..efceb84cf 100644 --- a/packages/uniforms-material/__tests__/TextField.tsx +++ b/packages/uniforms-material/__tests__/TextField.tsx @@ -12,7 +12,7 @@ import mount from './_mount'; describe('@RTL - TextField tests', () => { testTextField(TextField); - it(' - renders a TextField with correct error text (specified)', () => { + test(' - renders a TextField with correct error text (specified)', () => { const errorMessage = 'Error'; render( { expect(screen.getByText(errorMessage)).toBeInTheDocument(); }); - it(' - renders a TextField with correct error text (showInlineError=false)', () => { + test(' - renders a TextField with correct error text (showInlineError=false)', () => { const errorMessage = 'Error'; render( { expect(screen.queryByText(errorMessage)).not.toBeInTheDocument(); }); - it(' - default props are not passed when MUI theme props are specified', () => { + test(' - default props are not passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: false, margin: 'normal' } }, }); @@ -62,7 +62,7 @@ describe('@RTL - TextField tests', () => { ); }); - it(' - default props are passed when MUI theme props are absent', () => { + test(' - default props are passed when MUI theme props are absent', () => { const theme = createMuiTheme({}); const { container } = render( @@ -80,7 +80,7 @@ describe('@RTL - TextField tests', () => { ); }); - it(' - explicit props are passed when MUI theme props are specified', () => { + test(' - explicit props are passed when MUI theme props are specified', () => { const theme = createMuiTheme({ props: { MuiTextField: { fullWidth: true, margin: 'dense' } }, }); @@ -106,14 +106,14 @@ describe('@RTL - TextField tests', () => { }); }); -it(' - renders an TextField', () => { +test(' - renders an TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextFieldMaterial)).toHaveLength(1); }); -it(' - renders a TextField with correct disabled state', () => { +test(' - renders a TextField with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -121,7 +121,7 @@ it(' - renders a TextField with correct disabled state', () => { expect(wrapper.find(TextFieldMaterial).prop('disabled')).toBe(true); }); -it(' - renders a TextField with correct readOnly state', () => { +test(' - renders a TextField with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -131,7 +131,7 @@ it(' - renders a TextField with correct readOnly state', () => { ); }); -it(' - renders a TextField with correct id (inherited)', () => { +test(' - renders a TextField with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -139,7 +139,7 @@ it(' - renders a TextField with correct id (inherited)', () => { expect(wrapper.find(TextFieldMaterial).prop('id')).toBeTruthy(); }); -it(' - renders a TextField with correct id (specified)', () => { +test(' - renders a TextField with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -147,7 +147,7 @@ it(' - renders a TextField with correct id (specified)', () => { expect(wrapper.find(TextFieldMaterial).prop('id')).toBe('y'); }); -it(' - renders a TextField with correct name', () => { +test(' - renders a TextField with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -155,7 +155,7 @@ it(' - renders a TextField with correct name', () => { expect(wrapper.find(TextFieldMaterial).prop('name')).toBe('x'); }); -it(' - renders a TextField with correct placeholder', () => { +test(' - renders a TextField with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -163,7 +163,7 @@ it(' - renders a TextField with correct placeholder', () => { expect(wrapper.find(TextFieldMaterial).prop('placeholder')).toBe('y'); }); -it(' - renders a TextField with correct value (default)', () => { +test(' - renders a TextField with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -171,7 +171,7 @@ it(' - renders a TextField with correct value (default)', () => { expect(wrapper.find(TextFieldMaterial).prop('value')).toBe(''); }); -it(' - renders a TextField with correct value (model)', () => { +test(' - renders a TextField with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -182,7 +182,7 @@ it(' - renders a TextField with correct value (model)', () => { expect(wrapper.find(TextFieldMaterial).prop('value')).toBe('y'); }); -it(' - renders a TextField with correct value (specified)', () => { +test(' - renders a TextField with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -190,7 +190,7 @@ it(' - renders a TextField with correct value (specified)', () => { expect(wrapper.find(TextFieldMaterial).prop('value')).toBe('y'); }); -it(' - renders a TextField which correctly reacts on change', () => { +test(' - renders a TextField which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -206,7 +206,7 @@ it(' - renders a TextField which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a TextField which correctly reacts on change (empty)', () => { +test(' - renders a TextField which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -222,7 +222,7 @@ it(' - renders a TextField which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders a TextField which correctly reacts on change (same value)', () => { +test(' - renders a TextField which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -238,7 +238,7 @@ it(' - renders a TextField which correctly reacts on change (same val expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -246,7 +246,7 @@ it(' - renders a label', () => { expect(wrapper.find(TextFieldMaterial).prop('label')).toBe('y'); }); -it(' - renders a TextField with correct error text (specified)', () => { +test(' - renders a TextField with correct error text (specified)', () => { const error = new Error(); const element = ( @@ -256,7 +256,7 @@ it(' - renders a TextField with correct error text (specified)', () = expect(wrapper.find(TextFieldMaterial).prop('helperText')).toBe('Error'); }); -it(' - renders a TextField with correct error text (showInlineError=false)', () => { +test(' - renders a TextField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders a TextField with correct error text (showInlineError=f expect(wrapper.find(TextFieldMaterial).prop('helperText')).toBeUndefined(); }); -it(' - renders a input with autocomplete off', () => { +test(' - renders a input with autocomplete off', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-material/__tests__/ValidateQuickForm.tsx b/packages/uniforms-material/__tests__/ValidateQuickForm.tsx index 5a8633b1d..8835ace6f 100644 --- a/packages/uniforms-material/__tests__/ValidateQuickForm.tsx +++ b/packages/uniforms-material/__tests__/ValidateQuickForm.tsx @@ -5,7 +5,7 @@ import createContext from './_createContext'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-material/__tests__/ValidatedForm.tsx b/packages/uniforms-material/__tests__/ValidatedForm.tsx index 50ddb853a..c8af38014 100644 --- a/packages/uniforms-material/__tests__/ValidatedForm.tsx +++ b/packages/uniforms-material/__tests__/ValidatedForm.tsx @@ -5,7 +5,7 @@ import createContext from './_createContext'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-material/__tests__/index.ts b/packages/uniforms-material/__tests__/index.ts index 5e02e0d7a..332f44e65 100644 --- a/packages/uniforms-material/__tests__/index.ts +++ b/packages/uniforms-material/__tests__/index.ts @@ -1,6 +1,6 @@ import * as material from 'uniforms-material'; -it('exports everything', () => { +test('exports everything', () => { expect(material).toEqual({ AutoFields: expect.any(Function), AutoField: expect.any(Function), diff --git a/packages/uniforms-material/__tests__/wrapField.tsx b/packages/uniforms-material/__tests__/wrapField.tsx index f44d2c911..27f25020f 100644 --- a/packages/uniforms-material/__tests__/wrapField.tsx +++ b/packages/uniforms-material/__tests__/wrapField.tsx @@ -5,21 +5,21 @@ import { wrapField } from 'uniforms-material'; import mount from './_mount'; -it(' - renders wrapper', () => { +test(' - renders wrapper', () => { const element = wrapField({},
); const wrapper = mount(element); expect(wrapper.find(FormControl)).toHaveLength(1); }); -it(' - renders wrapper with helper text', () => { +test(' - renders wrapper with helper text', () => { const element = wrapField({ helperText: 'Helper text' },
); const wrapper = mount(element); expect(wrapper.find(FormHelperText).text()).toBe('Helper text'); }); -it(' - renders wrapper with error', () => { +test(' - renders wrapper with error', () => { const element = wrapField( { showInlineError: true, diff --git a/packages/uniforms-mui/__tests__/AutoField.tsx b/packages/uniforms-mui/__tests__/AutoField.tsx index a8e6ffcb6..806cb2df9 100644 --- a/packages/uniforms-mui/__tests__/AutoField.tsx +++ b/packages/uniforms-mui/__tests__/AutoField.tsx @@ -14,14 +14,14 @@ import { import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(AutoField)).toHaveLength(1); }); -it(' - detects RadioField', () => { +test(' - detects RadioField', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ it(' - detects RadioField', () => { expect(wrapper.find(RadioField.Component)).toHaveLength(1); }); -it(' - detects SelectField', () => { +test(' - detects SelectField', () => { const element = ; const wrapper = mount( element, @@ -50,14 +50,14 @@ it(' - detects SelectField', () => { expect(wrapper.find(SelectField.Component)).toHaveLength(1); }); -it(' - detects DateField', () => { +test(' - detects DateField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DateField.Component)).toHaveLength(1); }); -it(' - detects ListField', () => { +test(' - detects ListField', () => { const element = ; const wrapper = mount( element, @@ -67,35 +67,35 @@ it(' - detects ListField', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -it(' - detects NumField', () => { +test(' - detects NumField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(NumField.Component)).toHaveLength(1); }); -it(' - detects NestField', () => { +test(' - detects NestField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Object } })); expect(wrapper.find(NestField)).toHaveLength(1); }); -it(' - detects TextField', () => { +test(' - detects TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField.Component)).toHaveLength(1); }); -it(' - detects BoolField', () => { +test(' - detects BoolField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(BoolField.Component)).toHaveLength(1); }); -it(' - uses Component (schema)', () => { +test(' - uses Component (schema)', () => { const Component = jest.fn(() => null); const element = ; @@ -107,7 +107,7 @@ it(' - uses Component (schema)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -it(' - uses Component (props)', () => { +test(' - uses Component (props)', () => { const Component = jest.fn(() => null); const element = ; @@ -116,7 +116,7 @@ it(' - uses Component (props)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -it(' - uses Component (context)', () => { +test(' - uses Component (context)', () => { const FieldA = jest.fn(() => null); const FieldB = jest.fn(() => null); @@ -136,7 +136,7 @@ it(' - uses Component (context)', () => { expect(FieldB).toHaveBeenCalledTimes(1); }); -it(' - uses Component (invalid)', () => { +test(' - uses Component (invalid)', () => { const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {}); expect(() => { const element = ; diff --git a/packages/uniforms-mui/__tests__/AutoFields.tsx b/packages/uniforms-mui/__tests__/AutoFields.tsx index ac22fc9a5..37451658d 100644 --- a/packages/uniforms-mui/__tests__/AutoFields.tsx +++ b/packages/uniforms-mui/__tests__/AutoFields.tsx @@ -4,14 +4,14 @@ import { AutoField, AutoFields } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('AutoFields')).toHaveLength(1); }); -it(' - render all fields by default', () => { +test(' - render all fields by default', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - render all fields by default', () => { expect(wrapper.find('input')).toHaveLength(3); }); -it(' - renders only specified fields', () => { +test(' - renders only specified fields', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ it(' - renders only specified fields', () => { ); }); -it(' - does not render ommited fields', () => { +test(' - does not render ommited fields', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ it(' - does not render ommited fields', () => { ); }); -it(' - wraps fields in specified element', () => { +test(' - wraps fields in specified element', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ it(' - wraps fields in specified element', () => { expect(wrapper.find('section').find('input')).toHaveLength(3); }); -it(' - pass props to the children', () => { +test(' - pass props to the children', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-mui/__tests__/AutoForm.tsx b/packages/uniforms-mui/__tests__/AutoForm.tsx index 97929e35e..29099e1c0 100644 --- a/packages/uniforms-mui/__tests__/AutoForm.tsx +++ b/packages/uniforms-mui/__tests__/AutoForm.tsx @@ -5,7 +5,7 @@ import createContext from './_createContext'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-mui/__tests__/BaseForm.tsx b/packages/uniforms-mui/__tests__/BaseForm.tsx index f87bed819..4699e70cb 100644 --- a/packages/uniforms-mui/__tests__/BaseForm.tsx +++ b/packages/uniforms-mui/__tests__/BaseForm.tsx @@ -5,7 +5,7 @@ import createContext from './_createContext'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-mui/__tests__/BoolField.tsx b/packages/uniforms-mui/__tests__/BoolField.tsx index 49d8957d4..4a863767e 100644 --- a/packages/uniforms-mui/__tests__/BoolField.tsx +++ b/packages/uniforms-mui/__tests__/BoolField.tsx @@ -9,14 +9,14 @@ import { BoolField } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an Checkbox', () => { +test(' - renders an Checkbox', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(Checkbox)).toHaveLength(1); }); -it(' - renders a Checkbox with correct id (inherited)', () => { +test(' - renders a Checkbox with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -24,7 +24,7 @@ it(' - renders a Checkbox with correct id (inherited)', () => { expect(wrapper.find(Checkbox).prop('id')).toBeTruthy(); }); -it(' - renders a Checkbox with correct id (specified)', () => { +test(' - renders a Checkbox with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -32,7 +32,7 @@ it(' - renders a Checkbox with correct id (specified)', () => { expect(wrapper.find(Checkbox).prop('id')).toBe('y'); }); -it(' - renders a Checkbox with correct name', () => { +test(' - renders a Checkbox with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -40,7 +40,7 @@ it(' - renders a Checkbox with correct name', () => { expect(wrapper.find(Checkbox).prop('name')).toBe('x'); }); -it(' - renders an Checkbox with correct disabled state', () => { +test(' - renders an Checkbox with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -48,7 +48,7 @@ it(' - renders an Checkbox with correct disabled state', () => { expect(wrapper.find(Checkbox).prop('disabled')).toBe(true); }); -it(' - renders a Checkbox with correct label (specified)', () => { +test(' - renders a Checkbox with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -56,7 +56,7 @@ it(' - renders a Checkbox with correct label (specified)', () => { expect(wrapper.find(FormControlLabel).prop('label')).toBe('BoolFieldLabel'); }); -it(' - renders a Checkbox with correct value (default)', () => { +test(' - renders a Checkbox with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -64,7 +64,7 @@ it(' - renders a Checkbox with correct value (default)', () => { expect(wrapper.find(Checkbox).prop('checked')).toBe(false); }); -it(' - renders a Checkbox with correct value (model)', () => { +test(' - renders a Checkbox with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -75,7 +75,7 @@ it(' - renders a Checkbox with correct value (model)', () => { expect(wrapper.find(Checkbox).prop('checked')).toBe(true); }); -it(' - renders a Checkbox with correct value (specified)', () => { +test(' - renders a Checkbox with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -83,7 +83,7 @@ it(' - renders a Checkbox with correct value (specified)', () => { expect(wrapper.find(Checkbox).prop('checked')).toBe(true); }); -it(' - renders a Checkbox which correctly reacts on change', () => { +test(' - renders a Checkbox which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -97,14 +97,14 @@ it(' - renders a Checkbox which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', false); }); -it(' - renders an Switch', () => { +test(' - renders an Switch', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(Switch)).toHaveLength(1); }); -it(' - renders a Switch with correct id (inherited)', () => { +test(' - renders a Switch with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -112,7 +112,7 @@ it(' - renders a Switch with correct id (inherited)', () => { expect(wrapper.find(Switch).prop('id')).toBeTruthy(); }); -it(' - renders a Switch with correct id (specified)', () => { +test(' - renders a Switch with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -120,7 +120,7 @@ it(' - renders a Switch with correct id (specified)', () => { expect(wrapper.find(Switch).prop('id')).toBe('y'); }); -it(' - renders a Switch with correct name', () => { +test(' - renders a Switch with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -128,7 +128,7 @@ it(' - renders a Switch with correct name', () => { expect(wrapper.find(Switch).prop('name')).toBe('x'); }); -it(' - renders an Switch with correct disabled state', () => { +test(' - renders an Switch with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -136,7 +136,7 @@ it(' - renders an Switch with correct disabled state', () => { expect(wrapper.find(Switch).prop('disabled')).toBe(true); }); -it(' - renders a Switch with correct label (specified)', () => { +test(' - renders a Switch with correct label (specified)', () => { const element = ( ); @@ -146,7 +146,7 @@ it(' - renders a Switch with correct label (specified)', () => { expect(wrapper.find(FormControlLabel).prop('label')).toBe('BoolFieldLabel'); }); -it(' - renders a Switch with correct label (transform)', () => { +test(' - renders a Switch with correct label (transform)', () => { const element = ( - renders a Switch with correct label (transform)', () => { expect(wrapper.find(FormControlLabel).prop('label')).toBe('BOOLFIELDLABEL'); }); -it(' - renders a Switch with correct legend (specified)', () => { +test(' - renders a Switch with correct legend (specified)', () => { const element = ( ); @@ -171,7 +171,7 @@ it(' - renders a Switch with correct legend (specified)', () => { expect(wrapper.find(FormLabel).text()).toBe('BoolFieldLegend *'); }); -it(' - renders a Switch with correct value (default)', () => { +test(' - renders a Switch with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -179,7 +179,7 @@ it(' - renders a Switch with correct value (default)', () => { expect(wrapper.find(Switch).prop('checked')).toBe(false); }); -it(' - renders a Switch with correct value (model)', () => { +test(' - renders a Switch with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -190,7 +190,7 @@ it(' - renders a Switch with correct value (model)', () => { expect(wrapper.find(Switch).prop('checked')).toBe(true); }); -it(' - renders a Switch with correct value (specified)', () => { +test(' - renders a Switch with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -198,7 +198,7 @@ it(' - renders a Switch with correct value (specified)', () => { expect(wrapper.find(Switch).prop('checked')).toBe(true); }); -it(' - renders a Switch which correctly reacts on change', () => { +test(' - renders a Switch which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -212,7 +212,7 @@ it(' - renders a Switch which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', false); }); -it(' - renders a helperText', () => { +test(' - renders a helperText', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); diff --git a/packages/uniforms-mui/__tests__/DateField.tsx b/packages/uniforms-mui/__tests__/DateField.tsx index 38f401437..c282c5088 100644 --- a/packages/uniforms-mui/__tests__/DateField.tsx +++ b/packages/uniforms-mui/__tests__/DateField.tsx @@ -12,7 +12,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - DateField tests', () => { - it(' - handles "date" type correctly', () => { + test(' - handles "date" type correctly', () => { const onChange = jest.fn(); const initialDate = new Date(Date.UTC(2020, 0, 1)); @@ -33,63 +33,63 @@ describe('@RTL - DateField tests', () => { }); }); -it(' - renders Input', () => { +test(' - renders Input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(OutlinedInput)).toHaveLength(1); }); -it(' - renders a Input with correct id (inherited)', () => { +test(' - renders a Input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(OutlinedInput).prop('id')).toBeTruthy(); }); -it(' - renders a Input with correct id (specified)', () => { +test(' - renders a Input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(OutlinedInput).prop('id')).toBe('y'); }); -it(' - renders a Input with correct name', () => { +test(' - renders a Input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(OutlinedInput).prop('name')).toBe('x'); }); -it(' - renders an Input with correct disabled state', () => { +test(' - renders an Input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(FormControl).prop('disabled')).toBe(true); }); -it(' - renders an Input with correct readOnly state', () => { +test(' - renders an Input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(OutlinedInput).prop('inputProps')!.readOnly).toBe(true); }); -it(' - renders a Input with correct label (specified)', () => { +test(' - renders a Input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(FormLabel).text()).toBe('DateFieldLabel *'); }); -it(' - renders a Input with correct value (default)', () => { +test(' - renders a Input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(OutlinedInput).prop('value')).toBe(''); }); -it(' - renders a Input with correct value (model)', () => { +test(' - renders a Input with correct value (model)', () => { const now = new Date(); const element = ; const wrapper = mount( @@ -102,7 +102,7 @@ it(' - renders a Input with correct value (model)', () => { ); }); -it(' - renders a Input with correct value (specified)', () => { +test(' - renders a Input with correct value (specified)', () => { const now = new Date(); const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -112,7 +112,7 @@ it(' - renders a Input with correct value (specified)', () => { ); }); -it(' - renders a Input which correctly reacts on change', () => { +test(' - renders a Input which correctly reacts on change', () => { const onChange = jest.fn(); const now = new Date(); @@ -129,7 +129,7 @@ it(' - renders a Input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', now); }); -it(' - renders a Input which correctly reacts on change (empty)', () => { +test(' - renders a Input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -145,7 +145,7 @@ it(' - renders a Input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a Input which correctly reacts on change (overflow)', () => { +test(' - renders a Input which correctly reacts on change (overflow)', () => { const onChange = jest.fn(); const now = new Date(1e5, 0); @@ -162,7 +162,7 @@ it(' - renders a Input which correctly reacts on change (overflow)', expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a Input with correct error text (specified)', () => { +test(' - renders a Input with correct error text (specified)', () => { const error = new Error(); const element = ( @@ -172,7 +172,7 @@ it(' - renders a Input with correct error text (specified)', () => { expect(wrapper.find(FormHelperText).text()).toBe('Error'); }); -it(' - renders a Input with correct error text (showInlineError=false)', () => { +test(' - renders a Input with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorField)).toHaveLength(1); }); -it(' - renders correct error message (context)', () => { +test(' - renders correct error message (context)', () => { const element = ; const wrapper = mount( element, @@ -29,7 +29,7 @@ it(' - renders correct error message (context)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -it(' - renders correct error message (specified)', () => { +test(' - renders correct error message (specified)', () => { const element = ( - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorsField)).toHaveLength(1); }); -it(' - renders list of correct error messages (context)', () => { +test(' - renders list of correct error messages (context)', () => { const element = ; const wrapper = mount( element, @@ -39,7 +39,7 @@ it(' - renders list of correct error messages (context)', () => { expect(wrapper.find(FormHelperText).at(2).text()).toBe('Z is required'); }); -it(' - renders children (specified)', () => { +test(' - renders children (specified)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-mui/__tests__/HiddenField.tsx b/packages/uniforms-mui/__tests__/HiddenField.tsx index c494d6216..95771874a 100644 --- a/packages/uniforms-mui/__tests__/HiddenField.tsx +++ b/packages/uniforms-mui/__tests__/HiddenField.tsx @@ -4,14 +4,14 @@ import { HiddenField } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('hidden'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -62,7 +62,7 @@ it(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input which correctly reacts on model change', () => { +test(' - renders an input which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -76,7 +76,7 @@ it(' - renders an input which correctly reacts on model change', () expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders an input which correctly reacts on model change (empty)', () => { +test(' - renders an input which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -90,7 +90,7 @@ it(' - renders an input which correctly reacts on model change (emp expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders an input which correctly reacts on model change (same value)', () => { +test(' - renders an input which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -104,14 +104,14 @@ it(' - renders an input which correctly reacts on model change (sam expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders nothing', () => { +test(' - renders nothing', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.children()).toHaveLength(0); }); -it(' - renders nothing which correctly reacts on model change', () => { +test(' - renders nothing which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ it(' - renders nothing which correctly reacts on model change expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders nothing which correctly reacts on model change (empty)', () => { +test(' - renders nothing which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ it(' - renders nothing which correctly reacts on model change expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders nothing which correctly reacts on model change (same value)', () => { +test(' - renders nothing which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; diff --git a/packages/uniforms-mui/__tests__/ListAddField.tsx b/packages/uniforms-mui/__tests__/ListAddField.tsx index 329b9295f..89a9c1799 100644 --- a/packages/uniforms-mui/__tests__/ListAddField.tsx +++ b/packages/uniforms-mui/__tests__/ListAddField.tsx @@ -14,7 +14,7 @@ const context = (schema?: object) => { onChange, model: { x: [] } }, ); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, context()); @@ -56,7 +56,7 @@ test.skip(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['y']); }); -it(' - renders correct icon', () => { +test(' - renders correct icon', () => { const element = } />; const wrapper = mount(element, context()); diff --git a/packages/uniforms-mui/__tests__/ListDelField.tsx b/packages/uniforms-mui/__tests__/ListDelField.tsx index 9144f4832..50b6849a7 100644 --- a/packages/uniforms-mui/__tests__/ListDelField.tsx +++ b/packages/uniforms-mui/__tests__/ListDelField.tsx @@ -14,7 +14,7 @@ const context = (schema?: object) => { onChange, model: { x: ['x', 'y', 'z'] } }, ); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, context()); @@ -56,7 +56,7 @@ test.skip(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['x', 'z']); }); -it(' - renders correct icon', () => { +test(' - renders correct icon', () => { const element = } />; const wrapper = mount(element, context()); diff --git a/packages/uniforms-mui/__tests__/ListField.tsx b/packages/uniforms-mui/__tests__/ListField.tsx index 57151b4fd..908267623 100644 --- a/packages/uniforms-mui/__tests__/ListField.tsx +++ b/packages/uniforms-mui/__tests__/ListField.tsx @@ -14,7 +14,7 @@ describe('@RTL - ListField tests', () => { }); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount( element, @@ -24,7 +24,7 @@ it(' - works', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -it(' - renders ListAddField', () => { +test(' - renders ListAddField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ it(' - renders ListAddField', () => { expect(wrapper.find(ListAddField).prop('name')).toBe('$'); }); -it(' - renders correct label (specified)', () => { +test(' - renders correct label (specified)', () => { const element = ; const wrapper = mount( element, @@ -46,7 +46,7 @@ it(' - renders correct label (specified)', () => { expect(wrapper.find(ListSubheader).text()).toBe('ListFieldLabel'); }); -it(' - renders correct number of items with model (specified)', () => { +test(' - renders correct number of items with model (specified)', () => { const element = ; const wrapper = mount( element, @@ -58,7 +58,7 @@ it(' - renders correct number of items with model (specified)', () => expect(wrapper.find(ListItemField)).toHaveLength(3); }); -it(' - passes itemProps to its children', () => { +test(' - passes itemProps to its children', () => { const element = ; const wrapper = mount( element, @@ -70,7 +70,7 @@ it(' - passes itemProps to its children', () => { expect(wrapper.find(ListItemField).first().prop('data-xyz')).toBe(1); }); -it(' - renders children (specified)', () => { +test(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -89,7 +89,7 @@ it(' - renders children (specified)', () => { expect(Child).toHaveBeenCalledTimes(2); }); -it(' - renders children with correct name (children)', () => { +test(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -108,7 +108,7 @@ it(' - renders children with correct name (children)', () => { expect(wrapper.find(Child).at(1).prop('name')).toBe('1'); }); -it(' - renders children with correct name (value)', () => { +test(' - renders children with correct name (value)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-mui/__tests__/ListItemField.tsx b/packages/uniforms-mui/__tests__/ListItemField.tsx index a0db11d60..25de0fd8e 100644 --- a/packages/uniforms-mui/__tests__/ListItemField.tsx +++ b/packages/uniforms-mui/__tests__/ListItemField.tsx @@ -4,7 +4,7 @@ import { AutoField, ListDelField, ListItemField } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - works', () => { expect(wrapper.find(ListItemField)).toHaveLength(1); }); -it(' - renders ListDelField', () => { +test(' - renders ListDelField', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - renders ListDelField', () => { expect(wrapper.find(ListDelField).childAt(0).prop('name')).toBe('x.1'); }); -it(' - renders AutoField', () => { +test(' - renders AutoField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ it(' - renders AutoField', () => { expect(wrapper.find(AutoField)).toHaveLength(1); }); -it(' - renders children if specified', () => { +test(' - renders children if specified', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( diff --git a/packages/uniforms-mui/__tests__/LongTextField.tsx b/packages/uniforms-mui/__tests__/LongTextField.tsx index c24952f2b..91089bfff 100644 --- a/packages/uniforms-mui/__tests__/LongTextField.tsx +++ b/packages/uniforms-mui/__tests__/LongTextField.tsx @@ -5,14 +5,14 @@ import { LongTextField } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a TextField', () => { +test(' - renders a TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField)).toHaveLength(1); }); -it(' - renders a TextField with correct disabled state', () => { +test(' - renders a TextField with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -20,7 +20,7 @@ it(' - renders a TextField with correct disabled state', () => { expect(wrapper.find(TextField).prop('disabled')).toBe(true); }); -it(' - renders a TextField with correct readOnly state', () => { +test(' - renders a TextField with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -28,7 +28,7 @@ it(' - renders a TextField with correct readOnly state', () => { expect(wrapper.find(TextField).prop('inputProps')!.readOnly).toBe(true); }); -it(' - renders a TextField with correct id (inherited)', () => { +test(' - renders a TextField with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -36,7 +36,7 @@ it(' - renders a TextField with correct id (inherited)', () => { expect(wrapper.find(TextField).prop('id')).toBeTruthy(); }); -it(' - renders a TextField with correct id (specified)', () => { +test(' - renders a TextField with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -44,7 +44,7 @@ it(' - renders a TextField with correct id (specified)', () => { expect(wrapper.find(TextField).prop('id')).toBe('y'); }); -it(' - renders a TextField with correct name', () => { +test(' - renders a TextField with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -52,7 +52,7 @@ it(' - renders a TextField with correct name', () => { expect(wrapper.find(TextField).prop('name')).toBe('x'); }); -it(' - renders a TextField with correct placeholder', () => { +test(' - renders a TextField with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -60,7 +60,7 @@ it(' - renders a TextField with correct placeholder', () => { expect(wrapper.find(TextField).prop('placeholder')).toBe('y'); }); -it(' - renders a TextField with correct value (default)', () => { +test(' - renders a TextField with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -68,7 +68,7 @@ it(' - renders a TextField with correct value (default)', () => { expect(wrapper.find(TextField).prop('value')).toBe(''); }); -it(' - renders a TextField with correct value (model)', () => { +test(' - renders a TextField with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -79,7 +79,7 @@ it(' - renders a TextField with correct value (model)', () => { expect(wrapper.find(TextField).prop('value')).toBe('y'); }); -it(' - renders a TextField with correct value (specified)', () => { +test(' - renders a TextField with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -87,7 +87,7 @@ it(' - renders a TextField with correct value (specified)', () => expect(wrapper.find(TextField).prop('value')).toBe('y'); }); -it(' - renders a TextField which correctly reacts on change', () => { +test(' - renders a TextField which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -102,7 +102,7 @@ it(' - renders a TextField which correctly reacts on change', () expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a TextField which correctly reacts on change (empty)', () => { +test(' - renders a TextField which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -117,7 +117,7 @@ it(' - renders a TextField which correctly reacts on change (empt expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders a TextField which correctly reacts on change (same value)', () => { +test(' - renders a TextField which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -132,14 +132,14 @@ it(' - renders a TextField which correctly reacts on change (same expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField).prop('label')).toBe('y'); }); -it(' - renders a TextField with correct error text (specified)', () => { +test(' - renders a TextField with correct error text (specified)', () => { const error = new Error(); const element = ( - renders a TextField with correct error text (specified)', expect(wrapper.find(TextField).prop('helperText')).toBe('Error'); }); -it(' - renders a TextField with correct error text (showInlineError=false)', () => { +test(' - renders a TextField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders an for each field', () => { +test(' - renders an for each field', () => { const element = ; const wrapper = mount( element, @@ -22,7 +22,7 @@ it(' - renders an for each field', () => { expect(wrapper.find(AutoField).at(1).prop('name')).toBe('b'); }); -it(' - renders custom content if given', () => { +test(' - renders custom content if given', () => { const element = (
@@ -42,7 +42,7 @@ it(' - renders custom content if given', () => { expect(wrapper.find('article').prop('data-test')).toBe('content'); }); -it(' - renders a Subheader', () => { +test(' - renders a Subheader', () => { const element = ; const wrapper = mount( element, @@ -56,7 +56,7 @@ it(' - renders a Subheader', () => { expect(wrapper.find(FormLabel).at(0).text()).toBe('y *'); }); -it(' - renders a helperText', () => { +test(' - renders a helperText', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-mui/__tests__/NumField.tsx b/packages/uniforms-mui/__tests__/NumField.tsx index 7c3c5988f..26afeb0ae 100644 --- a/packages/uniforms-mui/__tests__/NumField.tsx +++ b/packages/uniforms-mui/__tests__/NumField.tsx @@ -5,14 +5,14 @@ import { NumField } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a TextField', () => { +test(' - renders a TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(TextField)).toHaveLength(1); }); -it(' - renders a TextField with correct disabled state', () => { +test(' - renders a TextField with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -20,7 +20,7 @@ it(' - renders a TextField with correct disabled state', () => { expect(wrapper.find(TextField).prop('disabled')).toBe(true); }); -it(' - renders a TextField with correct readOnly state', () => { +test(' - renders a TextField with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -28,7 +28,7 @@ it(' - renders a TextField with correct readOnly state', () => { expect(wrapper.find(TextField).prop('inputProps')!.readOnly).toBe(true); }); -it(' - renders a TextField with correct id (inherited)', () => { +test(' - renders a TextField with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -36,7 +36,7 @@ it(' - renders a TextField with correct id (inherited)', () => { expect(wrapper.find(TextField).prop('id')).toBeTruthy(); }); -it(' - renders a TextField with correct id (specified)', () => { +test(' - renders a TextField with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -44,7 +44,7 @@ it(' - renders a TextField with correct id (specified)', () => { expect(wrapper.find(TextField).prop('id')).toBe('y'); }); -it(' - renders a TextField with correct max', () => { +test(' - renders a TextField with correct max', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -52,7 +52,7 @@ it(' - renders a TextField with correct max', () => { expect(wrapper.find('input').prop('max')).toBe(10); }); -it(' - renders a TextField with correct min', () => { +test(' - renders a TextField with correct min', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -60,7 +60,7 @@ it(' - renders a TextField with correct min', () => { expect(wrapper.find('input').prop('min')).toBe(10); }); -it(' - renders a TextField with correct name', () => { +test(' - renders a TextField with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -68,7 +68,7 @@ it(' - renders a TextField with correct name', () => { expect(wrapper.find(TextField).prop('name')).toBe('x'); }); -it(' - renders a TextField with correct placeholder', () => { +test(' - renders a TextField with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -76,7 +76,7 @@ it(' - renders a TextField with correct placeholder', () => { expect(wrapper.find(TextField).prop('placeholder')).toBe('y'); }); -it(' - renders a TextField with correct step (decimal)', () => { +test(' - renders a TextField with correct step (decimal)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -84,7 +84,7 @@ it(' - renders a TextField with correct step (decimal)', () => { expect(wrapper.find('input').prop('step')).toBe(0.01); }); -it(' - renders a TextField with correct step (integer)', () => { +test(' - renders a TextField with correct step (integer)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -92,7 +92,7 @@ it(' - renders a TextField with correct step (integer)', () => { expect(wrapper.find('input').prop('step')).toBe(1); }); -it(' - renders a TextField with correct step (set)', () => { +test(' - renders a TextField with correct step (set)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -100,7 +100,7 @@ it(' - renders a TextField with correct step (set)', () => { expect(wrapper.find('input').prop('step')).toBe(3); }); -it(' - renders a TextField with correct type', () => { +test(' - renders a TextField with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -108,7 +108,7 @@ it(' - renders a TextField with correct type', () => { expect(wrapper.find(TextField).prop('type')).toBe('number'); }); -it(' - renders a TextField with correct value (default)', () => { +test(' - renders a TextField with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -116,7 +116,7 @@ it(' - renders a TextField with correct value (default)', () => { expect(wrapper.find(TextField).prop('value')).toBe(''); }); -it(' - renders a TextField with correct value (model)', () => { +test(' - renders a TextField with correct value (model)', () => { const onChange = jest.fn(); const element = ; @@ -158,7 +158,7 @@ it(' - renders a TextField with correct value (model)', () => { spy.mockRestore(); }); -it(' - renders a TextField with correct value (specified)', () => { +test(' - renders a TextField with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -166,7 +166,7 @@ it(' - renders a TextField with correct value (specified)', () => { expect(wrapper.find(TextField).prop('value')).toBe(2); }); -it(' - renders a TextField which correctly reacts on change', () => { +test(' - renders a TextField which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -181,7 +181,7 @@ it(' - renders a TextField which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -it(' - renders a TextField which correctly reacts on change (decimal on decimal)', () => { +test(' - renders a TextField which correctly reacts on change (decimal on decimal)', () => { const onChange = jest.fn(); const element = ; @@ -196,7 +196,7 @@ it(' - renders a TextField which correctly reacts on change (decimal o expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); -it(' - renders a TextField which correctly reacts on change (decimal on integer)', () => { +test(' - renders a TextField which correctly reacts on change (decimal on integer)', () => { const onChange = jest.fn(); const element = ; @@ -211,7 +211,7 @@ it(' - renders a TextField which correctly reacts on change (decimal o expect(onChange).toHaveBeenLastCalledWith('x', 2); }); -it(' - renders a TextField which correctly reacts on change (empty)', () => { +test(' - renders a TextField which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -226,7 +226,7 @@ it(' - renders a TextField which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a TextField which correctly reacts on change (same value)', () => { +test(' - renders a TextField which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -241,7 +241,7 @@ it(' - renders a TextField which correctly reacts on change (same valu expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -it(' - renders a TextField which correctly reacts on change (zero)', () => { +test(' - renders a TextField which correctly reacts on change (zero)', () => { const onChange = jest.fn(); const element = ; @@ -256,7 +256,7 @@ it(' - renders a TextField which correctly reacts on change (zero)', ( expect(onChange).toHaveBeenLastCalledWith('x', 0); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -264,7 +264,7 @@ it(' - renders a label', () => { expect(wrapper.find(TextField).prop('label')).toBe('y'); }); -it(' - renders a TextField with correct error text (specified)', () => { +test(' - renders a TextField with correct error text (specified)', () => { const error = new Error(); const element = ( @@ -274,7 +274,7 @@ it(' - renders a TextField with correct error text (specified)', () => expect(wrapper.find(TextField).prop('helperText')).toBe('Error'); }); -it(' - renders a TextField with correct error text (showInlineError=false)', () => { +test(' - renders a TextField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-mui/__tests__/RadioField.tsx b/packages/uniforms-mui/__tests__/RadioField.tsx index 8144dcbcd..981da2dea 100644 --- a/packages/uniforms-mui/__tests__/RadioField.tsx +++ b/packages/uniforms-mui/__tests__/RadioField.tsx @@ -10,7 +10,7 @@ import { RadioField } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a set of Radio buttons', () => { +test(' - renders a set of Radio buttons', () => { const element = ; const wrapper = mount( element, @@ -20,7 +20,7 @@ it(' - renders a set of Radio buttons', () => { expect(wrapper.find(Radio)).toHaveLength(2); }); -it(' - renders a set of Radio buttons wrapped with RadioGroup', () => { +test(' - renders a set of Radio buttons wrapped with RadioGroup', () => { const element = ; const wrapper = mount( element, @@ -31,7 +31,7 @@ it(' - renders a set of Radio buttons wrapped with RadioGroup', () = expect(wrapper.find(RadioGroup).find(Radio)).toHaveLength(2); }); -it(' - renders a set of Radio buttons with correct disabled state', () => { +test(' - renders a set of Radio buttons with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ it(' - renders a set of Radio buttons with correct disabled state', expect(wrapper.find(FormControl).prop('disabled')).toBe(true); }); -it(' - renders a RadioGroup with correct id (inherited)', () => { +test(' - renders a RadioGroup with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -52,7 +52,7 @@ it(' - renders a RadioGroup with correct id (inherited)', () => { expect(wrapper.find(RadioGroup).prop('id')).toBeTruthy(); }); -it(' - renders a RadioGroup with correct id (specified)', () => { +test(' - renders a RadioGroup with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -63,7 +63,7 @@ it(' - renders a RadioGroup with correct id (specified)', () => { expect(wrapper.find(RadioGroup).prop('id')).toBe('y'); }); -it(' - renders a RadioGroup with correct name', () => { +test(' - renders a RadioGroup with correct name', () => { const element = ; const wrapper = mount( element, @@ -74,7 +74,7 @@ it(' - renders a RadioGroup with correct name', () => { expect(wrapper.find(RadioGroup).prop('name')).toBe('x'); }); -it(' - renders a set of Radio buttons with correct options', () => { +test(' - renders a set of Radio buttons with correct options', () => { const element = ; const wrapper = mount( element, @@ -86,7 +86,7 @@ it(' - renders a set of Radio buttons with correct options', () => { expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('b'); }); -it(' - renders a set of Radio buttons with correct options (transform)', () => { +test(' - renders a set of Radio buttons with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -98,7 +98,7 @@ it(' - renders a set of Radio buttons with correct options (transfor expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('B'); }); -it(' - renders a RadioGroup with correct value (default)', () => { +test(' - renders a RadioGroup with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -109,7 +109,7 @@ it(' - renders a RadioGroup with correct value (default)', () => { expect(wrapper.find(RadioGroup).prop('value')).toBeFalsy(); }); -it(' - renders a RadioGroup with correct value (model)', () => { +test(' - renders a RadioGroup with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -123,7 +123,7 @@ it(' - renders a RadioGroup with correct value (model)', () => { expect(wrapper.find(RadioGroup).prop('value')).toBe('b'); }); -it(' - renders a RadioGroup with correct value (specified)', () => { +test(' - renders a RadioGroup with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -134,7 +134,7 @@ it(' - renders a RadioGroup with correct value (specified)', () => { expect(wrapper.find(RadioGroup).prop('value')).toBe('b'); }); -it(' - renders a RadioGroup which correctly reacts on change', () => { +test(' - renders a RadioGroup which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -152,7 +152,7 @@ it(' - renders a RadioGroup which correctly reacts on change', () => expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a RadioGroup which correctly reacts on change (same value)', () => { +test(' - renders a RadioGroup which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -170,7 +170,7 @@ it(' - renders a RadioGroup which correctly reacts on change (same v expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -181,7 +181,7 @@ it(' - renders a label', () => { expect(wrapper.find(FormLabel).text()).toBe('y *'); }); -it(' - renders a helperText', () => { +test(' - renders a helperText', () => { const element = ; const wrapper = mount( element, @@ -192,7 +192,7 @@ it(' - renders a helperText', () => { expect(wrapper.find(FormHelperText).text()).toBe('Helper'); }); -it(' - renders a TextField with correct error text (specified)', () => { +test(' - renders a TextField with correct error text (specified)', () => { const error = new Error(); const element = ( @@ -205,7 +205,7 @@ it(' - renders a TextField with correct error text (specified)', () expect(wrapper.find(FormHelperText).text()).toBe('Error'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), diff --git a/packages/uniforms-mui/__tests__/SelectField.tsx b/packages/uniforms-mui/__tests__/SelectField.tsx index 840c69da2..b9e770ec5 100644 --- a/packages/uniforms-mui/__tests__/SelectField.tsx +++ b/packages/uniforms-mui/__tests__/SelectField.tsx @@ -14,7 +14,7 @@ import { SelectField } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a Select', () => { +test(' - renders a Select', () => { const element = ; const wrapper = mount( element, @@ -24,7 +24,7 @@ it(' - renders a Select', () => { expect(wrapper.find(Select)).toHaveLength(1); }); -it(' - renders a Select with correct disabled state', () => { +test(' - renders a Select with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ it(' - renders a Select with correct disabled state', () => { expect(wrapper.find(FormControl).prop('disabled')).toBe(true); }); -it(' - renders a Select with correct required state', () => { +test(' - renders a Select with correct required state', () => { const element = ; const wrapper = mount( element, @@ -46,7 +46,7 @@ it(' - renders a Select with correct required state', () => { expect(wrapper.find(TextField).prop('required')).toBe(true); }); -it(' - renders a Select with correct id (inherited)', () => { +test(' - renders a Select with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -58,7 +58,7 @@ it(' - renders a Select with correct id (inherited)', () => { expect(wrapper.find(Select).prop('inputProps')!.id).toBeTruthy(); }); -it(' - renders a Select with correct id (specified)', () => { +test(' - renders a Select with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -70,7 +70,7 @@ it(' - renders a Select with correct id (specified)', () => { expect(wrapper.find(Select).prop('inputProps')!.id).toBe('y'); }); -it(' - renders a Select with correct name', () => { +test(' - renders a Select with correct name', () => { const element = ; const wrapper = mount( element, @@ -82,7 +82,7 @@ it(' - renders a Select with correct name', () => { expect(wrapper.find(Select).prop('inputProps')!.name).toBe('x'); }); -it(' - renders a Select with correct options', () => { +test(' - renders a Select with correct options', () => { const element = ; const wrapper = mount( element, @@ -102,7 +102,7 @@ it(' - renders a Select with correct options', () => { }); }); -it(' - renders a Select with correct options (transform)', () => { +test(' - renders a Select with correct options (transform)', () => { const element = ( x.toUpperCase()} native /> ); @@ -124,7 +124,7 @@ it(' - renders a Select with correct options (transform)', () => { }); }); -it(' - renders a Select with correct placeholder (implicit)', () => { +test(' - renders a Select with correct placeholder (implicit)', () => { const element = ; const wrapper = mount( element, @@ -144,7 +144,7 @@ it(' - renders a Select with correct placeholder (implicit)', () => }); }); -it(' - renders a Select with correct value (default)', () => { +test(' - renders a Select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -155,7 +155,7 @@ it(' - renders a Select with correct value (default)', () => { expect(wrapper.find(Select).prop('value')).toBe(''); }); -it(' - renders a Select with correct value (model)', () => { +test(' - renders a Select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -169,7 +169,7 @@ it(' - renders a Select with correct value (model)', () => { expect(wrapper.find(Select).prop('value')).toBe('b'); }); -it(' - renders a Select with correct value (specified)', () => { +test(' - renders a Select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -180,7 +180,7 @@ it(' - renders a Select with correct value (specified)', () => { expect(wrapper.find(Select).prop('value')).toBe('b'); }); -it(' - renders a Select which correctly reacts on change', () => { +test(' - renders a Select which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -198,7 +198,7 @@ it(' - renders a Select which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a Select which correctly reacts on change (empty)', () => { +test(' - renders a Select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -216,7 +216,7 @@ it(' - renders a Select which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a Select which correctly reacts on change (same value)', () => { +test(' - renders a Select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -234,7 +234,7 @@ it(' - renders a Select which correctly reacts on change (same valu expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -245,7 +245,7 @@ it(' - renders a label', () => { expect(wrapper.find(TextField).prop('label')).toBe('y'); }); -it(' - renders a SelectField with correct error text (showInlineError=true)', () => { +test(' - renders a SelectField with correct error text (showInlineError=true)', () => { const error = new Error(); const element = ( @@ -258,7 +258,7 @@ it(' - renders a SelectField with correct error text (showInlineErr expect(wrapper.find(FormHelperText).text()).toBe('Error'); }); -it(' - renders a SelectField with correct error text (showInlineError=false)', () => { +test(' - renders a SelectField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders a SelectField with correct error text (showInlineErr expect(wrapper.find(FormHelperText)).toHaveLength(0); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -it(' - disabled items (options) based on predicate', () => { +test(' - disabled items (options) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( @@ -306,7 +306,7 @@ it(' - disabled items (options) based on predicate', () => { expect(wrapper.find('option').at(1).prop('disabled')).toBe(false); }); -it(' - renders with correct classnames', () => { +test(' - renders with correct classnames', () => { const wrapper = mount( , createContext({ x: { type: String, allowedValues: ['a', 'b'] } }), @@ -317,7 +317,7 @@ it(' - renders with correct classnames', () => { ); }); -it(' - renders a multiselect with correct value (default)', () => { +test(' - renders a multiselect with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -331,7 +331,7 @@ it(' - renders a multiselect with correct value (default)', () => { expect(wrapper.find(Select).prop('value')).toStrictEqual([]); }); -it(' - renders a multiselect with correct value (model)', () => { +test(' - renders a multiselect with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -348,7 +348,7 @@ it(' - renders a multiselect with correct value (model)', () => { expect(wrapper.find(Select).prop('value')).toStrictEqual(['b']); }); -it(' - renders a multiselect with correct value (specified)', () => { +test(' - renders a multiselect with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -362,7 +362,7 @@ it(' - renders a multiselect with correct value (specified)', () => expect(wrapper.find(Select).prop('value')).toStrictEqual(['b']); }); -it(' - renders a set of Radio buttons', () => { +test(' - renders a set of Radio buttons', () => { const element = ; const wrapper = mount( element, @@ -372,7 +372,7 @@ it(' - renders a set of Radio buttons', () => { expect(wrapper.find(Radio)).toHaveLength(2); }); -it(' - renders a set of Radio buttons with correct disabled state', () => { +test(' - renders a set of Radio buttons with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -384,7 +384,7 @@ it(' - renders a set of Radio buttons with correct disab expect(wrapper.find(Radio).at(1).prop('disabled')).toBe(true); }); -it(' - renders a set of Radio buttons with correct id (inherited)', () => { +test(' - renders a set of Radio buttons with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -396,7 +396,7 @@ it(' - renders a set of Radio buttons with correct id (i expect(wrapper.find(Radio).at(1).prop('id')).toBeTruthy(); }); -it(' - renders a set of Radio buttons with correct id (specified)', () => { +test(' - renders a set of Radio buttons with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -408,7 +408,7 @@ it(' - renders a set of Radio buttons with correct id (s expect(wrapper.find(Radio).at(1).prop('id')).toBe('y-Yg'); }); -it(' - renders a set of Radio buttons with correct name', () => { +test(' - renders a set of Radio buttons with correct name', () => { const element = ; const wrapper = mount( element, @@ -420,7 +420,7 @@ it(' - renders a set of Radio buttons with correct name' expect(wrapper.find(Radio).at(1).find('input').prop('name')).toBe('x'); }); -it(' - renders a set of Radio buttons with correct options', () => { +test(' - renders a set of Radio buttons with correct options', () => { const element = ; const wrapper = mount( element, @@ -432,7 +432,7 @@ it(' - renders a set of Radio buttons with correct optio expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('b'); }); -it(' - renders a set of Radio buttons with correct options (transform)', () => { +test(' - renders a set of Radio buttons with correct options (transform)', () => { const element = ( x.toUpperCase()} /> ); @@ -446,7 +446,7 @@ it(' - renders a set of Radio buttons with correct optio expect(wrapper.find(FormControlLabel).at(1).prop('label')).toBe('B'); }); -it(' - renders a set of Radio buttons with correct value (default)', () => { +test(' - renders a set of Radio buttons with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -458,7 +458,7 @@ it(' - renders a set of Radio buttons with correct value expect(wrapper.find(Radio).at(1).find('input').prop('checked')).toBe(false); }); -it(' - renders a set of Radio buttons with correct value (model)', () => { +test(' - renders a set of Radio buttons with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -473,7 +473,7 @@ it(' - renders a set of Radio buttons with correct value expect(wrapper.find(Radio).at(1).find('input').prop('checked')).toBe(true); }); -it(' - renders a set of Radio buttons with correct value (specified)', () => { +test(' - renders a set of Radio buttons with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -485,7 +485,7 @@ it(' - renders a set of Radio buttons with correct value expect(wrapper.find(Radio).at(1).find('input').prop('checked')).toBe(true); }); -it(' - renders a set of Radio buttons which correctly reacts on change', () => { +test(' - renders a set of Radio buttons which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -503,7 +503,7 @@ it(' - renders a set of Radio buttons which correctly re expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a set of Checkboxes which correctly reacts on change (array check)', () => { +test(' - renders a set of Checkboxes which correctly reacts on change (array check)', () => { const onChange = jest.fn(); const element = ; @@ -523,7 +523,7 @@ it(' - renders a set of Checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -it(' - renders a set of Checkboxes which correctly reacts on change (array uncheck)', () => { +test(' - renders a set of Checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); const element = ; const wrapper = mount( @@ -542,7 +542,7 @@ it(' - renders a set of Checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a set of Checkboxes with correct labels', () => { +test(' - renders a set of Checkboxes with correct labels', () => { const onChange = jest.fn(); const element = ; const wrapper = mount( @@ -561,7 +561,7 @@ it(' - renders a set of Checkboxes with correct labels', expect(wrapper.find(FormControlLabel).at(1).text()).toBe('b'); }); -it(' - renders a set of Checkboxes which correct labels (transform)', () => { +test(' - renders a set of Checkboxes which correct labels (transform)', () => { const onChange = jest.fn(); const element = ( x.toUpperCase()} /> @@ -582,7 +582,7 @@ it(' - renders a set of Checkboxes which correct labels expect(wrapper.find(FormControlLabel).at(1).text()).toBe('B'); }); -it(' - renders a set of Radio buttons which correctly reacts on change (same value)', () => { +test(' - renders a set of Radio buttons which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -602,7 +602,7 @@ it(' - renders a set of Radio buttons which correctly re expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -612,7 +612,7 @@ it(' - renders a label', () => { expect(wrapper.find(FormLabel).text()).toBe('y *'); }); -it(' - renders a SelectField with correct error text (showInlineError=true)', () => { +test(' - renders a SelectField with correct error text (showInlineError=true)', () => { const error = new Error(); const element = ( - renders a SelectField with correct error text (sh expect(wrapper.find(FormHelperText).text()).toBe('Error'); }); -it(' - renders a SelectField with correct error text (showInlineError=false)', () => { +test(' - renders a SelectField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders a SelectField with correct error text (sh expect(wrapper.find(FormHelperText)).toHaveLength(0); }); -it(' - renders Checkbox with appearance=checkbox', () => { +test(' - renders Checkbox with appearance=checkbox', () => { const element = ; const wrapper = mount( element, @@ -664,7 +664,7 @@ it(' - renders Checkbox with appearance=checkbox', () => expect(wrapper.find(Switch)).toHaveLength(0); }); -it(' - renders Switch with appearance=switch', () => { +test(' - renders Switch with appearance=switch', () => { const element = ; const wrapper = mount( element, @@ -678,14 +678,14 @@ it(' - renders Switch with appearance=switch', () => { expect(wrapper.find(Switch)).toHaveLength(2); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -it(' - disabled items (checkboxes) based on predicate', () => { +test(' - disabled items (checkboxes) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( diff --git a/packages/uniforms-mui/__tests__/SubmitField.tsx b/packages/uniforms-mui/__tests__/SubmitField.tsx index ae6e6f92c..046eb8fd1 100644 --- a/packages/uniforms-mui/__tests__/SubmitField.tsx +++ b/packages/uniforms-mui/__tests__/SubmitField.tsx @@ -4,21 +4,21 @@ import { SubmitField } from 'uniforms-mui'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders', () => { +test(' - renders', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper).toHaveLength(1); }); -it(' - renders SubmitField with correct disabled state', () => { +test(' - renders SubmitField with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper.children().first().prop('disabled')).toBe(true); }); -it(' - renders SubmitField with correct disabled state when error (context)', () => { +test(' - renders SubmitField with correct disabled state when error (context)', () => { const error = new Error(); const element = ; const wrapper = mount(element, createContext({}, { error })); diff --git a/packages/uniforms-mui/__tests__/TextField.tsx b/packages/uniforms-mui/__tests__/TextField.tsx index f2975ae55..c9d563ca6 100644 --- a/packages/uniforms-mui/__tests__/TextField.tsx +++ b/packages/uniforms-mui/__tests__/TextField.tsx @@ -10,14 +10,14 @@ describe('@RTL - TextField tests', () => { testTextField(TextField); }); -it(' - renders an TextField', () => { +test(' - renders an TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextFieldMaterial)).toHaveLength(1); }); -it(' - renders a TextField with correct disabled state', () => { +test(' - renders a TextField with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -25,7 +25,7 @@ it(' - renders a TextField with correct disabled state', () => { expect(wrapper.find(TextFieldMaterial).prop('disabled')).toBe(true); }); -it(' - renders a TextField with correct readOnly state', () => { +test(' - renders a TextField with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ it(' - renders a TextField with correct readOnly state', () => { ); }); -it(' - renders a TextField with correct id (inherited)', () => { +test(' - renders a TextField with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ it(' - renders a TextField with correct id (inherited)', () => { expect(wrapper.find(TextFieldMaterial).prop('id')).toBeTruthy(); }); -it(' - renders a TextField with correct id (specified)', () => { +test(' - renders a TextField with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ it(' - renders a TextField with correct id (specified)', () => { expect(wrapper.find(TextFieldMaterial).prop('id')).toBe('y'); }); -it(' - renders a TextField with correct name', () => { +test(' - renders a TextField with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -59,7 +59,7 @@ it(' - renders a TextField with correct name', () => { expect(wrapper.find(TextFieldMaterial).prop('name')).toBe('x'); }); -it(' - renders a TextField with correct placeholder', () => { +test(' - renders a TextField with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -67,7 +67,7 @@ it(' - renders a TextField with correct placeholder', () => { expect(wrapper.find(TextFieldMaterial).prop('placeholder')).toBe('y'); }); -it(' - renders a TextField with correct value (default)', () => { +test(' - renders a TextField with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -75,7 +75,7 @@ it(' - renders a TextField with correct value (default)', () => { expect(wrapper.find(TextFieldMaterial).prop('value')).toBe(''); }); -it(' - renders a TextField with correct value (model)', () => { +test(' - renders a TextField with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -86,7 +86,7 @@ it(' - renders a TextField with correct value (model)', () => { expect(wrapper.find(TextFieldMaterial).prop('value')).toBe('y'); }); -it(' - renders a TextField with correct value (specified)', () => { +test(' - renders a TextField with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -94,7 +94,7 @@ it(' - renders a TextField with correct value (specified)', () => { expect(wrapper.find(TextFieldMaterial).prop('value')).toBe('y'); }); -it(' - renders a TextField which correctly reacts on change', () => { +test(' - renders a TextField which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -110,7 +110,7 @@ it(' - renders a TextField which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a TextField which correctly reacts on change (empty)', () => { +test(' - renders a TextField which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -126,7 +126,7 @@ it(' - renders a TextField which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders a TextField which correctly reacts on change (same value)', () => { +test(' - renders a TextField which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -142,7 +142,7 @@ it(' - renders a TextField which correctly reacts on change (same val expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -150,7 +150,7 @@ it(' - renders a label', () => { expect(wrapper.find(TextFieldMaterial).prop('label')).toBe('y'); }); -it(' - renders a TextField with correct error text (specified)', () => { +test(' - renders a TextField with correct error text (specified)', () => { const error = new Error(); const element = ( @@ -160,7 +160,7 @@ it(' - renders a TextField with correct error text (specified)', () = expect(wrapper.find(TextFieldMaterial).prop('helperText')).toBe('Error'); }); -it(' - renders a TextField with correct error text (showInlineError=false)', () => { +test(' - renders a TextField with correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders a TextField with correct error text (showInlineError=f expect(wrapper.find(TextFieldMaterial).prop('helperText')).toBeUndefined(); }); -it(' - renders a input with autocomplete off', () => { +test(' - renders a input with autocomplete off', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-mui/__tests__/ValidateQuickForm.tsx b/packages/uniforms-mui/__tests__/ValidateQuickForm.tsx index c9fa7957c..fdae9b151 100644 --- a/packages/uniforms-mui/__tests__/ValidateQuickForm.tsx +++ b/packages/uniforms-mui/__tests__/ValidateQuickForm.tsx @@ -5,7 +5,7 @@ import createContext from './_createContext'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-mui/__tests__/ValidatedForm.tsx b/packages/uniforms-mui/__tests__/ValidatedForm.tsx index c76a52065..2fc84e79f 100644 --- a/packages/uniforms-mui/__tests__/ValidatedForm.tsx +++ b/packages/uniforms-mui/__tests__/ValidatedForm.tsx @@ -5,7 +5,7 @@ import createContext from './_createContext'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-mui/__tests__/index.ts b/packages/uniforms-mui/__tests__/index.ts index bec0d5be2..180e878e1 100644 --- a/packages/uniforms-mui/__tests__/index.ts +++ b/packages/uniforms-mui/__tests__/index.ts @@ -1,6 +1,6 @@ import * as material from 'uniforms-mui'; -it('exports everything', () => { +test('exports everything', () => { expect(material).toEqual({ AutoFields: expect.any(Function), AutoField: expect.any(Function), diff --git a/packages/uniforms-mui/__tests__/wrapField.tsx b/packages/uniforms-mui/__tests__/wrapField.tsx index 10ef50abc..af882cc7a 100644 --- a/packages/uniforms-mui/__tests__/wrapField.tsx +++ b/packages/uniforms-mui/__tests__/wrapField.tsx @@ -5,21 +5,21 @@ import { wrapField } from 'uniforms-mui'; import mount from './_mount'; -it(' - renders wrapper', () => { +test(' - renders wrapper', () => { const element = wrapField({},
); const wrapper = mount(element); expect(wrapper.find(FormControl)).toHaveLength(1); }); -it(' - renders wrapper with helper text', () => { +test(' - renders wrapper with helper text', () => { const element = wrapField({ helperText: 'Helper text' },
); const wrapper = mount(element); expect(wrapper.find(FormHelperText).text()).toBe('Helper text'); }); -it(' - renders wrapper with error', () => { +test(' - renders wrapper with error', () => { const element = wrapField( { showInlineError: true, diff --git a/packages/uniforms-semantic/__tests__/AutoField.tsx b/packages/uniforms-semantic/__tests__/AutoField.tsx index 5afc791e6..28b7de9fe 100644 --- a/packages/uniforms-semantic/__tests__/AutoField.tsx +++ b/packages/uniforms-semantic/__tests__/AutoField.tsx @@ -14,14 +14,14 @@ import { import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(AutoField)).toHaveLength(1); }); -it(' - detects RadioField', () => { +test(' - detects RadioField', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ it(' - detects RadioField', () => { expect(wrapper.find(RadioField.Component)).toHaveLength(1); }); -it(' - detects SelectField', () => { +test(' - detects SelectField', () => { const element = ; const wrapper = mount( element, @@ -50,14 +50,14 @@ it(' - detects SelectField', () => { expect(wrapper.find(SelectField.Component)).toHaveLength(1); }); -it(' - detects DateField', () => { +test(' - detects DateField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DateField.Component)).toHaveLength(1); }); -it(' - detects ListField', () => { +test(' - detects ListField', () => { const element = ; const wrapper = mount( element, @@ -67,35 +67,35 @@ it(' - detects ListField', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -it(' - detects NumField', () => { +test(' - detects NumField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(NumField.Component)).toHaveLength(1); }); -it(' - detects NestField', () => { +test(' - detects NestField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Object } })); expect(wrapper.find(NestField)).toHaveLength(1); }); -it(' - detects TextField', () => { +test(' - detects TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField.Component)).toHaveLength(1); }); -it(' - detects BoolField', () => { +test(' - detects BoolField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(BoolField.Component)).toHaveLength(1); }); -it(' - detects Component (model)', () => { +test(' - detects Component (model)', () => { const Component = jest.fn(() => null); const element = ; @@ -107,7 +107,7 @@ it(' - detects Component (model)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -it(' - uses Component (props)', () => { +test(' - uses Component (props)', () => { const Component = jest.fn(() => null); const element = ; @@ -116,7 +116,7 @@ it(' - uses Component (props)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -it(' - uses Component (context)', () => { +test(' - uses Component (context)', () => { const FieldA = jest.fn(() => null); const FieldB = jest.fn(() => null); @@ -136,7 +136,7 @@ it(' - uses Component (context)', () => { expect(FieldB).toHaveBeenCalledTimes(1); }); -it(' - uses Component (invalid)', () => { +test(' - uses Component (invalid)', () => { const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {}); expect(() => { const element = ; diff --git a/packages/uniforms-semantic/__tests__/AutoFields.tsx b/packages/uniforms-semantic/__tests__/AutoFields.tsx index 33f77caf2..96f48bf62 100644 --- a/packages/uniforms-semantic/__tests__/AutoFields.tsx +++ b/packages/uniforms-semantic/__tests__/AutoFields.tsx @@ -4,14 +4,14 @@ import { AutoField, AutoFields } from 'uniforms-semantic'; import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('AutoFields')).toHaveLength(1); }); -it(' - render all fields by default', () => { +test(' - render all fields by default', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - render all fields by default', () => { expect(wrapper.find('input')).toHaveLength(3); }); -it(' - renders only specified fields', () => { +test(' - renders only specified fields', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ it(' - renders only specified fields', () => { ); }); -it(' - does not render ommited fields', () => { +test(' - does not render ommited fields', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ it(' - does not render ommited fields', () => { ); }); -it(' - wraps fields in specified element', () => { +test(' - wraps fields in specified element', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ it(' - wraps fields in specified element', () => { expect(wrapper.find('section').find('input')).toHaveLength(3); }); -it(' - pass props to the children', () => { +test(' - pass props to the children', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-semantic/__tests__/AutoForm.tsx b/packages/uniforms-semantic/__tests__/AutoForm.tsx index b65febc85..ec60672e8 100644 --- a/packages/uniforms-semantic/__tests__/AutoForm.tsx +++ b/packages/uniforms-semantic/__tests__/AutoForm.tsx @@ -4,7 +4,7 @@ import { AutoForm } from 'uniforms-semantic'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-semantic/__tests__/BaseForm.tsx b/packages/uniforms-semantic/__tests__/BaseForm.tsx index b6170e597..a89a9044b 100644 --- a/packages/uniforms-semantic/__tests__/BaseForm.tsx +++ b/packages/uniforms-semantic/__tests__/BaseForm.tsx @@ -4,7 +4,7 @@ import { BaseForm } from 'uniforms-semantic'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-semantic/__tests__/BoolField.tsx b/packages/uniforms-semantic/__tests__/BoolField.tsx index 19a565477..e4d8feb99 100644 --- a/packages/uniforms-semantic/__tests__/BoolField.tsx +++ b/packages/uniforms-semantic/__tests__/BoolField.tsx @@ -4,14 +4,14 @@ import { BoolField } from 'uniforms-semantic'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders a input with correct id (inherited)', () => { +test(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -19,7 +19,7 @@ it(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders a input with correct id (specified)', () => { +test(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -27,7 +27,7 @@ it(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders a input with correct name', () => { +test(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -35,7 +35,7 @@ it(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -43,7 +43,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('checkbox'); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -65,7 +65,7 @@ it(' - renders an input with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a input with correct label (specified)', () => { +test(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -76,7 +76,7 @@ it(' - renders a input with correct label (specified)', () => { ); }); -it(' - renders a input with correct value (default)', () => { +test(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -84,7 +84,7 @@ it(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('checked')).toBe(false); }); -it(' - renders a input with correct value (model)', () => { +test(' - renders a input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -95,7 +95,7 @@ it(' - renders a input with correct value (model)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -it(' - renders a input with correct value (specified)', () => { +test(' - renders a input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -103,7 +103,7 @@ it(' - renders a input with correct value (specified)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -it(' - renders a input which correctly reacts on change', () => { +test(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -117,7 +117,7 @@ it(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', true); }); -it(' - renders a input which correctly reacts on change', () => { +test(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -131,7 +131,7 @@ it(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', true); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -140,7 +140,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -150,7 +150,7 @@ it(' - renders correct error text (specified)', () => { expect(wrapper.children().last().text()).toBe('Error'); }); -it(' - renders correct error text (showInlineError=false)', () => { +test(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.children().last().text()).not.toBe('Error'); }); -it(' - renders with a custom wrapClassName', () => { +test(' - renders with a custom wrapClassName', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('.ui.test-class-name')).toHaveLength(1); }); -it(' - renders with a `fitted` className when `label` is disabled', () => { +test(' - renders with a `fitted` className when `label` is disabled', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -180,7 +180,7 @@ it(' - renders with a `fitted` className when `label` is disabled', ( expect(found.hasClass('fitted')).toEqual(true); }); -it(' - renders without a `fitted` className when `label` is enabled', () => { +test(' - renders without a `fitted` className when `label` is enabled', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-semantic/__tests__/DateField.tsx b/packages/uniforms-semantic/__tests__/DateField.tsx index 7568cb1c9..121e08ce7 100644 --- a/packages/uniforms-semantic/__tests__/DateField.tsx +++ b/packages/uniforms-semantic/__tests__/DateField.tsx @@ -8,7 +8,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - DateField tests', () => { - it(' - handles "date" type correctly', () => { + test(' - handles "date" type correctly', () => { const onChange = jest.fn(); const initialDate = new Date(Date.UTC(2020, 0, 1)); @@ -29,14 +29,14 @@ describe('@RTL - DateField tests', () => { }); }); -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders a input with correct id (inherited)', () => { +test(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -44,7 +44,7 @@ it(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders a input with correct id (specified)', () => { +test(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -52,7 +52,7 @@ it(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders a input with correct name', () => { +test(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -60,7 +60,7 @@ it(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -79,7 +79,7 @@ test.each(['datetime-local', 'date'] as const)( }, ); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -87,7 +87,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -95,7 +95,7 @@ it(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -it(' - renders a input with correct label (specified)', () => { +test(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -106,7 +106,7 @@ it(' - renders a input with correct label (specified)', () => { ); }); -it(' - renders a input with correct value (default)', () => { +test(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -114,7 +114,7 @@ it(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders a input with correct value (model)', () => { +test(' - renders a input with correct value (model)', () => { const now = new Date(); const element = ; const wrapper = mount( @@ -128,7 +128,7 @@ it(' - renders a input with correct value (model)', () => { ); }); -it(' - renders a input with correct value (specified)', () => { +test(' - renders a input with correct value (specified)', () => { const now = new Date(); const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -139,7 +139,7 @@ it(' - renders a input with correct value (specified)', () => { ); }); -it(' - renders a input which correctly reacts on change', () => { +test(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const now = new Date(); @@ -158,7 +158,7 @@ it(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', now); }); -it(' - renders a input which correctly reacts on change (empty)', () => { +test(' - renders a input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -176,7 +176,7 @@ it(' - renders a input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a input which correctly reacts on change (overflow)', () => { +test(' - renders a input which correctly reacts on change (overflow)', () => { const onChange = jest.fn(); const now = new Date(1e5, 0); @@ -195,7 +195,7 @@ it(' - renders a input which correctly reacts on change (overflow)', expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -204,7 +204,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -214,7 +214,7 @@ it(' - renders correct error text (specified)', () => { expect(wrapper.children().last().text()).toBe('Error'); }); -it(' - renders correct error text (showInlineError=false)', () => { +test(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.children().last().text()).not.toBe('Error'); }); -it(' - renders a icon', () => { +test(' - renders a icon', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find('i')).toHaveLength(1); }); -it(' - renders a icon', () => { +test(' - renders a icon', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find('i')).toHaveLength(1); }); -it(' - renders with a custom wrapClassName', () => { +test(' - renders with a custom wrapClassName', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); diff --git a/packages/uniforms-semantic/__tests__/ErrorField.tsx b/packages/uniforms-semantic/__tests__/ErrorField.tsx index 607afaa10..ed4e36e25 100644 --- a/packages/uniforms-semantic/__tests__/ErrorField.tsx +++ b/packages/uniforms-semantic/__tests__/ErrorField.tsx @@ -11,14 +11,14 @@ const error = { message: 'X is required [validation-error]', }; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorField)).toHaveLength(1); }); -it(' - renders correct error message (context)', () => { +test(' - renders correct error message (context)', () => { const element = ; const wrapper = mount( element, @@ -29,7 +29,7 @@ it(' - renders correct error message (context)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -it(' - renders correct error message (specified)', () => { +test(' - renders correct error message (specified)', () => { const element = ( - renders correct error message (specified)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -it(' - renders correct children if specified', () => { +test(' - renders correct children if specified', () => { const element = Error; const wrapper = mount( element, diff --git a/packages/uniforms-semantic/__tests__/ErrorsField.tsx b/packages/uniforms-semantic/__tests__/ErrorsField.tsx index 7d7146fd6..8b83e5ff7 100644 --- a/packages/uniforms-semantic/__tests__/ErrorsField.tsx +++ b/packages/uniforms-semantic/__tests__/ErrorsField.tsx @@ -15,14 +15,14 @@ const error = { message: 'X is required [validation-error]', }; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorsField)).toHaveLength(1); }); -it(' - renders list of correct error messages (context)', () => { +test(' - renders list of correct error messages (context)', () => { const element = ; const wrapper = mount( element, @@ -38,7 +38,7 @@ it(' - renders list of correct error messages (context)', () => { expect(wrapper.find('li').at(2).text()).toBe('Z is required'); }); -it(' - renders children (specified)', () => { +test(' - renders children (specified)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-semantic/__tests__/HiddenField.tsx b/packages/uniforms-semantic/__tests__/HiddenField.tsx index 5d1cc49a4..f8d7481d2 100644 --- a/packages/uniforms-semantic/__tests__/HiddenField.tsx +++ b/packages/uniforms-semantic/__tests__/HiddenField.tsx @@ -4,14 +4,14 @@ import { HiddenField } from 'uniforms-semantic'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('hidden'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -62,7 +62,7 @@ it(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input which correctly reacts on model change', () => { +test(' - renders an input which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -76,7 +76,7 @@ it(' - renders an input which correctly reacts on model change', () expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders an input which correctly reacts on model change (empty)', () => { +test(' - renders an input which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -90,7 +90,7 @@ it(' - renders an input which correctly reacts on model change (emp expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders an input which correctly reacts on model change (same value)', () => { +test(' - renders an input which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -104,14 +104,14 @@ it(' - renders an input which correctly reacts on model change (sam expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders nothing', () => { +test(' - renders nothing', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.children()).toHaveLength(0); }); -it(' - renders nothing which correctly reacts on model change', () => { +test(' - renders nothing which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ it(' - renders nothing which correctly reacts on model change expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders nothing which correctly reacts on model change (empty)', () => { +test(' - renders nothing which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ it(' - renders nothing which correctly reacts on model change expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders nothing which correctly reacts on model change (same value)', () => { +test(' - renders nothing which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; diff --git a/packages/uniforms-semantic/__tests__/ListAddField.tsx b/packages/uniforms-semantic/__tests__/ListAddField.tsx index a2472a43a..409bf402c 100644 --- a/packages/uniforms-semantic/__tests__/ListAddField.tsx +++ b/packages/uniforms-semantic/__tests__/ListAddField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListAddField)).toHaveLength(1); }); -it(' - prevents onClick when disabled', () => { +test(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ it(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when limit reached', () => { +test(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { maxCount: 0 } })); @@ -39,7 +39,7 @@ it(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - correctly reacts on click', () => { +test(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ it(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['y']); }); -it(' - correctly reacts on keyboard enter key', () => { +test(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-semantic/__tests__/ListDelField.tsx b/packages/uniforms-semantic/__tests__/ListDelField.tsx index 6ae5ead98..9d0d6e2e5 100644 --- a/packages/uniforms-semantic/__tests__/ListDelField.tsx +++ b/packages/uniforms-semantic/__tests__/ListDelField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListDelField)).toHaveLength(1); }); -it(' - prevents onClick when disabled', () => { +test(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ it(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when limit reached', () => { +test(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { minCount: 3 } })); @@ -39,7 +39,7 @@ it(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - correctly reacts on click', () => { +test(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ it(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['x', 'z']); }); -it(' - correctly reacts on keyboard enter key', () => { +test(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-semantic/__tests__/ListField.tsx b/packages/uniforms-semantic/__tests__/ListField.tsx index 7616a1329..ba41431a1 100644 --- a/packages/uniforms-semantic/__tests__/ListField.tsx +++ b/packages/uniforms-semantic/__tests__/ListField.tsx @@ -12,7 +12,7 @@ describe('@RTL - ListField tests', () => { }); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount( element, @@ -22,7 +22,7 @@ it(' - works', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -it(' - renders ListAddField', () => { +test(' - renders ListAddField', () => { const element = ; const wrapper = mount( element, @@ -33,7 +33,7 @@ it(' - renders ListAddField', () => { expect(wrapper.find(ListAddField).prop('name')).toBe('$'); }); -it(' - renders correct label (specified)', () => { +test(' - renders correct label (specified)', () => { const element = ; const wrapper = mount( element, @@ -46,7 +46,7 @@ it(' - renders correct label (specified)', () => { ); }); -it(' - renders correct number of items with model (specified)', () => { +test(' - renders correct number of items with model (specified)', () => { const element = ; const wrapper = mount( element, @@ -58,7 +58,7 @@ it(' - renders correct number of items with model (specified)', () => expect(wrapper.find('input')).toHaveLength(3); }); -it(' - passes itemProps to its children', () => { +test(' - passes itemProps to its children', () => { const element = ; const wrapper = mount( element, @@ -70,7 +70,7 @@ it(' - passes itemProps to its children', () => { expect(wrapper.find(ListItemField).first().prop('data-xyz')).toBe(1); }); -it(' - renders children (specified)', () => { +test(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -89,7 +89,7 @@ it(' - renders children (specified)', () => { expect(Child).toHaveBeenCalledTimes(2); }); -it(' - renders children with correct name (children)', () => { +test(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -108,7 +108,7 @@ it(' - renders children with correct name (children)', () => { expect(wrapper.find(Child).at(1).prop('name')).toBe('1'); }); -it(' - renders children with correct name (value)', () => { +test(' - renders children with correct name (value)', () => { const element = ; const wrapper = mount( element, @@ -121,7 +121,7 @@ it(' - renders children with correct name (value)', () => { expect(wrapper.find(ListItemField).at(1).prop('name')).toBe('1'); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -134,7 +134,7 @@ it(' - renders correct error text (specified)', () => { expect(wrapper.children().first().text()).toBe('Error'); }); -it(' - renders correct error text (showInlineError=false)', () => { +test(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.children().first().text()).not.toBe('Error'); }); -it(' - renders proper number of optional values after add new value', () => { +test(' - renders proper number of optional values after add new value', () => { const element = ; const onChange = jest.fn(); const wrapper = mount( diff --git a/packages/uniforms-semantic/__tests__/ListItemField.tsx b/packages/uniforms-semantic/__tests__/ListItemField.tsx index 5519809b7..2c4224268 100644 --- a/packages/uniforms-semantic/__tests__/ListItemField.tsx +++ b/packages/uniforms-semantic/__tests__/ListItemField.tsx @@ -4,7 +4,7 @@ import { AutoField, ListDelField, ListItemField } from 'uniforms-semantic'; import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - works', () => { expect(wrapper.find(ListItemField)).toHaveLength(1); }); -it(' - renders ListDelField', () => { +test(' - renders ListDelField', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - renders ListDelField', () => { expect(wrapper.find(ListDelField).childAt(0).prop('name')).toBe('x.1'); }); -it(' - renders AutoField', () => { +test(' - renders AutoField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ it(' - renders AutoField', () => { expect(wrapper.find(AutoField)).toHaveLength(1); }); -it(' - renders children if specified', () => { +test(' - renders children if specified', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( diff --git a/packages/uniforms-semantic/__tests__/LongTextField.tsx b/packages/uniforms-semantic/__tests__/LongTextField.tsx index c977b6829..c8a43cba7 100644 --- a/packages/uniforms-semantic/__tests__/LongTextField.tsx +++ b/packages/uniforms-semantic/__tests__/LongTextField.tsx @@ -4,14 +4,14 @@ import { LongTextField } from 'uniforms-semantic'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a textarea', () => { +test(' - renders a textarea', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('textarea')).toHaveLength(1); }); -it(' - renders a textarea with correct disabled state', () => { +test(' - renders a textarea with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ it(' - renders a textarea with correct disabled state', () => { expect(wrapper.find('textarea').prop('disabled')).toBe(true); }); -it(' - renders a textarea with correct readOnly state', () => { +test(' - renders a textarea with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ it(' - renders a textarea with correct readOnly state', () => { expect(wrapper.find('textarea').prop('readOnly')).toBe(true); }); -it(' - renders a textarea with correct id (inherited)', () => { +test(' - renders a textarea with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ it(' - renders a textarea with correct id (inherited)', () => { expect(wrapper.find('textarea').prop('id')).toBeTruthy(); }); -it(' - renders a textarea with correct id (specified)', () => { +test(' - renders a textarea with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ it(' - renders a textarea with correct id (specified)', () => { expect(wrapper.find('textarea').prop('id')).toBe('y'); }); -it(' - renders a textarea with correct name', () => { +test(' - renders a textarea with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ it(' - renders a textarea with correct name', () => { expect(wrapper.find('textarea').prop('name')).toBe('x'); }); -it(' - renders a textarea with correct placeholder', () => { +test(' - renders a textarea with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -59,7 +59,7 @@ it(' - renders a textarea with correct placeholder', () => { expect(wrapper.find('textarea').prop('placeholder')).toBe('y'); }); -it(' - renders a textarea with correct value (default)', () => { +test(' - renders a textarea with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -67,7 +67,7 @@ it(' - renders a textarea with correct value (default)', () => { expect(wrapper.find('textarea').prop('value')).toBe(''); }); -it(' - renders a textarea with correct value (model)', () => { +test(' - renders a textarea with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -78,7 +78,7 @@ it(' - renders a textarea with correct value (model)', () => { expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -it(' - renders a textarea with correct value (specified)', () => { +test(' - renders a textarea with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -86,7 +86,7 @@ it(' - renders a textarea with correct value (specified)', () => expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -it(' - renders a textarea which correctly reacts on change', () => { +test(' - renders a textarea which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -102,7 +102,7 @@ it(' - renders a textarea which correctly reacts on change', () = expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a textarea which correctly reacts on change (empty)', () => { +test(' - renders a textarea which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -118,7 +118,7 @@ it(' - renders a textarea which correctly reacts on change (empty expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders a textarea which correctly reacts on change (same value)', () => { +test(' - renders a textarea which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -134,7 +134,7 @@ it(' - renders a textarea which correctly reacts on change (same expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -145,7 +145,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -154,7 +154,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( - renders correct error text (specified)', () => { expect(wrapper.children().last().text()).toBe('Error'); }); -it(' - renders correct error text (showInlineError=false)', () => { +test(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders an for each field', () => { +test(' - renders an for each field', () => { const element = ; const wrapper = mount( element, @@ -20,7 +20,7 @@ it(' - renders an for each field', () => { expect(wrapper.find(AutoField).at(1).prop('name')).toBe('b'); }); -it(' - renders custom content if given', () => { +test(' - renders custom content if given', () => { const element = (
@@ -40,7 +40,7 @@ it(' - renders custom content if given', () => { expect(wrapper.find('article').prop('data-test')).toBe('content'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -71,7 +71,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -88,7 +88,7 @@ it(' - renders correct error text (specified)', () => { expect(wrapper.children().at(0).text()).toBe('Error'); }); -it(' - renders correct error text (showInlineError=false)', () => { +test(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -19,7 +19,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -27,7 +27,7 @@ it(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -35,7 +35,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -43,7 +43,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct max', () => { +test(' - renders an input with correct max', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct max', () => { expect(wrapper.find('input').prop('max')).toBe(10); }); -it(' - renders an input with correct min', () => { +test(' - renders an input with correct min', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -59,7 +59,7 @@ it(' - renders an input with correct min', () => { expect(wrapper.find('input').prop('min')).toBe(10); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -67,7 +67,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct placeholder', () => { +test(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -75,7 +75,7 @@ it(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -it(' - renders an input with correct step (decimal)', () => { +test(' - renders an input with correct step (decimal)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -83,7 +83,7 @@ it(' - renders an input with correct step (decimal)', () => { expect(wrapper.find('input').prop('step')).toBe(0.01); }); -it(' - renders an input with correct step (integer)', () => { +test(' - renders an input with correct step (integer)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -91,7 +91,7 @@ it(' - renders an input with correct step (integer)', () => { expect(wrapper.find('input').prop('step')).toBe(1); }); -it(' - renders an input with correct step (set)', () => { +test(' - renders an input with correct step (set)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -99,7 +99,7 @@ it(' - renders an input with correct step (set)', () => { expect(wrapper.find('input').prop('step')).toBe(3); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -107,7 +107,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('number'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -115,7 +115,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const onChange = jest.fn(); const element = ; @@ -157,7 +157,7 @@ it(' - renders an input with correct value (model)', () => { spy.mockRestore(); }); -it(' - renders an input with correct value (specified)', () => { +test(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -165,7 +165,7 @@ it(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe(2); }); -it(' - renders an input which correctly reacts on change', () => { +test(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -181,7 +181,7 @@ it(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -it(' - renders an input which correctly reacts on change (decimal on decimal)', () => { +test(' - renders an input which correctly reacts on change (decimal on decimal)', () => { const onChange = jest.fn(); const element = ; @@ -197,7 +197,7 @@ it(' - renders an input which correctly reacts on change (decimal on d expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); -it(' - renders an input which correctly reacts on change (decimal on integer)', () => { +test(' - renders an input which correctly reacts on change (decimal on integer)', () => { const onChange = jest.fn(); const element = ; @@ -213,7 +213,7 @@ it(' - renders an input which correctly reacts on change (decimal on i expect(onChange).toHaveBeenLastCalledWith('x', 2); }); -it(' - renders an input which correctly reacts on change (empty)', () => { +test(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -229,7 +229,7 @@ it(' - renders an input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders an input which correctly reacts on change (same value)', () => { +test(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -245,7 +245,7 @@ it(' - renders an input which correctly reacts on change (same value)' expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -it(' - renders an input which correctly reacts on change (zero)', () => { +test(' - renders an input which correctly reacts on change (zero)', () => { const onChange = jest.fn(); const element = ; @@ -261,7 +261,7 @@ it(' - renders an input which correctly reacts on change (zero)', () = expect(onChange).toHaveBeenLastCalledWith('x', 0); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -272,7 +272,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -281,7 +281,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -291,7 +291,7 @@ it(' - renders correct error text (specified)', () => { expect(wrapper.children().last().text()).toBe('Error'); }); -it(' - renders correct error text (showInlineError=false)', () => { +test(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.children().last().text()).not.toBe('Error'); }); -it(' - renders a icon', () => { +test(' - renders a icon', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find('i')).toHaveLength(1); }); -it(' - renders a icon', () => { +test(' - renders a icon', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find('i')).toHaveLength(1); }); -it(' - renders with a custom wrapClassName', () => { +test(' - renders with a custom wrapClassName', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); diff --git a/packages/uniforms-semantic/__tests__/QuickForm.tsx b/packages/uniforms-semantic/__tests__/QuickForm.tsx index 83923a142..2abd1b716 100644 --- a/packages/uniforms-semantic/__tests__/QuickForm.tsx +++ b/packages/uniforms-semantic/__tests__/QuickForm.tsx @@ -4,7 +4,7 @@ import { QuickForm } from 'uniforms-semantic'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - renders', () => { +test(' - renders', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-semantic/__tests__/RadioField.tsx b/packages/uniforms-semantic/__tests__/RadioField.tsx index 7b8596df8..c882c04cc 100644 --- a/packages/uniforms-semantic/__tests__/RadioField.tsx +++ b/packages/uniforms-semantic/__tests__/RadioField.tsx @@ -4,7 +4,7 @@ import { RadioField } from 'uniforms-semantic'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a set of checkboxes', () => { +test(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -it(' - renders a set of checkboxes with correct disabled state', () => { +test(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -26,7 +26,7 @@ it(' - renders a set of checkboxes with correct disabled state', () expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -it(' - renders a set of checkboxes with correct readOnly state', () => { +test(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -43,7 +43,7 @@ it(' - renders a set of checkboxes with correct readOnly state', () expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a set of checkboxes with correct id (inherited)', () => { +test(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ it(' - renders a set of checkboxes with correct id (inherited)', () expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -it(' - renders a set of checkboxes with correct id (specified)', () => { +test(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -67,7 +67,7 @@ it(' - renders a set of checkboxes with correct id (specified)', () expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -it(' - renders a set of checkboxes with correct name', () => { +test(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -79,7 +79,7 @@ it(' - renders a set of checkboxes with correct name', () => { expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -it(' - renders a set of checkboxes with correct options', () => { +test(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -91,7 +91,7 @@ it(' - renders a set of checkboxes with correct options', () => { expect(wrapper.find('label').at(1).text()).toBe('b'); }); -it(' - renders a set of checkboxes with correct options (transform)', () => { +test(' - renders a set of checkboxes with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -103,7 +103,7 @@ it(' - renders a set of checkboxes with correct options (transform)' expect(wrapper.find('label').at(1).text()).toBe('B'); }); -it(' - renders a set of checkboxes with correct value (default)', () => { +test(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -115,7 +115,7 @@ it(' - renders a set of checkboxes with correct value (default)', () expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -it(' - renders a set of checkboxes with correct value (model)', () => { +test(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -130,7 +130,7 @@ it(' - renders a set of checkboxes with correct value (model)', () = expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes with correct value (specified)', () => { +test(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -142,7 +142,7 @@ it(' - renders a set of checkboxes with correct value (specified)', expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes which correctly reacts on change', () => { +test(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -159,7 +159,7 @@ it(' - renders a set of checkboxes which correctly reacts on change' expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -176,7 +176,7 @@ it(' - renders a set of checkboxes which correctly reacts on change expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -187,7 +187,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -199,7 +199,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -213,7 +213,7 @@ it(' - renders correct error text (specified)', () => { expect(wrapper.find('.ui.red.label').text()).toBe('Error'); }); -it(' - renders correct error text (showInlineError=false)', () => { +test(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.find('.ui.red.label').length).toBe(0); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), diff --git a/packages/uniforms-semantic/__tests__/SelectField.tsx b/packages/uniforms-semantic/__tests__/SelectField.tsx index 2dea37b89..239a11783 100644 --- a/packages/uniforms-semantic/__tests__/SelectField.tsx +++ b/packages/uniforms-semantic/__tests__/SelectField.tsx @@ -4,7 +4,7 @@ import { SelectField } from 'uniforms-semantic'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a select', () => { +test(' - renders a select', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - renders a select', () => { expect(wrapper.find('select')).toHaveLength(1); }); -it(' - renders a select with correct disabled state', () => { +test(' - renders a select with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - renders a select with correct disabled state', () => { expect(wrapper.find('select').prop('disabled')).toBe(true); }); -it(' - renders a select with correct readOnly state', () => { +test(' - renders a select with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -44,7 +44,7 @@ it(' - renders a select with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a select with correct id (inherited)', () => { +test(' - renders a select with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ it(' - renders a select with correct id (inherited)', () => { expect(wrapper.find('select').prop('id')).toBeTruthy(); }); -it(' - renders a select with correct id (specified)', () => { +test(' - renders a select with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -66,7 +66,7 @@ it(' - renders a select with correct id (specified)', () => { expect(wrapper.find('select').prop('id')).toBe('y'); }); -it(' - renders a select with correct name', () => { +test(' - renders a select with correct name', () => { const element = ; const wrapper = mount( element, @@ -77,7 +77,7 @@ it(' - renders a select with correct name', () => { expect(wrapper.find('select').prop('name')).toBe('x'); }); -it(' - renders a select with correct options', () => { +test(' - renders a select with correct options', () => { const element = ; const wrapper = mount( element, @@ -97,7 +97,7 @@ it(' - renders a select with correct options', () => { }); }); -it(' - renders a select with correct options (transform)', () => { +test(' - renders a select with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -117,7 +117,7 @@ it(' - renders a select with correct options (transform)', () => { }); }); -it(' - renders a select with correct placeholder (fallback)', () => { +test(' - renders a select with correct placeholder (fallback)', () => { const element = ; const wrapper = mount( element, @@ -139,7 +139,7 @@ it(' - renders a select with correct placeholder (fallback)', () => }); }); -it(' - renders a select with correct placeholder (implicit)', () => { +test(' - renders a select with correct placeholder (implicit)', () => { const element = ; const wrapper = mount( element, @@ -159,7 +159,7 @@ it(' - renders a select with correct placeholder (implicit)', () => }); }); -it(' - renders a select with correct value (default)', () => { +test(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -170,7 +170,7 @@ it(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toBe(''); }); -it(' - renders a select with correct value (model)', () => { +test(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -184,7 +184,7 @@ it(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -it(' - renders a select with correct value (specified)', () => { +test(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -195,7 +195,7 @@ it(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -it(' - renders a select which correctly reacts on change', () => { +test(' - renders a select which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -214,7 +214,7 @@ it(' - renders a select which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a select which correctly reacts on change (empty)', () => { +test(' - renders a select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -233,7 +233,7 @@ it(' - renders a select which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a select which correctly reacts on change (same value)', () => { +test(' - renders a select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -252,7 +252,7 @@ it(' - renders a select which correctly reacts on change (same valu expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -266,7 +266,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -278,14 +278,14 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -it(' - disabled items (options) based on predicate', () => { +test(' - disabled items (options) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( @@ -301,7 +301,7 @@ it(' - disabled items (options) based on predicate', () => { expect(wrapper.find('option[value="b"]').at(0).prop('disabled')).toBe(false); }); -it(' - renders a select with correct value (default)', () => { +test(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -315,7 +315,7 @@ it(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual([]); }); -it(' - renders a select with correct value (model)', () => { +test(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -332,7 +332,7 @@ it(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -it(' - renders a select with correct value (specified)', () => { +test(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -346,7 +346,7 @@ it(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -it(' - renders a select which correctly reacts on change (first value)', () => { +test(' - renders a select which correctly reacts on change (first value)', () => { const onChange = jest.fn(); const element = ; @@ -368,7 +368,7 @@ it(' - renders a select which correctly reacts on change (first val expect(onChange).toHaveBeenLastCalledWith('x', ['a']); }); -it(' - renders a select which correctly reacts on change (next value)', () => { +test(' - renders a select which correctly reacts on change (next value)', () => { const onChange = jest.fn(); const element = ; @@ -390,7 +390,7 @@ it(' - renders a select which correctly reacts on change (next valu expect(onChange).toHaveBeenLastCalledWith('x', ['a', 'b']); }); -it(' - renders a select which correctly reacts on change (uncheck) by value', () => { +test(' - renders a select which correctly reacts on change (uncheck) by value', () => { const onChange = jest.fn(); const element = ; @@ -412,7 +412,7 @@ it(' - renders a select which correctly reacts on change (uncheck) expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { +test(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { const onChange = jest.fn(); const element = ; @@ -436,7 +436,7 @@ it(' - renders a select which correctly reacts on change (uncheck) expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a set of checkboxes', () => { +test(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -446,7 +446,7 @@ it(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -it(' - renders a set of checkboxes with correct disabled state', () => { +test(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -458,7 +458,7 @@ it(' - renders a set of checkboxes with correct disabled expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -it(' - renders a set of checkboxes with correct readOnly state', () => { +test(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -475,7 +475,7 @@ it(' - renders a set of checkboxes with correct readOnly expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a set of checkboxes with correct id (inherited)', () => { +test(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -487,7 +487,7 @@ it(' - renders a set of checkboxes with correct id (inhe expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -it(' - renders a set of checkboxes with correct id (specified)', () => { +test(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -499,7 +499,7 @@ it(' - renders a set of checkboxes with correct id (spec expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -it(' - renders a set of checkboxes with correct name', () => { +test(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -511,7 +511,7 @@ it(' - renders a set of checkboxes with correct name', ( expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -it(' - renders a set of checkboxes with correct options', () => { +test(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -523,7 +523,7 @@ it(' - renders a set of checkboxes with correct options' expect(wrapper.find('label').at(1).text()).toBe('b'); }); -it(' - renders a set of checkboxes with correct options (transform)', () => { +test(' - renders a set of checkboxes with correct options (transform)', () => { const element = ( x.toUpperCase()} /> ); @@ -537,7 +537,7 @@ it(' - renders a set of checkboxes with correct options expect(wrapper.find('label').at(1).text()).toBe('B'); }); -it(' - renders a set of checkboxes with correct value (default)', () => { +test(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -549,7 +549,7 @@ it(' - renders a set of checkboxes with correct value (d expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -it(' - renders a set of checkboxes with correct value (model)', () => { +test(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -564,7 +564,7 @@ it(' - renders a set of checkboxes with correct value (m expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes with correct value (specified)', () => { +test(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -576,7 +576,7 @@ it(' - renders a set of checkboxes with correct value (s expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes which correctly reacts on change', () => { +test(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -593,7 +593,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { const onChange = jest.fn(); const element = ; @@ -613,7 +613,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -it(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); const element = ; @@ -633,7 +633,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -650,7 +650,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -661,7 +661,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ( ); @@ -675,14 +675,14 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -696,7 +696,7 @@ it(' - renders correct error text (specified)', () => { expect(wrapper.find('.ui.red.label').text()).toBe('Error'); }); -it(' - renders correct error text (showInlineError=false)', () => { +test(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.find('.ui.red.label').length).toBe(0); }); -it(' - disabled items (checkboxes) based on predicate', () => { +test(' - disabled items (checkboxes) based on predicate', () => { const allowedValues = ['a', 'b']; const element = ( diff --git a/packages/uniforms-semantic/__tests__/SubmitField.tsx b/packages/uniforms-semantic/__tests__/SubmitField.tsx index fa5df267a..c70b97941 100644 --- a/packages/uniforms-semantic/__tests__/SubmitField.tsx +++ b/packages/uniforms-semantic/__tests__/SubmitField.tsx @@ -4,14 +4,14 @@ import { SubmitField } from 'uniforms-semantic'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders', () => { +test(' - renders', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper).toHaveLength(1); }); -it(' - renders disabled if error', () => { +test(' - renders disabled if error', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -19,7 +19,7 @@ it(' - renders disabled if error', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders enabled if error and enabled', () => { +test(' - renders enabled if error and enabled', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -27,7 +27,7 @@ it(' - renders enabled if error and enabled', () => { expect(wrapper.find('input').prop('disabled')).toBe(false); }); -it(' - renders a wrapper with correct value', () => { +test(' - renders a wrapper with correct value', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-semantic/__tests__/TextField.tsx b/packages/uniforms-semantic/__tests__/TextField.tsx index e73bad83e..1da5efac2 100644 --- a/packages/uniforms-semantic/__tests__/TextField.tsx +++ b/packages/uniforms-semantic/__tests__/TextField.tsx @@ -9,7 +9,7 @@ import mount from './_mount'; describe('@RTL - TextField tests', () => { testTextField(TextField); - it(' - renders a wrapper with unknown props', () => { + test(' - renders a wrapper with unknown props', () => { const props = { 'data-x': 'x', 'data-y': 'y', @@ -23,7 +23,7 @@ describe('@RTL - TextField tests', () => { ); }); - it(' - renders a TextField with correct error text (specified)', () => { + test(' - renders a TextField with correct error text (specified)', () => { const errorMessage = 'Error'; render( { expect(screen.getByText(errorMessage)).toBeInTheDocument(); }); - it(' - renders a TextField with correct error text (showInlineError=false)', () => { + test(' - renders a TextField with correct error text (showInlineError=false)', () => { const errorMessage = 'Error'; render( { expect(screen.queryByText(errorMessage)).not.toBeInTheDocument(); }); - it(' - renders an icon', () => { + test(' - renders an icon', () => { const { container } = render(, { x: String, }); @@ -61,7 +61,7 @@ describe('@RTL - TextField tests', () => { expect(container.querySelector('i')).toBeInTheDocument(); }); - it(' - renders with a custom wrapClassName', () => { + test(' - renders with a custom wrapClassName', () => { const testClassName = 'test-class-name'; render(, { x: String }); @@ -71,14 +71,14 @@ describe('@RTL - TextField tests', () => { }); }); -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -86,7 +86,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -94,7 +94,7 @@ it(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -102,7 +102,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -110,7 +110,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -118,7 +118,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct placeholder', () => { +test(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -126,7 +126,7 @@ it(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -134,7 +134,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('text'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -142,7 +142,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -153,7 +153,7 @@ it(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input with correct value (specified)', () => { +test(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -161,7 +161,7 @@ it(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input which correctly reacts on change', () => { +test(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -177,7 +177,7 @@ it(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders an input which correctly reacts on change (empty)', () => { +test(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -193,7 +193,7 @@ it(' - renders an input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders an input which correctly reacts on change (same value)', () => { +test(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -209,7 +209,7 @@ it(' - renders an input which correctly reacts on change (same value) expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -220,7 +220,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -229,7 +229,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - renders correct error text (specified)', () => { +test(' - renders correct error text (specified)', () => { const error = new Error(); const element = ( @@ -239,7 +239,7 @@ it(' - renders correct error text (specified)', () => { expect(wrapper.children().last().text()).toBe('Error'); }); -it(' - renders correct error text (showInlineError=false)', () => { +test(' - renders correct error text (showInlineError=false)', () => { const error = new Error(); const element = ( - renders correct error text (showInlineError=false)', () => { expect(wrapper.children().last().text()).not.toBe('Error'); }); -it(' - renders a icon', () => { +test(' - renders a icon', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('i')).toHaveLength(1); }); -it(' - renders a icon', () => { +test(' - renders a icon', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('i')).toHaveLength(1); }); -it(' - renders with a custom wrapClassName', () => { +test(' - renders with a custom wrapClassName', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('.ui.input.test-class-name')).toHaveLength(1); }); -it(' - renders a input with autocomplete turned off', () => { +test(' - renders a input with autocomplete turned off', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-semantic/__tests__/ValidateQuickForm.tsx b/packages/uniforms-semantic/__tests__/ValidateQuickForm.tsx index c2253493f..ff8bb4376 100644 --- a/packages/uniforms-semantic/__tests__/ValidateQuickForm.tsx +++ b/packages/uniforms-semantic/__tests__/ValidateQuickForm.tsx @@ -4,7 +4,7 @@ import { ValidatedQuickForm } from 'uniforms-semantic'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-semantic/__tests__/ValidatedForm.tsx b/packages/uniforms-semantic/__tests__/ValidatedForm.tsx index 37fde0587..f392f0b78 100644 --- a/packages/uniforms-semantic/__tests__/ValidatedForm.tsx +++ b/packages/uniforms-semantic/__tests__/ValidatedForm.tsx @@ -4,7 +4,7 @@ import { ValidatedForm } from 'uniforms-semantic'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-semantic/__tests__/index.ts b/packages/uniforms-semantic/__tests__/index.ts index 870c60425..50e7a3a65 100644 --- a/packages/uniforms-semantic/__tests__/index.ts +++ b/packages/uniforms-semantic/__tests__/index.ts @@ -1,6 +1,6 @@ import * as semantic from 'uniforms-semantic'; -it('exports everything', () => { +test('exports everything', () => { expect(semantic).toEqual({ AutoFields: expect.any(Function), AutoField: expect.any(Function), diff --git a/packages/uniforms-unstyled/__tests__/AutoField.tsx b/packages/uniforms-unstyled/__tests__/AutoField.tsx index d5d759dda..2bd06da5e 100644 --- a/packages/uniforms-unstyled/__tests__/AutoField.tsx +++ b/packages/uniforms-unstyled/__tests__/AutoField.tsx @@ -14,14 +14,14 @@ import { import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(AutoField)).toHaveLength(1); }); -it(' - detects RadioField', () => { +test(' - detects RadioField', () => { const element = ; const wrapper = mount( element, @@ -37,7 +37,7 @@ it(' - detects RadioField', () => { expect(wrapper.find(RadioField.Component)).toHaveLength(1); }); -it(' - detects SelectField', () => { +test(' - detects SelectField', () => { const element = ; const wrapper = mount( element, @@ -50,14 +50,14 @@ it(' - detects SelectField', () => { expect(wrapper.find(SelectField.Component)).toHaveLength(1); }); -it(' - detects DateField', () => { +test(' - detects DateField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find(DateField.Component)).toHaveLength(1); }); -it(' - detects ListField', () => { +test(' - detects ListField', () => { const element = ; const wrapper = mount( element, @@ -67,35 +67,35 @@ it(' - detects ListField', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -it(' - detects NumField', () => { +test(' - detects NumField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find(NumField.Component)).toHaveLength(1); }); -it(' - detects NestField', () => { +test(' - detects NestField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Object } })); expect(wrapper.find(NestField)).toHaveLength(1); }); -it(' - detects TextField', () => { +test(' - detects TextField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(TextField.Component)).toHaveLength(1); }); -it(' - detects BoolField', () => { +test(' - detects BoolField', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find(BoolField.Component)).toHaveLength(1); }); -it(' - uses Component (schema)', () => { +test(' - uses Component (schema)', () => { const Component = jest.fn(() => null); const element = ; @@ -107,7 +107,7 @@ it(' - uses Component (schema)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -it(' - uses Component (props)', () => { +test(' - uses Component (props)', () => { const Component = jest.fn(() => null); const element = ; @@ -116,7 +116,7 @@ it(' - uses Component (props)', () => { expect(Component).toHaveBeenCalledTimes(1); }); -it(' - uses Component (context)', () => { +test(' - uses Component (context)', () => { const FieldA = jest.fn(() => null); const FieldB = jest.fn(() => null); @@ -136,7 +136,7 @@ it(' - uses Component (context)', () => { expect(FieldB).toHaveBeenCalledTimes(1); }); -it(' - uses Component (invalid)', () => { +test(' - uses Component (invalid)', () => { const spy = jest.spyOn(global.console, 'error').mockImplementation(() => {}); expect(() => { const element = ; diff --git a/packages/uniforms-unstyled/__tests__/AutoFields.tsx b/packages/uniforms-unstyled/__tests__/AutoFields.tsx index 024dc1f62..306810c5e 100644 --- a/packages/uniforms-unstyled/__tests__/AutoFields.tsx +++ b/packages/uniforms-unstyled/__tests__/AutoFields.tsx @@ -4,14 +4,14 @@ import { AutoFields } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('AutoFields')).toHaveLength(1); }); -it(' - render all fields by default', () => { +test(' - render all fields by default', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - render all fields by default', () => { expect(wrapper.find('input')).toHaveLength(3); }); -it(' - renders only specified fields', () => { +test(' - renders only specified fields', () => { const element = ; const wrapper = mount( element, @@ -41,7 +41,7 @@ it(' - renders only specified fields', () => { ); }); -it(' - does not render ommited fields', () => { +test(' - does not render ommited fields', () => { const element = ; const wrapper = mount( element, @@ -57,7 +57,7 @@ it(' - does not render ommited fields', () => { ); }); -it(' - wraps fields in specified element', () => { +test(' - wraps fields in specified element', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-unstyled/__tests__/AutoForm.tsx b/packages/uniforms-unstyled/__tests__/AutoForm.tsx index 7eea63d6d..e64bb5cf7 100644 --- a/packages/uniforms-unstyled/__tests__/AutoForm.tsx +++ b/packages/uniforms-unstyled/__tests__/AutoForm.tsx @@ -4,7 +4,7 @@ import { AutoForm } from 'uniforms-unstyled'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-unstyled/__tests__/BaseForm.tsx b/packages/uniforms-unstyled/__tests__/BaseForm.tsx index 7a7e99417..d074d727e 100644 --- a/packages/uniforms-unstyled/__tests__/BaseForm.tsx +++ b/packages/uniforms-unstyled/__tests__/BaseForm.tsx @@ -4,7 +4,7 @@ import { BaseForm } from 'uniforms-unstyled'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-unstyled/__tests__/BoolField.tsx b/packages/uniforms-unstyled/__tests__/BoolField.tsx index fe3e4e159..04748d027 100644 --- a/packages/uniforms-unstyled/__tests__/BoolField.tsx +++ b/packages/uniforms-unstyled/__tests__/BoolField.tsx @@ -4,14 +4,14 @@ import { BoolField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders a input with correct id (inherited)', () => { +test(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -19,7 +19,7 @@ it(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders a input with correct id (specified)', () => { +test(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -27,7 +27,7 @@ it(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders a input with correct name', () => { +test(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -35,7 +35,7 @@ it(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -43,7 +43,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('checkbox'); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -65,7 +65,7 @@ it(' - renders an input with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a input with correct label (specified)', () => { +test(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -76,7 +76,7 @@ it(' - renders a input with correct label (specified)', () => { ); }); -it(' - renders a input with correct value (default)', () => { +test(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -84,7 +84,7 @@ it(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('checked')).toBe(false); }); -it(' - renders a input with correct value (model)', () => { +test(' - renders a input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -95,7 +95,7 @@ it(' - renders a input with correct value (model)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -it(' - renders a input with correct value (specified)', () => { +test(' - renders a input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); @@ -103,7 +103,7 @@ it(' - renders a input with correct value (specified)', () => { expect(wrapper.find('input').prop('checked')).toBe(true); }); -it(' - renders a input which correctly reacts on change', () => { +test(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -117,7 +117,7 @@ it(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', true); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Boolean } })); diff --git a/packages/uniforms-unstyled/__tests__/DateField.tsx b/packages/uniforms-unstyled/__tests__/DateField.tsx index 9f0367532..d18815530 100644 --- a/packages/uniforms-unstyled/__tests__/DateField.tsx +++ b/packages/uniforms-unstyled/__tests__/DateField.tsx @@ -8,7 +8,7 @@ import createContext from './_createContext'; import mount from './_mount'; describe('@RTL - DateField tests', () => { - it(' - handles "date" type correctly', () => { + test(' - handles "date" type correctly', () => { const onChange = jest.fn(); const initialDate = new Date(Date.UTC(2020, 0, 1)); @@ -29,14 +29,14 @@ describe('@RTL - DateField tests', () => { }); }); -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders a input with correct id (inherited)', () => { +test(' - renders a input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -44,7 +44,7 @@ it(' - renders a input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders a input with correct id (specified)', () => { +test(' - renders a input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -52,7 +52,7 @@ it(' - renders a input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders a input with correct name', () => { +test(' - renders a input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -60,7 +60,7 @@ it(' - renders a input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -79,7 +79,7 @@ test.each(['datetime-local', 'date'] as const)( }, ); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -87,7 +87,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -95,7 +95,7 @@ it(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -it(' - renders a input with correct label (specified)', () => { +test(' - renders a input with correct label (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -106,7 +106,7 @@ it(' - renders a input with correct label (specified)', () => { ); }); -it(' - renders a input with correct value (default)', () => { +test(' - renders a input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -114,7 +114,7 @@ it(' - renders a input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders a input with correct value (model)', () => { +test(' - renders a input with correct value (model)', () => { const now = new Date(); const element = ; const wrapper = mount( @@ -128,7 +128,7 @@ it(' - renders a input with correct value (model)', () => { ); }); -it(' - renders a input with correct value (specified)', () => { +test(' - renders a input with correct value (specified)', () => { const now = new Date(); const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); @@ -139,7 +139,7 @@ it(' - renders a input with correct value (specified)', () => { ); }); -it(' - renders a input which correctly reacts on change', () => { +test(' - renders a input which correctly reacts on change', () => { const onChange = jest.fn(); const now = new Date(); @@ -158,7 +158,7 @@ it(' - renders a input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', now); }); -it(' - renders a input which correctly reacts on change (empty)', () => { +test(' - renders a input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -176,7 +176,7 @@ it(' - renders a input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a input which correctly reacts on change (overflow)', () => { +test(' - renders a input which correctly reacts on change (overflow)', () => { const onChange = jest.fn(); const now = new Date(1e5, 0); @@ -195,7 +195,7 @@ it(' - renders a input which correctly reacts on change (overflow)', expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Date } })); diff --git a/packages/uniforms-unstyled/__tests__/ErrorField.tsx b/packages/uniforms-unstyled/__tests__/ErrorField.tsx index d047d867e..6acca1595 100644 --- a/packages/uniforms-unstyled/__tests__/ErrorField.tsx +++ b/packages/uniforms-unstyled/__tests__/ErrorField.tsx @@ -11,14 +11,14 @@ const error = { message: 'X is required [validation-error]', }; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorField)).toHaveLength(1); }); -it(' - renders correct error message (context)', () => { +test(' - renders correct error message (context)', () => { const element = ; const wrapper = mount( element, @@ -29,7 +29,7 @@ it(' - renders correct error message (context)', () => { expect(wrapper.find(ErrorField).text()).toBe('X is required'); }); -it(' - renders correct error message (specified)', () => { +test(' - renders correct error message (specified)', () => { const element = ( - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find(ErrorsField)).toHaveLength(1); }); -it(' - renders list of correct error messages (context)', () => { +test(' - renders list of correct error messages (context)', () => { const element = ; const wrapper = mount( element, @@ -38,7 +38,7 @@ it(' - renders list of correct error messages (context)', () => { expect(wrapper.find('li').at(2).text()).toBe('Z is required'); }); -it(' - renders children (specified)', () => { +test(' - renders children (specified)', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-unstyled/__tests__/HiddenField.tsx b/packages/uniforms-unstyled/__tests__/HiddenField.tsx index 3f16dcc65..4eff6c61b 100644 --- a/packages/uniforms-unstyled/__tests__/HiddenField.tsx +++ b/packages/uniforms-unstyled/__tests__/HiddenField.tsx @@ -4,14 +4,14 @@ import { HiddenField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('hidden'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -62,7 +62,7 @@ it(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input which correctly reacts on model change', () => { +test(' - renders an input which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -76,7 +76,7 @@ it(' - renders an input which correctly reacts on model change', () expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders an input which correctly reacts on model change (empty)', () => { +test(' - renders an input which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -90,7 +90,7 @@ it(' - renders an input which correctly reacts on model change (emp expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders an input which correctly reacts on model change (same value)', () => { +test(' - renders an input which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -104,14 +104,14 @@ it(' - renders an input which correctly reacts on model change (sam expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders nothing', () => { +test(' - renders nothing', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.children()).toHaveLength(0); }); -it(' - renders nothing which correctly reacts on model change', () => { +test(' - renders nothing which correctly reacts on model change', () => { const onChange = jest.fn(); const element = ; @@ -125,7 +125,7 @@ it(' - renders nothing which correctly reacts on model change expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders nothing which correctly reacts on model change (empty)', () => { +test(' - renders nothing which correctly reacts on model change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -139,7 +139,7 @@ it(' - renders nothing which correctly reacts on model change expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders nothing which correctly reacts on model change (same value)', () => { +test(' - renders nothing which correctly reacts on model change (same value)', () => { const onChange = jest.fn(); const element = ; diff --git a/packages/uniforms-unstyled/__tests__/ListAddField.tsx b/packages/uniforms-unstyled/__tests__/ListAddField.tsx index 46cadff3e..59dd9e6e8 100644 --- a/packages/uniforms-unstyled/__tests__/ListAddField.tsx +++ b/packages/uniforms-unstyled/__tests__/ListAddField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListAddField)).toHaveLength(1); }); -it(' - prevents onClick when disabled', () => { +test(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ it(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when limit reached', () => { +test(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { maxCount: 0 } })); @@ -39,7 +39,7 @@ it(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - correctly reacts on click', () => { +test(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ it(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['y']); }); -it(' - correctly reacts on keyboard enter key', () => { +test(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-unstyled/__tests__/ListDelField.tsx b/packages/uniforms-unstyled/__tests__/ListDelField.tsx index 042a988c5..91703ce84 100644 --- a/packages/uniforms-unstyled/__tests__/ListDelField.tsx +++ b/packages/uniforms-unstyled/__tests__/ListDelField.tsx @@ -16,14 +16,14 @@ beforeEach(() => { onChange.mockClear(); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element, context()); expect(wrapper.find(ListDelField)).toHaveLength(1); }); -it(' - prevents onClick when disabled', () => { +test(' - prevents onClick when disabled', () => { const element = ; const wrapper = mount(element, context()); @@ -31,7 +31,7 @@ it(' - prevents onClick when disabled', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - prevents onClick when limit reached', () => { +test(' - prevents onClick when limit reached', () => { const element = ; const wrapper = mount(element, context({ x: { minCount: 3 } })); @@ -39,7 +39,7 @@ it(' - prevents onClick when limit reached', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - correctly reacts on click', () => { +test(' - correctly reacts on click', () => { const element = ; const wrapper = mount(element, context()); @@ -47,7 +47,7 @@ it(' - correctly reacts on click', () => { expect(onChange).toHaveBeenLastCalledWith('x', ['x', 'z']); }); -it(' - correctly reacts on keyboard enter key', () => { +test(' - correctly reacts on keyboard enter key', () => { const element = ; const wrapper = mount(element, context()); diff --git a/packages/uniforms-unstyled/__tests__/ListField.tsx b/packages/uniforms-unstyled/__tests__/ListField.tsx index a651fde09..44e2ab91d 100644 --- a/packages/uniforms-unstyled/__tests__/ListField.tsx +++ b/packages/uniforms-unstyled/__tests__/ListField.tsx @@ -12,7 +12,7 @@ describe('@RTL - ListField tests', () => { }); }); -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount( element, @@ -22,7 +22,7 @@ it(' - works', () => { expect(wrapper.find(ListField)).toHaveLength(1); }); -it(' - renders ListAddField', () => { +test(' - renders ListAddField', () => { const element = ; const wrapper = mount( element, @@ -33,7 +33,7 @@ it(' - renders ListAddField', () => { expect(wrapper.find(ListAddField).prop('name')).toBe('$'); }); -it(' - renders correct label (specified)', () => { +test(' - renders correct label (specified)', () => { const element = ; const wrapper = mount( element, @@ -46,7 +46,7 @@ it(' - renders correct label (specified)', () => { ); }); -it(' - renders correct numer of items with model (specified)', () => { +test(' - renders correct numer of items with model (specified)', () => { const element = ; const wrapper = mount( element, @@ -58,7 +58,7 @@ it(' - renders correct numer of items with model (specified)', () => expect(wrapper.find('input')).toHaveLength(3); }); -it(' - passes itemProps to its children', () => { +test(' - passes itemProps to its children', () => { const element = ; const wrapper = mount( element, @@ -70,7 +70,7 @@ it(' - passes itemProps to its children', () => { expect(wrapper.find(ListItemField).first().prop('data-xyz')).toBe(1); }); -it(' - renders children (specified)', () => { +test(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -89,7 +89,7 @@ it(' - renders children (specified)', () => { expect(Child).toHaveBeenCalledTimes(2); }); -it(' - renders children with correct name (children)', () => { +test(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as React.FC; const element = ( @@ -108,7 +108,7 @@ it(' - renders children with correct name (children)', () => { expect(wrapper.find(Child).at(1).prop('name')).toBe('1'); }); -it(' - renders children with correct name (value)', () => { +test(' - renders children with correct name (value)', () => { const element = ; const wrapper = mount( element, @@ -121,7 +121,7 @@ it(' - renders children with correct name (value)', () => { expect(wrapper.find(ListItemField).at(1).prop('name')).toBe('1'); }); -it(' - renders proper number of optional values after add new value', () => { +test(' - renders proper number of optional values after add new value', () => { const element = ; const onChange = jest.fn(); const wrapper = mount( diff --git a/packages/uniforms-unstyled/__tests__/ListItemField.tsx b/packages/uniforms-unstyled/__tests__/ListItemField.tsx index eb2b87d32..6e9970e9b 100644 --- a/packages/uniforms-unstyled/__tests__/ListItemField.tsx +++ b/packages/uniforms-unstyled/__tests__/ListItemField.tsx @@ -4,7 +4,7 @@ import { AutoField, ListDelField, ListItemField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - works', () => { expect(wrapper.find(ListItemField)).toHaveLength(1); }); -it(' - renders ListDelField', () => { +test(' - renders ListDelField', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - renders ListDelField', () => { expect(wrapper.find(ListDelField).childAt(0).prop('name')).toBe('x.1'); }); -it(' - renders AutoField', () => { +test(' - renders AutoField', () => { const element = ; const wrapper = mount( element, @@ -35,7 +35,7 @@ it(' - renders AutoField', () => { expect(wrapper.find(AutoField)).toHaveLength(1); }); -it(' - renders children if specified', () => { +test(' - renders children if specified', () => { const Child: () => null = jest.fn(() => null); const element = ( diff --git a/packages/uniforms-unstyled/__tests__/LongTextField.tsx b/packages/uniforms-unstyled/__tests__/LongTextField.tsx index 3972fdbdd..a6e55a0ab 100644 --- a/packages/uniforms-unstyled/__tests__/LongTextField.tsx +++ b/packages/uniforms-unstyled/__tests__/LongTextField.tsx @@ -4,14 +4,14 @@ import { LongTextField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a textarea', () => { +test(' - renders a textarea', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('textarea')).toHaveLength(1); }); -it(' - renders a textarea with correct disabled state', () => { +test(' - renders a textarea with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -19,7 +19,7 @@ it(' - renders a textarea with correct disabled state', () => { expect(wrapper.find('textarea').prop('disabled')).toBe(true); }); -it(' - renders a textarea with correct readOnly state', () => { +test(' - renders a textarea with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -27,7 +27,7 @@ it(' - renders a textarea with correct readOnly state', () => { expect(wrapper.find('textarea').prop('readOnly')).toBe(true); }); -it(' - renders a textarea with correct id (inherited)', () => { +test(' - renders a textarea with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -35,7 +35,7 @@ it(' - renders a textarea with correct id (inherited)', () => { expect(wrapper.find('textarea').prop('id')).toBeTruthy(); }); -it(' - renders a textarea with correct id (specified)', () => { +test(' - renders a textarea with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -43,7 +43,7 @@ it(' - renders a textarea with correct id (specified)', () => { expect(wrapper.find('textarea').prop('id')).toBe('y'); }); -it(' - renders a textarea with correct name', () => { +test(' - renders a textarea with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -51,7 +51,7 @@ it(' - renders a textarea with correct name', () => { expect(wrapper.find('textarea').prop('name')).toBe('x'); }); -it(' - renders a textarea with correct placeholder', () => { +test(' - renders a textarea with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -59,7 +59,7 @@ it(' - renders a textarea with correct placeholder', () => { expect(wrapper.find('textarea').prop('placeholder')).toBe('y'); }); -it(' - renders a textarea with correct value (default)', () => { +test(' - renders a textarea with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -67,7 +67,7 @@ it(' - renders a textarea with correct value (default)', () => { expect(wrapper.find('textarea').prop('value')).toBe(''); }); -it(' - renders a textarea with correct value (model)', () => { +test(' - renders a textarea with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -78,7 +78,7 @@ it(' - renders a textarea with correct value (model)', () => { expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -it(' - renders a textarea with correct value (specified)', () => { +test(' - renders a textarea with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -86,7 +86,7 @@ it(' - renders a textarea with correct value (specified)', () => expect(wrapper.find('textarea').prop('value')).toBe('y'); }); -it(' - renders a textarea which correctly reacts on change', () => { +test(' - renders a textarea which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -102,7 +102,7 @@ it(' - renders a textarea which correctly reacts on change', () = expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a textarea which correctly reacts on change (empty)', () => { +test(' - renders a textarea which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -118,7 +118,7 @@ it(' - renders a textarea which correctly reacts on change (empty expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders a textarea which correctly reacts on change (same value)', () => { +test(' - renders a textarea which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -134,7 +134,7 @@ it(' - renders a textarea which correctly reacts on change (same expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -145,7 +145,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-unstyled/__tests__/NestField.tsx b/packages/uniforms-unstyled/__tests__/NestField.tsx index c02befc56..38d6addcb 100644 --- a/packages/uniforms-unstyled/__tests__/NestField.tsx +++ b/packages/uniforms-unstyled/__tests__/NestField.tsx @@ -4,7 +4,7 @@ import { AutoField, NestField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an for each field', () => { +test(' - renders an for each field', () => { const element = ; const wrapper = mount( element, @@ -20,7 +20,7 @@ it(' - renders an for each field', () => { expect(wrapper.find(AutoField).at(1).prop('name')).toBe('b'); }); -it(' - renders custom content if given', () => { +test(' - renders custom content if given', () => { const element = (
@@ -40,7 +40,7 @@ it(' - renders custom content if given', () => { expect(wrapper.find('article').prop('data-test')).toBe('content'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, diff --git a/packages/uniforms-unstyled/__tests__/NumField.tsx b/packages/uniforms-unstyled/__tests__/NumField.tsx index 21f95832a..c3aa4cea2 100644 --- a/packages/uniforms-unstyled/__tests__/NumField.tsx +++ b/packages/uniforms-unstyled/__tests__/NumField.tsx @@ -4,14 +4,14 @@ import { NumField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -19,7 +19,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -27,7 +27,7 @@ it(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -35,7 +35,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -43,7 +43,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct max', () => { +test(' - renders an input with correct max', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -51,7 +51,7 @@ it(' - renders an input with correct max', () => { expect(wrapper.find('input').prop('max')).toBe(10); }); -it(' - renders an input with correct min', () => { +test(' - renders an input with correct min', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -59,7 +59,7 @@ it(' - renders an input with correct min', () => { expect(wrapper.find('input').prop('min')).toBe(10); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -67,7 +67,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct placeholder', () => { +test(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -75,7 +75,7 @@ it(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -it(' - renders an input with correct step (decimal)', () => { +test(' - renders an input with correct step (decimal)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -83,7 +83,7 @@ it(' - renders an input with correct step (decimal)', () => { expect(wrapper.find('input').prop('step')).toBe(0.01); }); -it(' - renders an input with correct step (integer)', () => { +test(' - renders an input with correct step (integer)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -91,7 +91,7 @@ it(' - renders an input with correct step (integer)', () => { expect(wrapper.find('input').prop('step')).toBe(1); }); -it(' - renders an input with correct step (set)', () => { +test(' - renders an input with correct step (set)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -99,7 +99,7 @@ it(' - renders an input with correct step (set)', () => { expect(wrapper.find('input').prop('step')).toBe(3); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -107,7 +107,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('number'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -115,7 +115,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const onChange = jest.fn(); const element = ; @@ -157,7 +157,7 @@ it(' - renders an input with correct value (model)', () => { spy.mockRestore(); }); -it(' - renders an input with correct value (specified)', () => { +test(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -165,7 +165,7 @@ it(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe(2); }); -it(' - renders an input which correctly reacts on change', () => { +test(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -181,7 +181,7 @@ it(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -it(' - renders an input which correctly reacts on change (decimal on decimal)', () => { +test(' - renders an input which correctly reacts on change (decimal on decimal)', () => { const onChange = jest.fn(); const element = ; @@ -197,7 +197,7 @@ it(' - renders an input which correctly reacts on change (decimal on d expect(onChange).toHaveBeenLastCalledWith('x', 2.5); }); -it(' - renders an input which correctly reacts on change (decimal on integer)', () => { +test(' - renders an input which correctly reacts on change (decimal on integer)', () => { const onChange = jest.fn(); const element = ; @@ -213,7 +213,7 @@ it(' - renders an input which correctly reacts on change (decimal on i expect(onChange).toHaveBeenLastCalledWith('x', 2); }); -it(' - renders an input which correctly reacts on change (empty)', () => { +test(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -229,7 +229,7 @@ it(' - renders an input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders an input which correctly reacts on change (same value)', () => { +test(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -245,7 +245,7 @@ it(' - renders an input which correctly reacts on change (same value)' expect(onChange).toHaveBeenLastCalledWith('x', 1); }); -it(' - renders an input which correctly reacts on change (zero)', () => { +test(' - renders an input which correctly reacts on change (zero)', () => { const onChange = jest.fn(); const element = ; @@ -261,7 +261,7 @@ it(' - renders an input which correctly reacts on change (zero)', () = expect(onChange).toHaveBeenLastCalledWith('x', 0); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); @@ -272,7 +272,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: Number } })); diff --git a/packages/uniforms-unstyled/__tests__/QuickForm.tsx b/packages/uniforms-unstyled/__tests__/QuickForm.tsx index 97fe0e7ae..4ed2c1b40 100644 --- a/packages/uniforms-unstyled/__tests__/QuickForm.tsx +++ b/packages/uniforms-unstyled/__tests__/QuickForm.tsx @@ -4,7 +4,7 @@ import { QuickForm } from 'uniforms-unstyled'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - renders', () => { +test(' - renders', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-unstyled/__tests__/RadioField.tsx b/packages/uniforms-unstyled/__tests__/RadioField.tsx index 08d33c933..83a465ef8 100644 --- a/packages/uniforms-unstyled/__tests__/RadioField.tsx +++ b/packages/uniforms-unstyled/__tests__/RadioField.tsx @@ -4,7 +4,7 @@ import { RadioField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a set of checkboxes', () => { +test(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -it(' - renders a set of checkboxes with correct disabled state', () => { +test(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -26,7 +26,7 @@ it(' - renders a set of checkboxes with correct disabled state', () expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -it(' - renders a set of checkboxes with correct readOnly state', () => { +test(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -43,7 +43,7 @@ it(' - renders a set of checkboxes with correct readOnly state', () expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a set of checkboxes with correct id (inherited)', () => { +test(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ it(' - renders a set of checkboxes with correct id (inherited)', () expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -it(' - renders a set of checkboxes with correct id (specified)', () => { +test(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -67,7 +67,7 @@ it(' - renders a set of checkboxes with correct id (specified)', () expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -it(' - renders a set of checkboxes with correct name', () => { +test(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -79,7 +79,7 @@ it(' - renders a set of checkboxes with correct name', () => { expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -it(' - renders a set of checkboxes with correct options', () => { +test(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -91,7 +91,7 @@ it(' - renders a set of checkboxes with correct options', () => { expect(wrapper.find('label').at(1).text()).toBe('b'); }); -it(' - renders a set of checkboxes with correct options (transform)', () => { +test(' - renders a set of checkboxes with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -103,7 +103,7 @@ it(' - renders a set of checkboxes with correct options (transform)' expect(wrapper.find('label').at(1).text()).toBe('B'); }); -it(' - renders a set of checkboxes with correct value (default)', () => { +test(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -115,7 +115,7 @@ it(' - renders a set of checkboxes with correct value (default)', () expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -it(' - renders a set of checkboxes with correct value (model)', () => { +test(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -130,7 +130,7 @@ it(' - renders a set of checkboxes with correct value (model)', () = expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes with correct value (specified)', () => { +test(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -142,7 +142,7 @@ it(' - renders a set of checkboxes with correct value (specified)', expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes which correctly reacts on change', () => { +test(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -159,7 +159,7 @@ it(' - renders a set of checkboxes which correctly reacts on change' expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -176,7 +176,7 @@ it(' - renders a set of checkboxes which correctly reacts on change expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -187,7 +187,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -199,7 +199,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), diff --git a/packages/uniforms-unstyled/__tests__/SelectField.tsx b/packages/uniforms-unstyled/__tests__/SelectField.tsx index a0f2beaa4..757da8284 100644 --- a/packages/uniforms-unstyled/__tests__/SelectField.tsx +++ b/packages/uniforms-unstyled/__tests__/SelectField.tsx @@ -4,7 +4,7 @@ import { SelectField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders a select', () => { +test(' - renders a select', () => { const element = ; const wrapper = mount( element, @@ -14,7 +14,7 @@ it(' - renders a select', () => { expect(wrapper.find('select')).toHaveLength(1); }); -it(' - renders a select with correct disabled state', () => { +test(' - renders a select with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -25,7 +25,7 @@ it(' - renders a select with correct disabled state', () => { expect(wrapper.find('select').prop('disabled')).toBe(true); }); -it(' - renders a select with correct readOnly state', () => { +test(' - renders a select with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -44,7 +44,7 @@ it(' - renders a select with correct readOnly state', () => { expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a select with correct id (inherited)', () => { +test(' - renders a select with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -55,7 +55,7 @@ it(' - renders a select with correct id (inherited)', () => { expect(wrapper.find('select').prop('id')).toBeTruthy(); }); -it(' - renders a select with correct id (specified)', () => { +test(' - renders a select with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -66,7 +66,7 @@ it(' - renders a select with correct id (specified)', () => { expect(wrapper.find('select').prop('id')).toBe('y'); }); -it(' - renders a select with correct name', () => { +test(' - renders a select with correct name', () => { const element = ; const wrapper = mount( element, @@ -77,7 +77,7 @@ it(' - renders a select with correct name', () => { expect(wrapper.find('select').prop('name')).toBe('x'); }); -it(' - renders a select with correct options', () => { +test(' - renders a select with correct options', () => { const element = ; const wrapper = mount( element, @@ -97,7 +97,7 @@ it(' - renders a select with correct options', () => { }); }); -it(' - renders a select with correct options (transform)', () => { +test(' - renders a select with correct options (transform)', () => { const element = x.toUpperCase()} />; const wrapper = mount( element, @@ -117,7 +117,7 @@ it(' - renders a select with correct options (transform)', () => { }); }); -it(' - renders a select with correct placeholder (fallback)', () => { +test(' - renders a select with correct placeholder (fallback)', () => { const element = ; const wrapper = mount( element, @@ -139,7 +139,7 @@ it(' - renders a select with correct placeholder (fallback)', () => }); }); -it(' - renders a select with correct placeholder (implicit)', () => { +test(' - renders a select with correct placeholder (implicit)', () => { const element = ; const wrapper = mount( element, @@ -159,7 +159,7 @@ it(' - renders a select with correct placeholder (implicit)', () => }); }); -it(' - renders a select with correct value (default)', () => { +test(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -170,7 +170,7 @@ it(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toBe(''); }); -it(' - renders a select with correct value (model)', () => { +test(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -184,7 +184,7 @@ it(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -it(' - renders a select with correct value (specified)', () => { +test(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -195,7 +195,7 @@ it(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toBe('b'); }); -it(' - renders a select which correctly reacts on change', () => { +test(' - renders a select which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -214,7 +214,7 @@ it(' - renders a select which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a select which correctly reacts on change (empty)', () => { +test(' - renders a select which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -233,7 +233,7 @@ it(' - renders a select which correctly reacts on change (empty)', expect(onChange).toHaveBeenLastCalledWith('x', undefined); }); -it(' - renders a select which correctly reacts on change (same value)', () => { +test(' - renders a select which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -252,7 +252,7 @@ it(' - renders a select which correctly reacts on change (same valu expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -266,7 +266,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount( element, @@ -278,14 +278,14 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -it(' - renders a set of checkboxes', () => { +test(' - renders a set of checkboxes', () => { const element = ; const wrapper = mount( element, @@ -295,7 +295,7 @@ it(' - renders a set of checkboxes', () => { expect(wrapper.find('input')).toHaveLength(2); }); -it(' - renders a set of checkboxes with correct disabled state', () => { +test(' - renders a set of checkboxes with correct disabled state', () => { const element = ; const wrapper = mount( element, @@ -307,7 +307,7 @@ it(' - renders a set of checkboxes with correct disabled expect(wrapper.find('input').at(1).prop('disabled')).toBe(true); }); -it(' - renders a set of checkboxes with correct readOnly state', () => { +test(' - renders a set of checkboxes with correct readOnly state', () => { const onChange = jest.fn(); const element = ; @@ -324,7 +324,7 @@ it(' - renders a set of checkboxes with correct readOnly expect(onChange).not.toHaveBeenCalled(); }); -it(' - renders a set of checkboxes with correct id (inherited)', () => { +test(' - renders a set of checkboxes with correct id (inherited)', () => { const element = ; const wrapper = mount( element, @@ -336,7 +336,7 @@ it(' - renders a set of checkboxes with correct id (inhe expect(wrapper.find('input').at(1).prop('id')).toBeTruthy(); }); -it(' - renders a set of checkboxes with correct id (specified)', () => { +test(' - renders a set of checkboxes with correct id (specified)', () => { const element = ; const wrapper = mount( element, @@ -348,7 +348,7 @@ it(' - renders a set of checkboxes with correct id (spec expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg'); }); -it(' - renders a set of checkboxes with correct name', () => { +test(' - renders a set of checkboxes with correct name', () => { const element = ; const wrapper = mount( element, @@ -360,7 +360,7 @@ it(' - renders a set of checkboxes with correct name', ( expect(wrapper.find('input').at(1).prop('name')).toBe('x'); }); -it(' - renders a select with correct value (default)', () => { +test(' - renders a select with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -374,7 +374,7 @@ it(' - renders a select with correct value (default)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual([]); }); -it(' - renders a multiselect with disabled options', () => { +test(' - renders a multiselect with disabled options', () => { const element = value === 'b'} />; const wrapper = mount( element, @@ -390,7 +390,7 @@ it(' - renders a multiselect with disabled options', () => { expect(wrapper.find('option').at(1).prop('disabled')).toBe(true); }); -it(' - renders a select with correct value (model)', () => { +test(' - renders a select with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -407,7 +407,7 @@ it(' - renders a select with correct value (model)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -it(' - renders a select with correct value (specified)', () => { +test(' - renders a select with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -421,7 +421,7 @@ it(' - renders a select with correct value (specified)', () => { expect(wrapper.find('select').prop('value')).toStrictEqual(['b']); }); -it(' - renders a select which correctly reacts on change (first value)', () => { +test(' - renders a select which correctly reacts on change (first value)', () => { const onChange = jest.fn(); const element = ; @@ -443,7 +443,7 @@ it(' - renders a select which correctly reacts on change (first val expect(onChange).toHaveBeenLastCalledWith('x', ['a']); }); -it(' - renders a select which correctly reacts on change (next value)', () => { +test(' - renders a select which correctly reacts on change (next value)', () => { const onChange = jest.fn(); const element = ; @@ -465,7 +465,7 @@ it(' - renders a select which correctly reacts on change (next valu expect(onChange).toHaveBeenLastCalledWith('x', ['a', 'b']); }); -it(' - renders a select which correctly reacts on change (uncheck) by value', () => { +test(' - renders a select which correctly reacts on change (uncheck) by value', () => { const onChange = jest.fn(); const element = ; @@ -487,7 +487,7 @@ it(' - renders a select which correctly reacts on change (uncheck) expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { +test(' - renders a select which correctly reacts on change (uncheck) by selectedIndex', () => { const onChange = jest.fn(); const element = ; @@ -511,7 +511,7 @@ it(' - renders a select which correctly reacts on change (uncheck) expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a set of checkboxes with correct options', () => { +test(' - renders a set of checkboxes with correct options', () => { const element = ; const wrapper = mount( element, @@ -523,7 +523,7 @@ it(' - renders a set of checkboxes with correct options' expect(wrapper.find('label').at(1).text()).toBe('b'); }); -it(' - renders a set of checkboxes with correct options (transform)', () => { +test(' - renders a set of checkboxes with correct options (transform)', () => { const element = ( x.toUpperCase()} /> ); @@ -537,7 +537,7 @@ it(' - renders a set of checkboxes with correct options expect(wrapper.find('label').at(1).text()).toBe('B'); }); -it(' - renders a set of checkboxes with correct value (default)', () => { +test(' - renders a set of checkboxes with correct value (default)', () => { const element = ; const wrapper = mount( element, @@ -549,7 +549,7 @@ it(' - renders a set of checkboxes with correct value (d expect(wrapper.find('input').at(1).prop('checked')).toBe(false); }); -it(' - renders a set of checkboxes with correct value (model)', () => { +test(' - renders a set of checkboxes with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -564,7 +564,7 @@ it(' - renders a set of checkboxes with correct value (m expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes with correct value (specified)', () => { +test(' - renders a set of checkboxes with correct value (specified)', () => { const element = ; const wrapper = mount( element, @@ -576,7 +576,7 @@ it(' - renders a set of checkboxes with correct value (s expect(wrapper.find('input').at(1).prop('checked')).toBe(true); }); -it(' - renders a set of checkboxes which correctly reacts on change', () => { +test(' - renders a set of checkboxes which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -593,7 +593,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', 'b'); }); -it(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (array check)', () => { const onChange = jest.fn(); const element = ; @@ -613,7 +613,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', ['b']); }); -it(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (array uncheck)', () => { const onChange = jest.fn(); const element = ; @@ -633,7 +633,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', []); }); -it(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { +test(' - renders a set of checkboxes which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -650,7 +650,7 @@ it(' - renders a set of checkboxes which correctly react expect(onChange).toHaveBeenLastCalledWith('x', 'a'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount( element, @@ -661,7 +661,7 @@ it(' - renders a label', () => { expect(wrapper.find('label').at(0).text()).toBe('y'); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ( ); @@ -675,14 +675,14 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - works with special characters', () => { +test(' - works with special characters', () => { mount( , createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }), ); }); -it(' - renders a set of checkboxes with per-item props', () => { +test(' - renders a set of checkboxes with per-item props', () => { const allowedValues = ['a', 'b']; const element = ( diff --git a/packages/uniforms-unstyled/__tests__/SubmitField.tsx b/packages/uniforms-unstyled/__tests__/SubmitField.tsx index 6545e0c40..1ce693245 100644 --- a/packages/uniforms-unstyled/__tests__/SubmitField.tsx +++ b/packages/uniforms-unstyled/__tests__/SubmitField.tsx @@ -4,14 +4,14 @@ import { SubmitField } from 'uniforms-unstyled'; import createContext from './_createContext'; import mount from './_mount'; -it(' - renders', () => { +test(' - renders', () => { const element = ; const wrapper = mount(element, createContext()); expect(wrapper).toHaveLength(1); }); -it(' - renders disabled if error', () => { +test(' - renders disabled if error', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -19,7 +19,7 @@ it(' - renders disabled if error', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders enabled if error and enabled', () => { +test(' - renders enabled if error and enabled', () => { const element = ; const wrapper = mount(element, createContext(undefined, { error: {} })); @@ -27,7 +27,7 @@ it(' - renders enabled if error and enabled', () => { expect(wrapper.find('input').prop('disabled')).toBe(false); }); -it(' - renders a wrapper with correct value', () => { +test(' - renders a wrapper with correct value', () => { const element = ; const wrapper = mount(element, createContext()); diff --git a/packages/uniforms-unstyled/__tests__/TextField.tsx b/packages/uniforms-unstyled/__tests__/TextField.tsx index eab933163..211b73697 100644 --- a/packages/uniforms-unstyled/__tests__/TextField.tsx +++ b/packages/uniforms-unstyled/__tests__/TextField.tsx @@ -9,7 +9,7 @@ import mount from './_mount'; describe('@RTL - TextField tests', () => { testTextField(TextField); - it(' - renders a wrapper with unknown props', () => { + test(' - renders a wrapper with unknown props', () => { const props = { 'data-x': 'x', 'data-y': 'y', @@ -24,14 +24,14 @@ describe('@RTL - TextField tests', () => { }); }); -it(' - renders an input', () => { +test(' - renders an input', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); expect(wrapper.find('input')).toHaveLength(1); }); -it(' - renders an input with correct disabled state', () => { +test(' - renders an input with correct disabled state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -39,7 +39,7 @@ it(' - renders an input with correct disabled state', () => { expect(wrapper.find('input').prop('disabled')).toBe(true); }); -it(' - renders an input with correct readOnly state', () => { +test(' - renders an input with correct readOnly state', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -47,7 +47,7 @@ it(' - renders an input with correct readOnly state', () => { expect(wrapper.find('input').prop('readOnly')).toBe(true); }); -it(' - renders an input with correct id (inherited)', () => { +test(' - renders an input with correct id (inherited)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -55,7 +55,7 @@ it(' - renders an input with correct id (inherited)', () => { expect(wrapper.find('input').prop('id')).toBeTruthy(); }); -it(' - renders an input with correct id (specified)', () => { +test(' - renders an input with correct id (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -63,7 +63,7 @@ it(' - renders an input with correct id (specified)', () => { expect(wrapper.find('input').prop('id')).toBe('y'); }); -it(' - renders an input with correct name', () => { +test(' - renders an input with correct name', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -71,7 +71,7 @@ it(' - renders an input with correct name', () => { expect(wrapper.find('input').prop('name')).toBe('x'); }); -it(' - renders an input with correct placeholder', () => { +test(' - renders an input with correct placeholder', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -79,7 +79,7 @@ it(' - renders an input with correct placeholder', () => { expect(wrapper.find('input').prop('placeholder')).toBe('y'); }); -it(' - renders an input with correct type', () => { +test(' - renders an input with correct type', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -87,7 +87,7 @@ it(' - renders an input with correct type', () => { expect(wrapper.find('input').prop('type')).toBe('text'); }); -it(' - renders an input with correct value (default)', () => { +test(' - renders an input with correct value (default)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -95,7 +95,7 @@ it(' - renders an input with correct value (default)', () => { expect(wrapper.find('input').prop('value')).toBe(''); }); -it(' - renders an input with correct value (model)', () => { +test(' - renders an input with correct value (model)', () => { const element = ; const wrapper = mount( element, @@ -106,7 +106,7 @@ it(' - renders an input with correct value (model)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input with correct value (specified)', () => { +test(' - renders an input with correct value (specified)', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -114,7 +114,7 @@ it(' - renders an input with correct value (specified)', () => { expect(wrapper.find('input').prop('value')).toBe('y'); }); -it(' - renders an input which correctly reacts on change', () => { +test(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const element = ; @@ -130,7 +130,7 @@ it(' - renders an input which correctly reacts on change', () => { expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders an input which correctly reacts on change (empty)', () => { +test(' - renders an input which correctly reacts on change (empty)', () => { const onChange = jest.fn(); const element = ; @@ -146,7 +146,7 @@ it(' - renders an input which correctly reacts on change (empty)', () expect(onChange).toHaveBeenLastCalledWith('x', ''); }); -it(' - renders an input which correctly reacts on change (same value)', () => { +test(' - renders an input which correctly reacts on change (same value)', () => { const onChange = jest.fn(); const element = ; @@ -162,7 +162,7 @@ it(' - renders an input which correctly reacts on change (same value) expect(onChange).toHaveBeenLastCalledWith('x', 'y'); }); -it(' - renders a label', () => { +test(' - renders a label', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -173,7 +173,7 @@ it(' - renders a label', () => { ); }); -it(' - renders a wrapper with unknown props', () => { +test(' - renders a wrapper with unknown props', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); @@ -182,7 +182,7 @@ it(' - renders a wrapper with unknown props', () => { expect(wrapper.find('div').at(0).prop('data-z')).toBe('z'); }); -it(' - renders an input with autocomplete turned off', () => { +test(' - renders an input with autocomplete turned off', () => { const element = ; const wrapper = mount(element, createContext({ x: { type: String } })); diff --git a/packages/uniforms-unstyled/__tests__/ValidateQuickForm.tsx b/packages/uniforms-unstyled/__tests__/ValidateQuickForm.tsx index 412bd2c51..6b0f69eb2 100644 --- a/packages/uniforms-unstyled/__tests__/ValidateQuickForm.tsx +++ b/packages/uniforms-unstyled/__tests__/ValidateQuickForm.tsx @@ -4,7 +4,7 @@ import { ValidatedQuickForm } from 'uniforms-unstyled'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-unstyled/__tests__/ValidatedForm.tsx b/packages/uniforms-unstyled/__tests__/ValidatedForm.tsx index 725c955ff..f4b48cacf 100644 --- a/packages/uniforms-unstyled/__tests__/ValidatedForm.tsx +++ b/packages/uniforms-unstyled/__tests__/ValidatedForm.tsx @@ -4,7 +4,7 @@ import { ValidatedForm } from 'uniforms-unstyled'; import createSchema from './_createSchema'; import mount from './_mount'; -it(' - works', () => { +test(' - works', () => { const element = ; const wrapper = mount(element); diff --git a/packages/uniforms-unstyled/__tests__/index.ts b/packages/uniforms-unstyled/__tests__/index.ts index e8c50cae7..58ec7e511 100644 --- a/packages/uniforms-unstyled/__tests__/index.ts +++ b/packages/uniforms-unstyled/__tests__/index.ts @@ -1,6 +1,6 @@ import * as unstyled from 'uniforms-unstyled'; -it('exports everything', () => { +test('exports everything', () => { expect(unstyled).toEqual({ AutoFields: expect.any(Function), AutoField: expect.any(Function), diff --git a/packages/uniforms/__suites__/ListField.tsx b/packages/uniforms/__suites__/ListField.tsx index 03e356d02..3aec9c993 100644 --- a/packages/uniforms/__suites__/ListField.tsx +++ b/packages/uniforms/__suites__/ListField.tsx @@ -10,7 +10,7 @@ export function testListField( addFieldLocator, }: { addFieldLocator: () => HTMLElement | null | undefined }, ) { - it(' - renders ListAddField', () => { + test(' - renders ListAddField', () => { render(, { x: Array, 'x.$': String, @@ -19,7 +19,7 @@ export function testListField( expect(screen.getByRole('button')).toBeInTheDocument(); }); - it(' - renders correct label (specified)', () => { + test(' - renders correct label (specified)', () => { render(, { x: Array, 'x.$': String, @@ -29,7 +29,7 @@ export function testListField( expect(screen.getByText(/ListFieldLabel.*/)).toBeInTheDocument(); }); - it(' - renders correct numer of items with model (specified)', () => { + test(' - renders correct numer of items with model (specified)', () => { render( , { @@ -43,7 +43,7 @@ export function testListField( expect(screen.getAllByRole('textbox')).toHaveLength(3); }); - it(' - passes itemProps to its children', () => { + test(' - passes itemProps to its children', () => { const itemProps = { 'data-xyz': 1 }; const Child = jest.fn(() =>
) as FC; render( @@ -60,7 +60,7 @@ export function testListField( expect(Child).toHaveBeenNthCalledWith(2, itemProps, {}); }); - it(' - renders children (specified)', () => { + test(' - renders children (specified)', () => { const Child = jest.fn(() =>
) as FC; render( @@ -75,7 +75,7 @@ export function testListField( expect(Child).toHaveBeenCalledTimes(2); }); - it(' - renders children with correct name (children)', () => { + test(' - renders children with correct name (children)', () => { const Child = jest.fn(() =>
) as FC; render( @@ -90,7 +90,7 @@ export function testListField( expect(Child).toHaveBeenNthCalledWith(2, { name: '1' }, {}); }); - it(' - renders children with correct name (value)', () => { + test(' - renders children with correct name (value)', () => { render( , { @@ -106,7 +106,7 @@ export function testListField( expect(inputs[1]).toHaveAttribute('name', 'x.1'); }); - it(' - renders proper number of optional values after add new value', () => { + test(' - renders proper number of optional values after add new value', () => { const onChange = jest.fn(); render( , diff --git a/packages/uniforms/__suites__/TextField.tsx b/packages/uniforms/__suites__/TextField.tsx index 91cd13aa6..8ab4dc33a 100644 --- a/packages/uniforms/__suites__/TextField.tsx +++ b/packages/uniforms/__suites__/TextField.tsx @@ -5,19 +5,19 @@ import React, { ComponentType } from 'react'; import { render } from './render'; export function testTextField(TextField: ComponentType) { - it(' - renders an input with correct disabled state', () => { + test(' - renders an input with correct disabled state', () => { render(, { x: String }); expect(screen.getByRole('textbox')).toBeDisabled(); }); - it(' - renders an input with correct readOnly state', () => { + test(' - renders an input with correct readOnly state', () => { render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('readonly', ''); }); - it(' - renders an input with autocomplete turned off', () => { + test(' - renders an input with autocomplete turned off', () => { render(, { x: String, }); @@ -25,27 +25,27 @@ export function testTextField(TextField: ComponentType) { expect(screen.getByRole('textbox')).toHaveAttribute('autocomplete', 'off'); }); - it(' - renders an input with correct id (inherited)', () => { + test(' - renders an input with correct id (inherited)', () => { render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('id'); }); - it(' - renders an input with correct id (specified)', () => { + test(' - renders an input with correct id (specified)', () => { const id = 'y'; render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('id', id); }); - it(' - renders an input with correct name', () => { + test(' - renders an input with correct name', () => { const name = 'x'; render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('name', name); }); - it(' - renders an input with correct placeholder', () => { + test(' - renders an input with correct placeholder', () => { const placeholder = 'y'; render(, { x: String, @@ -57,25 +57,25 @@ export function testTextField(TextField: ComponentType) { ); }); - it(' - renders an input with correct type', () => { + test(' - renders an input with correct type', () => { render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('type', 'text'); }); - it(' - renders an input with correct type (url)', () => { + test(' - renders an input with correct type (url)', () => { render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('type', 'url'); }); - it(' - renders an input with correct value (default)', () => { + test(' - renders an input with correct value (default)', () => { render(, { x: String }); expect(screen.getByRole('textbox')).toHaveValue(''); }); - it(' - renders an input with correct value (model)', () => { + test(' - renders an input with correct value (model)', () => { const defaultValue = 'y'; render( , @@ -86,7 +86,7 @@ export function testTextField(TextField: ComponentType) { expect(screen.getByRole('textbox')).toHaveValue(defaultValue); }); - it(' - renders an input with correct value (specified)', () => { + test(' - renders an input with correct value (specified)', () => { const defaultValue = 'y'; render(, { x: String, @@ -95,7 +95,7 @@ export function testTextField(TextField: ComponentType) { expect(screen.getByRole('textbox')).toHaveValue(defaultValue); }); - it(' - renders an input which correctly reacts on change', () => { + test(' - renders an input which correctly reacts on change', () => { const onChange = jest.fn(); const name = 'x'; const text = 'y'; @@ -106,7 +106,7 @@ export function testTextField(TextField: ComponentType) { expect(onChange).toHaveBeenLastCalledWith(name, text); }); - it(' - renders an input which correctly reacts on change (empty value)', () => { + test(' - renders an input which correctly reacts on change (empty value)', () => { const onChange = jest.fn(); const name = 'x'; render( @@ -120,7 +120,7 @@ export function testTextField(TextField: ComponentType) { expect(onChange).toHaveBeenLastCalledWith(name, ''); }); - it(' - renders a label', () => { + test(' - renders a label', () => { render(, { x: String }); expect(screen.getByLabelText(/y.*/)).toBeInTheDocument(); diff --git a/packages/uniforms/__suites__/render.tsx b/packages/uniforms/__suites__/render.tsx index 704adaa38..52bf064d8 100644 --- a/packages/uniforms/__suites__/render.tsx +++ b/packages/uniforms/__suites__/render.tsx @@ -1,5 +1,5 @@ -import { render as renderOnScreen } from '@testing-library/react'; -import React, { ReactElement } from 'react'; +import { render as renderOnScreen, RenderResult } from '@testing-library/react'; +import React, { cloneElement, ReactElement } from 'react'; import SimpleSchema, { SimpleSchemaDefinition } from 'simpl-schema'; import { BaseForm, context, Context, randomIds } from 'uniforms'; import { SimpleSchema2Bridge } from 'uniforms-bridge-simple-schema-2'; @@ -11,7 +11,9 @@ export function render( schema: SimpleSchemaDefinition, contextValueExtension?: Partial>, initialModel?: object, -) { +): RenderResult & { + rerenderWithProps: (props: Record) => void; +} { const contextValue = { changed: false, changedMap: {}, @@ -37,11 +39,19 @@ export function render( formRef: {} as BaseForm, }; - return renderOnScreen(element, { + const originalRender = renderOnScreen(element, { wrapper({ children }) { return ( {children} ); }, }); + + const { rerender } = originalRender; + + const rerenderWithProps = (props: Record) => { + rerender(cloneElement(element, props)); + }; + + return { rerenderWithProps, ...originalRender }; } diff --git a/packages/uniforms/__tests__/AutoForm.tsx b/packages/uniforms/__tests__/AutoForm.tsx index 94d47df18..f03c4b4ea 100644 --- a/packages/uniforms/__tests__/AutoForm.tsx +++ b/packages/uniforms/__tests__/AutoForm.tsx @@ -166,55 +166,55 @@ describe('', () => { describe('when reset', () => { it('reset `model`', () => { - // FIXME: AutoForm is not a valid Component. - const Component = () => ( + const { rerenderWithProps } = render( + // FIXME: AutoForm is not a valid Component. {context => mockContext(context?.model)} - + , + { + schema: { type: SimpleSchema2Bridge }, + }, ); - const { rerender } = render(, { - schema: { type: SimpleSchema2Bridge }, - }); - rerender(); + rerenderWithProps({}); expect(mockContext).toHaveBeenLastCalledWith(model); }); it('resets state `changedMap`', () => { - // FIXME: AutoForm is not a valid Component. - const Component = () => ( + const { rerenderWithProps } = render( + // FIXME: AutoForm is not a valid Component. {context => mockContext(context?.changedMap)} - + , + { + schema: { type: SimpleSchema2Bridge }, + }, ); - const { rerender } = render(, { - schema: { type: SimpleSchema2Bridge }, - }); - rerender(); + rerenderWithProps({}); expect(mockContext).toHaveBeenLastCalledWith({}); }); it('resets state `changed`', () => { - // FIXME: AutoForm is not a valid Component. - const Component = () => ( + const { rerenderWithProps } = render( + // FIXME: AutoForm is not a valid Component. {context => mockContext(context?.changed)} - + , + { + schema: { type: SimpleSchema2Bridge }, + }, ); - const { rerender } = render(, { - schema: { type: SimpleSchema2Bridge }, - }); - rerender(); + rerenderWithProps({}); expect(mockContext).toHaveBeenLastCalledWith(false); }); @@ -238,11 +238,11 @@ describe('', () => { it(', validates', () => { // FIXME: AutoForm is not a valid Component. - const { rerender } = render(, { + const { rerenderWithProps } = render(, { schema: { type: SimpleSchema2Bridge }, }); - rerender(); + rerenderWithProps({ model, validate: 'onChange' }); expect(validator).toHaveBeenCalledTimes(1); }); }); diff --git a/packages/uniforms/__tests__/ValidatedForm.tsx b/packages/uniforms/__tests__/ValidatedForm.tsx index 0681dfc9c..537182ee6 100644 --- a/packages/uniforms/__tests__/ValidatedForm.tsx +++ b/packages/uniforms/__tests__/ValidatedForm.tsx @@ -528,7 +528,7 @@ describe('ValidatedForm', () => { ); }; - const Component = () => ( + render( // FIXME: ValidatedForm is not a valid Component. // TODO: delete ts-expect-error error if this issue is resolved https://github.com/vazco/uniforms/issues/1165 { {context => mockContext(context?.error)} - + , + { + schema: { type: SimpleSchema2Bridge }, + }, ); - - render(, { - schema: { type: SimpleSchema2Bridge }, - }); validator.mockImplementationOnce(() => { throw error; }); @@ -570,7 +569,7 @@ describe('ValidatedForm', () => { const anotherModel = { x: 2 }; // FIXME: ValidatedForm is not a valid Component. - const Component = (props: any) => ( + const Component = (props: Record) => ( { ); it('does not revalidate arbitrarily', () => { - const { rerender } = render(, { + const { rerenderWithProps } = render(, { schema: { type: SimpleSchema2Bridge }, }); - rerender(); + rerenderWithProps({ anything: 'anything' }); expect(validator).not.toBeCalled(); }); it('revalidates if `model` changes', () => { - const { rerender } = render(, { + const { rerenderWithProps } = render(, { schema: { type: SimpleSchema2Bridge }, }); - rerender(); + rerenderWithProps({ model: anotherModel }); expect(validator).toHaveBeenCalledTimes(1); }); it('revalidates if `validator` changes', () => { - const { rerender } = render(, { + const { rerenderWithProps } = render(, { schema: { type: SimpleSchema2Bridge }, }); - rerender(); + rerenderWithProps({ validator: {} }); expect(validator).toHaveBeenCalledTimes(1); }); it('revalidate if `schema` changes', () => { const anotherSchema = new SimpleSchema2Bridge(schema.schema); - const { rerender } = render(, { + const { rerenderWithProps } = render(, { schema: { type: SimpleSchema2Bridge }, }); - rerender(); + rerenderWithProps({ schema: anotherSchema }); expect(validator).toHaveBeenCalledTimes(1); }); }); describe('in `onSubmit` mode', () => { // FIXME: ValidatedForm is not a valid Component. - const Component = (props: any) => ( - + const Component = () => ( + ); it('does not revalidate when `model` changes', () => { - const { rerender } = render(, { + const { rerenderWithProps } = render(, { schema: { type: SimpleSchema2Bridge }, }); - rerender(); + rerenderWithProps({ model: {} }); expect(validator).not.toBeCalled(); }); it('does not revalidate when validator `options` change', () => { - const { rerender } = render(, { + const { rerenderWithProps } = render(, { schema: { type: SimpleSchema2Bridge }, }); - rerender(); + rerenderWithProps({ validator: {} }); expect(validator).not.toBeCalled(); }); it('does not revalidate when `schema` changes', () => { const anotherSchema = new SimpleSchema2Bridge(schema.schema); - const { rerender } = render(, { + const { rerenderWithProps } = render(, { schema: { type: SimpleSchema2Bridge }, }); - rerender(); + rerenderWithProps({ schema: anotherSchema }); expect(validator).not.toBeCalled(); }); }); describe('in any mode', () => { - // FIXME: ValidatedForm is not a valid Component. - const Component = (props: any) => ( - - - - ); - it('reuses the validator between validations', () => { - render(, { - schema: { type: SimpleSchema2Bridge }, - }); + render( + // FIXME: ValidatedForm is not a valid Component. + + + , + { + schema: { type: SimpleSchema2Bridge }, + }, + ); ['1', '2', '3'].forEach(value => { const form = screen.getByRole('form'); const input = screen.getByLabelText('A'); @@ -681,19 +674,23 @@ describe('ValidatedForm', () => { it('uses the new validator settings if `validator` changes', () => { const validatorA = Symbol(); const validatorB = Symbol(); - const { rerender } = render(, { - schema: { type: SimpleSchema2Bridge }, - }); + const { rerenderWithProps } = render( + // FIXME: ValidatedForm is not a valid Component. + , + { + schema: { type: SimpleSchema2Bridge }, + }, + ); - rerender(); + rerenderWithProps({ validator: validatorA }); expect(validatorForSchema).toHaveBeenCalledTimes(2); expect(validatorForSchema).toHaveBeenNthCalledWith(2, validatorA); - rerender(); + rerenderWithProps({ validator: validatorB }); expect(validatorForSchema).toHaveBeenCalledTimes(3); expect(validatorForSchema).toHaveBeenNthCalledWith(3, validatorB); - rerender(); + rerenderWithProps({ validator: validatorA }); expect(validatorForSchema).toHaveBeenCalledTimes(4); expect(validatorForSchema).toHaveBeenNthCalledWith(4, validatorA); }); @@ -704,11 +701,25 @@ describe('ValidatedForm', () => { jest .spyOn(alternativeSchema, 'getValidator') .mockImplementation(() => alternativeValidator); - const { rerender } = render(, { - schema: { type: SimpleSchema2Bridge }, - }); + const { rerenderWithProps } = render( + // FIXME: ValidatedForm is not a valid Component. + + + , + { + schema: { type: SimpleSchema2Bridge }, + }, + ); - rerender(); + rerenderWithProps({ + schema: alternativeSchema, + }); const form = screen.getByRole('form'); fireEvent.submit(form); From e8838c53cd146210a60a3866cf59fcf1189091fe Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Mon, 28 Nov 2022 18:27:31 +0100 Subject: [PATCH 13/27] fix naming test to it --- packages/uniforms-antd/__tests__/index.ts | 2 +- .../uniforms-bootstrap3/__tests__/index.ts | 2 +- .../uniforms-bootstrap4/__tests__/index.ts | 2 +- .../uniforms-bootstrap5/__tests__/index.ts | 2 +- .../__tests__/GraphQLBridge.ts | 90 +++++----- .../__tests__/index.ts | 2 +- .../__tests__/JSONSchemaBridge.ts | 160 +++++++++--------- .../__tests__/index.ts | 2 +- .../__tests__/SimpleSchema2Bridge.ts | 76 ++++----- .../__tests__/index.ts | 2 +- .../__tests__/SimpleSchemaBridge.ts | 68 ++++---- .../__tests__/index.ts | 2 +- .../__tests__/ZodBridge.ts | 134 +++++++-------- .../uniforms-bridge-zod/__tests__/index.ts | 2 +- packages/uniforms-mui/__tests__/index.ts | 2 +- packages/uniforms-semantic/__tests__/index.ts | 2 +- packages/uniforms-unstyled/__tests__/index.ts | 2 +- 17 files changed, 276 insertions(+), 276 deletions(-) diff --git a/packages/uniforms-antd/__tests__/index.ts b/packages/uniforms-antd/__tests__/index.ts index 75a72ad82..d87b61151 100644 --- a/packages/uniforms-antd/__tests__/index.ts +++ b/packages/uniforms-antd/__tests__/index.ts @@ -1,6 +1,6 @@ import * as antd from 'uniforms-antd'; -test('exports everything', () => { +it('exports everything', () => { expect(antd).toEqual({ AutoFields: expect.any(Function), AutoField: expect.any(Function), diff --git a/packages/uniforms-bootstrap3/__tests__/index.ts b/packages/uniforms-bootstrap3/__tests__/index.ts index 1ee7bde25..d9254222a 100644 --- a/packages/uniforms-bootstrap3/__tests__/index.ts +++ b/packages/uniforms-bootstrap3/__tests__/index.ts @@ -1,6 +1,6 @@ import * as bootstrap3 from 'uniforms-bootstrap3'; -test('exports everything', () => { +it('exports everything', () => { expect(bootstrap3).toEqual({ AutoFields: expect.any(Function), AutoField: expect.any(Function), diff --git a/packages/uniforms-bootstrap4/__tests__/index.ts b/packages/uniforms-bootstrap4/__tests__/index.ts index 47d79f1c0..ba3902224 100644 --- a/packages/uniforms-bootstrap4/__tests__/index.ts +++ b/packages/uniforms-bootstrap4/__tests__/index.ts @@ -1,6 +1,6 @@ import * as bootstrap4 from 'uniforms-bootstrap4'; -test('exports everything', () => { +it('exports everything', () => { expect(bootstrap4).toEqual({ AutoFields: expect.any(Function), AutoField: expect.any(Function), diff --git a/packages/uniforms-bootstrap5/__tests__/index.ts b/packages/uniforms-bootstrap5/__tests__/index.ts index b54aa3aea..a4a541cc9 100644 --- a/packages/uniforms-bootstrap5/__tests__/index.ts +++ b/packages/uniforms-bootstrap5/__tests__/index.ts @@ -1,6 +1,6 @@ import * as bootstrap5 from 'uniforms-bootstrap5'; -test('exports everything', () => { +it('exports everything', () => { expect(bootstrap5).toEqual({ AutoFields: expect.any(Function), AutoField: expect.any(Function), diff --git a/packages/uniforms-bridge-graphql/__tests__/GraphQLBridge.ts b/packages/uniforms-bridge-graphql/__tests__/GraphQLBridge.ts index d7e512fe5..5b4af28eb 100644 --- a/packages/uniforms-bridge-graphql/__tests__/GraphQLBridge.ts +++ b/packages/uniforms-bridge-graphql/__tests__/GraphQLBridge.ts @@ -85,23 +85,23 @@ describe('GraphQLBridge', () => { ); describe('#constructor()', () => { - test('always ensures `extras`', () => { + it('always ensures `extras`', () => { const bridge = new GraphQLBridge(astI.getType('Post')!, schemaValidator); expect(bridge.extras).toEqual({}); }); }); describe('#getError', () => { - test('works without error', () => { + it('works without error', () => { expect(bridgeI.getError('title', undefined)).toBe(null); }); - test('works with invalid error', () => { + it('works with invalid error', () => { expect(bridgeI.getError('title', {})).toBe(null); expect(bridgeI.getError('title', { invalid: true })).toBe(null); }); - test('works with correct error', () => { + it('works with correct error', () => { expect( bridgeI.getError('title', { details: [{ name: 'title' }] }), ).toEqual({ name: 'title' }); @@ -112,16 +112,16 @@ describe('GraphQLBridge', () => { }); describe('#getErrorMessage', () => { - test('works without error', () => { + it('works without error', () => { expect(bridgeI.getErrorMessage('title', undefined)).toBe(''); }); - test('works with invalid error', () => { + it('works with invalid error', () => { expect(bridgeI.getErrorMessage('title', {})).toBe(''); expect(bridgeI.getErrorMessage('title', { invalid: true })).toBe(''); }); - test('works with correct error', () => { + it('works with correct error', () => { expect( bridgeI.getErrorMessage('title', { details: [{ name: 'title', message: '!' }], @@ -136,23 +136,23 @@ describe('GraphQLBridge', () => { }); describe('#getErrorMessages', () => { - test('works without error', () => { + it('works without error', () => { expect(bridgeI.getErrorMessages(null)).toEqual([]); expect(bridgeI.getErrorMessages(undefined)).toEqual([]); }); - test('works with other errors', () => { + it('works with other errors', () => { expect(bridgeI.getErrorMessages('correct')).toEqual(['correct']); expect(bridgeI.getErrorMessages(999999999)).toEqual([999999999]); }); - test('works with Error', () => { + it('works with Error', () => { expect(bridgeI.getErrorMessages(new Error('correct'))).toEqual([ 'correct', ]); }); - test('works with ValidationError', () => { + it('works with ValidationError', () => { expect( bridgeI.getErrorMessages({ details: [{ name: 'title', message: '!' }], @@ -167,7 +167,7 @@ describe('GraphQLBridge', () => { }); describe('#getField', () => { - test('return correct definition (input)', () => { + it('return correct definition (input)', () => { expect(bridgeI.getField('author.firstName')).toEqual({ astNode: expect.objectContaining({}), defaultValue: 'John', @@ -177,7 +177,7 @@ describe('GraphQLBridge', () => { }); }); - test('return correct definition (type)', () => { + it('return correct definition (type)', () => { expect(bridgeT.getField('author.firstName')).toEqual({ args: [], astNode: expect.objectContaining({}), @@ -189,7 +189,7 @@ describe('GraphQLBridge', () => { }); }); - test('throws on not found field', () => { + it('throws on not found field', () => { const error = /Field not found in schema/; expect(() => bridgeI.getField('x')).toThrow(error); expect(() => bridgeI.getField('author.x')).toThrow(error); @@ -198,11 +198,11 @@ describe('GraphQLBridge', () => { }); describe('#getInitialValue', () => { - test('works with arrays', () => { + it('works with arrays', () => { expect(bridgeI.getInitialValue('author.tags')).toEqual([]); }); - test('works with objects', () => { + it('works with objects', () => { expect(bridgeI.getInitialValue('author')).toEqual({ firstName: 'John', lastName: 'Doe', @@ -210,15 +210,15 @@ describe('GraphQLBridge', () => { }); }); - test('works with undefined primitives', () => { + it('works with undefined primitives', () => { expect(bridgeI.getInitialValue('id')).toBe(undefined); }); - test('works with defined primitives', () => { + it('works with defined primitives', () => { expect(bridgeI.getInitialValue('votes')).toBe(44); }); - test('works with default values', () => { + it('works with default values', () => { expect(bridgeI.getInitialValue('author.firstName')).toBe('John'); }); }); @@ -227,7 +227,7 @@ describe('GraphQLBridge', () => { describe('labels are derived properly', () => { describe('when props.label is undefined or true', () => { describe('and no extra data is passed', () => { - test('should use AST field name', () => { + it('should use AST field name', () => { expect(bridgeT.getProps('title')).toEqual({ allowedValues: ['a', 'b', 'Some Title'], label: false, @@ -253,7 +253,7 @@ describe('GraphQLBridge', () => { }); describe('and extra data is present', () => { - test('should use extra data', () => { + it('should use extra data', () => { expect(bridgeT.getProps('id')).toEqual({ allowedValues: [1, 2, 3], label: 'Post ID', @@ -271,7 +271,7 @@ describe('GraphQLBridge', () => { }); describe('when props.label is a string', () => { - test('should use label from props', () => { + it('should use label from props', () => { expect(bridgeT.getProps('title', { label: 'Overriden' })).toEqual({ allowedValues: ['a', 'b', 'Some Title'], label: false, @@ -300,7 +300,7 @@ describe('GraphQLBridge', () => { }); describe('when props.label is false or null (unset)', () => { - test('should display empty label', () => { + it('should display empty label', () => { expect(bridgeT.getProps('id', { label: false })).toEqual({ allowedValues: [1, 2, 3], label: 'Post ID', @@ -318,7 +318,7 @@ describe('GraphQLBridge', () => { }); }); - test('works with allowedValues', () => { + it('works with allowedValues', () => { expect(bridgeI.getProps('id')).toEqual({ label: 'Post ID', placeholder: 'Post ID', @@ -327,7 +327,7 @@ describe('GraphQLBridge', () => { }); }); - test('works with allowedValues from props', () => { + it('works with allowedValues from props', () => { expect(bridgeI.getProps('id', { allowedValues: [1] })).toEqual({ label: 'Post ID', placeholder: 'Post ID', @@ -336,7 +336,7 @@ describe('GraphQLBridge', () => { }); }); - test('works with custom component', () => { + it('works with custom component', () => { expect(bridgeI.getProps('author')).toEqual({ label: 'Author', required: true, @@ -344,7 +344,7 @@ describe('GraphQLBridge', () => { }); }); - test('works with label (custom)', () => { + it('works with label (custom)', () => { expect(bridgeI.getProps('id', { label: 'ID' })).toEqual({ label: 'Post ID', placeholder: 'Post ID', @@ -353,7 +353,7 @@ describe('GraphQLBridge', () => { }); }); - test('works with label (true)', () => { + it('works with label (true)', () => { expect(bridgeI.getProps('id', { label: true })).toEqual({ label: 'Post ID', placeholder: 'Post ID', @@ -362,7 +362,7 @@ describe('GraphQLBridge', () => { }); }); - test('works with label (falsy)', () => { + it('works with label (falsy)', () => { expect(bridgeI.getProps('id', { label: null })).toEqual({ label: 'Post ID', placeholder: 'Post ID', @@ -371,7 +371,7 @@ describe('GraphQLBridge', () => { }); }); - test('works with placeholder (custom)', () => { + it('works with placeholder (custom)', () => { expect(bridgeI.getProps('id', { placeholder: 'Post ID' })).toEqual({ label: 'Post ID', placeholder: 'Post ID', @@ -380,7 +380,7 @@ describe('GraphQLBridge', () => { }); }); - test('works with placeholder (true)', () => { + it('works with placeholder (true)', () => { expect(bridgeI.getProps('id', { placeholder: true })).toEqual({ label: 'Post ID', placeholder: 'Post ID', @@ -389,7 +389,7 @@ describe('GraphQLBridge', () => { }); }); - test('works with placeholder (falsy)', () => { + it('works with placeholder (falsy)', () => { expect(bridgeI.getProps('id', { placeholder: null })).toEqual({ label: 'Post ID', placeholder: 'Post ID', @@ -398,7 +398,7 @@ describe('GraphQLBridge', () => { }); }); - test('works with placeholder (extra.placeholder === undefined)', () => { + it('works with placeholder (extra.placeholder === undefined)', () => { expect(bridgeI.getProps('title', { placeholder: true })).toEqual({ allowedValues: ['a', 'b', 'Some Title'], label: false, @@ -413,7 +413,7 @@ describe('GraphQLBridge', () => { }); }); - test('works with Number type', () => { + it('works with Number type', () => { expect(bridgeI.getProps('author.decimal1')).toEqual({ label: 'Decimal 1', required: false, @@ -427,21 +427,21 @@ describe('GraphQLBridge', () => { }); }); - test('works with options (array)', () => { + it('works with options (array)', () => { expect(bridgeI.getProps('title').transform('a')).toBe(1); expect(bridgeI.getProps('title').transform('b')).toBe(2); expect(bridgeI.getProps('title').allowedValues[0]).toBe('a'); expect(bridgeI.getProps('title').allowedValues[1]).toBe('b'); }); - test('works with options (object)', () => { + it('works with options (object)', () => { expect(bridgeI.getProps('votes').transform('a')).toBe(1); expect(bridgeI.getProps('votes').transform('b')).toBe(2); expect(bridgeI.getProps('votes').allowedValues[0]).toBe('a'); expect(bridgeI.getProps('votes').allowedValues[1]).toBe('b'); }); - test('works with options from props', () => { + it('works with options from props', () => { expect( bridgeI.getProps('votes', { options: { c: 1, d: 2 } }).transform('c'), ).toBe(1); @@ -456,7 +456,7 @@ describe('GraphQLBridge', () => { ).toBe('d'); }); - test('works with other props', () => { + it('works with other props', () => { expect(bridgeI.getProps('category', { x: 1, y: 1 })).toEqual({ label: 'Category', required: true, @@ -464,19 +464,19 @@ describe('GraphQLBridge', () => { }); describe('when enum', () => { - test('should return possibleValues', () => { + it('should return possibleValues', () => { expect(bridgeI.getProps('author.level').allowedValues).toEqual([ 'Admin', 'User', ]); }); - test('should transform the value to the name', () => { + it('should transform the value to the name', () => { const transform = bridgeI.getProps('author.level').transform; expect(transform('Admin')).toBe('Admin'); }); - test('should prefer options over enum', () => { + it('should prefer options over enum', () => { const bridge = new GraphQLBridge( astI.getType('Post')!, schemaValidator, @@ -499,7 +499,7 @@ describe('GraphQLBridge', () => { }); describe('#getSubfields', () => { - test('works on top level', () => { + it('works on top level', () => { expect(bridgeI.getSubfields()).toEqual([ 'id', 'author', @@ -511,7 +511,7 @@ describe('GraphQLBridge', () => { ]); }); - test('works with nested types', () => { + it('works with nested types', () => { expect(bridgeI.getSubfields('author')).toEqual([ 'id', 'confirmed', @@ -524,7 +524,7 @@ describe('GraphQLBridge', () => { ]); }); - test('works with primitives', () => { + it('works with primitives', () => { expect(bridgeI.getSubfields('id')).toEqual([]); expect(bridgeI.getSubfields('author.id')).toEqual([]); }); @@ -574,7 +574,7 @@ describe('GraphQLBridge', () => { }); describe('#getValidator', () => { - test('calls correct validator', () => { + it('calls correct validator', () => { expect(bridgeI.getValidator()).toBe(schemaValidator); }); }); diff --git a/packages/uniforms-bridge-graphql/__tests__/index.ts b/packages/uniforms-bridge-graphql/__tests__/index.ts index ba49a47a0..ae697b630 100644 --- a/packages/uniforms-bridge-graphql/__tests__/index.ts +++ b/packages/uniforms-bridge-graphql/__tests__/index.ts @@ -1,6 +1,6 @@ import * as uniformsGraphQL from 'uniforms-bridge-graphql'; -test('exports everything', () => { +it('exports everything', () => { expect(uniformsGraphQL).toEqual({ default: expect.any(Function), GraphQLBridge: expect.any(Function), diff --git a/packages/uniforms-bridge-json-schema/__tests__/JSONSchemaBridge.ts b/packages/uniforms-bridge-json-schema/__tests__/JSONSchemaBridge.ts index c5b09b725..22d6962f6 100644 --- a/packages/uniforms-bridge-json-schema/__tests__/JSONSchemaBridge.ts +++ b/packages/uniforms-bridge-json-schema/__tests__/JSONSchemaBridge.ts @@ -221,11 +221,11 @@ describe('JSONSchemaBridge', () => { const bridge = new JSONSchemaBridge(schema, validator); describe('#constructor()', () => { - test('sets schema correctly when has top level type of object', () => { + it('sets schema correctly when has top level type of object', () => { expect(bridge.schema).toEqual(schema); }); - test('sets schema correctly when has top level $ref', () => { + it('sets schema correctly when has top level $ref', () => { const localSchema = { definitions: schema.definitions, $ref: '#/definitions/personalData', @@ -241,7 +241,7 @@ describe('JSONSchemaBridge', () => { expect(localBridge.schema).toEqual(resolvedSchema); }); - test('falls back to input schema', () => { + it('falls back to input schema', () => { const localSchema = { definitions: schema.definitions }; const localBridge = new JSONSchemaBridge(localSchema, validator); expect(localBridge.schema).toEqual(localSchema); @@ -249,28 +249,28 @@ describe('JSONSchemaBridge', () => { }); describe('#getError', () => { - test('works without error', () => { + it('works without error', () => { expect(bridge.getError('age', undefined)).toEqual(null); }); - test('works with invalid error', () => { + it('works with invalid error', () => { expect(bridge.getError('age', {})).toEqual(null); expect(bridge.getError('age', { invalid: true })).toEqual(null); }); - test('works with correct error (data path)', () => { + it('works with correct error (data path)', () => { const error = { details: [{ dataPath: '.x' }] }; expect(bridge.getError('x', error)).toEqual(error.details[0]); expect(bridge.getError('y', error)).toEqual(null); }); - test('works with correct error (instance path)', () => { + it('works with correct error (instance path)', () => { const error = { details: [{ instancePath: '.x' }] }; expect(bridge.getError('x', error)).toEqual(error.details[0]); expect(bridge.getError('y', error)).toEqual(null); }); - test('works with correct error (data path at root)', () => { + it('works with correct error (data path at root)', () => { const error = { details: [ { @@ -287,7 +287,7 @@ describe('JSONSchemaBridge', () => { expect(bridge.getError('y', error)).toEqual(null); }); - test('works with correct error (instance path at root)', () => { + it('works with correct error (instance path at root)', () => { const error = { details: [ { @@ -304,7 +304,7 @@ describe('JSONSchemaBridge', () => { expect(bridge.getError('y', error)).toEqual(null); }); - test('works with correct error (data path of parent)', () => { + it('works with correct error (data path of parent)', () => { const error = { details: [ { @@ -322,7 +322,7 @@ describe('JSONSchemaBridge', () => { expect(bridge.getError('y.x', error)).toEqual(null); }); - test('works with correct error (instance path of parent)', () => { + it('works with correct error (instance path of parent)', () => { const error = { details: [ { @@ -340,7 +340,7 @@ describe('JSONSchemaBridge', () => { expect(bridge.getError('y.x', error)).toEqual(null); }); - test('works with correct error (complex data paths)', () => { + it('works with correct error (complex data paths)', () => { const pairs = [ ["a.0.b.c-d.0.f/'g", ".a[0].b['c-d'][0]['f/\\'g']"], ['a.0.b.c-d.0.h/"i', ".a[0].b['c-d'][0]['h/\"i']"], @@ -354,7 +354,7 @@ describe('JSONSchemaBridge', () => { }); }); - test('works with correct error (complex instance paths)', () => { + it('works with correct error (complex instance paths)', () => { const pairs = [ ["a.0.b.c-d.0.f/'g", ".a[0].b['c-d'][0]['f/\\'g']"], ['a.0.b.c-d.0.h/"i', ".a[0].b['c-d'][0]['h/\"i']"], @@ -368,7 +368,7 @@ describe('JSONSchemaBridge', () => { }); }); - test('works with correct error (complex data paths - JSON pointers)', () => { + it('works with correct error (complex data paths - JSON pointers)', () => { const pairs = [ ["a.0.b.c-d.0.f/'g", "/a/0/b/c-d/0/f~1'g"], ['a.0.b.c-d.0.h/"i', '/a/0/b/c-d/0/h~1"i'], @@ -382,7 +382,7 @@ describe('JSONSchemaBridge', () => { }); }); - test('works with correct error (complex instance paths - JSON pointers)', () => { + it('works with correct error (complex instance paths - JSON pointers)', () => { const pairs = [ ["a.0.b.c-d.0.f/'g", "/a/0/b/c-d/0/f~1'g"], ['a.0.b.c-d.0.h/"i', '/a/0/b/c-d/0/h~1"i'], @@ -396,7 +396,7 @@ describe('JSONSchemaBridge', () => { }); }); - test('works with correct error (complex instance paths - dots in names)', () => { + it('works with correct error (complex instance paths - dots in names)', () => { const pairs = [ ['["a.b.c"].["d.e/f"].g', '/a.b.c/d.e~1f/g'], ['a.["b"]', '/a/b'], @@ -415,16 +415,16 @@ describe('JSONSchemaBridge', () => { }); describe('#getErrorMessage', () => { - test('works without error', () => { + it('works without error', () => { expect(bridge.getErrorMessage('age', undefined)).toBe(''); }); - test('works with invalid error', () => { + it('works with invalid error', () => { expect(bridge.getErrorMessage('age', {})).toBe(''); expect(bridge.getErrorMessage('age', { invalid: true })).toBe(''); }); - test('works with correct error', () => { + it('works with correct error', () => { expect( bridge.getErrorMessage('age', { details: [{ dataPath: '.age', message: 'Zing!' }], @@ -437,7 +437,7 @@ describe('JSONSchemaBridge', () => { ).toBe(''); }); - test('works with correct error (instance path)', () => { + it('works with correct error (instance path)', () => { expect( bridge.getErrorMessage('age', { details: [{ instancePath: '.age', message: 'Zing!' }], @@ -452,23 +452,23 @@ describe('JSONSchemaBridge', () => { }); describe('#getErrorMessages', () => { - test('works without error', () => { + it('works without error', () => { expect(bridge.getErrorMessages(null)).toEqual([]); expect(bridge.getErrorMessages(undefined)).toEqual([]); }); - test('works with other errors', () => { + it('works with other errors', () => { expect(bridge.getErrorMessages('correct')).toEqual(['correct']); expect(bridge.getErrorMessages(999999999)).toEqual([999999999]); }); - test('works with Error', () => { + it('works with Error', () => { expect(bridge.getErrorMessages(new Error('correct'))).toEqual([ 'correct', ]); }); - test('works with ValidationError', () => { + it('works with ValidationError', () => { expect( bridge.getErrorMessages({ details: [{ dataPath: '.age', message: 'Zing!' }], @@ -481,7 +481,7 @@ describe('JSONSchemaBridge', () => { ).toEqual(['Ignore!']); }); - test('works with ValidationError (instance path)', () => { + it('works with ValidationError (instance path)', () => { expect( bridge.getErrorMessages({ details: [{ instancePath: '.age', message: 'Zing!' }], @@ -496,7 +496,7 @@ describe('JSONSchemaBridge', () => { }); describe('#getField', () => { - test('returns correct definition (flat)', () => { + it('returns correct definition (flat)', () => { expect(bridge.getField('age')).toEqual({ type: 'integer', default: 24, @@ -504,7 +504,7 @@ describe('JSONSchemaBridge', () => { }); }); - test('returns correct definition (flat with $ref)', () => { + it('returns correct definition (flat with $ref)', () => { expect(bridge.getField('billingAddress')).toEqual({ properties: expect.objectContaining({ city: { type: 'string', uniforms: { label: false, required: false } }, @@ -523,18 +523,18 @@ describe('JSONSchemaBridge', () => { }); }); - test('returns correct definition (nested)', () => { + it('returns correct definition (nested)', () => { expect(bridge.getField('email.work')).toEqual({ type: 'string' }); }); - test('returns correct definition (nested with $ref)', () => { + it('returns correct definition (nested with $ref)', () => { expect(bridge.getField('personalData.firstName')).toEqual({ default: 'John', type: 'string', }); }); - test('returns correct definition (dots in name)', () => { + it('returns correct definition (dots in name)', () => { expect(bridge.getField('["path.with.a.dot"]')).toMatchObject({ type: 'object', }); @@ -556,30 +556,30 @@ describe('JSONSchemaBridge', () => { }); }); - test('returns correct definition ($ref pointing to $ref)', () => { + it('returns correct definition ($ref pointing to $ref)', () => { expect(bridge.getField('personalData.middleName')).toEqual({ type: 'string', }); }); - test('returns correct definition (array tuple)', () => { + it('returns correct definition (array tuple)', () => { expect(bridge.getField('dateOfBirthTuple.1')).toEqual({ type: 'string' }); }); - test('returns correct definition (array flat $ref)', () => { + it('returns correct definition (array flat $ref)', () => { expect(bridge.getField('friends.$')).toEqual( expect.objectContaining({ type: expect.any(String) }), ); }); - test('returns correct definition (array flat $ref, nested property)', () => { + it('returns correct definition (array flat $ref, nested property)', () => { expect(bridge.getField('friends.$.firstName')).toEqual({ default: 'John', type: 'string', }); }); - test('returns correct definition when schema has top level $ref', () => { + it('returns correct definition when schema has top level $ref', () => { const localBridge = new JSONSchemaBridge( { definitions: schema.definitions, $ref: '#/definitions/personalData' }, validator, @@ -591,7 +591,7 @@ describe('JSONSchemaBridge', () => { }); }); - test('throws when resolving field schema is not possible', () => { + it('throws when resolving field schema is not possible', () => { const localBridge = new JSONSchemaBridge( { definitions: schema.definitions, $ref: '#/definitions/personalData' }, validator, @@ -602,13 +602,13 @@ describe('JSONSchemaBridge', () => { ); }); - test('throws when resolving field schema is not possible (with allOf with $ref field)', () => { + it('throws when resolving field schema is not possible (with allOf with $ref field)', () => { expect(() => bridge.getField('shippingAddress.street.invalid')).toThrow( /Field not found in schema/, ); }); - test('throws when resolving field schema is not possible (with allOf with $ref field without properties prop)', () => { + it('throws when resolving field schema is not possible (with allOf with $ref field without properties prop)', () => { const localBridge = new JSONSchemaBridge( { definitions: schema.definitions, @@ -630,7 +630,7 @@ describe('JSONSchemaBridge', () => { ); }); - test('returns correct definition (allOf with $ref)', () => { + it('returns correct definition (allOf with $ref)', () => { expect(bridge.getField('shippingAddress.street')).toEqual({ type: 'string', }); @@ -638,7 +638,7 @@ describe('JSONSchemaBridge', () => { }); describe('#getInitialValue', () => { - test('works with arrays', () => { + it('works with arrays', () => { expect(bridge.getInitialValue('friends')).toEqual([]); expect(bridge.getInitialValue('friendsMinCount')).toEqual([ { firstName: 'John', lastName: 'John' }, @@ -647,25 +647,25 @@ describe('JSONSchemaBridge', () => { ]); }); - test('works with objects', () => { + it('works with objects', () => { expect(bridge.getInitialValue('billingAddress')).toEqual({}); }); - test('works with undefined primitives', () => { + it('works with undefined primitives', () => { expect(bridge.getInitialValue('salary')).toBe(undefined); }); - test('works with defined primitives', () => { + it('works with defined primitives', () => { expect(bridge.getInitialValue('age')).toBe(24); }); - test('works with default values', () => { + it('works with default values', () => { expect(bridge.getInitialValue('personalData.firstName')).toBe('John'); }); }); describe('#getProps', () => { - test('works with allowedValues', () => { + it('works with allowedValues', () => { expect(bridge.getProps('shippingAddress.type')).toEqual({ allowedValues: ['residential', 'business'], label: 'Type', @@ -673,7 +673,7 @@ describe('JSONSchemaBridge', () => { }); }); - test('works with allowedValues from props', () => { + it('works with allowedValues from props', () => { expect( bridge.getProps('shippingAddress.type', { allowedValues: [1] }), ).toEqual({ @@ -683,14 +683,14 @@ describe('JSONSchemaBridge', () => { }); }); - test('works with allowedValues from props', () => { + it('works with allowedValues from props', () => { expect(bridge.getProps('forcedRequired')).toEqual({ label: 'Forced required', required: true, }); }); - test('works with custom component', () => { + it('works with custom component', () => { expect(bridge.getProps('age')).toEqual({ component: 'span', label: 'Age', @@ -698,28 +698,28 @@ describe('JSONSchemaBridge', () => { }); }); - test('works with label (default)', () => { + it('works with label (default)', () => { expect(bridge.getProps('withLabel')).toEqual({ label: 'Example', required: false, }); }); - test('works with label (custom)', () => { + it('works with label (custom)', () => { expect(bridge.getProps('dateOfBirth', { label: 'Death' })).toEqual({ label: 'Date of birth', required: true, }); }); - test('works with label (true)', () => { + it('works with label (true)', () => { expect(bridge.getProps('dateOfBirth', { label: true })).toEqual({ label: 'Date of birth', required: true, }); }); - test('works with property title as default label', () => { + it('works with property title as default label', () => { expect(bridge.getProps('hasAJob', { label: true })).toEqual({ allowedValues: undefined, label: 'Currently Employed', @@ -729,28 +729,28 @@ describe('JSONSchemaBridge', () => { }); }); - test('works with placeholder (custom)', () => { + it('works with placeholder (custom)', () => { expect(bridge.getProps('email.work', { placeholder: 'Email' })).toEqual({ label: 'Work', required: true, }); }); - test('works with placeholder (true)', () => { + it('works with placeholder (true)', () => { expect(bridge.getProps('email.work', { placeholder: true })).toEqual({ label: 'Work', required: true, }); }); - test('works with placeholder (falsy)', () => { + it('works with placeholder (falsy)', () => { expect(bridge.getProps('email.work', { placeholder: null })).toEqual({ label: 'Work', required: true, }); }); - test('works with placeholder (label falsy)', () => { + it('works with placeholder (label falsy)', () => { expect( bridge.getProps('email.work', { label: null, placeholder: true }), ).toEqual({ @@ -766,7 +766,7 @@ describe('JSONSchemaBridge', () => { }); }); - test('works with Number type', () => { + it('works with Number type', () => { expect(bridge.getProps('salary')).toEqual({ allowedValues: ['low', 'medium', 'height'], decimal: true, @@ -777,7 +777,7 @@ describe('JSONSchemaBridge', () => { }); }); - test('works with options (array)', () => { + it('works with options (array)', () => { expect(bridge.getProps('billingAddress.state').transform('AL')).toBe( 'Alabama', ); @@ -792,14 +792,14 @@ describe('JSONSchemaBridge', () => { ); }); - test('works with options (object)', () => { + it('works with options (object)', () => { expect(bridge.getProps('salary').transform('low')).toBe(6000); expect(bridge.getProps('salary').transform('medium')).toBe(12000); expect(bridge.getProps('salary').allowedValues[0]).toBe('low'); expect(bridge.getProps('salary').allowedValues[1]).toBe('medium'); }); - test('works with options from props', () => { + it('works with options from props', () => { const props = { options: { minimal: 4000, avarage: 8000 } }; expect(bridge.getProps('salary', props).transform('minimal')).toBe(4000); expect(bridge.getProps('salary', props).transform('avarage')).toBe(8000); @@ -807,7 +807,7 @@ describe('JSONSchemaBridge', () => { expect(bridge.getProps('salary', props).allowedValues[1]).toBe('avarage'); }); - test('works with type', () => { + it('works with type', () => { expect(bridge.getProps('password')).toEqual({ label: 'Password', required: false, @@ -825,7 +825,7 @@ describe('JSONSchemaBridge', () => { }); }); - test('works with other props', () => { + it('works with other props', () => { expect(bridge.getProps('personalData.firstName', { x: 1, y: 1 })).toEqual( { label: 'First name', @@ -834,57 +834,57 @@ describe('JSONSchemaBridge', () => { ); }); - test('works with allOf in items', () => { + it('works with allOf in items', () => { expect(bridge.getProps('arrayWithAllOf.0.child')).toEqual({ label: 'Child', required: true, }); }); - test('works with anyOf for a non-object computed property (required default value)', () => { + it('works with anyOf for a non-object computed property (required default value)', () => { expect(bridge.getProps('nonObjectAnyOf')).toHaveProperty( 'required', false, ); }); - test('works with anyOf for a non-object computed property (required)', () => { + it('works with anyOf for a non-object computed property (required)', () => { expect(bridge.getProps('nonObjectAnyOfRequired')).toHaveProperty( 'required', true, ); }); - test('works with anyOf for a non-object computed property (properties not defined)', () => { + it('works with anyOf for a non-object computed property (properties not defined)', () => { expect(bridge.getProps('nonObjectAnyOf')).toHaveProperty( 'properties', undefined, ); }); - test('works with maxItems in props', () => { + it('works with maxItems in props', () => { expect(bridge.getProps('arrayWithAllOf')).toHaveProperty('maxCount', 3); }); - test('works with minItems in props', () => { + it('works with minItems in props', () => { expect(bridge.getProps('arrayWithAllOf')).toHaveProperty('minCount', 1); }); - test('works with maximum in props', () => { + it('works with maximum in props', () => { expect(bridge.getProps('passwordNumeric')).toHaveProperty('max', 9999); }); - test('works with minimum in props', () => { + it('works with minimum in props', () => { expect(bridge.getProps('passwordNumeric')).toHaveProperty('min', 1000); }); - test('works with multipleOf in props', () => { + it('works with multipleOf in props', () => { expect(bridge.getProps('passwordNumeric')).toHaveProperty('step', 3); }); }); describe('#getSubfields', () => { - test('works on top level', () => { + it('works on top level', () => { expect(bridge.getSubfields()).toEqual([ 'age', 'billingAddress', @@ -914,7 +914,7 @@ describe('JSONSchemaBridge', () => { ]); }); - test('works with nested types', () => { + it('works with nested types', () => { expect(bridge.getSubfields('arrayWithAllOf.0')).toEqual(['child']); expect(bridge.getSubfields('shippingAddress')).toEqual([ 'city', @@ -924,7 +924,7 @@ describe('JSONSchemaBridge', () => { ]); }); - test('works with recursive types', () => { + it('works with recursive types', () => { expect(bridge.getSubfields('recursive')).toEqual(['field', 'recursive']); expect(bridge.getSubfields('recursive.recursive')).toEqual([ 'field', @@ -932,12 +932,12 @@ describe('JSONSchemaBridge', () => { ]); }); - test('works with primitives', () => { + it('works with primitives', () => { expect(bridge.getSubfields('personalData.firstName')).toEqual([]); expect(bridge.getSubfields('age')).toEqual([]); }); - test('works when schema has top level $ref', () => { + it('works when schema has top level $ref', () => { const localBridge = new JSONSchemaBridge( { definitions: schema.definitions, $ref: '#/definitions/address' }, validator, @@ -946,11 +946,11 @@ describe('JSONSchemaBridge', () => { expect(localBridge.getSubfields()).toEqual(['city', 'state', 'street']); }); - test('works when an object does not have properties', () => { + it('works when an object does not have properties', () => { expect(bridge.getSubfields('objectWithoutProperties')).toEqual([]); }); - test('works on top level when schema does not have properties', () => { + it('works on top level when schema does not have properties', () => { const localBridge = new JSONSchemaBridge( { definitions: schema.definitions, $ref: '#/definitions/lastName' }, validator, @@ -961,7 +961,7 @@ describe('JSONSchemaBridge', () => { }); describe('#getType', () => { - test('works with any type', () => { + it('works with any type', () => { expect(bridge.getType('age')).toBe(Number); expect(bridge.getType('billingAddress')).toBe(Object); expect(bridge.getType('billingAddress.city')).toBe(String); @@ -988,7 +988,7 @@ describe('JSONSchemaBridge', () => { }); describe('#getValidator', () => { - test('calls correct validator', () => { + it('calls correct validator', () => { expect(bridge.getValidator()).toBe(validator); }); }); diff --git a/packages/uniforms-bridge-json-schema/__tests__/index.ts b/packages/uniforms-bridge-json-schema/__tests__/index.ts index fbd5a9dbe..2b90e331f 100644 --- a/packages/uniforms-bridge-json-schema/__tests__/index.ts +++ b/packages/uniforms-bridge-json-schema/__tests__/index.ts @@ -1,6 +1,6 @@ import * as uniformsJSONSchema from 'uniforms-bridge-json-schema'; -test('exports everything', () => { +it('exports everything', () => { expect(uniformsJSONSchema).toEqual({ default: expect.any(Function), JSONSchemaBridge: expect.any(Function), diff --git a/packages/uniforms-bridge-simple-schema-2/__tests__/SimpleSchema2Bridge.ts b/packages/uniforms-bridge-simple-schema-2/__tests__/SimpleSchema2Bridge.ts index cc277de52..c054b13ec 100644 --- a/packages/uniforms-bridge-simple-schema-2/__tests__/SimpleSchema2Bridge.ts +++ b/packages/uniforms-bridge-simple-schema-2/__tests__/SimpleSchema2Bridge.ts @@ -54,16 +54,16 @@ describe('SimpleSchema2Bridge', () => { const bridge = new SimpleSchema2Bridge(schema); describe('#getError', () => { - test('works without error', () => { + it('works without error', () => { expect(bridge.getError('a', undefined)).toBe(null); }); - test('works with invalid error', () => { + it('works with invalid error', () => { expect(bridge.getError('a', {})).toBe(null); expect(bridge.getError('a', { invalid: true })).toBe(null); }); - test('works with correct error', () => { + it('works with correct error', () => { expect(bridge.getError('a', { details: [{ name: 'a' }] })).toEqual({ name: 'a', }); @@ -72,16 +72,16 @@ describe('SimpleSchema2Bridge', () => { }); describe('#getErrorMessage', () => { - test('works without error', () => { + it('works without error', () => { expect(bridge.getErrorMessage('a', undefined)).toBe(''); }); - test('works with invalid error', () => { + it('works with invalid error', () => { expect(bridge.getErrorMessage('a', {})).toBe(''); expect(bridge.getErrorMessage('a', { invalid: true })).toBe(''); }); - test('works with correct error', () => { + it('works with correct error', () => { expect( bridge.getErrorMessage('a', { details: [{ name: 'a', details: { value: 1 } }], @@ -96,23 +96,23 @@ describe('SimpleSchema2Bridge', () => { }); describe('#getErrorMessages', () => { - test('works without error', () => { + it('works without error', () => { expect(bridge.getErrorMessages(null)).toEqual([]); expect(bridge.getErrorMessages(undefined)).toEqual([]); }); - test('works with other errors', () => { + it('works with other errors', () => { expect(bridge.getErrorMessages('correct')).toEqual(['correct']); expect(bridge.getErrorMessages(999999999)).toEqual([999999999]); }); - test('works with Error', () => { + it('works with Error', () => { expect(bridge.getErrorMessages(new Error('correct'))).toEqual([ 'correct', ]); }); - test('works with ValidationError', () => { + it('works with ValidationError', () => { expect( bridge.getErrorMessages({ details: [{ name: 'a', details: { value: 1 } }], @@ -127,14 +127,14 @@ describe('SimpleSchema2Bridge', () => { }); describe('#getField', () => { - test('return correct definition', () => { + it('return correct definition', () => { const definition = schema.getDefinition('a'); const definitionComposed = { ...definition, ...definition.type[0] }; expect(bridge.getField('a')).toEqual(definitionComposed); }); - test('return correct definition (`autoValue` hack)', () => { + it('return correct definition (`autoValue` hack)', () => { const definition = schema.getDefinition('x'); const definitionComposed = { ...definition, @@ -145,17 +145,17 @@ describe('SimpleSchema2Bridge', () => { expect(bridge.getField('x')).toEqual(definitionComposed); }); - test('throws on not found field', () => { + it('throws on not found field', () => { expect(() => bridge.getField('xxx')).toThrow(/Field not found in schema/); }); }); describe('#getInitialValue', () => { - test('works with arrays', () => { + it('works with arrays', () => { expect(bridge.getInitialValue('k')).toEqual([]); }); - test('works with arrays (minCount)', () => { + it('works with arrays (minCount)', () => { expect(bridge.getInitialValue('j')).toEqual([ { a: 'x' }, { a: 'x' }, @@ -163,25 +163,25 @@ describe('SimpleSchema2Bridge', () => { ]); }); - test('works with arrays (defaultValue)', () => { + it('works with arrays (defaultValue)', () => { expect(bridge.getInitialValue('y')).toEqual(['y']); }); - test('works with arrays of objects (defaultValue)', () => { + it('works with arrays of objects (defaultValue)', () => { expect(bridge.getInitialValue('zs')).toEqual([{ a: 'a' }]); }); - test('works with objects', () => { + it('works with objects', () => { expect(bridge.getInitialValue('a')).toEqual({ b: {} }); }); - test('works with objects (defaultValue)', () => { + it('works with objects (defaultValue)', () => { expect(bridge.getInitialValue('z')).toEqual({ a: 'a' }); }); }); describe('#getProps', () => { - test('works with allowedValues', () => { + it('works with allowedValues', () => { expect(bridge.getProps('o')).toEqual({ label: 'O', required: true, @@ -189,14 +189,14 @@ describe('SimpleSchema2Bridge', () => { }); }); - test('works with allowedValues from props', () => { + it('works with allowedValues from props', () => { expect(bridge.getProps('o', { allowedValues: ['O'] })).toEqual({ label: 'O', required: true, }); }); - test('works with custom component', () => { + it('works with custom component', () => { expect(bridge.getProps('l')).toEqual({ label: 'L', required: true, @@ -209,7 +209,7 @@ describe('SimpleSchema2Bridge', () => { }); }); - test('works with custom component (field)', () => { + it('works with custom component (field)', () => { expect(bridge.getProps('n')).toEqual({ label: 'N', required: true, @@ -217,7 +217,7 @@ describe('SimpleSchema2Bridge', () => { }); }); - test('works with Number type', () => { + it('works with Number type', () => { expect(bridge.getProps('h')).toEqual({ label: 'H', required: true, @@ -225,28 +225,28 @@ describe('SimpleSchema2Bridge', () => { }); }); - test('works with options (array)', () => { + it('works with options (array)', () => { expect(bridge.getProps('s').transform('a')).toBe(1); expect(bridge.getProps('s').transform('b')).toBe(2); expect(bridge.getProps('s').allowedValues[0]).toBe('a'); expect(bridge.getProps('s').allowedValues[1]).toBe('b'); }); - test('works with options (function)', () => { + it('works with options (function)', () => { expect(bridge.getProps('t').transform('a')).toBe(1); expect(bridge.getProps('t').transform('b')).toBe(2); expect(bridge.getProps('t').allowedValues[0]).toBe('a'); expect(bridge.getProps('t').allowedValues[1]).toBe('b'); }); - test('works with options (object)', () => { + it('works with options (object)', () => { expect(bridge.getProps('r').transform('a')).toBe(1); expect(bridge.getProps('r').transform('b')).toBe(2); expect(bridge.getProps('r').allowedValues[0]).toBe('a'); expect(bridge.getProps('r').allowedValues[1]).toBe('b'); }); - test('works with options from props', () => { + it('works with options from props', () => { expect( bridge.getProps('s', { options: { c: 1, d: 2 } }).transform('c'), ).toBe(1); @@ -261,7 +261,7 @@ describe('SimpleSchema2Bridge', () => { ).toBe('d'); }); - test('works with transform', () => { + it('works with transform', () => { expect(bridge.getProps('p')).toEqual({ label: 'P', required: true, @@ -269,14 +269,14 @@ describe('SimpleSchema2Bridge', () => { }); }); - test('works with transform from props', () => { + it('works with transform from props', () => { expect(bridge.getProps('p', { transform: () => {} })).toEqual({ label: 'P', required: true, }); }); - test('works with type', () => { + it('works with type', () => { expect(bridge.getProps('aa')).toEqual({ label: 'Aa', type: 'password', @@ -284,7 +284,7 @@ describe('SimpleSchema2Bridge', () => { }); }); - test('returns no field type', () => { + it('returns no field type', () => { expect(bridge.getProps('a')).not.toHaveProperty('type'); expect(bridge.getProps('j')).not.toHaveProperty('type'); expect(bridge.getProps('d')).not.toHaveProperty('type'); @@ -294,7 +294,7 @@ describe('SimpleSchema2Bridge', () => { }); describe('#getSubfields', () => { - test('works on top level', () => { + it('works on top level', () => { expect(bridge.getSubfields()).toEqual([ 'a', 'aa', @@ -323,23 +323,23 @@ describe('SimpleSchema2Bridge', () => { ]); }); - test('works with nested schemas', () => { + it('works with nested schemas', () => { expect(bridge.getSubfields('w')).toEqual(['x']); }); - test('works with objects', () => { + it('works with objects', () => { expect(bridge.getSubfields('a')).toEqual(['b']); expect(bridge.getSubfields('a.b')).toEqual(['c']); }); - test('works with primitives', () => { + it('works with primitives', () => { expect(bridge.getSubfields('d')).toEqual([]); expect(bridge.getSubfields('e')).toEqual([]); }); }); describe('#getType', () => { - test('works with any type', () => { + it('works with any type', () => { expect(bridge.getType('a')).toBe(Object); expect(bridge.getType('j')).toBe(Array); expect(bridge.getType('d')).toBe(String); @@ -351,7 +351,7 @@ describe('SimpleSchema2Bridge', () => { }); describe('#getValidator', () => { - test('calls correct validator', () => { + it('calls correct validator', () => { const schema = new SimpleSchema({ x: { type: Number } }); const bridge = new SimpleSchema2Bridge(schema); diff --git a/packages/uniforms-bridge-simple-schema-2/__tests__/index.ts b/packages/uniforms-bridge-simple-schema-2/__tests__/index.ts index 81a65f651..c96aa3e7e 100644 --- a/packages/uniforms-bridge-simple-schema-2/__tests__/index.ts +++ b/packages/uniforms-bridge-simple-schema-2/__tests__/index.ts @@ -1,6 +1,6 @@ import * as uniformsSimpleSchema2 from 'uniforms-bridge-simple-schema-2'; -test('exports everything', () => { +it('exports everything', () => { expect(uniformsSimpleSchema2).toEqual({ default: expect.any(Function), SimpleSchema2Bridge: expect.any(Function), diff --git a/packages/uniforms-bridge-simple-schema/__tests__/SimpleSchemaBridge.ts b/packages/uniforms-bridge-simple-schema/__tests__/SimpleSchemaBridge.ts index a4626c201..f93c0eea3 100644 --- a/packages/uniforms-bridge-simple-schema/__tests__/SimpleSchemaBridge.ts +++ b/packages/uniforms-bridge-simple-schema/__tests__/SimpleSchemaBridge.ts @@ -93,16 +93,16 @@ describe('SimpleSchemaBridge', () => { const bridge = new SimpleSchemaBridge(schema); describe('#getError', () => { - test('works without error', () => { + it('works without error', () => { expect(bridge.getError('a', null)).toBe(null); }); - test('works with invalid error', () => { + it('works with invalid error', () => { expect(bridge.getError('a', {})).toBe(null); expect(bridge.getError('a', { invalid: true })).toBe(null); }); - test('works with correct error', () => { + it('works with correct error', () => { expect(bridge.getError('a', { details: [{ name: 'a' }] })).toEqual({ name: 'a', }); @@ -111,16 +111,16 @@ describe('SimpleSchemaBridge', () => { }); describe('#getErrorMessage', () => { - test('works without error', () => { + it('works without error', () => { expect(bridge.getErrorMessage('a', undefined)).toBe(''); }); - test('works with invalid error', () => { + it('works with invalid error', () => { expect(bridge.getErrorMessage('a', {})).toBe(''); expect(bridge.getErrorMessage('a', { invalid: true })).toBe(''); }); - test('works with correct error', () => { + it('works with correct error', () => { expect( bridge.getErrorMessage('a', { details: [{ name: 'a', details: { value: 1 } }], @@ -135,23 +135,23 @@ describe('SimpleSchemaBridge', () => { }); describe('#getErrorMessages', () => { - test('works without error', () => { + it('works without error', () => { expect(bridge.getErrorMessages(null)).toEqual([]); expect(bridge.getErrorMessages(undefined)).toEqual([]); }); - test('works with other errors', () => { + it('works with other errors', () => { expect(bridge.getErrorMessages('correct')).toEqual(['correct']); expect(bridge.getErrorMessages(999999999)).toEqual([999999999]); }); - test('works with Error', () => { + it('works with Error', () => { expect(bridge.getErrorMessages(new Error('correct'))).toEqual([ 'correct', ]); }); - test('works with ValidationError', () => { + it('works with ValidationError', () => { expect( bridge.getErrorMessages({ details: [{ name: 'a', details: { value: 1 } }], @@ -166,21 +166,21 @@ describe('SimpleSchemaBridge', () => { }); describe('#getField', () => { - test('return correct definition', () => { + it('return correct definition', () => { expect(bridge.getField('a')).toEqual(schema.getDefinition('a')); }); - test('throws on not found field', () => { + it('throws on not found field', () => { expect(() => bridge.getField('x')).toThrow(/Field not found in schema/); }); }); describe('#getInitialValue', () => { - test('works with arrays', () => { + it('works with arrays', () => { expect(bridge.getInitialValue('k')).toEqual([]); }); - test('works with arrays (minCount)', () => { + it('works with arrays (minCount)', () => { expect(bridge.getInitialValue('j')).toEqual([ { a: 'x' }, { a: 'x' }, @@ -188,25 +188,25 @@ describe('SimpleSchemaBridge', () => { ]); }); - test('works with arrays (defaultValue)', () => { + it('works with arrays (defaultValue)', () => { expect(bridge.getInitialValue('u')).toEqual(['u']); }); - test('works with arrays of objects (defaultValue)', () => { + it('works with arrays of objects (defaultValue)', () => { expect(bridge.getInitialValue('w')).toEqual([{ a: 'a' }]); }); - test('works with objects', () => { + it('works with objects', () => { expect(bridge.getInitialValue('a')).toEqual({ b: {} }); }); - test('works with objects (defaultValue)', () => { + it('works with objects (defaultValue)', () => { expect(bridge.getInitialValue('v')).toEqual({ a: 'a' }); }); }); describe('#getProps', () => { - test('works with allowedValues', () => { + it('works with allowedValues', () => { expect(bridge.getProps('o')).toEqual({ label: 'O', required: true, @@ -214,14 +214,14 @@ describe('SimpleSchemaBridge', () => { }); }); - test('works with allowedValues from props', () => { + it('works with allowedValues from props', () => { expect(bridge.getProps('o', { allowedValues: ['O'] })).toEqual({ label: 'O', required: true, }); }); - test('works with custom component', () => { + it('works with custom component', () => { expect(bridge.getProps('l')).toEqual({ label: 'L', required: true, @@ -234,7 +234,7 @@ describe('SimpleSchemaBridge', () => { }); }); - test('works with custom component (field)', () => { + it('works with custom component (field)', () => { expect(bridge.getProps('n')).toEqual({ label: 'N', required: true, @@ -242,28 +242,28 @@ describe('SimpleSchemaBridge', () => { }); }); - test('works with options (array)', () => { + it('works with options (array)', () => { expect(bridge.getProps('s').transform('a')).toBe(1); expect(bridge.getProps('s').transform('b')).toBe(2); expect(bridge.getProps('s').allowedValues[0]).toBe('a'); expect(bridge.getProps('s').allowedValues[1]).toBe('b'); }); - test('works with options (function)', () => { + it('works with options (function)', () => { expect(bridge.getProps('t').transform('a')).toBe(1); expect(bridge.getProps('t').transform('b')).toBe(2); expect(bridge.getProps('t').allowedValues[0]).toBe('a'); expect(bridge.getProps('t').allowedValues[1]).toBe('b'); }); - test('works with options (object)', () => { + it('works with options (object)', () => { expect(bridge.getProps('r').transform('a')).toBe(1); expect(bridge.getProps('r').transform('b')).toBe(2); expect(bridge.getProps('r').allowedValues[0]).toBe('a'); expect(bridge.getProps('r').allowedValues[1]).toBe('b'); }); - test('works with options from props', () => { + it('works with options from props', () => { expect( bridge.getProps('s', { options: { c: 1, d: 2 } }).transform('c'), ).toBe(1); @@ -278,7 +278,7 @@ describe('SimpleSchemaBridge', () => { ).toBe('d'); }); - test('works with transform', () => { + it('works with transform', () => { expect(bridge.getProps('p')).toEqual({ label: 'P', required: true, @@ -286,14 +286,14 @@ describe('SimpleSchemaBridge', () => { }); }); - test('works with transform from props', () => { + it('works with transform from props', () => { expect(bridge.getProps('p', { transform: () => {} })).toEqual({ label: 'P', required: true, }); }); - test('works with type', () => { + it('works with type', () => { expect(bridge.getProps('aa')).toEqual({ label: 'AA', type: 'password', @@ -301,7 +301,7 @@ describe('SimpleSchemaBridge', () => { }); }); - test('returns no field type', () => { + it('returns no field type', () => { expect(bridge.getProps('a')).not.toHaveProperty('type'); expect(bridge.getProps('j')).not.toHaveProperty('type'); expect(bridge.getProps('d')).not.toHaveProperty('type'); @@ -311,19 +311,19 @@ describe('SimpleSchemaBridge', () => { }); describe('#getSubfields', () => { - test('works with objects', () => { + it('works with objects', () => { expect(bridge.getSubfields('a')).toEqual(['b']); expect(bridge.getSubfields('a.b')).toEqual(['c']); }); - test('works with primitives', () => { + it('works with primitives', () => { expect(bridge.getSubfields('d')).toEqual([]); expect(bridge.getSubfields('e')).toEqual([]); }); }); describe('#getType', () => { - test('works with any type', () => { + it('works with any type', () => { expect(bridge.getType('a')).toBe(Object); expect(bridge.getType('j')).toBe(Array); expect(bridge.getType('d')).toBe(String); @@ -333,7 +333,7 @@ describe('SimpleSchemaBridge', () => { }); describe('#getValidator', () => { - test('calls correct validator', () => { + it('calls correct validator', () => { const bridge = new SimpleSchemaBridge({ ...schema, validator() { diff --git a/packages/uniforms-bridge-simple-schema/__tests__/index.ts b/packages/uniforms-bridge-simple-schema/__tests__/index.ts index b1aa4b935..1c1b5ef31 100644 --- a/packages/uniforms-bridge-simple-schema/__tests__/index.ts +++ b/packages/uniforms-bridge-simple-schema/__tests__/index.ts @@ -1,6 +1,6 @@ import * as uniformsSimpleSchema from 'uniforms-bridge-simple-schema'; -test('exports everything', () => { +it('exports everything', () => { expect(uniformsSimpleSchema).toEqual({ default: expect.any(Function), SimpleSchemaBridge: expect.any(Function), diff --git a/packages/uniforms-bridge-zod/__tests__/ZodBridge.ts b/packages/uniforms-bridge-zod/__tests__/ZodBridge.ts index 2b907df48..5ee9546f7 100644 --- a/packages/uniforms-bridge-zod/__tests__/ZodBridge.ts +++ b/packages/uniforms-bridge-zod/__tests__/ZodBridge.ts @@ -32,14 +32,14 @@ import { describe('ZodBridge', () => { describe('#getError', () => { - test('works without error', () => { + it('works without error', () => { const schema = object({ a: string() }); const bridge = new ZodBridge(schema); expect(bridge.getError('a', null)).toBe(null); expect(bridge.getError('a', undefined)).toBe(null); }); - test('works with simple types', () => { + it('works with simple types', () => { const schema = object({ a: string(), b: number() }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({}); @@ -48,7 +48,7 @@ describe('ZodBridge', () => { expect(bridge.getError('b', error)).toBe(issues?.[1]); }); - test('works with arrays', () => { + it('works with arrays', () => { const schema = object({ a: array(array(string())) }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({ a: [['x', 'y', 0], [1]] }); @@ -61,7 +61,7 @@ describe('ZodBridge', () => { expect(bridge.getError('a.1.0', error)).toBe(issues?.[1]); }); - test('works with nested objects', () => { + it('works with nested objects', () => { const schema = object({ a: object({ b: object({ c: string() }) }) }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({ a: { b: { c: 1 } } }); @@ -73,14 +73,14 @@ describe('ZodBridge', () => { }); describe('#getErrorMessage', () => { - test('works without error', () => { + it('works without error', () => { const schema = object({ a: string() }); const bridge = new ZodBridge(schema); expect(bridge.getErrorMessage('a', null)).toBe(''); expect(bridge.getErrorMessage('a', undefined)).toBe(''); }); - test('works with simple types', () => { + it('works with simple types', () => { const schema = object({ a: string(), b: number() }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({}); @@ -89,7 +89,7 @@ describe('ZodBridge', () => { expect(bridge.getErrorMessage('b', error)).toBe(issues?.[1].message); }); - test('works with arrays', () => { + it('works with arrays', () => { const schema = object({ a: array(array(string())) }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({ a: [['x', 'y', 0], [1]] }); @@ -102,7 +102,7 @@ describe('ZodBridge', () => { expect(bridge.getErrorMessage('a.1.0', error)).toBe(issues?.[1].message); }); - test('works with nested objects', () => { + it('works with nested objects', () => { const schema = object({ a: object({ b: object({ c: string() }) }) }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({ a: { b: { c: 1 } } }); @@ -114,20 +114,20 @@ describe('ZodBridge', () => { }); describe('#getErrorMessages', () => { - test('works without error', () => { + it('works without error', () => { const schema = object({ a: string() }); const bridge = new ZodBridge(schema); expect(bridge.getErrorMessages(null)).toEqual([]); expect(bridge.getErrorMessages(undefined)).toEqual([]); }); - test('works with generic error', () => { + it('works with generic error', () => { const schema = object({ a: string() }); const bridge = new ZodBridge(schema); expect(bridge.getErrorMessages(new Error('Error'))).toEqual(['Error']); }); - test('works with simple types', () => { + it('works with simple types', () => { const schema = object({ a: string(), b: number() }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({}); @@ -135,7 +135,7 @@ describe('ZodBridge', () => { expect(bridge.getErrorMessages(error)).toEqual(messages); }); - test('works with arrays', () => { + it('works with arrays', () => { const schema = object({ a: array(array(string())) }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({ a: [['x', 'y', 0], [1]] }); @@ -143,7 +143,7 @@ describe('ZodBridge', () => { expect(bridge.getErrorMessages(error)).toEqual(messages); }); - test('works with nested objects', () => { + it('works with nested objects', () => { const schema = object({ a: object({ b: object({ c: string() }) }) }); const bridge = new ZodBridge(schema); const error = bridge.getValidator()({ a: { b: { c: 1 } } }); @@ -153,20 +153,20 @@ describe('ZodBridge', () => { }); describe('#getField', () => { - test('works with root schema', () => { + it('works with root schema', () => { const schema = object({}); const bridge = new ZodBridge(schema); expect(bridge.getField('')).toBe(schema); }); - test('works with simple types', () => { + it('works with simple types', () => { const schema = object({ a: string(), b: number() }); const bridge = new ZodBridge(schema); expect(bridge.getField('a')).toBe(schema.shape.a); expect(bridge.getField('b')).toBe(schema.shape.b); }); - test('works with arrays', () => { + it('works with arrays', () => { const schema = object({ a: array(array(string())) }); const bridge = new ZodBridge(schema); expect(bridge.getField('a')).toBe(schema.shape.a); @@ -174,7 +174,7 @@ describe('ZodBridge', () => { expect(bridge.getField('a.$.$')).toBe(schema.shape.a.element.element); }); - test('works with nested objects', () => { + it('works with nested objects', () => { const schema = object({ a: object({ b: object({ c: string() }) }) }); const bridge = new ZodBridge(schema); expect(bridge.getField('a')).toBe(schema.shape.a); @@ -182,7 +182,7 @@ describe('ZodBridge', () => { expect(bridge.getField('a.b.c')).toBe(schema.shape.a.shape.b.shape.c); }); - test('works with default', () => { + it('works with default', () => { const schema = object({ a: object({ b: string() }).default({ b: 'x' }) }); const bridge = new ZodBridge(schema); expect(bridge.getField('a')).toBe(schema.shape.a); @@ -191,7 +191,7 @@ describe('ZodBridge', () => { ); }); - test('works with optional', () => { + it('works with optional', () => { const schema = object({ a: optional(object({ b: string() })) }); const bridge = new ZodBridge(schema); expect(bridge.getField('a')).toBe(schema.shape.a); @@ -200,7 +200,7 @@ describe('ZodBridge', () => { }); describe('#getInitialValue', () => { - test('works with array', () => { + it('works with array', () => { const schema = object({ a: array(array(string())) }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual([]); @@ -208,7 +208,7 @@ describe('ZodBridge', () => { expect(bridge.getInitialValue('a.0.0')).toEqual(undefined); }); - test('works with array (min length)', () => { + it('works with array (min length)', () => { const schema = object({ a: array(array(string()).min(1)).min(2) }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual([[], []]); @@ -216,25 +216,25 @@ describe('ZodBridge', () => { expect(bridge.getInitialValue('a.0.0')).toEqual(undefined); }); - test('works with boolean', () => { + it('works with boolean', () => { const schema = object({ a: boolean() }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual(undefined); }); - test('works with date', () => { + it('works with date', () => { const schema = object({ a: date() }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual(undefined); }); - test('works with enum (array)', () => { + it('works with enum (array)', () => { const schema = object({ a: enum_(['x', 'y', 'z']) }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual('x'); }); - test('works with enum (native, numbers)', () => { + it('works with enum (native, numbers)', () => { enum Test { x, y, @@ -246,7 +246,7 @@ describe('ZodBridge', () => { expect(bridge.getInitialValue('a')).toEqual(0); }); - test('works with enum (native, string)', () => { + it('works with enum (native, string)', () => { enum Test { x = 'x', y = 'y', @@ -258,13 +258,13 @@ describe('ZodBridge', () => { expect(bridge.getInitialValue('a')).toEqual('x'); }); - test('works with number', () => { + it('works with number', () => { const schema = object({ a: number() }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual(undefined); }); - test('works with object', () => { + it('works with object', () => { const schema = object({ a: object({ b: object({ c: string() }) }) }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual({ b: {} }); @@ -272,19 +272,19 @@ describe('ZodBridge', () => { expect(bridge.getInitialValue('a.b.c')).toEqual(undefined); }); - test('works with default', () => { + it('works with default', () => { const schema = object({ a: string().default('x') }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual('x'); }); - test('works with optional', () => { + it('works with optional', () => { const schema = object({ a: optional(string()) }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual(undefined); }); - test('works with string', () => { + it('works with string', () => { const schema = object({ a: string() }); const bridge = new ZodBridge(schema); expect(bridge.getInitialValue('a')).toEqual(undefined); @@ -292,7 +292,7 @@ describe('ZodBridge', () => { }); describe('#getProps', () => { - test('works with array', () => { + it('works with array', () => { const schema = object({ a: array(array(string())) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ label: 'A', required: true }); @@ -300,7 +300,7 @@ describe('ZodBridge', () => { expect(bridge.getProps('a.0.0')).toEqual({ label: '0', required: true }); }); - test('works with array (maxCount)', () => { + it('works with array (maxCount)', () => { const schema = object({ a: array(array(string())).max(1) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ @@ -310,7 +310,7 @@ describe('ZodBridge', () => { }); }); - test('works with array (minCount)', () => { + it('works with array (minCount)', () => { const schema = object({ a: array(array(string())).min(1) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ @@ -320,19 +320,19 @@ describe('ZodBridge', () => { }); }); - test('works with boolean', () => { + it('works with boolean', () => { const schema = object({ a: boolean() }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ label: 'A', required: true }); }); - test('works with date', () => { + it('works with date', () => { const schema = object({ a: date() }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ label: 'A', required: true }); }); - test('works with enum (array)', () => { + it('works with enum (array)', () => { const schema = object({ a: enum_(['x', 'y', 'z']) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ @@ -342,7 +342,7 @@ describe('ZodBridge', () => { }); }); - test('works with enum (native, number)', () => { + it('works with enum (native, number)', () => { enum Test { x, y, @@ -358,7 +358,7 @@ describe('ZodBridge', () => { }); }); - test('works with enum (native, string)', () => { + it('works with enum (native, string)', () => { enum Test { x = 'x', y = 'y', @@ -374,7 +374,7 @@ describe('ZodBridge', () => { }); }); - test('works with number', () => { + it('works with number', () => { const schema = object({ a: number() }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ @@ -384,13 +384,13 @@ describe('ZodBridge', () => { }); }); - test('works with number (int)', () => { + it('works with number (int)', () => { const schema = object({ a: number().int() }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ label: 'A', required: true }); }); - test('works with number (max)', () => { + it('works with number (max)', () => { const schema = object({ a: number().max(1) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ @@ -401,7 +401,7 @@ describe('ZodBridge', () => { }); }); - test('works with number (min)', () => { + it('works with number (min)', () => { const schema = object({ a: number().min(1) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ @@ -412,7 +412,7 @@ describe('ZodBridge', () => { }); }); - test('works with number (multipleOf)', () => { + it('works with number (multipleOf)', () => { const schema = object({ a: number().int().multipleOf(7) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ @@ -422,7 +422,7 @@ describe('ZodBridge', () => { }); }); - test('works with object', () => { + it('works with object', () => { const schema = object({ a: object({ b: object({ c: string() }) }) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ label: 'A', required: true }); @@ -430,19 +430,19 @@ describe('ZodBridge', () => { expect(bridge.getProps('a.b.c')).toEqual({ label: 'C', required: true }); }); - test('works with default', () => { + it('works with default', () => { const schema = object({ a: string().default('x') }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ label: 'A', required: false }); }); - test('works with optional', () => { + it('works with optional', () => { const schema = object({ a: optional(string()) }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ label: 'A', required: false }); }); - test('works with string', () => { + it('works with string', () => { const schema = object({ a: string() }); const bridge = new ZodBridge(schema); expect(bridge.getProps('a')).toEqual({ label: 'A', required: true }); @@ -450,26 +450,26 @@ describe('ZodBridge', () => { }); describe('#getSubfields', () => { - test('works with empty objects', () => { + it('works with empty objects', () => { const schema = object({}); const bridge = new ZodBridge(schema); expect(bridge.getSubfields()).toEqual([]); }); - test('works with non-empty objects', () => { + it('works with non-empty objects', () => { const schema = object({ a: string(), b: number() }); const bridge = new ZodBridge(schema); expect(bridge.getSubfields()).toEqual(['a', 'b']); }); - test('works with simple types', () => { + it('works with simple types', () => { const schema = object({ a: string(), b: number() }); const bridge = new ZodBridge(schema); expect(bridge.getSubfields('a')).toEqual([]); expect(bridge.getSubfields('b')).toEqual([]); }); - test('works with arrays', () => { + it('works with arrays', () => { const schema = object({ a: array(array(string())) }); const bridge = new ZodBridge(schema); expect(bridge.getSubfields('a')).toEqual(['$']); @@ -477,7 +477,7 @@ describe('ZodBridge', () => { expect(bridge.getSubfields('a.$.$')).toEqual([]); }); - test('works with nested objects', () => { + it('works with nested objects', () => { const schema = object({ a: object({ b: object({ c: string() }) }) }); const bridge = new ZodBridge(schema); expect(bridge.getSubfields('a')).toEqual(['b']); @@ -485,14 +485,14 @@ describe('ZodBridge', () => { expect(bridge.getSubfields('a.b.c')).toEqual([]); }); - test('works with optional', () => { + it('works with optional', () => { const schema = object({ a: object({ b: string() }).default({ b: 'x' }) }); const bridge = new ZodBridge(schema); expect(bridge.getSubfields('a')).toEqual(['b']); expect(bridge.getSubfields('a.b')).toEqual([]); }); - test('works with optional', () => { + it('works with optional', () => { const schema = object({ a: optional(object({ b: string() })) }); const bridge = new ZodBridge(schema); expect(bridge.getSubfields('a')).toEqual(['b']); @@ -501,31 +501,31 @@ describe('ZodBridge', () => { }); describe('#getType', () => { - test('works with array', () => { + it('works with array', () => { const schema = object({ a: array(array(string())) }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(Array); }); - test('works with boolean', () => { + it('works with boolean', () => { const schema = object({ a: boolean() }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(Boolean); }); - test('works with date', () => { + it('works with date', () => { const schema = object({ a: date() }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(Date); }); - test('works with enum (array)', () => { + it('works with enum (array)', () => { const schema = object({ a: enum_(['x', 'y', 'z']) }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(String); }); - test('works with enum (native, number)', () => { + it('works with enum (native, number)', () => { enum Test { x, y, @@ -537,7 +537,7 @@ describe('ZodBridge', () => { expect(bridge.getType('a')).toBe(Number); }); - test('works with enum (native, string)', () => { + it('works with enum (native, string)', () => { enum Test { x = 'x', y = 'y', @@ -549,31 +549,31 @@ describe('ZodBridge', () => { expect(bridge.getType('a')).toBe(String); }); - test('works with number', () => { + it('works with number', () => { const schema = object({ a: number() }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(Number); }); - test('works with object', () => { + it('works with object', () => { const schema = object({ a: object({ b: object({ c: string() }) }) }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(Object); }); - test('works with default', () => { + it('works with default', () => { const schema = object({ a: string().default('x') }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(String); }); - test('works with optional', () => { + it('works with optional', () => { const schema = object({ a: optional(string()) }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(String); }); - test('works with string', () => { + it('works with string', () => { const schema = object({ a: string() }); const bridge = new ZodBridge(schema); expect(bridge.getType('a')).toBe(String); @@ -614,7 +614,7 @@ describe('ZodBridge', () => { }); describe('#getValidator', () => { - test('return a function', () => { + it('return a function', () => { const schema = object({}); const bridge = new ZodBridge(schema); const validator = bridge.getValidator(); diff --git a/packages/uniforms-bridge-zod/__tests__/index.ts b/packages/uniforms-bridge-zod/__tests__/index.ts index 80a00251b..5bd69d955 100644 --- a/packages/uniforms-bridge-zod/__tests__/index.ts +++ b/packages/uniforms-bridge-zod/__tests__/index.ts @@ -1,6 +1,6 @@ import * as uniformsZod from 'uniforms-bridge-zod'; -test('exports everything', () => { +it('exports everything', () => { expect(uniformsZod).toEqual({ default: expect.any(Function), ZodBridge: expect.any(Function), diff --git a/packages/uniforms-mui/__tests__/index.ts b/packages/uniforms-mui/__tests__/index.ts index 180e878e1..bec0d5be2 100644 --- a/packages/uniforms-mui/__tests__/index.ts +++ b/packages/uniforms-mui/__tests__/index.ts @@ -1,6 +1,6 @@ import * as material from 'uniforms-mui'; -test('exports everything', () => { +it('exports everything', () => { expect(material).toEqual({ AutoFields: expect.any(Function), AutoField: expect.any(Function), diff --git a/packages/uniforms-semantic/__tests__/index.ts b/packages/uniforms-semantic/__tests__/index.ts index 50e7a3a65..870c60425 100644 --- a/packages/uniforms-semantic/__tests__/index.ts +++ b/packages/uniforms-semantic/__tests__/index.ts @@ -1,6 +1,6 @@ import * as semantic from 'uniforms-semantic'; -test('exports everything', () => { +it('exports everything', () => { expect(semantic).toEqual({ AutoFields: expect.any(Function), AutoField: expect.any(Function), diff --git a/packages/uniforms-unstyled/__tests__/index.ts b/packages/uniforms-unstyled/__tests__/index.ts index 58ec7e511..e8c50cae7 100644 --- a/packages/uniforms-unstyled/__tests__/index.ts +++ b/packages/uniforms-unstyled/__tests__/index.ts @@ -1,6 +1,6 @@ import * as unstyled from 'uniforms-unstyled'; -test('exports everything', () => { +it('exports everything', () => { expect(unstyled).toEqual({ AutoFields: expect.any(Function), AutoField: expect.any(Function), From b781eef12ba311fd1f80870e32375940559cb69b Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Mon, 28 Nov 2022 18:28:19 +0100 Subject: [PATCH 14/27] fix test to it name in material tests --- packages/uniforms-material/__tests__/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uniforms-material/__tests__/index.ts b/packages/uniforms-material/__tests__/index.ts index 332f44e65..5e02e0d7a 100644 --- a/packages/uniforms-material/__tests__/index.ts +++ b/packages/uniforms-material/__tests__/index.ts @@ -1,6 +1,6 @@ import * as material from 'uniforms-material'; -test('exports everything', () => { +it('exports everything', () => { expect(material).toEqual({ AutoFields: expect.any(Function), AutoField: expect.any(Function), From 615d7d0e212facdf282c3015ce3e1bd44910ee41 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Fri, 2 Dec 2022 14:40:22 +0100 Subject: [PATCH 15/27] rewrite last describe in ValidateForm to rtl --- packages/uniforms/__tests__/ValidatedForm.tsx | 263 +++++++++--------- 1 file changed, 139 insertions(+), 124 deletions(-) diff --git a/packages/uniforms/__tests__/ValidatedForm.tsx b/packages/uniforms/__tests__/ValidatedForm.tsx index 537182ee6..5eb1c5034 100644 --- a/packages/uniforms/__tests__/ValidatedForm.tsx +++ b/packages/uniforms/__tests__/ValidatedForm.tsx @@ -727,128 +727,143 @@ describe('ValidatedForm', () => { expect(alternativeValidator).toHaveBeenCalledTimes(1); }); }); -}); -// describe('validation flow', () => { -// const variantGroups = [ -// { -// 'fail-async': () => Promise.resolve(error), -// 'fail-sync': () => error, -// 'good-async': () => Promise.resolve(null), -// 'good-async-silent': () => Promise.resolve(), -// 'good-sync': () => null, -// 'good-sync-silent': () => {}, -// }, -// { -// 'fail-async': () => Promise.resolve(error), -// 'fail-sync': () => error, -// 'good-async': () => Promise.resolve(null), -// 'good-async-silent': () => Promise.resolve(), -// 'good-sync': () => null, -// 'good-sync-silent': () => {}, -// 'pass-async': (_: string, error: any) => Promise.resolve(error), -// 'pass-sync': (_: string, error: any) => error, -// }, -// { -// 'fail-async': () => -// new Promise((_, reject) => setTimeout(() => reject(error))), -// 'good-async': () => -// new Promise(resolve => setTimeout(() => resolve('ok'))), -// 'good-sync': () => 'ok', -// }, -// ] as const; -// -// function cartesian(xs: X[], ys: Y[]) { -// return xs.reduce<[X, Y][]>( -// (xys, x) => ys.reduce((xys, y) => [...xys, [x, y]], xys), -// [], -// ); -// } -// -// function keys(x: X) { -// return Object.keys(x) as (keyof X)[]; -// } -// -// const cases = cartesian( -// [true, false] as [true, false], -// cartesian( -// keys(variantGroups[0]), -// cartesian(keys(variantGroups[1]), keys(variantGroups[2])), -// ), -// ); -// -// const alternativeSchema = new SimpleSchema2Bridge(schema.schema); -// alternativeSchema.getValidator = () => validator; -// -// function flatPair4([a, [b, [c, d]]]: [A, [B, [C, D]]]) { -// return [a, b, c, d] as const; -// } -// -// it.each(cases.map(flatPair4))('works for %p/%p/%p/%p', async (...modes) => { -// const [hasError, validatorMode, onValidateMode, onSubmitMode] = modes; -// // FIXME: ValidatedForm is not a valid Component. -// const wrapper = mount( -// , -// ); -// -// const asyncSubmission = onSubmitMode.includes('async'); -// const asyncValidation = -// validatorMode.includes('async') || onValidateMode.includes('async'); -// const hasValidationError = -// hasError || -// (validatorMode.includes('good') -// ? onValidateMode.includes('fail') -// : !onValidateMode.includes('good')); -// const hasSubmissionError = -// hasValidationError || onSubmitMode.includes('fail'); -// -// for (let run = 1; run <= 3; ++run) { -// validator.mockImplementationOnce(variantGroups[0][validatorMode]); -// onValidate.mockImplementationOnce(variantGroups[1][onValidateMode]); -// onSubmit.mockImplementationOnce(variantGroups[2][onSubmitMode]); -// -// const result = wrapper.instance().submit(); -// expect(validator).toHaveBeenCalledTimes(run); -// -// if (asyncValidation) { -// expect(wrapper.instance().getContext().validating).toBe(true); -// await new Promise(resolve => process.nextTick(resolve)); -// expect(wrapper.instance().getContext().validating).toBe(false); -// } -// -// await new Promise(resolve => process.nextTick(resolve)); -// -// expect(onValidate).toHaveBeenCalledTimes(run); -// -// if (hasValidationError) { -// expect(onSubmit).not.toHaveBeenCalled(); -// expect(wrapper.instance().getContext().error).toBe(error); -// } else { -// expect(onSubmit).toHaveBeenCalledTimes(run); -// expect(wrapper.instance().getContext().error).toBe(null); -// -// if (asyncSubmission) { -// expect(wrapper.instance().getContext().submitting).toBe(true); -// await new Promise(resolve => setTimeout(resolve)); -// expect(wrapper.instance().getContext().submitting).toBe(false); -// } -// } -// -// await new Promise(resolve => setTimeout(resolve)); -// -// if (hasSubmissionError) { -// expect(wrapper.instance().getContext().error).toBe(error); -// await expect(result).rejects.toEqual(error); -// } else { -// expect(wrapper.instance().getContext().error).toBe(null); -// const submissionResult = asyncSubmission ? 'ok' : undefined; -// await expect(result).resolves.toEqual(submissionResult); -// } -// } -// }); -// }); + describe('validation flow', () => { + const variantGroups = [ + { + 'fail-async': () => Promise.resolve(error), + 'fail-sync': () => error, + 'good-async': () => Promise.resolve(null), + 'good-async-silent': () => Promise.resolve(), + 'good-sync': () => null, + 'good-sync-silent': () => {}, + }, + { + 'fail-async': () => Promise.resolve(error), + 'fail-sync': () => error, + 'good-async': () => Promise.resolve(null), + 'good-async-silent': () => Promise.resolve(), + 'good-sync': () => null, + 'good-sync-silent': () => {}, + 'pass-async': (_: string, error: any) => Promise.resolve(error), + 'pass-sync': (_: string, error: any) => error, + }, + { + 'fail-async': () => + new Promise((_, reject) => setTimeout(() => reject(error))), + 'good-async': () => + new Promise(resolve => setTimeout(() => resolve('ok'))), + 'good-sync': () => 'ok', + }, + ] as const; + + function cartesian(xs: X[], ys: Y[]) { + return xs.reduce<[X, Y][]>( + (xys, x) => ys.reduce((xys, y) => [...xys, [x, y]], xys), + [], + ); + } + + function keys(x: X) { + return Object.keys(x) as (keyof X)[]; + } + + const cases = cartesian( + [true, false] as [true, false], + cartesian( + keys(variantGroups[0]), + cartesian(keys(variantGroups[1]), keys(variantGroups[2])), + ), + ); + + const alternativeSchema = new SimpleSchema2Bridge(schema.schema); + alternativeSchema.getValidator = () => validator; + + function flatPair4([a, [b, [c, d]]]: [A, [B, [C, D]]]) { + return [a, b, c, d] as const; + } + + it.each(cases.map(flatPair4))('works for %p/%p/%p/%p', async (...modes) => { + const [hasError, validatorMode, onValidateMode, onSubmitMode] = modes; + + const mockContextError = jest.fn(); + const mockContextSubmitting = jest.fn(); + + render( + // FIXME: ValidatedForm is not a valid Component. + + + {context => { + mockContext(context?.validating); + mockContextError(context?.error); + mockContextSubmitting(context?.submitting); + return null; + }} + + , + { schema: { type: SimpleSchema2Bridge } }, + ); + + const asyncSubmission = onSubmitMode.includes('async'); + const asyncValidation = + validatorMode.includes('async') || onValidateMode.includes('async'); + const hasValidationError = + hasError || + (validatorMode.includes('good') + ? onValidateMode.includes('fail') + : !onValidateMode.includes('good')); + const hasSubmissionError = + hasValidationError || onSubmitMode.includes('fail'); + + for (let run = 1; run <= 3; ++run) { + validator.mockImplementationOnce(variantGroups[0][validatorMode]); + onValidate.mockImplementationOnce(variantGroups[1][onValidateMode]); + onSubmit.mockImplementationOnce(variantGroups[2][onSubmitMode]); + + const form = screen.getByRole('form'); + fireEvent.submit(form); + expect(validator).toHaveBeenCalledTimes(run); + + if (asyncValidation) { + expect(mockContext).toHaveBeenLastCalledWith(true); + await new Promise(resolve => process.nextTick(resolve)); + expect(mockContext).toHaveBeenLastCalledWith(false); + } + + await new Promise(resolve => process.nextTick(resolve)); + + expect(onValidate).toHaveBeenCalledTimes(run); + + if (hasValidationError) { + expect(onSubmit).not.toHaveBeenCalled(); + expect(mockContextError).toHaveBeenLastCalledWith(error); + } else { + expect(onSubmit).toHaveBeenCalledTimes(run); + expect(mockContextError).toHaveBeenLastCalledWith(null); + + if (asyncSubmission) { + expect(mockContextSubmitting).toHaveBeenLastCalledWith(true); + await new Promise(resolve => setTimeout(resolve)); + expect(mockContextSubmitting).toHaveBeenLastCalledWith(false); + } + } + + await new Promise(resolve => setTimeout(resolve)); + + if (hasSubmissionError) { + expect(mockContextError).toHaveBeenLastCalledWith(error); + } else { + expect(mockContextError).toHaveBeenLastCalledWith(null); + } + } + }); + }); +}); From 3fcd882cfb067f75def2a6d610111694817ca664 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Fri, 2 Dec 2022 14:45:25 +0100 Subject: [PATCH 16/27] rename testFn to test --- packages/uniforms/__tests__/joinName.ts | 152 ++++++++++++------------ 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/packages/uniforms/__tests__/joinName.ts b/packages/uniforms/__tests__/joinName.ts index 1b8f8a384..0da4c9c1d 100644 --- a/packages/uniforms/__tests__/joinName.ts +++ b/packages/uniforms/__tests__/joinName.ts @@ -1,6 +1,6 @@ import { joinName } from 'uniforms'; -function testFn(parts: unknown[], array: string[], string: string) { +function test(parts: unknown[], array: string[], string: string) { // Serialization (join). expect(joinName(...parts)).toBe(string); @@ -20,116 +20,116 @@ describe('joinName', () => { }); it('works with empty name', () => { - testFn([], [], ''); + test([], [], ''); }); it('works with arrays', () => { - testFn([['a']], ['a'], 'a'); - testFn([[['a']]], ['a'], 'a'); - testFn([[[['a']]]], ['a'], 'a'); + test([['a']], ['a'], 'a'); + test([[['a']]], ['a'], 'a'); + test([[[['a']]]], ['a'], 'a'); - testFn([[], 'a'], ['a'], 'a'); - testFn(['a', []], ['a'], 'a'); + test([[], 'a'], ['a'], 'a'); + test(['a', []], ['a'], 'a'); - testFn([['a'], 'b'], ['a', 'b'], 'a.b'); - testFn(['a', ['b']], ['a', 'b'], 'a.b'); + test([['a'], 'b'], ['a', 'b'], 'a.b'); + test(['a', ['b']], ['a', 'b'], 'a.b'); - testFn([['a', 'b'], 'c'], ['a', 'b', 'c'], 'a.b.c'); - testFn(['a', ['b', 'c']], ['a', 'b', 'c'], 'a.b.c'); + test([['a', 'b'], 'c'], ['a', 'b', 'c'], 'a.b.c'); + test(['a', ['b', 'c']], ['a', 'b', 'c'], 'a.b.c'); - testFn(['a', ['b', 'c'], 'd'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); + test(['a', ['b', 'c'], 'd'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); }); it('works with empty strings', () => { - testFn(['', 'a', 'b'], ['a', 'b'], 'a.b'); - testFn(['a', '', 'b'], ['a', 'b'], 'a.b'); - testFn(['a', 'b', ''], ['a', 'b'], 'a.b'); + test(['', 'a', 'b'], ['a', 'b'], 'a.b'); + test(['a', '', 'b'], ['a', 'b'], 'a.b'); + test(['a', 'b', ''], ['a', 'b'], 'a.b'); }); it('works with falsy values', () => { - testFn(['a', null, 'b'], ['a', 'b'], 'a.b'); - testFn(['a', false, 'b'], ['a', 'b'], 'a.b'); - testFn(['a', undefined, 'b'], ['a', 'b'], 'a.b'); + test(['a', null, 'b'], ['a', 'b'], 'a.b'); + test(['a', false, 'b'], ['a', 'b'], 'a.b'); + test(['a', undefined, 'b'], ['a', 'b'], 'a.b'); }); it('works with numbers', () => { - testFn([0, 'a', 'b'], ['0', 'a', 'b'], '0.a.b'); - testFn(['a', 0, 'b'], ['a', '0', 'b'], 'a.0.b'); - testFn(['a', 'b', 0], ['a', 'b', '0'], 'a.b.0'); - testFn([1, 'a', 'b'], ['1', 'a', 'b'], '1.a.b'); - testFn(['a', 1, 'b'], ['a', '1', 'b'], 'a.1.b'); - testFn(['a', 'b', 1], ['a', 'b', '1'], 'a.b.1'); + test([0, 'a', 'b'], ['0', 'a', 'b'], '0.a.b'); + test(['a', 0, 'b'], ['a', '0', 'b'], 'a.0.b'); + test(['a', 'b', 0], ['a', 'b', '0'], 'a.b.0'); + test([1, 'a', 'b'], ['1', 'a', 'b'], '1.a.b'); + test(['a', 1, 'b'], ['a', '1', 'b'], 'a.1.b'); + test(['a', 'b', 1], ['a', 'b', '1'], 'a.b.1'); }); it('works with partials', () => { - testFn(['a', 'b.c.d'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); - testFn(['a.b', 'c.d'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); - testFn(['a.b.c', 'd'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); + test(['a', 'b.c.d'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); + test(['a.b', 'c.d'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); + test(['a.b.c', 'd'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); }); it('works with subscripts', () => { - testFn(['a["b"]'], ['a', 'b'], 'a.b'); - testFn(['a["b"].c'], ['a', 'b', 'c'], 'a.b.c'); - testFn(['a["b"].c["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); - testFn(['a["b"]["c.d"]'], ['a', 'b', '["c.d"]'], 'a.b["c.d"]'); - testFn(['a["b"]["c.d"].e'], ['a', 'b', '["c.d"]', 'e'], 'a.b["c.d"].e'); - testFn(['a["b"]["c.d"]["e"]'], ['a', 'b', '["c.d"]', 'e'], 'a.b["c.d"].e'); - testFn(['a["b"].["c.d"]'], ['a', 'b', '["c.d"]'], 'a.b["c.d"]'); - testFn(['a["b"].["c.d"].e'], ['a', 'b', '["c.d"]', 'e'], 'a.b["c.d"].e'); - testFn(['a["b"].["c.d"]["e"]'], ['a', 'b', '["c.d"]', 'e'], 'a.b["c.d"].e'); - - testFn(['["a"]'], ['a'], 'a'); - testFn(['["a"].b'], ['a', 'b'], 'a.b'); - testFn(['["a"]["b.c"]'], ['a', '["b.c"]'], 'a["b.c"]'); - testFn(['["a"]["b.c"].d'], ['a', '["b.c"]', 'd'], 'a["b.c"].d'); - testFn(['["a"]["b.c"]["d"]'], ['a', '["b.c"]', 'd'], 'a["b.c"].d'); - testFn(['["a"].["b.c"]'], ['a', '["b.c"]'], 'a["b.c"]'); - testFn(['["a"].["b.c"].d'], ['a', '["b.c"]', 'd'], 'a["b.c"].d'); - testFn(['["a"].["b.c"]["d"]'], ['a', '["b.c"]', 'd'], 'a["b.c"].d'); - - testFn(['[""]'], ['[""]'], '[""]'); - testFn(['["."]'], ['["."]'], '["."]'); - testFn(['[".."]'], ['[".."]'], '[".."]'); - testFn(['["..."]'], ['["..."]'], '["..."]'); - testFn(['["[\'\']"]'], ['["[\'\']"]'], '["[\'\']"]'); - testFn(['["[\\"\\"]"]'], ['["[\\"\\"]"]'], '["[\\"\\"]"]'); + test(['a["b"]'], ['a', 'b'], 'a.b'); + test(['a["b"].c'], ['a', 'b', 'c'], 'a.b.c'); + test(['a["b"].c["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); + test(['a["b"]["c.d"]'], ['a', 'b', '["c.d"]'], 'a.b["c.d"]'); + test(['a["b"]["c.d"].e'], ['a', 'b', '["c.d"]', 'e'], 'a.b["c.d"].e'); + test(['a["b"]["c.d"]["e"]'], ['a', 'b', '["c.d"]', 'e'], 'a.b["c.d"].e'); + test(['a["b"].["c.d"]'], ['a', 'b', '["c.d"]'], 'a.b["c.d"]'); + test(['a["b"].["c.d"].e'], ['a', 'b', '["c.d"]', 'e'], 'a.b["c.d"].e'); + test(['a["b"].["c.d"]["e"]'], ['a', 'b', '["c.d"]', 'e'], 'a.b["c.d"].e'); + + test(['["a"]'], ['a'], 'a'); + test(['["a"].b'], ['a', 'b'], 'a.b'); + test(['["a"]["b.c"]'], ['a', '["b.c"]'], 'a["b.c"]'); + test(['["a"]["b.c"].d'], ['a', '["b.c"]', 'd'], 'a["b.c"].d'); + test(['["a"]["b.c"]["d"]'], ['a', '["b.c"]', 'd'], 'a["b.c"].d'); + test(['["a"].["b.c"]'], ['a', '["b.c"]'], 'a["b.c"]'); + test(['["a"].["b.c"].d'], ['a', '["b.c"]', 'd'], 'a["b.c"].d'); + test(['["a"].["b.c"]["d"]'], ['a', '["b.c"]', 'd'], 'a["b.c"].d'); + + test(['[""]'], ['[""]'], '[""]'); + test(['["."]'], ['["."]'], '["."]'); + test(['[".."]'], ['[".."]'], '[".."]'); + test(['["..."]'], ['["..."]'], '["..."]'); + test(['["[\'\']"]'], ['["[\'\']"]'], '["[\'\']"]'); + test(['["[\\"\\"]"]'], ['["[\\"\\"]"]'], '["[\\"\\"]"]'); }); it('handles incorrect cases _somehow_', () => { // Boolean `true`. - testFn([true], ['true'], 'true'); - testFn([true, 'a'], ['true', 'a'], 'true.a'); - testFn(['a', true], ['a', 'true'], 'a.true'); + test([true], ['true'], 'true'); + test([true, 'a'], ['true', 'a'], 'true.a'); + test(['a', true], ['a', 'true'], 'a.true'); // Dots before subscripts. - testFn(['a["b"].c.["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); - testFn(['a.["b"].c["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); - testFn(['a.["b"].c.["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); + test(['a["b"].c.["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); + test(['a.["b"].c["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); + test(['a.["b"].c.["d"]'], ['a', 'b', 'c', 'd'], 'a.b.c.d'); // Only dots. - testFn(['.'], ['["."]'], '["."]'); - testFn(['..'], ['[".."]'], '[".."]'); - testFn(['...'], ['["..."]'], '["..."]'); + test(['.'], ['["."]'], '["."]'); + test(['..'], ['[".."]'], '[".."]'); + test(['...'], ['["..."]'], '["..."]'); // Leading and trailing dots. - testFn(['a.'], ['["a."]'], '["a."]'); - testFn(['.a'], ['[""]', 'a'], '[""].a'); - testFn(['["a"].'], ['a'], 'a'); - testFn(['.["a"]'], ['a'], 'a'); + test(['a.'], ['["a."]'], '["a."]'); + test(['.a'], ['[""]', 'a'], '[""].a'); + test(['["a"].'], ['a'], 'a'); + test(['.["a"]'], ['a'], 'a'); // Unescaped brackets. - testFn(['['], ['["["]'], '["["]'); - testFn(["['"], ['["[\'"]'], '["[\'"]'); - testFn(["[''"], ['["[\'\'"]'], '["[\'\'"]'); - testFn(["['']"], ['["[\'\']"]'], '["[\'\']"]'); - testFn(['["'], ['["[\\""]'], '["[\\""]'); - testFn(['[""'], ['["[\\"\\""]'], '["[\\"\\""]'); + test(['['], ['["["]'], '["["]'); + test(["['"], ['["[\'"]'], '["[\'"]'); + test(["[''"], ['["[\'\'"]'], '["[\'\'"]'); + test(["['']"], ['["[\'\']"]'], '["[\'\']"]'); + test(['["'], ['["[\\""]'], '["[\\""]'); + test(['[""'], ['["[\\"\\""]'], '["[\\"\\""]'); // Incorrect escape. - testFn(['["a\\"]'], ['["[\\"a\\\\"]"]'], '["[\\"a\\\\"]"]'); - testFn(['[\\""]'], ['["[\\\\"\\"]"]'], '["[\\\\"\\"]"]'); - testFn(['[\\"a"]'], ['["[\\\\"a\\"]"]'], '["[\\\\"a\\"]"]'); - testFn(['["\\"]'], ['["[\\"\\\\"]"]'], '["[\\"\\\\"]"]'); - testFn(['["\\"\\"]'], ['["[\\"\\\\"\\\\"]"]'], '["[\\"\\\\"\\\\"]"]'); + test(['["a\\"]'], ['["[\\"a\\\\"]"]'], '["[\\"a\\\\"]"]'); + test(['[\\""]'], ['["[\\\\"\\"]"]'], '["[\\\\"\\"]"]'); + test(['[\\"a"]'], ['["[\\\\"a\\"]"]'], '["[\\\\"a\\"]"]'); + test(['["\\"]'], ['["[\\"\\\\"]"]'], '["[\\"\\\\"]"]'); + test(['["\\"\\"]'], ['["[\\"\\\\"\\\\"]"]'], '["[\\"\\\\"\\\\"]"]'); }); }); From 3661997858e7d25b40287cc00e79e4d366ea51c0 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Fri, 2 Dec 2022 15:06:59 +0100 Subject: [PATCH 17/27] transfer const and mocks from global scope to describe --- packages/uniforms/__tests__/AutoForm.tsx | 46 ++++++++++++------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/uniforms/__tests__/AutoForm.tsx b/packages/uniforms/__tests__/AutoForm.tsx index f03c4b4ea..fff87c4a3 100644 --- a/packages/uniforms/__tests__/AutoForm.tsx +++ b/packages/uniforms/__tests__/AutoForm.tsx @@ -7,30 +7,30 @@ import { AutoFields } from 'uniforms-unstyled'; import { render } from '../__suites__'; -const schema = new SimpleSchema2Bridge( - new SimpleSchema({ - a: { type: String, defaultValue: '' }, - b: { type: String, defaultValue: '' }, - c: { type: String, defaultValue: '' }, - }), -); -const model = { a: '1' }; -const onChange = jest.fn(); -const onChangeModel = jest.fn(); -const onSubmit = jest.fn(); -const validator = jest.fn(); -const mockContext = jest.fn(); - -jest.spyOn(schema.schema, 'validator').mockImplementation(() => validator); - -beforeEach(() => { - onChange.mockClear(); - onChangeModel.mockClear(); - onSubmit.mockClear(); - validator.mockClear(); -}); - describe('', () => { + const schema = new SimpleSchema2Bridge( + new SimpleSchema({ + a: { type: String, defaultValue: '' }, + b: { type: String, defaultValue: '' }, + c: { type: String, defaultValue: '' }, + }), + ); + const model = { a: '1' }; + const onChange = jest.fn(); + const onChangeModel = jest.fn(); + const onSubmit = jest.fn(); + const validator = jest.fn(); + const mockContext = jest.fn(); + + jest.spyOn(schema.schema, 'validator').mockImplementation(() => validator); + + beforeEach(() => { + onChange.mockClear(); + onChangeModel.mockClear(); + onSubmit.mockClear(); + validator.mockClear(); + }); + describe('when changes', () => { it('updates', () => { render( From af0ef2357a319b25f634408563a3d2025cac9cb6 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Wed, 15 Feb 2023 11:45:50 +0100 Subject: [PATCH 18/27] fix typing for render fn and fix context mocking in validateForm and AutoForm --- packages/uniforms/__suites__/render.tsx | 16 +- packages/uniforms/__tests__/AutoForm.tsx | 113 ++++++----- packages/uniforms/__tests__/ValidatedForm.tsx | 176 +++++++++--------- 3 files changed, 146 insertions(+), 159 deletions(-) diff --git a/packages/uniforms/__suites__/render.tsx b/packages/uniforms/__suites__/render.tsx index 52bf064d8..83eb1a4b4 100644 --- a/packages/uniforms/__suites__/render.tsx +++ b/packages/uniforms/__suites__/render.tsx @@ -6,14 +6,12 @@ import { SimpleSchema2Bridge } from 'uniforms-bridge-simple-schema-2'; const randomId = randomIds(); -export function render( - element: ReactElement, +export function render

( + element: ReactElement

, schema: SimpleSchemaDefinition, contextValueExtension?: Partial>, initialModel?: object, -): RenderResult & { - rerenderWithProps: (props: Record) => void; -} { +): RenderResult & { rerenderWithProps: (props: P) => void } { const contextValue = { changed: false, changedMap: {}, @@ -39,7 +37,7 @@ export function render( formRef: {} as BaseForm, }; - const originalRender = renderOnScreen(element, { + const renderResult = renderOnScreen(element, { wrapper({ children }) { return ( {children} @@ -47,11 +45,11 @@ export function render( }, }); - const { rerender } = originalRender; + const { rerender } = renderResult; - const rerenderWithProps = (props: Record) => { + const rerenderWithProps = (props: P) => { rerender(cloneElement(element, props)); }; - return { rerenderWithProps, ...originalRender }; + return { rerenderWithProps, ...renderResult }; } diff --git a/packages/uniforms/__tests__/AutoForm.tsx b/packages/uniforms/__tests__/AutoForm.tsx index fff87c4a3..24319db4a 100644 --- a/packages/uniforms/__tests__/AutoForm.tsx +++ b/packages/uniforms/__tests__/AutoForm.tsx @@ -1,13 +1,19 @@ import { fireEvent, screen } from '@testing-library/react'; -import React from 'react'; +import React, { ReactNode } from 'react'; import SimpleSchema from 'simpl-schema'; -import { AutoForm, connectField, context } from 'uniforms'; +import { AutoForm, connectField, Context, context } from 'uniforms'; import { SimpleSchema2Bridge } from 'uniforms-bridge-simple-schema-2'; import { AutoFields } from 'uniforms-unstyled'; import { render } from '../__suites__'; describe('', () => { + const onChange = jest.fn(); + const onChangeModel = jest.fn(); + const onSubmit = jest.fn(); + const validator = jest.fn(); + const contextSpy = jest.fn | null]>(); + const model = { a: '1' }; const schema = new SimpleSchema2Bridge( new SimpleSchema({ a: { type: String, defaultValue: '' }, @@ -15,23 +21,12 @@ describe('', () => { c: { type: String, defaultValue: '' }, }), ); - const model = { a: '1' }; - const onChange = jest.fn(); - const onChangeModel = jest.fn(); - const onSubmit = jest.fn(); - const validator = jest.fn(); - const mockContext = jest.fn(); jest.spyOn(schema.schema, 'validator').mockImplementation(() => validator); - beforeEach(() => { - onChange.mockClear(); - onChangeModel.mockClear(); - onSubmit.mockClear(); - validator.mockClear(); - }); + beforeEach(() => jest.clearAllMocks()); - describe('when changes', () => { + describe('when changed', () => { it('updates', () => { render( , @@ -43,8 +38,7 @@ describe('', () => { // FIXME: AutoForm is not a valid Component. render( @@ -72,8 +66,7 @@ describe('', () => { // FIXME: AutoForm is not a valid Component. render( ', () => { // FIXME: AutoForm is not a valid Component. render( - - {context => mockContext(context?.changed, context?.changedMap)} - + , { @@ -101,11 +92,12 @@ describe('', () => { }, ); - expect(mockContext).toHaveBeenLastCalledWith(true, { - a: {}, - b: {}, - c: {}, - }); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ + changed: true, + changedMap: { a: {}, b: {}, c: {} }, + }), + ); }); }); describe('when render', () => { @@ -166,57 +158,62 @@ describe('', () => { describe('when reset', () => { it('reset `model`', () => { - const { rerenderWithProps } = render( + const Component = () => ( // FIXME: AutoForm is not a valid Component. - - {context => mockContext(context?.model)} - - , - { - schema: { type: SimpleSchema2Bridge }, - }, + + ); + const { rerender } = render(, { + schema: { type: SimpleSchema2Bridge }, + }); - rerenderWithProps({}); + rerender(); - expect(mockContext).toHaveBeenLastCalledWith(model); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ model }), + ); }); it('resets state `changedMap`', () => { - const { rerenderWithProps } = render( + const Component = () => ( // FIXME: AutoForm is not a valid Component. - - {context => mockContext(context?.changedMap)} - - , - { - schema: { type: SimpleSchema2Bridge }, - }, + + ); - rerenderWithProps({}); + const { rerender } = render(, { + schema: { type: SimpleSchema2Bridge }, + }); + + rerender(); - expect(mockContext).toHaveBeenLastCalledWith({}); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ changedMap: {} }), + ); }); it('resets state `changed`', () => { - const { rerenderWithProps } = render( + const Component = () => ( // FIXME: AutoForm is not a valid Component. - - {context => mockContext(context?.changed)} - - , + + + ); + const { rerender } = render( + // FIXME: AutoForm is not a valid Component. + , { schema: { type: SimpleSchema2Bridge }, }, ); - rerenderWithProps({}); + rerender(); - expect(mockContext).toHaveBeenLastCalledWith(false); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ changed: false }), + ); }); }); describe('when update', () => { @@ -224,16 +221,16 @@ describe('', () => { // FIXME: AutoForm is not a valid Component. render( - - {context => mockContext(context?.model)} - + , { schema: { type: SimpleSchema2Bridge }, }, ); - expect(mockContext).toHaveBeenLastCalledWith({}); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ model: {} }), + ); }); it(', validates', () => { diff --git a/packages/uniforms/__tests__/ValidatedForm.tsx b/packages/uniforms/__tests__/ValidatedForm.tsx index 5eb1c5034..050eb433e 100644 --- a/packages/uniforms/__tests__/ValidatedForm.tsx +++ b/packages/uniforms/__tests__/ValidatedForm.tsx @@ -1,7 +1,7 @@ import { fireEvent, screen } from '@testing-library/react'; -import React from 'react'; +import React, { ReactNode } from 'react'; import SimpleSchema from 'simpl-schema'; -import { ValidatedForm, context, useForm } from 'uniforms'; +import { ValidatedForm, context, Context, useForm } from 'uniforms'; import { SimpleSchema2Bridge } from 'uniforms-bridge-simple-schema-2'; import { AutoField } from 'uniforms-unstyled'; @@ -13,7 +13,7 @@ describe('ValidatedForm', () => { const onValidate = jest.fn((model, error) => error); const validator = jest.fn(); const validatorForSchema = jest.fn(() => validator); - const mockContext = jest.fn(); + const contextSpy = jest.fn | null]>(); const error = new Error('test error message'); const model = { a: 1 }; @@ -34,8 +34,7 @@ describe('ValidatedForm', () => { it('validates (when `.validate` is called)', () => { render( { it('correctly calls `validator`', () => { render( { it('updates error state with errors from `validator`', async () => { render( { it('correctly calls `onValidate` when validation succeeds', () => { render( { it('correctly calls `onValidate` when validation fails ', () => { render( { it('updates error state with async errors from `onValidate`', async () => { render( - - {context => mockContext(context?.error)} - + , { schema: { type: SimpleSchema2Bridge }, @@ -174,23 +166,21 @@ describe('ValidatedForm', () => { onValidate.mockImplementationOnce(() => error); fireEvent.submit(form); - - expect(mockContext).toHaveBeenLastCalledWith(error); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ error }), + ); }); it('leaves error state alone when `onValidate` suppress `validator` errors', async () => { render( - - {context => mockContext(context?.error)} - + , { schema: { type: SimpleSchema2Bridge }, @@ -206,7 +196,9 @@ describe('ValidatedForm', () => { expect(validator).toHaveBeenCalled(); expect(onValidate).toHaveBeenCalled(); - expect(mockContext).toHaveBeenLastCalledWith(null); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ error: null }), + ); }); it('has `validating` context variable, default `false`', () => { render( @@ -216,16 +208,16 @@ describe('ValidatedForm', () => { onValidate={onValidate} validator={validator} > - - {context => mockContext(context?.validating)} - + , { schema: { type: SimpleSchema2Bridge }, }, ); - expect(mockContext).toHaveBeenCalledWith(false); + expect(contextSpy).toHaveBeenCalledWith( + expect.objectContaining({ validating: false }), + ); }); it('uses `modelTransform`s `validate` mode', () => { @@ -234,8 +226,7 @@ describe('ValidatedForm', () => { mode === 'validate' ? transformedModel : model; render( { render( // FIXME: ValidatedForm is not a valid Component. { render( // FIXME: ValidatedForm is not a valid Component. { render( // FIXME: ValidatedForm is not a valid Component. - - {context => mockContext(context?.submitted)} - + , { schema: { type: SimpleSchema2Bridge }, @@ -328,28 +314,29 @@ describe('ValidatedForm', () => { ); const form = screen.getByRole('form'); - expect(mockContext).toHaveBeenLastCalledWith(false); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ submitted: false }), + ); fireEvent.submit(form); - expect(mockContext).toHaveBeenLastCalledWith(true); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ submitted: true }), + ); }); it('sets submitted to true, when form is submitted and validation fails', () => { render( // FIXME: ValidatedForm is not a valid Component. - - {context => mockContext(context?.submitted)} - + , { schema: { type: SimpleSchema2Bridge }, @@ -362,28 +349,29 @@ describe('ValidatedForm', () => { const form = screen.getByRole('form'); - expect(mockContext).toHaveBeenLastCalledWith(false); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ submitted: false }), + ); fireEvent.submit(form); - expect(mockContext).toHaveBeenLastCalledWith(true); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ submitted: true }), + ); }); it('updates error state with async errors from `onSubmit`', async () => { render( // FIXME: ValidatedForm is not a valid Component. - - {context => mockContext(context?.error)} - + , { schema: { type: SimpleSchema2Bridge }, @@ -397,15 +385,16 @@ describe('ValidatedForm', () => { await new Promise(resolve => process.nextTick(resolve)); expect(onSubmit).toHaveBeenCalled(); - expect(mockContext).toHaveBeenLastCalledWith(error); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ error }), + ); }); it('works if unmounts on submit', async () => { const { unmount } = render( // FIXME: ValidatedForm is not a valid Component. { render( // FIXME: ValidatedForm is not a valid Component. { render( // FIXME: ValidatedForm is not a valid Component. - // TODO: delete ts-expect-error error if this issue is resolved https://github.com/vazco/uniforms/issues/1165 - - {context => mockContext(context?.error)} - + , { @@ -557,11 +542,15 @@ describe('ValidatedForm', () => { fireEvent.submit(form); await new Promise(resolve => process.nextTick(resolve)); - expect(mockContext).toHaveBeenLastCalledWith(error); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ error }), + ); fireEvent.click(resetButton); await new Promise(resolve => process.nextTick(resolve)); - expect(mockContext).toHaveBeenLastCalledWith(null); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ error: null }), + ); }); }); @@ -649,8 +638,7 @@ describe('ValidatedForm', () => { render( // FIXME: ValidatedForm is not a valid Component. { const { rerenderWithProps } = render( // FIXME: ValidatedForm is not a valid Component. { it.each(cases.map(flatPair4))('works for %p/%p/%p/%p', async (...modes) => { const [hasError, validatorMode, onValidateMode, onSubmitMode] = modes; - const mockContextError = jest.fn(); - const mockContextSubmitting = jest.fn(); - render( // FIXME: ValidatedForm is not a valid Component. - - {context => { - mockContext(context?.validating); - mockContextError(context?.error); - mockContextSubmitting(context?.submitting); - return null; - }} - + , { schema: { type: SimpleSchema2Bridge } }, ); @@ -833,9 +809,13 @@ describe('ValidatedForm', () => { expect(validator).toHaveBeenCalledTimes(run); if (asyncValidation) { - expect(mockContext).toHaveBeenLastCalledWith(true); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ validating: true }), + ); await new Promise(resolve => process.nextTick(resolve)); - expect(mockContext).toHaveBeenLastCalledWith(false); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ validating: false }), + ); } await new Promise(resolve => process.nextTick(resolve)); @@ -844,24 +824,36 @@ describe('ValidatedForm', () => { if (hasValidationError) { expect(onSubmit).not.toHaveBeenCalled(); - expect(mockContextError).toHaveBeenLastCalledWith(error); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ error }), + ); } else { expect(onSubmit).toHaveBeenCalledTimes(run); - expect(mockContextError).toHaveBeenLastCalledWith(null); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ error: null }), + ); if (asyncSubmission) { - expect(mockContextSubmitting).toHaveBeenLastCalledWith(true); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ submitting: true }), + ); await new Promise(resolve => setTimeout(resolve)); - expect(mockContextSubmitting).toHaveBeenLastCalledWith(false); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ submitting: false }), + ); } } await new Promise(resolve => setTimeout(resolve)); if (hasSubmissionError) { - expect(mockContextError).toHaveBeenLastCalledWith(error); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ error }), + ); } else { - expect(mockContextError).toHaveBeenLastCalledWith(null); + expect(contextSpy).toHaveBeenLastCalledWith( + expect.objectContaining({ error: null }), + ); } } }); From ceae67668778d2d23acb5a9926ace04380c5fdbd Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Wed, 15 Feb 2023 11:56:17 +0100 Subject: [PATCH 19/27] add expect in first AutoForm test --- packages/uniforms/__tests__/AutoForm.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/uniforms/__tests__/AutoForm.tsx b/packages/uniforms/__tests__/AutoForm.tsx index 24319db4a..5beccfed3 100644 --- a/packages/uniforms/__tests__/AutoForm.tsx +++ b/packages/uniforms/__tests__/AutoForm.tsx @@ -29,10 +29,16 @@ describe('', () => { describe('when changed', () => { it('updates', () => { render( - , + + + , { schema: { type: SimpleSchema2Bridge } }, { onChange }, ); + const input = screen.getByLabelText('A'); + fireEvent.change(input, { target: { value: '2' } }); + expect(onChange).toHaveBeenCalledTimes(4); + expect(onChange).toHaveBeenLastCalledWith('a', '2'); }); it('validates', () => { // FIXME: AutoForm is not a valid Component. From 91bcd675a633f8e161310ce617103021e4a3ad13 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Fri, 17 Feb 2023 14:08:23 +0100 Subject: [PATCH 20/27] add proper typing to useField --- packages/uniforms/__tests__/useField.tsx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/uniforms/__tests__/useField.tsx b/packages/uniforms/__tests__/useField.tsx index 5e6fe448c..8841fd7bb 100644 --- a/packages/uniforms/__tests__/useField.tsx +++ b/packages/uniforms/__tests__/useField.tsx @@ -27,23 +27,23 @@ function Test(rawProps: { return <>{props.children}; } -const TestComponent = connectField((props: Record) => { - return ( - { - props.onChange(event.target.value); - }} - /> - ); -}); - describe('useField', () => { it('is a function', () => { expect(useField).toBeInstanceOf(Function); }); describe('when called with initialValue', () => { + type Props = { onChange: (value?: string) => void; value?: string }; + const TestComponent = connectField((props: Props) => { + return ( + { + props.onChange(event.target.value); + }} + /> + ); + }); it('applies default value', () => { render( From 442b18db9e4b1285e02447d7f45b9eb8c68ca210 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Fri, 17 Feb 2023 14:46:16 +0100 Subject: [PATCH 21/27] change schema passing to render function --- packages/uniforms/__suites__/ListField.tsx | 10 +- packages/uniforms/__suites__/TextField.tsx | 32 ++--- packages/uniforms/__suites__/render.tsx | 60 ++++----- packages/uniforms/__tests__/AutoForm.tsx | 47 ++----- packages/uniforms/__tests__/ValidatedForm.tsx | 119 ++++-------------- packages/uniforms/__tests__/useField.tsx | 5 - 6 files changed, 79 insertions(+), 194 deletions(-) diff --git a/packages/uniforms/__suites__/ListField.tsx b/packages/uniforms/__suites__/ListField.tsx index 3aec9c993..d62199506 100644 --- a/packages/uniforms/__suites__/ListField.tsx +++ b/packages/uniforms/__suites__/ListField.tsx @@ -11,19 +11,13 @@ export function testListField( }: { addFieldLocator: () => HTMLElement | null | undefined }, ) { test(' - renders ListAddField', () => { - render(, { - x: Array, - 'x.$': String, - }); + render(); expect(screen.getByRole('button')).toBeInTheDocument(); }); test(' - renders correct label (specified)', () => { - render(, { - x: Array, - 'x.$': String, - }); + render(); // Throws error with no form control found when getting by label expect(screen.getByText(/ListFieldLabel.*/)).toBeInTheDocument(); diff --git a/packages/uniforms/__suites__/TextField.tsx b/packages/uniforms/__suites__/TextField.tsx index 8ab4dc33a..52e4c91cc 100644 --- a/packages/uniforms/__suites__/TextField.tsx +++ b/packages/uniforms/__suites__/TextField.tsx @@ -6,50 +6,46 @@ import { render } from './render'; export function testTextField(TextField: ComponentType) { test(' - renders an input with correct disabled state', () => { - render(, { x: String }); + render(); expect(screen.getByRole('textbox')).toBeDisabled(); }); test(' - renders an input with correct readOnly state', () => { - render(, { x: String }); + render(); expect(screen.getByRole('textbox')).toHaveAttribute('readonly', ''); }); test(' - renders an input with autocomplete turned off', () => { - render(, { - x: String, - }); + render(); expect(screen.getByRole('textbox')).toHaveAttribute('autocomplete', 'off'); }); test(' - renders an input with correct id (inherited)', () => { - render(, { x: String }); + render(); expect(screen.getByRole('textbox')).toHaveAttribute('id'); }); test(' - renders an input with correct id (specified)', () => { const id = 'y'; - render(, { x: String }); + render(); expect(screen.getByRole('textbox')).toHaveAttribute('id', id); }); test(' - renders an input with correct name', () => { const name = 'x'; - render(, { x: String }); + render(); expect(screen.getByRole('textbox')).toHaveAttribute('name', name); }); test(' - renders an input with correct placeholder', () => { const placeholder = 'y'; - render(, { - x: String, - }); + render(); expect(screen.getByRole('textbox')).toHaveAttribute( 'placeholder', @@ -58,30 +54,26 @@ export function testTextField(TextField: ComponentType) { }); test(' - renders an input with correct type', () => { - render(, { x: String }); + render(); expect(screen.getByRole('textbox')).toHaveAttribute('type', 'text'); }); test(' - renders an input with correct type (url)', () => { - render(, { x: String }); + render(); expect(screen.getByRole('textbox')).toHaveAttribute('type', 'url'); }); test(' - renders an input with correct value (default)', () => { - render(, { x: String }); + render(); expect(screen.getByRole('textbox')).toHaveValue(''); }); test(' - renders an input with correct value (model)', () => { const defaultValue = 'y'; - render( - , - { x: String }, - { model: { x: defaultValue } }, - ); + render(, {}, { model: { x: defaultValue } }); expect(screen.getByRole('textbox')).toHaveValue(defaultValue); }); @@ -121,7 +113,7 @@ export function testTextField(TextField: ComponentType) { }); test(' - renders a label', () => { - render(, { x: String }); + render(); expect(screen.getByLabelText(/y.*/)).toBeInTheDocument(); }); diff --git a/packages/uniforms/__suites__/render.tsx b/packages/uniforms/__suites__/render.tsx index 83eb1a4b4..24c28afaa 100644 --- a/packages/uniforms/__suites__/render.tsx +++ b/packages/uniforms/__suites__/render.tsx @@ -8,40 +8,42 @@ const randomId = randomIds(); export function render

( element: ReactElement

, - schema: SimpleSchemaDefinition, + schema?: SimpleSchemaDefinition, contextValueExtension?: Partial>, initialModel?: object, ): RenderResult & { rerenderWithProps: (props: P) => void } { - const contextValue = { - changed: false, - changedMap: {}, - error: null, - model: initialModel ?? {}, - name: [], - onChange() {}, - onSubmit() {}, - randomId, - submitted: false, - submitting: false, - validating: false, - ...contextValueExtension, - schema: new SimpleSchema2Bridge(new SimpleSchema(schema)), - state: { - disabled: false, - label: false, - placeholder: false, - readOnly: false, - showInlineError: false, - ...contextValueExtension?.state, - }, - formRef: {} as BaseForm, - }; - const renderResult = renderOnScreen(element, { wrapper({ children }) { - return ( - {children} - ); + if (schema) { + const contextValue = { + changed: false, + changedMap: {}, + error: null, + model: initialModel ?? {}, + name: [], + onChange() {}, + onSubmit() {}, + randomId, + submitted: false, + submitting: false, + validating: false, + ...contextValueExtension, + schema: new SimpleSchema2Bridge(new SimpleSchema(schema)), + state: { + disabled: false, + label: false, + placeholder: false, + readOnly: false, + showInlineError: false, + ...contextValueExtension?.state, + }, + formRef: {} as BaseForm, + }; + return ( + {children} + ); + } + return <>{children}; }, }); diff --git a/packages/uniforms/__tests__/AutoForm.tsx b/packages/uniforms/__tests__/AutoForm.tsx index 5beccfed3..1b8fd22ef 100644 --- a/packages/uniforms/__tests__/AutoForm.tsx +++ b/packages/uniforms/__tests__/AutoForm.tsx @@ -14,13 +14,12 @@ describe('', () => { const validator = jest.fn(); const contextSpy = jest.fn | null]>(); const model = { a: '1' }; - const schema = new SimpleSchema2Bridge( - new SimpleSchema({ - a: { type: String, defaultValue: '' }, - b: { type: String, defaultValue: '' }, - c: { type: String, defaultValue: '' }, - }), - ); + const schemaValues = { + a: { type: String, defaultValue: '' }, + b: { type: String, defaultValue: '' }, + c: { type: String, defaultValue: '' }, + }; + const schema = new SimpleSchema2Bridge(new SimpleSchema(schemaValues)); jest.spyOn(schema.schema, 'validator').mockImplementation(() => validator); @@ -32,7 +31,7 @@ describe('', () => { , - { schema: { type: SimpleSchema2Bridge } }, + schemaValues, { onChange }, ); const input = screen.getByLabelText('A'); @@ -50,9 +49,6 @@ describe('', () => { > , - { - schema: { type: SimpleSchema2Bridge }, - }, ); const form = screen.getByRole('form'); @@ -77,7 +73,6 @@ describe('', () => { onChange={onChangeModel} schema={schema} />, - { schema: { type: SimpleSchema2Bridge } }, ); const form = screen.getByRole('form'); @@ -93,9 +88,7 @@ describe('', () => { , - { - schema: { type: SimpleSchema2Bridge }, - }, + schemaValues, ); expect(contextSpy).toHaveBeenLastCalledWith( @@ -127,7 +120,6 @@ describe('', () => { autoField={Field} model={model} />, - { schema: { type: SimpleSchema2Bridge } }, ); expect(onChange).toHaveBeenCalledTimes(2); @@ -140,9 +132,6 @@ describe('', () => { , - { - schema: { type: SimpleSchema2Bridge }, - }, ); expect(onSubmit).not.toBeCalled(); @@ -170,9 +159,7 @@ describe('', () => { ); - const { rerender } = render(, { - schema: { type: SimpleSchema2Bridge }, - }); + const { rerender } = render(, schemaValues); rerender(); @@ -189,9 +176,7 @@ describe('', () => { ); - const { rerender } = render(, { - schema: { type: SimpleSchema2Bridge }, - }); + const { rerender } = render(, schemaValues); rerender(); @@ -210,9 +195,7 @@ describe('', () => { const { rerender } = render( // FIXME: AutoForm is not a valid Component. , - { - schema: { type: SimpleSchema2Bridge }, - }, + schemaValues, ); rerender(); @@ -229,9 +212,7 @@ describe('', () => { , - { - schema: { type: SimpleSchema2Bridge }, - }, + schemaValues, ); expect(contextSpy).toHaveBeenLastCalledWith( @@ -241,9 +222,7 @@ describe('', () => { it(', validates', () => { // FIXME: AutoForm is not a valid Component. - const { rerenderWithProps } = render(, { - schema: { type: SimpleSchema2Bridge }, - }); + const { rerenderWithProps } = render(); rerenderWithProps({ model, validate: 'onChange' }); expect(validator).toHaveBeenCalledTimes(1); diff --git a/packages/uniforms/__tests__/ValidatedForm.tsx b/packages/uniforms/__tests__/ValidatedForm.tsx index 050eb433e..1838ef4b8 100644 --- a/packages/uniforms/__tests__/ValidatedForm.tsx +++ b/packages/uniforms/__tests__/ValidatedForm.tsx @@ -17,13 +17,12 @@ describe('ValidatedForm', () => { const error = new Error('test error message'); const model = { a: 1 }; - const schema = new SimpleSchema2Bridge( - new SimpleSchema({ - a: { type: String, defaultValue: '' }, - b: { type: String, defaultValue: '' }, - c: { type: String, defaultValue: '' }, - }), - ); + const schemaValues = { + a: { type: String, defaultValue: '' }, + b: { type: String, defaultValue: '' }, + c: { type: String, defaultValue: '' }, + }; + const schema = new SimpleSchema2Bridge(new SimpleSchema(schemaValues)); jest.spyOn(schema.schema, 'validator').mockImplementation(validatorForSchema); beforeEach(() => jest.clearAllMocks()); @@ -41,9 +40,6 @@ describe('ValidatedForm', () => { onValidate={onValidate} validator={validator} />, - { - schema: { type: SimpleSchema2Bridge }, - }, ); const form = screen.getByRole('form'); fireEvent.submit(form); @@ -61,9 +57,6 @@ describe('ValidatedForm', () => { validator={validator} data-testid="validateForm" />, - { - schema: { type: SimpleSchema2Bridge }, - }, ); const form = screen.getByRole('form'); fireEvent.submit(form); @@ -81,9 +74,6 @@ describe('ValidatedForm', () => { validator={validator} data-testid="validateForm" />, - { - schema: { type: SimpleSchema2Bridge }, - }, ); const form = screen.getByRole('form'); @@ -107,9 +97,6 @@ describe('ValidatedForm', () => { onValidate={onValidate} validator={validator} />, - { - schema: { type: SimpleSchema2Bridge }, - }, ); const form = screen.getByRole('form'); @@ -129,9 +116,6 @@ describe('ValidatedForm', () => { validator={validator} data-testid="validateForm" />, - { - schema: { type: SimpleSchema2Bridge }, - }, ); const form = screen.getByRole('form'); @@ -157,9 +141,7 @@ describe('ValidatedForm', () => { > , - { - schema: { type: SimpleSchema2Bridge }, - }, + schemaValues, ); const form = screen.getByRole('form'); @@ -182,9 +164,7 @@ describe('ValidatedForm', () => { > , - { - schema: { type: SimpleSchema2Bridge }, - }, + schemaValues, ); const form = screen.getByRole('form'); @@ -210,9 +190,7 @@ describe('ValidatedForm', () => { > , - { - schema: { type: SimpleSchema2Bridge }, - }, + schemaValues, ); expect(contextSpy).toHaveBeenCalledWith( @@ -233,9 +211,6 @@ describe('ValidatedForm', () => { onValidate={onValidate} modelTransform={modelTransform} />, - { - schema: { type: SimpleSchema2Bridge }, - }, ); const form = screen.getByRole('form'); fireEvent.submit(form); @@ -256,9 +231,6 @@ describe('ValidatedForm', () => { onValidate={onValidate} onSubmit={onSubmit} />, - { - schema: { type: SimpleSchema2Bridge }, - }, ); const form = screen.getByRole('form'); @@ -279,9 +251,6 @@ describe('ValidatedForm', () => { onValidate={onValidate} onSubmit={onSubmit} />, - { - schema: { type: SimpleSchema2Bridge }, - }, ); validator.mockImplementationOnce(() => { @@ -308,9 +277,7 @@ describe('ValidatedForm', () => { > , - { - schema: { type: SimpleSchema2Bridge }, - }, + schemaValues, ); const form = screen.getByRole('form'); @@ -338,9 +305,7 @@ describe('ValidatedForm', () => { > , - { - schema: { type: SimpleSchema2Bridge }, - }, + schemaValues, ); validator.mockImplementationOnce(() => { @@ -373,9 +338,7 @@ describe('ValidatedForm', () => { > , - { - schema: { type: SimpleSchema2Bridge }, - }, + schemaValues, ); onSubmit.mockImplementationOnce(() => Promise.reject(error)); @@ -401,9 +364,6 @@ describe('ValidatedForm', () => { onValidate={onValidate} onSubmit={onSubmit} />, - { - schema: { type: SimpleSchema2Bridge }, - }, ); const form = screen.getByRole('form'); onSubmit.mockImplementationOnce(() => unmount()); @@ -425,9 +385,6 @@ describe('ValidatedForm', () => { > , - { - schema: { type: SimpleSchema2Bridge }, - }, ); const input = screen.getByLabelText('A'); fireEvent.change(input, { target: { value: 'test' } }); @@ -442,9 +399,6 @@ describe('ValidatedForm', () => { , - { - schema: { type: SimpleSchema2Bridge }, - }, ); const input = screen.getByLabelText('A'); fireEvent.change(input, { target: { value: 'test' } }); @@ -464,9 +418,6 @@ describe('ValidatedForm', () => { > , - { - schema: { type: SimpleSchema2Bridge }, - }, ); const input = screen.getByLabelText('A'); fireEvent.change(input, { target: { value: 'test' } }); @@ -486,9 +437,6 @@ describe('ValidatedForm', () => { > , - { - schema: { type: SimpleSchema2Bridge }, - }, ); const form = screen.getByRole('form'); @@ -528,9 +476,7 @@ describe('ValidatedForm', () => { , - { - schema: { type: SimpleSchema2Bridge }, - }, + schemaValues, ); validator.mockImplementationOnce(() => { throw error; @@ -568,34 +514,26 @@ describe('ValidatedForm', () => { ); it('does not revalidate arbitrarily', () => { - const { rerenderWithProps } = render(, { - schema: { type: SimpleSchema2Bridge }, - }); + const { rerenderWithProps } = render(); rerenderWithProps({ anything: 'anything' }); expect(validator).not.toBeCalled(); }); it('revalidates if `model` changes', () => { - const { rerenderWithProps } = render(, { - schema: { type: SimpleSchema2Bridge }, - }); + const { rerenderWithProps } = render(); rerenderWithProps({ model: anotherModel }); expect(validator).toHaveBeenCalledTimes(1); }); it('revalidates if `validator` changes', () => { - const { rerenderWithProps } = render(, { - schema: { type: SimpleSchema2Bridge }, - }); + const { rerenderWithProps } = render(); rerenderWithProps({ validator: {} }); expect(validator).toHaveBeenCalledTimes(1); }); it('revalidate if `schema` changes', () => { const anotherSchema = new SimpleSchema2Bridge(schema.schema); - const { rerenderWithProps } = render(, { - schema: { type: SimpleSchema2Bridge }, - }); + const { rerenderWithProps } = render(); rerenderWithProps({ schema: anotherSchema }); expect(validator).toHaveBeenCalledTimes(1); }); @@ -608,26 +546,20 @@ describe('ValidatedForm', () => { ); it('does not revalidate when `model` changes', () => { - const { rerenderWithProps } = render(, { - schema: { type: SimpleSchema2Bridge }, - }); + const { rerenderWithProps } = render(, schemaValues); rerenderWithProps({ model: {} }); expect(validator).not.toBeCalled(); }); it('does not revalidate when validator `options` change', () => { - const { rerenderWithProps } = render(, { - schema: { type: SimpleSchema2Bridge }, - }); + const { rerenderWithProps } = render(, schemaValues); rerenderWithProps({ validator: {} }); expect(validator).not.toBeCalled(); }); it('does not revalidate when `schema` changes', () => { const anotherSchema = new SimpleSchema2Bridge(schema.schema); - const { rerenderWithProps } = render(, { - schema: { type: SimpleSchema2Bridge }, - }); + const { rerenderWithProps } = render(, schemaValues); rerenderWithProps({ schema: anotherSchema }); expect(validator).not.toBeCalled(); }); @@ -645,9 +577,6 @@ describe('ValidatedForm', () => { > , - { - schema: { type: SimpleSchema2Bridge }, - }, ); ['1', '2', '3'].forEach(value => { const form = screen.getByRole('form'); @@ -665,9 +594,6 @@ describe('ValidatedForm', () => { const { rerenderWithProps } = render( // FIXME: ValidatedForm is not a valid Component. , - { - schema: { type: SimpleSchema2Bridge }, - }, ); rerenderWithProps({ validator: validatorA }); @@ -699,9 +625,6 @@ describe('ValidatedForm', () => { > , - { - schema: { type: SimpleSchema2Bridge }, - }, ); rerenderWithProps({ @@ -785,7 +708,7 @@ describe('ValidatedForm', () => { > , - { schema: { type: SimpleSchema2Bridge } }, + schemaValues, ); const asyncSubmission = onSubmitMode.includes('async'); diff --git a/packages/uniforms/__tests__/useField.tsx b/packages/uniforms/__tests__/useField.tsx index 8841fd7bb..8d4a3f826 100644 --- a/packages/uniforms/__tests__/useField.tsx +++ b/packages/uniforms/__tests__/useField.tsx @@ -2,7 +2,6 @@ import { fireEvent, screen } from '@testing-library/react'; import React, { ReactNode } from 'react'; import { AutoForm, BaseForm, connectField, useField } from 'uniforms'; import { JSONSchemaBridge } from 'uniforms-bridge-json-schema'; -import { SimpleSchema2Bridge } from 'uniforms-bridge-simple-schema-2'; import { render } from '../__suites__'; @@ -49,7 +48,6 @@ describe('useField', () => { , - { schema: { type: SimpleSchema2Bridge } }, ); const input = screen.getByRole('textbox'); @@ -61,7 +59,6 @@ describe('useField', () => { , - { schema: { type: SimpleSchema2Bridge } }, ); const input = getByRole('textbox'); @@ -80,7 +77,6 @@ describe('useField', () => { , - { schema: { type: SimpleSchema2Bridge } }, ); }); @@ -93,7 +89,6 @@ describe('useField', () => { , - { schema: { type: SimpleSchema2Bridge } }, ); }); }); From 27ef2a5fa2a198fa04832a387e374125977d76a5 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Fri, 17 Feb 2023 14:52:18 +0100 Subject: [PATCH 22/27] fix naming convention in useFields --- packages/uniforms/__tests__/useField.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/uniforms/__tests__/useField.tsx b/packages/uniforms/__tests__/useField.tsx index 8d4a3f826..6c467beba 100644 --- a/packages/uniforms/__tests__/useField.tsx +++ b/packages/uniforms/__tests__/useField.tsx @@ -55,13 +55,13 @@ describe('useField', () => { }); it('does not apply default value after first change', () => { - const { getByRole } = render( + render( , ); - const input = getByRole('textbox'); + const input = screen.getByRole('textbox'); fireEvent.change(input, { target: { value: null } }); From 24e9af271971ce5b0fe85b2e319e8ade6541673f Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Fri, 17 Feb 2023 15:14:25 +0100 Subject: [PATCH 23/27] fix ListField and TextField tests --- packages/uniforms/__suites__/ListField.tsx | 10 ++++++-- packages/uniforms/__suites__/TextField.tsx | 28 ++++++++++++---------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/packages/uniforms/__suites__/ListField.tsx b/packages/uniforms/__suites__/ListField.tsx index d62199506..3aec9c993 100644 --- a/packages/uniforms/__suites__/ListField.tsx +++ b/packages/uniforms/__suites__/ListField.tsx @@ -11,13 +11,19 @@ export function testListField( }: { addFieldLocator: () => HTMLElement | null | undefined }, ) { test(' - renders ListAddField', () => { - render(); + render(, { + x: Array, + 'x.$': String, + }); expect(screen.getByRole('button')).toBeInTheDocument(); }); test(' - renders correct label (specified)', () => { - render(); + render(, { + x: Array, + 'x.$': String, + }); // Throws error with no form control found when getting by label expect(screen.getByText(/ListFieldLabel.*/)).toBeInTheDocument(); diff --git a/packages/uniforms/__suites__/TextField.tsx b/packages/uniforms/__suites__/TextField.tsx index 52e4c91cc..dd71882fc 100644 --- a/packages/uniforms/__suites__/TextField.tsx +++ b/packages/uniforms/__suites__/TextField.tsx @@ -6,46 +6,46 @@ import { render } from './render'; export function testTextField(TextField: ComponentType) { test(' - renders an input with correct disabled state', () => { - render(); + render(, { x: String }); expect(screen.getByRole('textbox')).toBeDisabled(); }); test(' - renders an input with correct readOnly state', () => { - render(); + render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('readonly', ''); }); test(' - renders an input with autocomplete turned off', () => { - render(); + render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('autocomplete', 'off'); }); test(' - renders an input with correct id (inherited)', () => { - render(); + render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('id'); }); test(' - renders an input with correct id (specified)', () => { const id = 'y'; - render(); + render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('id', id); }); test(' - renders an input with correct name', () => { const name = 'x'; - render(); + render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('name', name); }); test(' - renders an input with correct placeholder', () => { const placeholder = 'y'; - render(); + render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute( 'placeholder', @@ -54,26 +54,30 @@ export function testTextField(TextField: ComponentType) { }); test(' - renders an input with correct type', () => { - render(); + render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('type', 'text'); }); test(' - renders an input with correct type (url)', () => { - render(); + render(, { x: String }); expect(screen.getByRole('textbox')).toHaveAttribute('type', 'url'); }); test(' - renders an input with correct value (default)', () => { - render(); + render(, { x: String }); expect(screen.getByRole('textbox')).toHaveValue(''); }); test(' - renders an input with correct value (model)', () => { const defaultValue = 'y'; - render(, {}, { model: { x: defaultValue } }); + render( + , + { x: String }, + { model: { x: defaultValue } }, + ); expect(screen.getByRole('textbox')).toHaveValue(defaultValue); }); @@ -113,7 +117,7 @@ export function testTextField(TextField: ComponentType) { }); test(' - renders a label', () => { - render(); + render(, { x: String }); expect(screen.getByLabelText(/y.*/)).toBeInTheDocument(); }); From 076de8056f95a63ac367c4167fd017b85ff9f7ba Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Thu, 23 Feb 2023 15:23:26 +0100 Subject: [PATCH 24/27] fixes --- packages/uniforms/__tests__/AutoForm.tsx | 24 ++++++---------- packages/uniforms/__tests__/ValidatedForm.tsx | 28 +++++++++---------- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/packages/uniforms/__tests__/AutoForm.tsx b/packages/uniforms/__tests__/AutoForm.tsx index 1b8fd22ef..307af9905 100644 --- a/packages/uniforms/__tests__/AutoForm.tsx +++ b/packages/uniforms/__tests__/AutoForm.tsx @@ -14,12 +14,12 @@ describe('', () => { const validator = jest.fn(); const contextSpy = jest.fn | null]>(); const model = { a: '1' }; - const schemaValues = { + const schemaDefinition = { a: { type: String, defaultValue: '' }, b: { type: String, defaultValue: '' }, c: { type: String, defaultValue: '' }, }; - const schema = new SimpleSchema2Bridge(new SimpleSchema(schemaValues)); + const schema = new SimpleSchema2Bridge(new SimpleSchema(schemaDefinition)); jest.spyOn(schema.schema, 'validator').mockImplementation(() => validator); @@ -31,7 +31,7 @@ describe('', () => { , - schemaValues, + schemaDefinition, { onChange }, ); const input = screen.getByLabelText('A'); @@ -40,7 +40,6 @@ describe('', () => { expect(onChange).toHaveBeenLastCalledWith('a', '2'); }); it('validates', () => { - // FIXME: AutoForm is not a valid Component. render( ', () => { }); it('calls `onChangeModel`', () => { - // FIXME: AutoForm is not a valid Component. render( ', () => { , - schemaValues, + schemaDefinition, ); expect(contextSpy).toHaveBeenLastCalledWith( @@ -127,7 +125,6 @@ describe('', () => { expect(onChange.mock.calls[1]).toEqual(expect.arrayContaining(['c', ''])); }); it('skips `onSubmit` until rendered (`autosave` = true)', async () => { - // FIXME: AutoForm is not a valid Component. render( @@ -154,12 +151,11 @@ describe('', () => { describe('when reset', () => { it('reset `model`', () => { const Component = () => ( - // FIXME: AutoForm is not a valid Component. ); - const { rerender } = render(, schemaValues); + const { rerender } = render(, schemaDefinition); rerender(); @@ -170,13 +166,12 @@ describe('', () => { it('resets state `changedMap`', () => { const Component = () => ( - // FIXME: AutoForm is not a valid Component. ); - const { rerender } = render(, schemaValues); + const { rerender } = render(, schemaDefinition); rerender(); @@ -187,7 +182,6 @@ describe('', () => { it('resets state `changed`', () => { const Component = () => ( - // FIXME: AutoForm is not a valid Component. @@ -195,7 +189,7 @@ describe('', () => { const { rerender } = render( // FIXME: AutoForm is not a valid Component. , - schemaValues, + schemaDefinition, ); rerender(); @@ -207,12 +201,11 @@ describe('', () => { }); describe('when update', () => { it(', updates', () => { - // FIXME: AutoForm is not a valid Component. render( , - schemaValues, + schemaDefinition, ); expect(contextSpy).toHaveBeenLastCalledWith( @@ -221,7 +214,6 @@ describe('', () => { }); it(', validates', () => { - // FIXME: AutoForm is not a valid Component. const { rerenderWithProps } = render(); rerenderWithProps({ model, validate: 'onChange' }); diff --git a/packages/uniforms/__tests__/ValidatedForm.tsx b/packages/uniforms/__tests__/ValidatedForm.tsx index 50d561945..9ae48486c 100644 --- a/packages/uniforms/__tests__/ValidatedForm.tsx +++ b/packages/uniforms/__tests__/ValidatedForm.tsx @@ -22,14 +22,14 @@ describe('ValidatedForm', () => { const validatorForSchema = jest.fn(() => validator); const contextSpy = jest.fn | null]>(); - const error = new Error('test error message'); + const error = new Error(); const model = { a: 1 }; - const schemaValues = { + const schemaDefinition = { a: { type: String, defaultValue: '' }, b: { type: String, defaultValue: '' }, c: { type: String, defaultValue: '' }, }; - const schema = new SimpleSchema2Bridge(new SimpleSchema(schemaValues)); + const schema = new SimpleSchema2Bridge(new SimpleSchema(schemaDefinition)); jest.spyOn(schema.schema, 'validator').mockImplementation(validatorForSchema); beforeEach(() => jest.clearAllMocks()); @@ -148,7 +148,7 @@ describe('ValidatedForm', () => { > , - schemaValues, + schemaDefinition, ); const form = screen.getByRole('form'); @@ -171,7 +171,7 @@ describe('ValidatedForm', () => { > , - schemaValues, + schemaDefinition, ); const form = screen.getByRole('form'); @@ -197,7 +197,7 @@ describe('ValidatedForm', () => { > , - schemaValues, + schemaDefinition, ); expect(contextSpy).toHaveBeenCalledWith( @@ -284,7 +284,7 @@ describe('ValidatedForm', () => { > , - schemaValues, + schemaDefinition, ); const form = screen.getByRole('form'); @@ -312,7 +312,7 @@ describe('ValidatedForm', () => { > , - schemaValues, + schemaDefinition, ); validator.mockImplementationOnce(() => { @@ -345,7 +345,7 @@ describe('ValidatedForm', () => { > , - schemaValues, + schemaDefinition, ); onSubmit.mockImplementationOnce(() => Promise.reject(error)); @@ -483,7 +483,7 @@ describe('ValidatedForm', () => { , - schemaValues, + schemaDefinition, ); validator.mockImplementationOnce(() => { throw error; @@ -553,20 +553,20 @@ describe('ValidatedForm', () => { ); it('does not revalidate when `model` changes', () => { - const { rerenderWithProps } = render(, schemaValues); + const { rerenderWithProps } = render(, schemaDefinition); rerenderWithProps({ model: {} }); expect(validator).not.toBeCalled(); }); it('does not revalidate when validator `options` change', () => { - const { rerenderWithProps } = render(, schemaValues); + const { rerenderWithProps } = render(, schemaDefinition); rerenderWithProps({ validator: {} }); expect(validator).not.toBeCalled(); }); it('does not revalidate when `schema` changes', () => { const anotherSchema = new SimpleSchema2Bridge(schema.schema); - const { rerenderWithProps } = render(, schemaValues); + const { rerenderWithProps } = render(, schemaDefinition); rerenderWithProps({ schema: anotherSchema }); expect(validator).not.toBeCalled(); }); @@ -715,7 +715,7 @@ describe('ValidatedForm', () => { > , - schemaValues, + schemaDefinition, ); const asyncSubmission = onSubmitMode.includes('async'); From 4942fe57325cd82bae05ee887f96e0f31ae5b004 Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Fri, 24 Feb 2023 12:28:15 +0100 Subject: [PATCH 25/27] fix onChangeModel test --- packages/uniforms/__tests__/AutoForm.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uniforms/__tests__/AutoForm.tsx b/packages/uniforms/__tests__/AutoForm.tsx index 307af9905..ae1fc5519 100644 --- a/packages/uniforms/__tests__/AutoForm.tsx +++ b/packages/uniforms/__tests__/AutoForm.tsx @@ -68,7 +68,7 @@ describe('', () => { , ); From 188b5e62cad82851a43f40e3a6c69c8af7a2aeca Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Fri, 24 Feb 2023 12:54:45 +0100 Subject: [PATCH 26/27] revert prettier unnecessary changes --- packages/uniforms/__suites__/TextField.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/uniforms/__suites__/TextField.tsx b/packages/uniforms/__suites__/TextField.tsx index dd71882fc..8ab4dc33a 100644 --- a/packages/uniforms/__suites__/TextField.tsx +++ b/packages/uniforms/__suites__/TextField.tsx @@ -18,7 +18,9 @@ export function testTextField(TextField: ComponentType) { }); test(' - renders an input with autocomplete turned off', () => { - render(, { x: String }); + render(, { + x: String, + }); expect(screen.getByRole('textbox')).toHaveAttribute('autocomplete', 'off'); }); @@ -45,7 +47,9 @@ export function testTextField(TextField: ComponentType) { test(' - renders an input with correct placeholder', () => { const placeholder = 'y'; - render(, { x: String }); + render(, { + x: String, + }); expect(screen.getByRole('textbox')).toHaveAttribute( 'placeholder', From 81f69df2d4ed31c50b04843e6ae8a8c39c78c05f Mon Sep 17 00:00:00 2001 From: Ernest Teluk Date: Fri, 24 Feb 2023 14:26:09 +0100 Subject: [PATCH 27/27] add lacking expects to autoForm test --- packages/uniforms/__tests__/AutoForm.tsx | 25 ++++++++---------------- packages/uniforms/__tests__/useField.tsx | 4 +++- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/packages/uniforms/__tests__/AutoForm.tsx b/packages/uniforms/__tests__/AutoForm.tsx index ae1fc5519..d701ddcdc 100644 --- a/packages/uniforms/__tests__/AutoForm.tsx +++ b/packages/uniforms/__tests__/AutoForm.tsx @@ -44,6 +44,7 @@ describe('', () => { @@ -80,7 +81,6 @@ describe('', () => { expect(onChangeModel).toHaveBeenLastCalledWith({ a: '2' }); }); it('updates `changed` and `changedMap`', () => { - // FIXME: AutoForm is not a valid Component. render( @@ -109,7 +109,6 @@ describe('', () => { } } - // FIXME: AutoForm is not a valid Component. render( // @ts-expect-error Convoluted AutoForm types ', () => { ); expect(onSubmit).not.toBeCalled(); - - await new Promise(resolve => setTimeout(resolve)); - const input = screen.getByLabelText('A'); - - expect(onSubmit).toHaveBeenCalledTimes(1); - expect(onSubmit).toHaveBeenLastCalledWith({ a: '', b: '', c: '' }); - - await new Promise(resolve => setTimeout(resolve)); fireEvent.change(input, { target: { value: '1' } }); - expect(validator).toHaveBeenCalledTimes(2); + await new Promise(resolve => setTimeout(resolve)); + expect(onSubmit).toHaveBeenCalledTimes(1); + expect(onSubmit).toHaveBeenLastCalledWith({ a: '1', b: '', c: '' }); + expect(validator).toHaveBeenCalledTimes(1); expect(validator).toHaveBeenLastCalledWith({ a: '1', b: '', c: '' }); }); }); @@ -186,11 +180,7 @@ describe('', () => { ); - const { rerender } = render( - // FIXME: AutoForm is not a valid Component. - , - schemaDefinition, - ); + const { rerender } = render(, schemaDefinition); rerender(); @@ -201,13 +191,14 @@ describe('', () => { }); describe('when update', () => { it(', updates', () => { - render( + const { rerenderWithProps } = render( , schemaDefinition, ); + rerenderWithProps({ model: {} }); expect(contextSpy).toHaveBeenLastCalledWith( expect.objectContaining({ model: {} }), ); diff --git a/packages/uniforms/__tests__/useField.tsx b/packages/uniforms/__tests__/useField.tsx index 94a1dca0a..ef0fa7b6a 100644 --- a/packages/uniforms/__tests__/useField.tsx +++ b/packages/uniforms/__tests__/useField.tsx @@ -53,11 +53,13 @@ describe('useField', () => { const input = screen.getByRole('textbox'); expect(input).toHaveAttribute('value', '4'); + fireEvent.change(input, { target: { value: null } }); + expect(input).toHaveAttribute('value', ''); }); it('does not apply default value after first change', () => { render( - + , );