fix(striker-ui): expose isRequired in build test batch functions

main
Tsu-ba-me 2 years ago committed by digimer
parent 737850f9d0
commit 26881c0436
  1. 3
      striker-ui/lib/test_input/buildDomainTestBatch.tsx
  2. 3
      striker-ui/lib/test_input/buildIPAddressTestBatch.tsx
  3. 3
      striker-ui/lib/test_input/buildNumberTestBatch.tsx
  4. 3
      striker-ui/lib/test_input/buildPeacefulStringTestBatch.tsx
  5. 3
      striker-ui/lib/test_input/buildUUIDTestBatch.tsx
  6. 3
      striker-ui/types/TestInputFunction.d.ts

@ -6,10 +6,11 @@ import { InlineMonoText } from '../../components/Text';
const buildDomainTestBatch: BuildInputTestBatchFunction = ( const buildDomainTestBatch: BuildInputTestBatchFunction = (
inputName, inputName,
onSuccess, onSuccess,
{ onFinishBatch, ...defaults } = {}, { isRequired, onFinishBatch, ...defaults } = {},
onDomainTestFailure, onDomainTestFailure,
) => ({ ) => ({
defaults: { ...defaults, onSuccess }, defaults: { ...defaults, onSuccess },
isRequired,
onFinishBatch, onFinishBatch,
tests: [ tests: [
{ {

@ -5,10 +5,11 @@ import testNotBlank from './testNotBlank';
const buildIPAddressTestBatch: BuildInputTestBatchFunction = ( const buildIPAddressTestBatch: BuildInputTestBatchFunction = (
inputName, inputName,
onSuccess, onSuccess,
{ onFinishBatch, ...defaults } = {}, { isRequired, onFinishBatch, ...defaults } = {},
onIPv4TestFailure, onIPv4TestFailure,
) => ({ ) => ({
defaults: { ...defaults, onSuccess }, defaults: { ...defaults, onSuccess },
isRequired,
onFinishBatch, onFinishBatch,
tests: [ tests: [
{ {

@ -4,7 +4,7 @@ import toNumber from '../toNumber';
const buildNumberTestBatch: BuildInputTestBatchFunction = ( const buildNumberTestBatch: BuildInputTestBatchFunction = (
inputName, inputName,
onSuccess, onSuccess,
{ onFinishBatch, ...defaults } = {}, { isRequired, onFinishBatch, ...defaults } = {},
onIntTestFailure?, onIntTestFailure?,
onFloatTestFailure?, onFloatTestFailure?,
onRangeTestFailure?, onRangeTestFailure?,
@ -48,6 +48,7 @@ const buildNumberTestBatch: BuildInputTestBatchFunction = (
return { return {
defaults: { ...defaults, onSuccess }, defaults: { ...defaults, onSuccess },
isRequired,
onFinishBatch, onFinishBatch,
tests, tests,
}; };

@ -6,10 +6,11 @@ import { InlineMonoText } from '../../components/Text';
const buildPeacefulStringTestBatch: BuildInputTestBatchFunction = ( const buildPeacefulStringTestBatch: BuildInputTestBatchFunction = (
inputName, inputName,
onSuccess, onSuccess,
{ onFinishBatch, ...defaults } = {}, { isRequired, onFinishBatch, ...defaults } = {},
onTestPeacefulStringFailureAppend, onTestPeacefulStringFailureAppend,
) => ({ ) => ({
defaults: { ...defaults, onSuccess }, defaults: { ...defaults, onSuccess },
isRequired,
onFinishBatch, onFinishBatch,
tests: [ tests: [
{ {

@ -5,10 +5,11 @@ import testNotBlank from './testNotBlank';
const buildUUIDTestBatch: BuildInputTestBatchFunction = ( const buildUUIDTestBatch: BuildInputTestBatchFunction = (
inputName, inputName,
onSuccess, onSuccess,
{ onFinishBatch, ...defaults } = {}, { isRequired, onFinishBatch, ...defaults } = {},
onUUIDTestFailure, onUUIDTestFailure,
) => ({ ) => ({
defaults: { ...defaults, onSuccess }, defaults: { ...defaults, onSuccess },
isRequired,
onFinishBatch, onFinishBatch,
tests: [ tests: [
{ {

@ -65,7 +65,8 @@ type InputTestBatch = {
type BuildInputTestBatchFunction = ( type BuildInputTestBatchFunction = (
inputName: string, inputName: string,
onSuccess: InputTestSuccessCallback, onSuccess: InputTestSuccessCallback,
options?: InputTestBatch['defaults'] & Pick<InputTestBatch, 'onFinishBatch'>, options?: InputTestBatch['defaults'] &
Pick<InputTestBatch, 'isRequired' | 'onFinishBatch'>,
...onFailureAppends: InputTestFailureAppendCallback[] ...onFailureAppends: InputTestFailureAppendCallback[]
) => InputTestBatch; ) => InputTestBatch;

Loading…
Cancel
Save