aboutsummaryrefslogtreecommitdiffstats
path: root/spec/javascripts/actions_spec.js
diff options
context:
space:
mode:
authorAlban Peignier2016-11-20 22:38:47 +0100
committerAlban Peignier2016-11-20 22:38:47 +0100
commit85fd6480daebe50e423ba27bce772c7b7f86fbf6 (patch)
tree04285d132e00fa82cb4786f946a605ac9f549795 /spec/javascripts/actions_spec.js
parent7b05ae21fc9421b81fc071976f3bb98ed7c87f43 (diff)
parent65c8a96a00f8d3afbd02cfb019b34f39ad44bc3e (diff)
downloadchouette-core-85fd6480daebe50e423ba27bce772c7b7f86fbf6.tar.bz2
Merge branch 'master' into staging
Diffstat (limited to 'spec/javascripts/actions_spec.js')
-rw-r--r--spec/javascripts/actions_spec.js71
1 files changed, 71 insertions, 0 deletions
diff --git a/spec/javascripts/actions_spec.js b/spec/javascripts/actions_spec.js
new file mode 100644
index 000000000..55de1c31f
--- /dev/null
+++ b/spec/javascripts/actions_spec.js
@@ -0,0 +1,71 @@
+var actions = require('es6_browserified/actions')
+
+describe('actions', () => {
+ it('should create an action to add a stop', () => {
+ const expectedAction = {
+ type: 'ADD_STOP',
+ }
+ expect(actions.addStop()).toEqual(expectedAction)
+ })
+})
+describe('actions', () => {
+ it('should create an action to move up a stop', () => {
+ const index = 1
+ const expectedAction = {
+ type: 'MOVE_STOP_UP',
+ index
+ }
+ expect(actions.moveStopUp(index)).toEqual(expectedAction)
+ })
+})
+describe('actions', () => {
+ it('should create an action to move down a stop', () => {
+ const index = 1
+ const expectedAction = {
+ type: 'MOVE_STOP_DOWN',
+ index
+ }
+ expect(actions.moveStopDown(index)).toEqual(expectedAction)
+ })
+})
+describe('actions', () => {
+ it('should create an action to delete a stop', () => {
+ const index = 1
+ const expectedAction = {
+ type: 'DELETE_STOP',
+ index
+ }
+ expect(actions.deleteStop(index)).toEqual(expectedAction)
+ })
+})
+describe('actions', () => {
+ it('should create an action to update the value of a stop', () => {
+ const text = 'updated text'
+ const index = 1
+ const expectedAction = {
+ type: 'UPDATE_INPUT_VALUE',
+ index,
+ text
+ }
+ expect(actions.updateInputValue(index, text)).toEqual(expectedAction)
+ })
+})
+
+describe('actions', () => {
+ it('should create an action to update the up select of a stop', () => {
+ const event = {
+ currentTarget: {
+ value: 'forbidden',
+ id: 'up'
+ }
+ }
+ const index = 1
+ const expectedAction = {
+ type :'UPDATE_SELECT_VALUE',
+ select_id: 'up',
+ select_value: 'forbidden',
+ index
+ }
+ expect(actions.updateSelectValue(event, index)).toEqual(expectedAction)
+ })
+})