aboutsummaryrefslogtreecommitdiffstats
path: root/spec/javascript
diff options
context:
space:
mode:
authorLuc Donnet2018-01-31 12:20:25 +0100
committerGitHub2018-01-31 12:20:25 +0100
commit4fa30ef61bd334de0627267b7b2eda4e09c8b728 (patch)
treefa73d3d20cfa67a818b6f1d5f3a0a03898659cad /spec/javascript
parente54ee3a4379afb763906ab2ba2fd980349c48334 (diff)
parentc463c3a950246c4c2660ce7df1c1ea8f2acbe578 (diff)
downloadchouette-core-4fa30ef61bd334de0627267b7b2eda4e09c8b728.tar.bz2
Merge pull request #263 from af83/5750-non-commercial-stop-areas
5750 non commercial stop areas
Diffstat (limited to 'spec/javascript')
-rw-r--r--spec/javascript/vehicle_journeys/actions_spec.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/javascript/vehicle_journeys/actions_spec.js b/spec/javascript/vehicle_journeys/actions_spec.js
index 9515b57f2..d486c9af8 100644
--- a/spec/javascript/vehicle_journeys/actions_spec.js
+++ b/spec/javascript/vehicle_journeys/actions_spec.js
@@ -37,6 +37,47 @@ describe('when clicking on add button', () => {
expect(actions.openCreateModal()).toEqual(expectedAction)
})
})
+describe('when validating the form', () => {
+ it('should check that non-commercial stops have passing time', () => {
+ let state = [{
+ vehicle_journey_at_stops: [{
+ area_kind: "non_commercial",
+ departure_time: {
+ hour: "00",
+ minute: "00"
+ }
+ }]
+ }]
+
+ expect(actions.validate(dispatch, state)).toEqual(false)
+
+ state = [{
+ vehicle_journey_at_stops: [{
+ area_kind: "non_commercial",
+ departure_time: {
+ hour: "00",
+ minute: "01"
+ }
+ }]
+ }]
+
+ expect(actions.validate(dispatch, state)).toEqual(true)
+ })
+
+ it('should not check that commercial stops', () => {
+ let state = [{
+ vehicle_journey_at_stops: [{
+ area_kind: "commercial",
+ departure_time: {
+ hour: "00",
+ minute: "00"
+ }
+ }]
+ }]
+
+ expect(actions.validate(dispatch, state)).toEqual(true)
+ })
+})
describe('when using select2 to pick a journey pattern', () => {
it('should create an action to select a journey pattern inside modal', () => {
let selectedJP = {