diff options
| author | Thomas Haddad | 2017-03-08 15:18:46 +0100 |
|---|---|---|
| committer | Thomas Haddad | 2017-03-08 15:18:46 +0100 |
| commit | 62c1e3e5a8e27e9ddc8c8c538251db6dc3610109 (patch) | |
| tree | ab1ff35b79c0ad90318fd8c7eb4cd414ce2da1e8 /spec/javascripts | |
| parent | 7b270edbc5aada9f933c2e0fa162166ea539d84e (diff) | |
| download | chouette-core-62c1e3e5a8e27e9ddc8c8c538251db6dc3610109.tar.bz2 | |
Refs #2507: add some specs for latest actions/reducers w/filters
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
Diffstat (limited to 'spec/javascripts')
| -rw-r--r-- | spec/javascripts/vehicle_journeys/actions_spec.js | 21 | ||||
| -rw-r--r-- | spec/javascripts/vehicle_journeys/reducers/pagination_spec.js | 11 |
2 files changed, 30 insertions, 2 deletions
diff --git a/spec/javascripts/vehicle_journeys/actions_spec.js b/spec/javascripts/vehicle_journeys/actions_spec.js index ac73462e0..4851d6081 100644 --- a/spec/javascripts/vehicle_journeys/actions_spec.js +++ b/spec/javascripts/vehicle_journeys/actions_spec.js @@ -287,6 +287,19 @@ describe('when clicking on reset button inside query filters', () => { expect(actions.resetFilters()).toEqual(expectedAction) }) }) +describe('when clicking on filter button inside query filters', () => { + it('should create an action to filter', () => { + const expectedAction = { + type: 'BATCH', + payload: [ + {type: 'CREATE_QUERY_STRING'}, + {type: 'RESET_PAGINATION'}, + {type: 'QUERY_FILTER_VEHICLEJOURNEYS', dispatch: undefined}, + ] + } + expect(actions.filterQuery()).toEqual(expectedAction) + }) +}) describe('when clicking on checkbox to show vj without schedule', () => { it('should create an action to toggle this filter', () => { const expectedAction = { @@ -353,3 +366,11 @@ describe('when using select2 to pick a journeypattern in the filters', () => { expect(actions.filterSelect2JourneyPattern(selectedJP)).toEqual(expectedAction) }) }) +describe('when user clicked either on filter or reset button in filters', () => { + it('should create an action to reset pagination', () => { + const expectedAction = { + type: 'RESET_PAGINATION', + } + expect(actions.resetPagination()).toEqual(expectedAction) + }) +}) diff --git a/spec/javascripts/vehicle_journeys/reducers/pagination_spec.js b/spec/javascripts/vehicle_journeys/reducers/pagination_spec.js index 2dd600436..55e48dfd6 100644 --- a/spec/javascripts/vehicle_journeys/reducers/pagination_spec.js +++ b/spec/javascripts/vehicle_journeys/reducers/pagination_spec.js @@ -18,6 +18,14 @@ describe('pagination reducer, given parameters allowing page change', () => { ).toEqual({}) }) + it('should handle RESET_PAGINATION', () => { + expect( + reducer(state, { + type: 'RESET_PAGINATION', + }) + ).toEqual(Object.assign({}, state, {page: 1})) + }) + it('should handle GO_TO_NEXT_PAGE and change state', () => { expect( reducer(state, { @@ -52,8 +60,7 @@ describe('pagination reducer, given parameters allowing page change', () => { isDeparture, isArrivalsToggled }) - ).toEqual(Object.assign({}, state, {stateChanged: true}) -) + ).toEqual(Object.assign({}, state, {stateChanged: true})) }) }) |
