flip tree Y

This commit is contained in:
Peter Cottle 2015-03-28 14:16:09 -07:00
parent e03bdc619f
commit c7cede468b
4 changed files with 23 additions and 0 deletions

View file

@ -10,4 +10,12 @@ describe('this store', function() {
expect(GlobalStateStore.getIsAnimating()).toEqual(false); 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);
});
}); });

View file

@ -12,6 +12,13 @@ var GlobalStateActions = {
type: ActionTypes.CHANGE_IS_ANIMATING, type: ActionTypes.CHANGE_IS_ANIMATING,
isAnimating: isAnimating isAnimating: isAnimating
}); });
},
changeFlipTreeY: function(flipTreeY) {
AppDispatcher.handleViewAction({
type: ActionTypes.CHANGE_FLIP_TREE_Y,
flipTreeY: flipTreeY
});
} }
}; };

View file

@ -20,6 +20,7 @@ module.exports = {
ActionTypes: keyMirror({ ActionTypes: keyMirror({
CHANGE_IS_ANIMATING: null, CHANGE_IS_ANIMATING: null,
CHANGE_FLIP_TREE_Y: null,
SUBMIT_COMMAND: null, SUBMIT_COMMAND: null,
CHANGE_LOCALE: null, CHANGE_LOCALE: null,
CHANGE_LOCALE_FROM_HEADER: null CHANGE_LOCALE_FROM_HEADER: null

View file

@ -9,6 +9,7 @@ var assign = require('object-assign');
var ActionTypes = AppConstants.ActionTypes; var ActionTypes = AppConstants.ActionTypes;
var _isAnimating = false; var _isAnimating = false;
var _flipTreeY = false;
var GlobalStateStore = assign( var GlobalStateStore = assign(
{}, {},
@ -19,6 +20,10 @@ AppConstants.StoreSubscribePrototype,
return _isAnimating; return _isAnimating;
}, },
getFlipTreeY: function() {
return _flipTreeY;
},
dispatchToken: AppDispatcher.register(function(payload) { dispatchToken: AppDispatcher.register(function(payload) {
var action = payload.action; var action = payload.action;
var shouldInform = false; var shouldInform = false;
@ -29,6 +34,8 @@ AppConstants.StoreSubscribePrototype,
shouldInform = true; shouldInform = true;
break; break;
case ActionTypes.CHANGE_FLIP_TREE_Y: case ActionTypes.CHANGE_FLIP_TREE_Y:
_flipTreeY = action.flipTreeY;
shouldInform = true;
break; break;
} }