Skip to content

Commit c8dbd10

Browse files
committed
Prettier reformatted some things
1 parent ed131b7 commit c8dbd10

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/Field.test.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { ErrorBoundary, Toggle, wrapWith } from './testUtils'
55
import Form from './ReactFinalForm'
66
import Field from './Field'
77

8-
const onSubmitMock = (values) => {}
8+
const onSubmitMock = values => {}
99

10-
const timeout = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
10+
const timeout = ms => new Promise(resolve => setTimeout(resolve, ms))
1111
async function sleep(ms) {
1212
await act(async () => {
1313
await timeout(ms)
@@ -36,7 +36,7 @@ describe('Field', () => {
3636
it('should resubscribe if name changes', () => {
3737
const { getByTestId, getByText } = render(
3838
<Toggle>
39-
{(isCat) => (
39+
{isCat => (
4040
<Form
4141
onSubmit={onSubmitMock}
4242
initialValues={{ dog: 'Odie', cat: 'Garfield' }}
@@ -129,7 +129,7 @@ describe('Field', () => {
129129
// This is mainly here for code coverage. 🧐
130130
const { getByText } = render(
131131
<Toggle>
132-
{(hidden) => (
132+
{hidden => (
133133
<Form
134134
onSubmit={onSubmitMock}
135135
initialValues={{ dog: 'Odie', cat: 'Garfield' }}
@@ -208,7 +208,7 @@ describe('Field', () => {
208208
<Form onSubmit={onSubmitMock} subscription={{ values: true }}>
209209
{wrapWith(spy, () => (
210210
<form>
211-
<Field name="name" parse={(v) => v}>
211+
<Field name="name" parse={v => v}>
212212
{({ input: { value, ...props } }) => (
213213
<input
214214
{...props}
@@ -241,7 +241,7 @@ describe('Field', () => {
241241
<Field
242242
name="name"
243243
component="input"
244-
format={(value) => (value ? value.toUpperCase() : '')}
244+
format={value => (value ? value.toUpperCase() : '')}
245245
data-testid="name"
246246
/>
247247
</form>
@@ -258,7 +258,7 @@ describe('Field', () => {
258258
})
259259

260260
it('should only format on blur if formatOnBlur is true', () => {
261-
const format = jest.fn((value) => (value ? value.toUpperCase() : ''))
261+
const format = jest.fn(value => (value ? value.toUpperCase() : ''))
262262
const { getByTestId } = render(
263263
<Form onSubmit={onSubmitMock} subscription={{ values: true }}>
264264
{() => (
@@ -286,7 +286,7 @@ describe('Field', () => {
286286
})
287287

288288
it('should `formatOnBlur` most updated value', () => {
289-
const format = jest.fn((value) => (value ? value.trim() : ''))
289+
const format = jest.fn(value => (value ? value.trim() : ''))
290290
const { getByTestId } = render(
291291
<Form onSubmit={onSubmitMock} subscription={{ values: true }}>
292292
{() => (
@@ -296,7 +296,7 @@ describe('Field', () => {
296296
<input
297297
{...input}
298298
data-testid="name"
299-
onBlur={(e) => {
299+
onBlur={e => {
300300
input.onChange(
301301
e.target.value && e.target.value.toUpperCase()
302302
)
@@ -320,7 +320,7 @@ describe('Field', () => {
320320
})
321321

322322
it('should not format value at all when formatOnBlur and render prop', () => {
323-
const format = jest.fn((value) => (value ? value.toUpperCase() : ''))
323+
const format = jest.fn(value => (value ? value.toUpperCase() : ''))
324324
render(
325325
<Form onSubmit={onSubmitMock} subscription={{ values: true }}>
326326
{() => (
@@ -344,7 +344,7 @@ describe('Field', () => {
344344
<Form onSubmit={onSubmitMock} subscription={{ values: true }}>
345345
{() => (
346346
<form>
347-
<Field name="name" format={(v) => v}>
347+
<Field name="name" format={v => v}>
348348
{wrapWith(spy, ({ input: { value, ...props } }) => (
349349
<input
350350
{...props}
@@ -551,8 +551,8 @@ describe('Field', () => {
551551
})
552552

553553
it('should allow changing field-level validation function', () => {
554-
const simpleValidate = (value) => (value ? undefined : 'Required')
555-
const complexValidate = (value) => {
554+
const simpleValidate = value => (value ? undefined : 'Required')
555+
const complexValidate = value => {
556556
if (value) {
557557
if (value !== value.toUpperCase()) {
558558
return 'SHOULD BE UPPERCASE!'
@@ -563,7 +563,7 @@ describe('Field', () => {
563563
}
564564
const { getByTestId, getByText } = render(
565565
<Toggle>
566-
{(useComplexValidation) => (
566+
{useComplexValidation => (
567567
<Form onSubmit={onSubmitMock}>
568568
{({ handleSubmit }) => (
569569
<form onSubmit={handleSubmit}>
@@ -610,8 +610,8 @@ describe('Field', () => {
610610
* form.
611611
*/
612612
it('should ignore changes field-level validation function', () => {
613-
const createValidator = (isRequired) =>
614-
isRequired ? (value) => (value ? undefined : 'Required') : undefined
613+
const createValidator = isRequired =>
614+
isRequired ? value => (value ? undefined : 'Required') : undefined
615615

616616
const Error = ({ name }) => (
617617
<Field name={name} subscription={{ error: true }}>
@@ -620,7 +620,7 @@ describe('Field', () => {
620620
)
621621
const { getByTestId, getByText } = render(
622622
<Toggle>
623-
{(isRequired) => (
623+
{isRequired => (
624624
<Form onSubmit={onSubmitMock}>
625625
{({ handleSubmit }) => (
626626
<form onSubmit={handleSubmit}>
@@ -656,7 +656,7 @@ describe('Field', () => {
656656

657657
it('should not rerender if validateFields is !== every time', () => {
658658
// https://github.com/final-form/react-final-form/issues/502
659-
const required = (value) => (value ? undefined : 'Required')
659+
const required = value => (value ? undefined : 'Required')
660660
const spy = jest.fn()
661661
const { getByTestId } = render(
662662
<Form onSubmit={onSubmitMock}>
@@ -1038,7 +1038,7 @@ describe('Field', () => {
10381038
<Field
10391039
name="name"
10401040
component="input"
1041-
format={(value) => value && value.toUpperCase()}
1041+
format={value => value && value.toUpperCase()}
10421042
formatOnBlur
10431043
data-testid="name"
10441044
/>
@@ -1107,7 +1107,7 @@ describe('Field', () => {
11071107
<Field
11081108
name="name"
11091109
component="input"
1110-
validate={async (value) => {
1110+
validate={async value => {
11111111
await timeout(5)
11121112
return value === 'erikras' ? 'Username taken' : undefined
11131113
}}
@@ -1152,7 +1152,7 @@ describe('Field', () => {
11521152
const validate = jest.fn()
11531153
const { getByText } = render(
11541154
<Toggle>
1155-
{(showOtherFields) => (
1155+
{showOtherFields => (
11561156
<Form onSubmit={onSubmitMock} validate={validate}>
11571157
{({ handleSubmit }) => (
11581158
<form onSubmit={handleSubmit}>
@@ -1184,13 +1184,13 @@ describe('Field', () => {
11841184
it('submit should not throw when field with enabled `formatOnBlur` changes name `prop`', () => {
11851185
const onSubmit = jest.fn()
11861186

1187-
const trim = (value) => value && value.trim()
1187+
const trim = value => value && value.trim()
11881188

11891189
const { getByTestId, getByText } = render(
11901190
<Form onSubmit={onSubmit}>
11911191
{({ handleSubmit }) => (
11921192
<Toggle>
1193-
{(newFieldName) => (
1193+
{newFieldName => (
11941194
<form onSubmit={handleSubmit}>
11951195
<Field
11961196
name={newFieldName ? 'newName' : 'oldName'}

0 commit comments

Comments
 (0)