aboutsummaryrefslogtreecommitdiffstats
path: root/spec/javascripts
diff options
context:
space:
mode:
authorThomas Haddad2017-02-23 14:46:05 +0100
committerThomas Haddad2017-02-23 14:46:05 +0100
commitec224c3a86678c6765a8f5a4ba6700e66b747cc7 (patch)
treedcd65affdfcd2cf32f2581383a20839b7fdb85b6 /spec/javascripts
parentd397d16c2b9681228032df27039beb6acdba7564 (diff)
downloadchouette-core-ec224c3a86678c6765a8f5a4ba6700e66b747cc7.tar.bz2
Refs #2521: Add edit modal for vj medatatas (only comment editable)
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/vehicle_journeys/actions_spec.js10
-rw-r--r--spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js13
2 files changed, 23 insertions, 0 deletions
diff --git a/spec/javascripts/vehicle_journeys/actions_spec.js b/spec/javascripts/vehicle_journeys/actions_spec.js
index 952c80312..5d01ac284 100644
--- a/spec/javascripts/vehicle_journeys/actions_spec.js
+++ b/spec/javascripts/vehicle_journeys/actions_spec.js
@@ -132,6 +132,16 @@ describe('when clicking on validate button inside shifting modal', () => {
expect(actions.shiftVehicleJourney(data)).toEqual(expectedAction)
})
})
+describe('when clicking on validate button inside editing modal', () => {
+ it('should create an action to update a vehiclejourney', () => {
+ const data = {}
+ const expectedAction = {
+ type: 'EDIT_VEHICLEJOURNEY',
+ data
+ }
+ expect(actions.editVehicleJourney(data)).toEqual(expectedAction)
+ })
+})
describe('when clicking on validate button inside duplicating modal', () => {
it('should create an action to duplicate a vehiclejourney schedule', () => {
const data = {}
diff --git a/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js b/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js
index dc04d5bf7..35d53a1fd 100644
--- a/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js
+++ b/spec/javascripts/vehicle_journeys/reducers/vehicle_journeys_spec.js
@@ -201,4 +201,17 @@ describe('vehicleJourneys reducer', () => {
})
).toEqual([state[0], newVJ, state[1]])
})
+
+ it('should handle EDIT_VEHICLEJOURNEY', () => {
+ let fakeData = {
+ comment: {value : 'toto'},
+ }
+ let newVJ = Object.assign({}, state[0], {comment: fakeData.comment.value})
+ expect(
+ vjReducer(state, {
+ type: 'EDIT_VEHICLEJOURNEY',
+ data: fakeData
+ })
+ ).toEqual([newVJ, state[1]])
+ })
})