Created ShortUrlVisits test

This commit is contained in:
Alejandro Celaya
2018-09-08 13:28:40 +02:00
parent d37e7ca7ce
commit 64c1b56973
3 changed files with 96 additions and 6 deletions

View File

@@ -2,24 +2,24 @@ import calendarIcon from '@fortawesome/fontawesome-free-regular/faCalendarAlt';
import FontAwesomeIcon from '@fortawesome/react-fontawesome';
import React from 'react';
import DatePicker from 'react-datepicker';
import './DateInput.scss';
import { isNil } from 'ramda';
import './DateInput.scss';
export default class DateInput extends React.Component {
constructor(props) {
super(props);
this.inputRef = React.createRef();
this.inputRef = props.ref || React.createRef();
}
render() {
const { isClearable, selected } = this.props;
const { className, isClearable, selected } = this.props;
const showCalendarIcon = !isClearable || isNil(selected);
return (
<div className="date-input-container">
<DatePicker
{...this.props}
className={`date-input-container__input form-control ${this.props.className || ''}`}
className={`date-input-container__input form-control ${className || ''}`}
dateFormat="YYYY-MM-DD"
readOnly
ref={this.inputRef}

View File

@@ -25,7 +25,9 @@ export class ShortUrlsVisitsComponent extends React.Component {
processBrowserStats: PropTypes.func,
processCountriesStats: PropTypes.func,
processReferrersStats: PropTypes.func,
match: PropTypes.object,
match: PropTypes.shape({
params: PropTypes.object,
}),
getShortUrlVisits: PropTypes.func,
shortUrlVisits: shortUrlVisitsType,
getShortUrlDetail: PropTypes.func,
@@ -122,7 +124,6 @@ export class ShortUrlsVisitsComponent extends React.Component {
selected={this.state.endDate}
placeholderText="Until"
isClearable
className="short-url-visits__date-input"
minDate={this.state.startDate}
onChange={(date) => this.setState({ endDate: date }, () => this.loadVisits())}
/>