17782: Fixes almost all tests (4 left) mostly by fixing namespace-type imports.
[arvados-workbench2.git] / src / views / run-process-panel / inputs / int-input.tsx
index 32ebeb75c27bc8ee6be8ed186b5051a5dcff0ab0..aa4fe9bba658add4abeb5cb094243d3c6d6564b2 100644 (file)
@@ -2,13 +2,13 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
+import React from 'react';
 import { memoize } from 'lodash/fp';
-import { IntCommandInputParameter, isRequiredInput } from '~/models/workflow';
+import { IntCommandInputParameter, isRequiredInput } from 'models/workflow';
 import { Field } from 'redux-form';
-import { isInteger } from '~/validators/is-integer';
-import { GenericInputProps, GenericInput } from '~/views/run-process-panel/inputs/generic-input';
-import { IntInput as IntInputComponent } from '~/components/int-input/int-input';
+import { isInteger } from 'validators/is-integer';
+import { GenericInputProps, GenericInput } from 'views/run-process-panel/inputs/generic-input';
+import { IntInput as IntInputComponent } from 'components/int-input/int-input';
 
 export interface IntInputProps {
     input: IntCommandInputParameter;
@@ -22,9 +22,9 @@ export const IntInput = ({ input }: IntInputProps) =>
         format={format}
         validate={getValidation(input)} />;
 
-const parse = (value: any) => parseInt(value, 10);
+export const parse = (value: any) => value === '' ? '' : parseInt(value, 10);
 
-const format = (value: any) => isNaN(value) ? '' : JSON.stringify(value);
+export const format = (value: any) => isNaN(value) ? '' : JSON.stringify(value);
 
 const getValidation = memoize(
     (input: IntCommandInputParameter) => ([