diff --git a/src/js/__tests__/GlobalStateStore.spec.js b/src/js/__tests__/GlobalStateStore.spec.js index 7a07260d..c2590946 100644 --- a/src/js/__tests__/GlobalStateStore.spec.js +++ b/src/js/__tests__/GlobalStateStore.spec.js @@ -10,4 +10,12 @@ describe('this store', function() { expect(GlobalStateStore.getIsAnimating()).toEqual(false); }); + it('can change flip treey', function() { + expect(GlobalStateStore.getFlipTreeY()).toEqual(false); + GlobalStateActions.changeFlipTreeY(true); + expect(GlobalStateStore.getFlipTreeY()).toEqual(true); + GlobalStateActions.changeFlipTreeY(false); + expect(GlobalStateStore.getFlipTreeY()).toEqual(false); + }); + }); diff --git a/src/js/actions/GlobalStateActions.js b/src/js/actions/GlobalStateActions.js index f21fdb2c..58f3f121 100644 --- a/src/js/actions/GlobalStateActions.js +++ b/src/js/actions/GlobalStateActions.js @@ -12,6 +12,13 @@ var GlobalStateActions = { type: ActionTypes.CHANGE_IS_ANIMATING, isAnimating: isAnimating }); + }, + + changeFlipTreeY: function(flipTreeY) { + AppDispatcher.handleViewAction({ + type: ActionTypes.CHANGE_FLIP_TREE_Y, + flipTreeY: flipTreeY + }); } }; diff --git a/src/js/constants/AppConstants.js b/src/js/constants/AppConstants.js index 2469ed28..c8992247 100644 --- a/src/js/constants/AppConstants.js +++ b/src/js/constants/AppConstants.js @@ -20,6 +20,7 @@ module.exports = { ActionTypes: keyMirror({ CHANGE_IS_ANIMATING: null, + CHANGE_FLIP_TREE_Y: null, SUBMIT_COMMAND: null, CHANGE_LOCALE: null, CHANGE_LOCALE_FROM_HEADER: null diff --git a/src/js/stores/GlobalStateStore.js b/src/js/stores/GlobalStateStore.js index c93b4131..03215072 100644 --- a/src/js/stores/GlobalStateStore.js +++ b/src/js/stores/GlobalStateStore.js @@ -9,6 +9,7 @@ var assign = require('object-assign'); var ActionTypes = AppConstants.ActionTypes; var _isAnimating = false; +var _flipTreeY = false; var GlobalStateStore = assign( {}, @@ -19,6 +20,10 @@ AppConstants.StoreSubscribePrototype, return _isAnimating; }, + getFlipTreeY: function() { + return _flipTreeY; + }, + dispatchToken: AppDispatcher.register(function(payload) { var action = payload.action; var shouldInform = false; @@ -29,6 +34,8 @@ AppConstants.StoreSubscribePrototype, shouldInform = true; break; case ActionTypes.CHANGE_FLIP_TREE_Y: + _flipTreeY = action.flipTreeY; + shouldInform = true; break; }