stub ADD_FEATURE reducer action
This commit is contained in:
parent
a6b362efda
commit
afea8906e1
2 changed files with 11 additions and 1 deletions
|
@ -5,7 +5,7 @@ describe('Features', () => {
|
|||
features: [
|
||||
'low', 'high','back', 'rounded', 'sonorant',
|
||||
'nasal', 'obstruent', 'occlusive', 'plosive',
|
||||
'prenasalized', 'aspirated', 'coronal', 'anterior'
|
||||
'prenasalized', 'aspirated', 'coronal'
|
||||
]
|
||||
};
|
||||
|
||||
|
@ -14,4 +14,9 @@ describe('Features', () => {
|
|||
expect(stateReducer(state, action)).toBe(state);
|
||||
});
|
||||
|
||||
it('feature addition returns new feature list', () => {
|
||||
const action = {type: 'ADD_FEATURE', value: {feature: 'anterior'}};
|
||||
expect(stateReducer(state, action)).toEqual({...state, features:[...state.features, action.value.feature]})
|
||||
})
|
||||
|
||||
});
|
|
@ -24,6 +24,11 @@ const stateReducer = (state, action) => {
|
|||
return {...state, lexicon: newLexicon}
|
||||
}
|
||||
|
||||
case 'ADD_FEATURE': {
|
||||
let newFeature = action.value.feature;
|
||||
return {...state, features:[...state.features, newFeature]}
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue