mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 17:00:04 +02:00
locale store and test
This commit is contained in:
parent
eba404c595
commit
ef74ac1cf8
4 changed files with 13 additions and 1 deletions
7
src/js/__tests__/LocaleStore.spec.js
Normal file
7
src/js/__tests__/LocaleStore.spec.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
|
||||
var LocaleStore = require('../stores/LocaleStore');
|
||||
|
||||
describe('LocaleStore', function() {
|
||||
it('changes locales', function() {
|
||||
});
|
||||
});
|
|
@ -8,6 +8,7 @@ var ActionTypes = AppConstants.ActionTypes;
|
|||
var LocaleActions = {
|
||||
|
||||
changeLocale: function(newLocale) {
|
||||
console.log('firingt his off', newLocale);
|
||||
AppDispatcher.handleViewAction({
|
||||
type: ActionTypes.CHANGE_LOCALE,
|
||||
locale: newLocale
|
||||
|
|
|
@ -8,6 +8,7 @@ var PayloadSources = AppConstants.PayloadSources;
|
|||
var AppDispatcher = new Dispatcher();
|
||||
|
||||
AppDispatcher.handleViewAction = function(action) {
|
||||
console.log('dispatching', action);
|
||||
this.dispatch({
|
||||
source: PayloadSources.VIEW_ACTION,
|
||||
action: action
|
||||
|
|
|
@ -30,10 +30,13 @@ var LocaleStore = assign({}, EventEmitter.prototype, {
|
|||
|
||||
switch (action.type) {
|
||||
case ActionTypes.CHANGE_LOCALE:
|
||||
_locale = action.locale;
|
||||
shouldInform = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (shouldInform) {
|
||||
this.emit(CHANGE_EVENT);
|
||||
LocaleStore.emit(CHANGE_EVENT);
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue