Commit 27ef40fe authored by Donald Cook's avatar Donald Cook

Moved descriptionVersion to a getter

parent 9d12e062
......@@ -28,6 +28,8 @@ export const getUserData = state => state.userData || {};
export const getUserDataByProp = state => prop => state.userData && state.userData[prop];
export const descriptionVersion = state => state.descriptionVersion;
export const notesById = state =>
state.discussions.reduce((acc, note) => {
note.notes.every(n => Object.assign(acc, { [n.id]: n }));
......
......@@ -54,8 +54,8 @@ export default {
};
},
computed: {
...mapGetters(['targetNoteHash']),
...mapState(['descriptionVersion', 'isLoadingDescriptionVersion']),
...mapGetters(['targetNoteHash', 'descriptionVersion']),
...mapState(['isLoadingDescriptionVersion']),
noteAnchorId() {
return `note_${this.note.id}`;
},
......
......@@ -35,6 +35,7 @@ describe('Getters Notes Store', () => {
notesData: notesDataMock,
userData: userDataMock,
noteableData: noteableDataMock,
descriptionVersion: 'descriptionVersion',
};
});
......@@ -385,4 +386,10 @@ describe('Getters Notes Store', () => {
expect(getters.getDiscussion(state)('1')).toEqual({ id: '1' });
});
});
describe('descriptionVersion', () => {
it('should return `descriptionVersion`', () => {
expect(getters.descriptionVersion(state)).toEqual('descriptionVersion');
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment