Skip to content

Commit

Permalink
Migrated to react 16.0.0 (Hacker0x01#1047)
Browse files Browse the repository at this point in the history
* Migrated to react 16.0.0

* Fix tests, configure Adapter for enzyme

* fix linter errors

* Fixed 'should track the currently hovered day' test

* upgrade enzyme version

* Moved enzyme adapter configuration to test/index.js

* change simulate('click') to click() in tests based on refs

* move moment and prop-types to peerDependency

* Add missing installation of peerDependencies in CI

* Updated readme

* update travis.yml to install peerDependencies

* Install peer dependencies before_script

* Update enzyme and install peers in install step on travis

* merge diff of Hacker0x01#1047

* fix some failing tests by looking up elements with .find rather than .ref

* fix failing tests where Enzyme 3 requires calls to update()

* remove yarn install in travis

* Trigger yarn install in travis

* Update npm before yarn install

* Update npm in before_install

* Add missing yarn install

* updated dependencies

* downgrade chai

* Update dependencies

* Installed missing dependencies

* eslint fixes

* Updated yarn.lock

* eslint fix
  • Loading branch information
Adam Gołąb authored and martijnrusschen committed Nov 12, 2017
1 parent 3e0b061 commit dc89f5b
Show file tree
Hide file tree
Showing 74 changed files with 13,877 additions and 22,370 deletions.
10 changes: 5 additions & 5 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"env": {
"browser": true,
"es6": true,
"es6": true
},

"plugins": [
Expand All @@ -14,8 +14,8 @@
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
},
"jsx": true
}
},

"parser": "babel-eslint",
Expand All @@ -28,7 +28,7 @@
"react/jsx-boolean-value": 2,
"react/jsx-closing-bracket-location": [2, 'after-props'],
"react/jsx-curly-spacing": [2, "never"],
"react/jsx-indent-props": 2,
"react/jsx-indent-props": [2, 2],
"react/jsx-key": 2,
"react/jsx-max-props-per-line": [2, { "maximum": 4 }],
"react/jsx-no-duplicate-props": 2,
Expand All @@ -52,6 +52,6 @@
"react/react-in-jsx-scope": 2,
"react/self-closing-comp": 2,
"react/sort-comp": 2,
"react/wrap-multilines": 0,
"react/wrap-multilines": 0
}
}
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ addons:
packages:
- g++-4.8
before_install:
- npm i -g npm@latest
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm i -g npm@latest
install:
- yarn install
script:
- yarn lint
- yarn test
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The package can be installed via NPM:
npm install react-datepicker --save
```

You’ll need to install React and Moment.js separately since those dependencies aren’t included in the package. Below is a simple example on how to use the Datepicker in a React view. You will also need to require the css file from this package (or provide your own). The example below shows how to include the css from this package if your build system supports requiring css files (webpack is one that does).
You’ll need to install React, PropTypes and Moment.js separately since those dependencies aren’t included in the package. Below is a simple example on how to use the Datepicker in a React view. You will also need to require the css file from this package (or provide your own). The example below shows how to include the css from this package if your build system supports requiring css files (webpack is one that does).

```js
import React from 'react';
Expand Down
23,141 changes: 1,804 additions & 21,337 deletions docs-site/bundle.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs-site/src/examples/children.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export default class Children extends React.Component {
</pre>
<div className="column">
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}>
selected={this.state.startDate}
onChange={this.handleChange}>
<div style={{color: 'red'}}>
Don't forget to check the weather!
</div>
Expand Down
8 changes: 4 additions & 4 deletions docs-site/src/examples/clear_input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export default class ClearInput extends React.Component {
</pre>
<div className="column">
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}
isClearable
placeholderText="I have been cleared!" />
selected={this.state.startDate}
onChange={this.handleChange}
isClearable
placeholderText="I have been cleared!" />
</div>
</div>
}
Expand Down
30 changes: 15 additions & 15 deletions docs-site/src/examples/configurePopper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ export default class ConfigurePopper extends React.Component {
</pre>
<div className="column">
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}
popperClassName="some-custom-class"
popperPlacement="top-end"
popperModifiers={{
offset: {
enabled: true,
offset: '5px, 10px'
},
preventOverflow: {
enabled: true,
escapeWithReference: false,
boundariesElement: 'viewport'
}
}}/>
selected={this.state.startDate}
onChange={this.handleChange}
popperClassName="some-custom-class"
popperPlacement="top-end"
popperModifiers={{
offset: {
enabled: true,
offset: '5px, 10px'
},
preventOverflow: {
enabled: true,
escapeWithReference: false,
boundariesElement: 'viewport'
}
}}/>
</div>
</div>
}
Expand Down
6 changes: 3 additions & 3 deletions docs-site/src/examples/custom_calendar_class_name.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ export default class CustomCalendarClassName extends React.Component {
</pre>
<div className="column">
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}
calendarClassName="rasta-stripes"/>
selected={this.state.startDate}
onChange={this.handleChange}
calendarClassName="rasta-stripes"/>
</div>
</div>
}
Expand Down
6 changes: 3 additions & 3 deletions docs-site/src/examples/custom_class_name.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export default class CustomClassName extends React.Component {
</pre>
<div className="column">
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}
className="red-border" />
selected={this.state.startDate}
onChange={this.handleChange}
className="red-border" />
</div>
</div>
}
Expand Down
12 changes: 6 additions & 6 deletions docs-site/src/examples/custom_date_format.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ export default class CustomDateFormat extends React.Component {
<pre className="column example__code">
<code className="jsx">
{'<DatePicker'}<br />
<strong>{'dateFormat="YYYY/MM/DD"'}</strong><br />
{'selected={this.state.startDate}'}<br />
{'onChange={this.handleChange} />'}
<strong>{'dateFormat="YYYY/MM/DD"'}</strong><br />
{'selected={this.state.startDate}'}<br />
{'onChange={this.handleChange} />'}
</code>
</pre>
<div className="column">
<DatePicker
dateFormat="YYYY/MM/DD"
selected={this.state.startDate}
onChange={this.handleChange} />
dateFormat="YYYY/MM/DD"
selected={this.state.startDate}
onChange={this.handleChange} />
</div>
</div>
}
Expand Down
6 changes: 3 additions & 3 deletions docs-site/src/examples/custom_day_class_names.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export default class CustomDayClassNames extends React.Component {
</pre>
<div className="column">
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}
dayClassName={date => date.date() < Math.random() * 31 ? 'random' : undefined} />
selected={this.state.startDate}
onChange={this.handleChange}
dayClassName={date => date.date() < Math.random() * 31 ? 'random' : undefined} />
</div>
</div>
}
Expand Down
12 changes: 6 additions & 6 deletions docs-site/src/examples/custom_input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class ExampleCustomInput extends React.Component {
render () {
return (
<button
className="example-custom-input"
onClick={this.props.onClick}>
{this.props.value}
className="example-custom-input"
onClick={this.props.onClick}>
{this.props.value}
</button>
)
}
Expand Down Expand Up @@ -68,9 +68,9 @@ ExampleCustomInput.propTypes = {
</pre>
<div className="column">
<DatePicker
customInput={<ExampleCustomInput />}
selected={this.state.startDate}
onChange={this.handleChange} />
customInput={<ExampleCustomInput />}
selected={this.state.startDate}
onChange={this.handleChange} />
</div>
</div>
}
Expand Down
20 changes: 10 additions & 10 deletions docs-site/src/examples/date_range.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ export default class DateRange extends React.Component {
</pre>
<div className="column">
<DatePicker
selected={this.state.startDate}
selectsStart
startDate={this.state.startDate}
endDate={this.state.endDate}
onChange={this.handleChangeStart} />
selected={this.state.startDate}
selectsStart
startDate={this.state.startDate}
endDate={this.state.endDate}
onChange={this.handleChangeStart} />
<DatePicker
selected={this.state.endDate}
selectsEnd
startDate={this.state.startDate}
endDate={this.state.endDate}
onChange={this.handleChangeEnd} />
selected={this.state.endDate}
selectsEnd
startDate={this.state.startDate}
endDate={this.state.endDate}
onChange={this.handleChangeEnd} />
</div>
</div>
}
Expand Down
4 changes: 2 additions & 2 deletions docs-site/src/examples/default.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export default class Default extends React.Component {
</pre>
<div className="column">
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange} />
selected={this.state.startDate}
onChange={this.handleChange} />
</div>
</div>
}
Expand Down
18 changes: 9 additions & 9 deletions docs-site/src/examples/disabled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ export default class Disabled extends React.Component {
return <div className="row">
<pre className="column example__code">
<code className="jsx">
{'<DatePicker'}<br />
{' selected={this.state.startDate}'}<br />
{' onChange={this.handleChange}'}<br />
<strong>{' disabled={true}'}</strong><br />
{' placeholderText="This is disabled"'} />
{'<DatePicker'}<br />
{' selected={this.state.startDate}'}<br />
{' onChange={this.handleChange}'}<br />
<strong>{' disabled={true}'}</strong><br />
{' placeholderText="This is disabled"'} />
</code>
</pre>
<div className="column">
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}
disabled
placeholderText="This is disabled" />
selected={this.state.startDate}
onChange={this.handleChange}
disabled
placeholderText="This is disabled" />
</div>
</div>
}
Expand Down
16 changes: 8 additions & 8 deletions docs-site/src/examples/disabled_keyboard_navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ export default class DisabledKeyboardNavigation extends React.Component {
<pre className="column example__code">
<code className="jsx">
{'<DatePicker'}<br />
{'selected={this.state.startDate}'}<br />
{'onChange={this.handleChange}'}<br />
<strong>{'disabledKeyboardNavigation'}</strong><br />
{'placeholderText="This has disabled keyboard navigation" />'}
{'selected={this.state.startDate}'}<br />
{'onChange={this.handleChange}'}<br />
<strong>{'disabledKeyboardNavigation'}</strong><br />
{'placeholderText="This has disabled keyboard navigation" />'}
</code>
</pre>
<div className="column">
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}
disabledKeyboardNavigation
placeholderText="This has disabled keyboard navigation" />
selected={this.state.startDate}
onChange={this.handleChange}
disabledKeyboardNavigation
placeholderText="This has disabled keyboard navigation" />
</div>
</div>
}
Expand Down
6 changes: 3 additions & 3 deletions docs-site/src/examples/dont_close_onSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export default class DontCloseOnSelect extends React.Component {
</pre>
<div className="column">
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}
shouldCloseOnSelect={false} />
selected={this.state.startDate}
onChange={this.handleChange}
shouldCloseOnSelect={false} />
</div>
</div>
}
Expand Down
18 changes: 9 additions & 9 deletions docs-site/src/examples/exclude_dates.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ export default class ExcludeDates extends React.Component {
return <div className="row">
<pre className="column example__code">
<code className="jsx">
{'<DatePicker'}<br />
{' selected={this.state.startDate}'}<br />
{' onChange={this.handleChange}'}<br />
<strong>{' excludeDates={[moment(), moment().subtract(1, "days")]}'}</strong><br />
{' placeholderText="Select a date other than today or yesterday" />'}
{'<DatePicker'}<br />
{' selected={this.state.startDate}'}<br />
{' onChange={this.handleChange}'}<br />
<strong>{' excludeDates={[moment(), moment().subtract(1, "days")]}'}</strong><br />
{' placeholderText="Select a date other than today or yesterday" />'}
</code>
</pre>
<div className="column">
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}
excludeDates={[moment(), moment().subtract(1, 'days')]}
placeholderText="Select a date other than today or yesterday" />
selected={this.state.startDate}
onChange={this.handleChange}
excludeDates={[moment(), moment().subtract(1, 'days')]}
placeholderText="Select a date other than today or yesterday" />
</div>
</div>
}
Expand Down
28 changes: 14 additions & 14 deletions docs-site/src/examples/exclude_time_period.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ export default class ExcludeTimePeriod extends React.Component {
return <div className="row">
<pre className="column example__code">
<code className="jsx">
{'<DatePicker'}<br />
{' selected={this.state.startDate}'}<br />
{' onChange={this.handleChange}'}<br />
<strong>{' showTimeSelect'}<br />
{' minTime={moment().hours(17).minutes(0)}'}<br />
{' maxTime={moment().hours(20).minutes(30)}'}<br />
{' dateFormat="LLL"'}</strong><br />
{'/>'}
{'<DatePicker'}<br />
{' selected={this.state.startDate}'}<br />
{' onChange={this.handleChange}'}<br />
<strong>{' showTimeSelect'}<br />
{' minTime={moment().hours(17).minutes(0)}'}<br />
{' maxTime={moment().hours(20).minutes(30)}'}<br />
{' dateFormat="LLL"'}</strong><br />
{'/>'}
</code>
</pre>
<div className="column">
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}
showTimeSelect
minTime={moment().hours(17).minutes(0)}
maxTime={moment().hours(20).minutes(30)}
dateFormat="LLL" />
selected={this.state.startDate}
onChange={this.handleChange}
showTimeSelect
minTime={moment().hours(17).minutes(0)}
maxTime={moment().hours(20).minutes(30)}
dateFormat="LLL" />
</div>
</div>
}
Expand Down
Loading

0 comments on commit dc89f5b

Please sign in to comment.