Skip to content

Commit

Permalink
cleanup in the test files before adding new tests #2766
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Pollock committed Nov 19, 2018
1 parent a8fa334 commit 10bc215
Show file tree
Hide file tree
Showing 12 changed files with 3,696 additions and 3,699 deletions.
826 changes: 412 additions & 414 deletions clients/blocks/build/index.min.js

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions clients/blocks/build/index.min.js.map

Large diffs are not rendered by default.

3,034 changes: 1,555 additions & 1,479 deletions clients/privacy/build/index.min.js

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions clients/privacy/build/index.min.js.map

Large diffs are not rendered by default.

2,078 changes: 998 additions & 1,080 deletions clients/pro/build/index.min.js

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions clients/pro/build/index.min.js.map

Large diffs are not rendered by default.

971 changes: 483 additions & 488 deletions clients/render/build/index.min.js

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions clients/render/build/index.min.js.map

Large diffs are not rendered by default.

161 changes: 81 additions & 80 deletions clients/render/components/Fields/FileInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Dropzone from 'react-dropzone';
*/
export const FileInput = (props) => {

const { shouldDisable, onChange, accept, field, describedById, style, className, multiple, multiUploadText, inputProps, text, usePreviews, previewHeight, previewWidth } = props;
const {shouldDisable, onChange, accept, field, describedById, style, className, multiple, multiUploadText, inputProps, text, usePreviews, previewHeight, previewWidth} = props;

const {
outterIdAttr,
Expand All @@ -41,9 +41,9 @@ export const FileInput = (props) => {
return (

<div className="cf2-dropzone" data-field={fieldId}>
{valueSet && ! multiple ?
{valueSet && !multiple ?
<div className="cf2-one-file-notice">{text.multipleDisabled}</div>
:
:
<Dropzone
onDrop={onChange}
className={className}
Expand All @@ -65,52 +65,53 @@ export const FileInput = (props) => {
</Dropzone>
}

{valueSet &&
<ul
id="cf2-list-files"
role="list"
>
{
fieldValue.map(
(file, index) =>
<li
id={removeFileID + index}
key={index}
className="cf2-file-listed"
role="listitem"
aria-posinset={index}
{valueSet &&
<ul
id="cf2-list-files"
role="list"
>
{
fieldValue.map(
(file, index) =>
<li
id={removeFileID + index}
key={index}
className="cf2-file-listed"
role="listitem"
aria-posinset={index}
>

<button
type="button"
aria-controls={removeFileID + index}
data-file={removeFileID + index}
className="cf2-file-remove"
onClick={(e) => onChange(e, file)}
>

<button
type="button"
aria-controls={removeFileID + index}
data-file={removeFileID + index}
className="cf2-file-remove"
onClick={(e) => onChange(e, file)}
>
<span className="screen-reader-text sr-text">{text.removeFile}</span>
</button>

<div>
{usePreviews === true && file.type.startsWith("image") === true ?
<img
className="cf2-file-field-img-preview"
width={previewWidth}
height={previewHeight}
src={file.preview}
alt={file.name}
/>
:
<span className="cf2-file-name">{file.name}</span>
}
<br/>
<span className="cf2-file-data"> {file.type} - {file.size} bytes - {file.type.startsWith("image")}</span>
</div>
</li>
)
}
</ul>
}
<span className="screen-reader-text sr-text">{text.removeFile}</span>
</button>

<div>
{usePreviews === true && file.type.startsWith("image") === true ?
<img
className="cf2-file-field-img-preview"
width={previewWidth}
height={previewHeight}
src={file.preview}
alt={file.name}
/>
:
<span className="cf2-file-name">{file.name}</span>
}
<br/>
<span
className="cf2-file-data"> {file.type} - {file.size} bytes - {file.type.startsWith("image")}</span>
</div>
</li>
)
}
</ul>
}
</div>

)
Expand Down Expand Up @@ -141,18 +142,18 @@ FileInput.propTypes = {
message: PropTypes.string
}),
style: PropTypes.object,
usePreviews: PropTypes.oneOfType([
PropTypes.bool,
PropTypes.string
]),
usePreviews: PropTypes.oneOfType([
PropTypes.bool,
PropTypes.string
]),
previewWidth: PropTypes.number,
previewHeight: PropTypes.number,
previewHeight: PropTypes.number,
inputProps: PropTypes.object,
className: PropTypes.string,
accept: PropTypes.oneOfType([
PropTypes.bool,
PropTypes.string
]),
accept: PropTypes.oneOfType([
PropTypes.bool,
PropTypes.string
]),
};

/**
Expand Down Expand Up @@ -198,11 +199,11 @@ FileInput.fieldConfigToProps = (fieldConfig) => {
];
if (fieldConfig.hasOwnProperty('configOptions')) {

const {configOptions} = fieldConfig;
const {configOptions} = fieldConfig;

configOptionProps.forEach(key => {
props[key] = configOptions[key];
});
configOptionProps.forEach(key => {
props[key] = configOptions[key];
});

if (configOptions.hasOwnProperty('allowedTypes')) {

Expand All @@ -216,29 +217,29 @@ FileInput.fieldConfigToProps = (fieldConfig) => {
props.accept = '';
}

if (fieldConfig.configOptions.hasOwnProperty('multiple')) {
if(fieldConfig.configOptions.multiple === 1 ) {
props.multiple = true;
}else {
props.multiple = false;
}
} else {
props.multiple = false;
}

if (configOptions.hasOwnProperty('usePreviews')) {

if( configOptions.usePreviews === true ){
props.usePreviews = true;
props.previewWidth = configOptions.previewWidth;
props.previewHeight = configOptions.previewHeight;
if (fieldConfig.configOptions.hasOwnProperty('multiple')) {
if (fieldConfig.configOptions.multiple === 1) {
props.multiple = true;
} else {
props.usePreviews = false;
props.multiple = false;
}
} else {
props.multiple = false;
}

}
if (configOptions.hasOwnProperty('usePreviews')) {

if (configOptions.usePreviews === true) {
props.usePreviews = true;
props.previewWidth = configOptions.previewWidth;
props.previewHeight = configOptions.previewHeight;
} else {
props.usePreviews = false;
}

}

if(configOptions.multiUploadText === false){
if (configOptions.multiUploadText === false) {
props.multiUploadText = 'Drop files or click to select files to Upload';
}

Expand Down
Loading

0 comments on commit 10bc215

Please sign in to comment.