aboutsummaryrefslogtreecommitdiffstats
path: root/spec/javascripts
diff options
context:
space:
mode:
authorcedricnjanga2017-08-28 18:07:46 +0200
committercedricnjanga2017-08-28 18:18:51 +0200
commit24fdf8c88330a4851b7f17000da9fbe365e54dfd (patch)
treee6c4b493859dff36ea0e3b9e5b4067d19dfa260c /spec/javascripts
parent559dfcd5473cd106ef98826f19df22e2cbb2a4c5 (diff)
downloadchouette-core-24fdf8c88330a4851b7f17000da9fbe365e54dfd.tar.bz2
Timetable validate form update
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/time_table/actions_spec.js6
-rw-r--r--spec/javascripts/time_table/reducers/modal_spec.js13
-rw-r--r--spec/javascripts/time_table/reducers/timetable_spec.js3
3 files changed, 14 insertions, 8 deletions
diff --git a/spec/javascripts/time_table/actions_spec.js b/spec/javascripts/time_table/actions_spec.js
index f32e93327..f052aeece 100644
--- a/spec/javascripts/time_table/actions_spec.js
+++ b/spec/javascripts/time_table/actions_spec.js
@@ -159,14 +159,16 @@ describe('actions', () => {
let timeTablePeriods = []
let metas = {}
let timetableInDates = []
+ let error = ''
const expectedAction = {
type: 'VALIDATE_PERIOD_FORM',
modalProps,
timeTablePeriods,
metas,
- timetableInDates
+ timetableInDates,
+ error
}
- expect(actions.validatePeriodForm(modalProps, timeTablePeriods, metas, timetableInDates)).toEqual(expectedAction)
+ expect(actions.validatePeriodForm(modalProps, timeTablePeriods, metas, timetableInDates, error)).toEqual(expectedAction)
})
it('should create an action to include date in period', () => {
diff --git a/spec/javascripts/time_table/reducers/modal_spec.js b/spec/javascripts/time_table/reducers/modal_spec.js
index 160f3955f..570eb85ed 100644
--- a/spec/javascripts/time_table/reducers/modal_spec.js
+++ b/spec/javascripts/time_table/reducers/modal_spec.js
@@ -154,7 +154,7 @@ describe('modal reducer', () => {
error: ''
}
let newModalProps = {
- active: false,
+ active: true,
begin: {
day: '01',
month: '01',
@@ -177,7 +177,8 @@ describe('modal reducer', () => {
type: 'VALIDATE_PERIOD_FORM',
modalProps : modProps,
timeTablePeriods: ttperiods,
- timetableInDates: ttdates
+ timetableInDates: ttdates,
+ error: 'La date de départ doit être antérieure à la date de fin'
})
).toEqual(Object.assign({}, state, {modalProps: newModalProps}))
})
@@ -247,7 +248,8 @@ describe('modal reducer', () => {
type: 'VALIDATE_PERIOD_FORM',
modalProps : modProps2,
timeTablePeriods: ttperiods2,
- timetableInDates: ttdates2
+ timetableInDates: ttdates2,
+ error: "Les périodes ne peuvent pas se chevaucher"
})
).toEqual(Object.assign({}, state2, {modalProps: newModalProps2}))
})
@@ -273,7 +275,7 @@ describe('modal reducer', () => {
type: ''
}
let modProps3 = {
- active: false,
+ active: true,
begin: {
day: '01',
month: '08',
@@ -312,7 +314,8 @@ describe('modal reducer', () => {
type: 'VALIDATE_PERIOD_FORM',
modalProps : modProps3,
timeTablePeriods: ttperiods3,
- timetableInDates: ttdates3
+ timetableInDates: ttdates3,
+ error: "Une période ne peut chevaucher une date dans un calendrier"
})
).toEqual(Object.assign({}, state3, {modalProps: newModalProps3}))
})
diff --git a/spec/javascripts/time_table/reducers/timetable_spec.js b/spec/javascripts/time_table/reducers/timetable_spec.js
index 5b3561a5f..6585a78a0 100644
--- a/spec/javascripts/time_table/reducers/timetable_spec.js
+++ b/spec/javascripts/time_table/reducers/timetable_spec.js
@@ -231,7 +231,8 @@ describe('timetable reducer with filled state', () => {
metas: {
day_types: arrDayTypes
},
- timetableInDates: state.time_table_dates.filter(d => d.in_out == true)
+ timetableInDates: state.time_table_dates.filter(d => d.in_out == true),
+ error: modalProps.error
})
).toEqual(newState)
})