aboutsummaryrefslogtreecommitdiffstats
path: root/spec/javascripts
diff options
context:
space:
mode:
authorcedricnjanga2017-08-25 16:27:59 +0200
committercedricnjanga2017-08-25 16:46:55 +0200
commitb240f38d661e6e11428e3f09258ba29bcbf228bb (patch)
tree25b4c6df208780ada787791f696c2db2301ff504 /spec/javascripts
parent2434f8e41b7b718b115a023aa8cdbb99045e092d (diff)
downloadchouette-core-b240f38d661e6e11428e3f09258ba29bcbf228bb.tar.bz2
Clean timetable dates after updating day types
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/time_table/reducers/timetable_spec.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/javascripts/time_table/reducers/timetable_spec.js b/spec/javascripts/time_table/reducers/timetable_spec.js
index 805a29b5f..5b3561a5f 100644
--- a/spec/javascripts/time_table/reducers/timetable_spec.js
+++ b/spec/javascripts/time_table/reducers/timetable_spec.js
@@ -192,6 +192,19 @@ describe('timetable reducer with filled state', () => {
).toEqual(newState)
})
+ it('should handle UPDATE_DAY_TYPES and remove out_day that are out of day types', () => {
+ state.time_table_dates = [{date: "2017-05-01", in_out: false}]
+ let newArrDayTypes = arrDayTypes.slice(0)
+ newArrDayTypes[1] = false
+ let newState = Object.assign({}, state, {time_table_dates: []})
+ expect(
+ timetableReducer(state, {
+ type: 'UPDATE_DAY_TYPES',
+ dayTypes: newArrDayTypes
+ }).time_table_dates
+ ).toEqual([])
+ })
+
it('should handle VALIDATE_PERIOD_FORM and add period if modalProps index = false', () => {
let newPeriods = state.time_table_periods.concat({"period_start": "2018-05-15", "period_end": "2018-05-24"})
let newState = Object.assign({}, state, {time_table_periods: newPeriods})