From 26d720b54d0caccbadcea9e50aeb785ad48aedf8 Mon Sep 17 00:00:00 2001 From: Samuel Gomez Date: Tue, 9 Jul 2019 22:14:18 +0200 Subject: [PATCH] fix: omit props and display errors --- packages/Form/Input/file/src/File.js | 2 +- packages/Form/Input/file/src/FileTable.js | 27 +++++++++---------- .../src/__snapshots__/FileTable.spec.js.snap | 19 ++++++++++++- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/packages/Form/Input/file/src/File.js b/packages/Form/Input/file/src/File.js index 4ae74d632..642f6278e 100644 --- a/packages/Form/Input/file/src/File.js +++ b/packages/Form/Input/file/src/File.js @@ -10,7 +10,7 @@ import { import { InputManager } from '@axa-fr/react-toolkit-core'; import Button from '@axa-fr/react-toolkit-button'; -const omitProperties = omit(['classModifier', 'className', 'onChange']); +const omitProperties = omit(['classModifier', 'className', 'onChange', 'isVisible', 'inputRef']); class File extends Component { constructor(props) { diff --git a/packages/Form/Input/file/src/FileTable.js b/packages/Form/Input/file/src/FileTable.js index e8c187c47..718fb8197 100644 --- a/packages/Form/Input/file/src/FileTable.js +++ b/packages/Form/Input/file/src/FileTable.js @@ -46,9 +46,6 @@ const FileTable = ({ disabled, onClick, }) => { - if (!values || values.length <= 0) { - return null; - } const componentClassName = ClassManager.getComponentClassName( className, classModifier, @@ -57,17 +54,19 @@ const FileTable = ({ return (
-
    - {values.map(({ file, id }) => ( - - ))} -
+ {values && values.length > 0 && ( +
    + {values.map(({ file, id }) => ( + + ))} +
+ )}
); }; diff --git a/packages/Form/Input/file/src/__snapshots__/FileTable.spec.js.snap b/packages/Form/Input/file/src/__snapshots__/FileTable.spec.js.snap index a9beab760..1a39c5412 100644 --- a/packages/Form/Input/file/src/__snapshots__/FileTable.spec.js.snap +++ b/packages/Form/Input/file/src/__snapshots__/FileTable.spec.js.snap @@ -56,4 +56,21 @@ exports[` renders File.FileTable correctly 1`] = ` `; -exports[` renders File.FileTable correctly when no have values 1`] = `""`; +exports[` renders File.FileTable correctly when no have values 1`] = ` +
+ +
+`;