diff options
| author | Thomas Haddad | 2017-05-05 15:33:40 +0200 |
|---|---|---|
| committer | Thomas Haddad | 2017-05-05 15:34:06 +0200 |
| commit | ef13c897645ed2397db3fede5257a41f62ca9c39 (patch) | |
| tree | 4569b2c9337ccdb3037fe142b46fd952ba996a4a | |
| parent | d0ebc8b7055fcf4afc749400c8c348beca835c1b (diff) | |
| download | chouette-core-ef13c897645ed2397db3fede5257a41f62ca9c39.tar.bz2 | |
Js gardening in timetable actions & action specs
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
4 files changed, 10 insertions, 14 deletions
diff --git a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js b/app/assets/javascripts/es6_browserified/time_tables/actions/index.js index 48d3a585f..3f15b7f01 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js +++ b/app/assets/javascripts/es6_browserified/time_tables/actions/index.js @@ -104,16 +104,14 @@ const actions = { timeTablePeriods, metas }), - includeDateInPeriod: (index, day, dayTypes) => ({ + includeDateInPeriod: (index, dayTypes) => ({ type: 'INCLUDE_DATE_IN_PERIOD', index, - day, dayTypes }), - excludeDateFromPeriod: (index, day, dayTypes) => ({ + excludeDateFromPeriod: (index, dayTypes) => ({ type: 'EXCLUDE_DATE_FROM_PERIOD', index, - day, dayTypes }), openConfirmModal : (callback) => ({ diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/ExceptionsInDay.js b/app/assets/javascripts/es6_browserified/time_tables/components/ExceptionsInDay.js index 13615a6ef..e90099283 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/components/ExceptionsInDay.js +++ b/app/assets/javascripts/es6_browserified/time_tables/components/ExceptionsInDay.js @@ -21,7 +21,7 @@ class ExceptionsInDay extends Component { data-actiontype='remove' onClick={(e) => { $(e.currentTarget).toggleClass('active') - this.props.onExcludeDateFromPeriod(this.props.index, this.props.value.current_month[this.props.index], this.props.metas.day_types) + this.props.onExcludeDateFromPeriod(this.props.index, this.props.metas.day_types) }} > <span className='fa fa-times'></span> @@ -37,7 +37,7 @@ class ExceptionsInDay extends Component { data-actiontype='add' onClick={(e) => { $(e.currentTarget).toggleClass('active') - this.props.onIncludeDateInPeriod(this.props.index, this.props.value.current_month[this.props.index], this.props.metas.day_types) + this.props.onIncludeDateInPeriod(this.props.index, this.props.metas.day_types) }} > <span className='fa fa-plus'></span> diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js b/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js index 2a17d3dea..c6b5fcc6b 100644 --- a/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js +++ b/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js @@ -15,11 +15,11 @@ const mapDispatchToProps = (dispatch) => { onDeletePeriod: (index, dayTypes) =>{ dispatch(actions.deletePeriod(index, dayTypes)) }, - onExcludeDateFromPeriod: (index, day, dayTypes) => { - dispatch(actions.excludeDateFromPeriod(index, day, dayTypes)) + onExcludeDateFromPeriod: (index, dayTypes) => { + dispatch(actions.excludeDateFromPeriod(index, dayTypes)) }, - onIncludeDateInPeriod: (index, day, dayTypes) => { - dispatch(actions.includeDateInPeriod(index, day, dayTypes)) + onIncludeDateInPeriod: (index, dayTypes) => { + dispatch(actions.includeDateInPeriod(index, dayTypes)) }, onOpenEditPeriodForm: (period, index) => { dispatch(actions.openEditPeriodForm(period, index)) diff --git a/spec/javascripts/time_table/actions_spec.js b/spec/javascripts/time_table/actions_spec.js index 73b2d2ac9..a8abd8f90 100644 --- a/spec/javascripts/time_table/actions_spec.js +++ b/spec/javascripts/time_table/actions_spec.js @@ -171,10 +171,9 @@ describe('actions', () => { const expectedAction = { type: 'INCLUDE_DATE_IN_PERIOD', index, - day, dayTypes } - expect(actions.includeDateInPeriod(index, day, dayTypes)).toEqual(expectedAction) + expect(actions.includeDateInPeriod(index, dayTypes)).toEqual(expectedAction) }) it('should create an action to exclude date from period', () => { @@ -182,10 +181,9 @@ describe('actions', () => { const expectedAction = { type: 'EXCLUDE_DATE_FROM_PERIOD', index, - day, dayTypes } - expect(actions.excludeDateFromPeriod(index, day, dayTypes)).toEqual(expectedAction) + expect(actions.excludeDateFromPeriod(index, dayTypes)).toEqual(expectedAction) }) it('should create an action to open confirm modal', () => { |
