aboutsummaryrefslogtreecommitdiffstats
path: root/spec/javascripts
diff options
context:
space:
mode:
authorThomas Haddad2017-01-10 17:23:58 +0100
committerThomas Haddad2017-01-10 17:25:27 +0100
commit1ed5294c5227c2f8d24cb78c71a87f8f4d58f1b9 (patch)
treec48fb6f1e8738b05ab74e4145e2df159e689eaa4 /spec/javascripts
parent60bd5e945f959c080b3c478b0495dc39466ca80f (diff)
downloadchouette-core-1ed5294c5227c2f8d24cb78c71a87f8f4d58f1b9.tar.bz2
Refs #2205: Fix confirm modal being opened only when journey patterns state changed
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/journey_patterns/actions_spec.js7
-rw-r--r--spec/javascripts/journey_patterns/reducers/modal_spec.js9
-rw-r--r--spec/javascripts/journey_patterns/reducers/pagination_spec.js4
-rw-r--r--spec/javascripts/spec_helper.js2
4 files changed, 10 insertions, 12 deletions
diff --git a/spec/javascripts/journey_patterns/actions_spec.js b/spec/javascripts/journey_patterns/actions_spec.js
index ced053935..03198c2c4 100644
--- a/spec/javascripts/journey_patterns/actions_spec.js
+++ b/spec/javascripts/journey_patterns/actions_spec.js
@@ -53,13 +53,12 @@ describe('when clicking on a journey pattern checkbox', () => {
})
describe('when clicking on next button', () => {
it('should create an action to open a confirm modal', () => {
- const accept = {}, cancel = {}
+ const callback = function(){}
const expectedAction = {
type: 'OPEN_CONFIRM_MODAL',
- accept,
- cancel,
+ callback
}
- expect(actions.openConfirmModal(accept, cancel)).toEqual(expectedAction)
+ expect(actions.openConfirmModal(callback)).toEqual(expectedAction)
})
})
describe('when clicking on edit button', () => {
diff --git a/spec/javascripts/journey_patterns/reducers/modal_spec.js b/spec/javascripts/journey_patterns/reducers/modal_spec.js
index 46ab2d905..0bc7c9240 100644
--- a/spec/javascripts/journey_patterns/reducers/modal_spec.js
+++ b/spec/javascripts/journey_patterns/reducers/modal_spec.js
@@ -11,8 +11,7 @@ let fakeJourneyPattern = {
deletable: false
}
-const accept = function(){}
-const cancel = function(){}
+const cb = function(){}
describe('modal reducer', () => {
beforeEach(() => {
@@ -33,15 +32,13 @@ describe('modal reducer', () => {
let newState = Object.assign({}, state, {
type: 'confirm',
confirmModal: {
- accept: accept,
- cancel: cancel
+ callback: cb
}
})
expect(
modalReducer(state, {
type: 'OPEN_CONFIRM_MODAL',
- accept,
- cancel
+ callback: cb
})
).toEqual(newState)
})
diff --git a/spec/javascripts/journey_patterns/reducers/pagination_spec.js b/spec/javascripts/journey_patterns/reducers/pagination_spec.js
index a99e8ff85..1c8011fca 100644
--- a/spec/javascripts/journey_patterns/reducers/pagination_spec.js
+++ b/spec/javascripts/journey_patterns/reducers/pagination_spec.js
@@ -22,7 +22,7 @@ describe('pagination reducer, given parameters allowing page change', () => {
currentPage,
nextPage : true
})
- ).toEqual(Object.assign({}, state, {page : state.page + 1}))
+ ).toEqual(Object.assign({}, state, {page : state.page + 1, stateChanged: false}))
})
it('should return GO_TO_PREVIOUS_PAGE and change state', () => {
@@ -33,7 +33,7 @@ describe('pagination reducer, given parameters allowing page change', () => {
currentPage,
nextPage : false
})
- ).toEqual(Object.assign({}, state, {page : state.page - 1}))
+ ).toEqual(Object.assign({}, state, {page : state.page - 1, stateChanged: false}))
})
})
diff --git a/spec/javascripts/spec_helper.js b/spec/javascripts/spec_helper.js
index a2fde3860..a0285cccf 100644
--- a/spec/javascripts/spec_helper.js
+++ b/spec/javascripts/spec_helper.js
@@ -4,6 +4,8 @@
// require support/jasmine-jquery-2.1.0
// require support/sinon
// require support/your-support-file
+//= require jquery
+//= require bootstrap-sass-official
require('es6-object-assign').polyfill();
//
// PhantomJS (Teaspoons default driver) doesn't have support for Function.prototype.bind, which has caused confusion.