Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: omit props and display errors #309

Merged
merged 1 commit into from
Jul 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/Form/Input/file/src/File.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
27 changes: 13 additions & 14 deletions packages/Form/Input/file/src/FileTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ const FileTable = ({
disabled,
onClick,
}) => {
if (!values || values.length <= 0) {
return null;
}
const componentClassName = ClassManager.getComponentClassName(
className,
classModifier,
Expand All @@ -57,17 +54,19 @@ const FileTable = ({
return (
<div className={componentClassName}>
<Errors errors={errors} />
<ul className="af-form__file-list">
{values.map(({ file, id }) => (
<LineFile
disabled={disabled}
file={file}
onClick={onClick}
id={id}
key={id}
/>
))}
</ul>
{values && values.length > 0 && (
<ul className="af-form__file-list">
{values.map(({ file, id }) => (
<LineFile
disabled={disabled}
file={file}
onClick={onClick}
id={id}
key={id}
/>
))}
</ul>
)}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,21 @@ exports[`<File.FileTable> renders File.FileTable correctly 1`] = `
</div>
`;

exports[`<File.FileTable> renders File.FileTable correctly when no have values 1`] = `""`;
exports[`<File.FileTable> renders File.FileTable correctly when no have values 1`] = `
<div
className="custom-table-file af-file-table"
>
<Errors
errors={
Array [
Object {
"file": Object {
"name": "youhou.txt",
"size": 2,
},
},
]
}
/>
</div>
`;