diff options
| author | Thomas Haddad | 2017-02-16 11:56:46 +0100 |
|---|---|---|
| committer | Thomas Haddad | 2017-02-16 11:56:46 +0100 |
| commit | 69495e859893db0d3d75fbac23ac346a8bdc7eec (patch) | |
| tree | 7ac9886a274379dc845e35a4fe8a15a34eecf62c /spec/javascripts | |
| parent | f36e853b5113225d26d3eda434a2f7db8a877739 (diff) | |
| download | chouette-core-69495e859893db0d3d75fbac23ac346a8bdc7eec.tar.bz2 | |
Refs #2521: Add confirm modal when changing page if modifications were previously done
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
Diffstat (limited to 'spec/javascripts')
| -rw-r--r-- | spec/javascripts/vehicle_journeys/reducers/modal_spec.js | 44 | ||||
| -rw-r--r-- | spec/javascripts/vehicle_journeys/reducers/pagination_spec.js | 17 |
2 files changed, 61 insertions, 0 deletions
diff --git a/spec/javascripts/vehicle_journeys/reducers/modal_spec.js b/spec/javascripts/vehicle_journeys/reducers/modal_spec.js new file mode 100644 index 000000000..8da8e6c65 --- /dev/null +++ b/spec/javascripts/vehicle_journeys/reducers/modal_spec.js @@ -0,0 +1,44 @@ +var modalReducer = require('es6_browserified/vehicle_journeys/reducers/modal') + +let state = {} + +const cb = function(){} + +describe('modal reducer', () => { + beforeEach(() => { + state = { + type: '', + modalProps: {}, + confirmModal: {} + } + }) + + it('should return the initial state', () => { + expect( + modalReducer(undefined, {}) + ).toEqual({}) + }) + + it('should handle OPEN_CONFIRM_MODAL', () => { + let newState = Object.assign({}, state, { + type: 'confirm', + confirmModal: { + callback: cb + } + }) + expect( + modalReducer(state, { + type: 'OPEN_CONFIRM_MODAL', + callback: cb + }) + ).toEqual(newState) + }) + + it('should handle CLOSE_MODAL', () => { + expect( + modalReducer(state, { + type: 'CLOSE_MODAL' + }) + ).toEqual(state) + }) +}) diff --git a/spec/javascripts/vehicle_journeys/reducers/pagination_spec.js b/spec/javascripts/vehicle_journeys/reducers/pagination_spec.js index 240d99c85..2dd600436 100644 --- a/spec/javascripts/vehicle_journeys/reducers/pagination_spec.js +++ b/spec/javascripts/vehicle_journeys/reducers/pagination_spec.js @@ -39,6 +39,23 @@ describe('pagination reducer, given parameters allowing page change', () => { }) ).toEqual(Object.assign({}, state, {page : state.page - 1, stateChanged: false})) }) + + it('should handle UPDATE_TIME', () => { + const val = '33', subIndex = 0, index = 0, timeUnit = 'minute', isDeparture = true, isArrivalsToggled = true + expect( + reducer(state, { + type: 'UPDATE_TIME', + val, + subIndex, + index, + timeUnit, + isDeparture, + isArrivalsToggled + }) + ).toEqual(Object.assign({}, state, {stateChanged: true}) +) + }) + }) |
