aboutsummaryrefslogtreecommitdiffstats
path: root/spec/javascripts
diff options
context:
space:
mode:
authorThomas Haddad2017-03-08 15:01:37 +0100
committerThomas Haddad2017-03-08 15:03:09 +0100
commitbb10391face1fb10689e2210d192a918a2078aa0 (patch)
treee9686a385952ca6ca727176aab1504109df9245d /spec/javascripts
parentc6f1b8de3efa57c647cf44d23a2c39383075f508 (diff)
downloadchouette-core-bb10391face1fb10689e2210d192a918a2078aa0.tar.bz2
Refs #2507: fix whole query system with batchActions and queryString
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/vehicle_journeys/actions_spec.js19
-rw-r--r--spec/javascripts/vehicle_journeys/reducers/filters_spec.js5
2 files changed, 17 insertions, 7 deletions
diff --git a/spec/javascripts/vehicle_journeys/actions_spec.js b/spec/javascripts/vehicle_journeys/actions_spec.js
index 45e43ab9f..ac73462e0 100644
--- a/spec/javascripts/vehicle_journeys/actions_spec.js
+++ b/spec/javascripts/vehicle_journeys/actions_spec.js
@@ -72,6 +72,7 @@ describe('when clicking on validate button inside create modal', () => {
describe('when previous navigation button is clicked', () => {
it('should create an action to go to previous page', () => {
const nextPage = false
+ const queryString = ''
const pagination = {
totalCount: 25,
perPage: 12,
@@ -81,13 +82,15 @@ describe('when previous navigation button is clicked', () => {
type: 'GO_TO_PREVIOUS_PAGE',
dispatch,
pagination,
- nextPage
+ nextPage,
+ queryString
}
- expect(actions.goToPreviousPage(dispatch, pagination)).toEqual(expectedAction)
+ expect(actions.goToPreviousPage(dispatch, pagination, queryString)).toEqual(expectedAction)
})
})
describe('when next navigation button is clicked', () => {
it('should create an action to go to next page', () => {
+ const queryString = ''
const nextPage = true
const pagination = {
totalCount: 25,
@@ -98,9 +101,10 @@ describe('when next navigation button is clicked', () => {
type: 'GO_TO_NEXT_PAGE',
dispatch,
pagination,
- nextPage
+ nextPage,
+ queryString
}
- expect(actions.goToNextPage(dispatch, pagination)).toEqual(expectedAction)
+ expect(actions.goToNextPage(dispatch, pagination, queryString)).toEqual(expectedAction)
})
})
describe('when checking a vehicleJourney', () => {
@@ -273,7 +277,12 @@ describe('when using select2 to pick a timetable', () => {
describe('when clicking on reset button inside query filters', () => {
it('should create an action to reset the query filters', () => {
const expectedAction = {
- type: 'RESET_FILTERS',
+ type: 'BATCH',
+ payload: [
+ {type: 'RESET_FILTERS'},
+ {type: 'RESET_PAGINATION'},
+ {type: 'QUERY_FILTER_VEHICLEJOURNEYS', dispatch: undefined},
+ ]
}
expect(actions.resetFilters()).toEqual(expectedAction)
})
diff --git a/spec/javascripts/vehicle_journeys/reducers/filters_spec.js b/spec/javascripts/vehicle_journeys/reducers/filters_spec.js
index 02072192f..c985733c8 100644
--- a/spec/javascripts/vehicle_journeys/reducers/filters_spec.js
+++ b/spec/javascripts/vehicle_journeys/reducers/filters_spec.js
@@ -29,8 +29,9 @@ describe('filters reducer', () => {
},
journeyPattern: {},
timetable: {},
- withoutSchedule: false
- }
+ withoutSchedule: false,
+ },
+ queryString: ''
}
})