Commit 4e24ccc4 authored by Phil Hughes's avatar Phil Hughes

Merge branch 'gt-rename-diffs-store-variable' into 'master'

Rename diffs store variable

See merge request gitlab-org/gitlab-ce!23123
parents 4708f6af 4a2b1970
...@@ -167,7 +167,7 @@ export const expandAllFiles = ({ commit }) => { ...@@ -167,7 +167,7 @@ export const expandAllFiles = ({ commit }) => {
export const toggleFileDiscussions = ({ getters, dispatch }, diff) => { export const toggleFileDiscussions = ({ getters, dispatch }, diff) => {
const discussions = getters.getDiffFileDiscussions(diff); const discussions = getters.getDiffFileDiscussions(diff);
const shouldCloseAll = getters.diffHasAllExpandedDiscussions(diff); const shouldCloseAll = getters.diffHasAllExpandedDiscussions(diff);
const shouldExpandAll = getters.diffHasAllCollpasedDiscussions(diff); const shouldExpandAll = getters.diffHasAllCollapsedDiscussions(diff);
discussions.forEach(discussion => { discussions.forEach(discussion => {
const data = { discussionId: discussion.id }; const data = { discussionId: discussion.id };
......
...@@ -27,7 +27,7 @@ export const diffHasAllExpandedDiscussions = (state, getters) => diff => { ...@@ -27,7 +27,7 @@ export const diffHasAllExpandedDiscussions = (state, getters) => diff => {
* @param {Object} diff * @param {Object} diff
* @returns {Boolean} * @returns {Boolean}
*/ */
export const diffHasAllCollpasedDiscussions = (state, getters) => diff => { export const diffHasAllCollapsedDiscussions = (state, getters) => diff => {
const discussions = getters.getDiffFileDiscussions(diff); const discussions = getters.getDiffFileDiscussions(diff);
return ( return (
......
---
title: Rename diffs store variable
merge_request: 23123
author: George Tsiolis
type: other
...@@ -416,7 +416,7 @@ describe('DiffsStoreActions', () => { ...@@ -416,7 +416,7 @@ describe('DiffsStoreActions', () => {
const getters = { const getters = {
getDiffFileDiscussions: jasmine.createSpy().and.returnValue([{ id: 1 }]), getDiffFileDiscussions: jasmine.createSpy().and.returnValue([{ id: 1 }]),
diffHasAllExpandedDiscussions: jasmine.createSpy().and.returnValue(true), diffHasAllExpandedDiscussions: jasmine.createSpy().and.returnValue(true),
diffHasAllCollpasedDiscussions: jasmine.createSpy().and.returnValue(false), diffHasAllCollapsedDiscussions: jasmine.createSpy().and.returnValue(false),
}; };
const dispatch = jasmine.createSpy('dispatch'); const dispatch = jasmine.createSpy('dispatch');
...@@ -434,7 +434,7 @@ describe('DiffsStoreActions', () => { ...@@ -434,7 +434,7 @@ describe('DiffsStoreActions', () => {
const getters = { const getters = {
getDiffFileDiscussions: jasmine.createSpy().and.returnValue([{ id: 1 }]), getDiffFileDiscussions: jasmine.createSpy().and.returnValue([{ id: 1 }]),
diffHasAllExpandedDiscussions: jasmine.createSpy().and.returnValue(false), diffHasAllExpandedDiscussions: jasmine.createSpy().and.returnValue(false),
diffHasAllCollpasedDiscussions: jasmine.createSpy().and.returnValue(true), diffHasAllCollapsedDiscussions: jasmine.createSpy().and.returnValue(true),
}; };
const dispatch = jasmine.createSpy(); const dispatch = jasmine.createSpy();
...@@ -452,7 +452,7 @@ describe('DiffsStoreActions', () => { ...@@ -452,7 +452,7 @@ describe('DiffsStoreActions', () => {
const getters = { const getters = {
getDiffFileDiscussions: jasmine.createSpy().and.returnValue([{ expanded: false, id: 1 }]), getDiffFileDiscussions: jasmine.createSpy().and.returnValue([{ expanded: false, id: 1 }]),
diffHasAllExpandedDiscussions: jasmine.createSpy().and.returnValue(false), diffHasAllExpandedDiscussions: jasmine.createSpy().and.returnValue(false),
diffHasAllCollpasedDiscussions: jasmine.createSpy().and.returnValue(false), diffHasAllCollapsedDiscussions: jasmine.createSpy().and.returnValue(false),
}; };
const dispatch = jasmine.createSpy(); const dispatch = jasmine.createSpy();
......
...@@ -106,13 +106,13 @@ describe('Diffs Module Getters', () => { ...@@ -106,13 +106,13 @@ describe('Diffs Module Getters', () => {
}); });
}); });
describe('diffHasAllCollpasedDiscussions', () => { describe('diffHasAllCollapsedDiscussions', () => {
it('returns true when all discussions are collapsed', () => { it('returns true when all discussions are collapsed', () => {
discussionMock.diff_file.file_hash = diffFileMock.fileHash; discussionMock.diff_file.file_hash = diffFileMock.fileHash;
discussionMock.expanded = false; discussionMock.expanded = false;
expect( expect(
getters.diffHasAllCollpasedDiscussions(localState, { getters.diffHasAllCollapsedDiscussions(localState, {
getDiffFileDiscussions: () => [discussionMock], getDiffFileDiscussions: () => [discussionMock],
})(diffFileMock), })(diffFileMock),
).toEqual(true); ).toEqual(true);
...@@ -120,7 +120,7 @@ describe('Diffs Module Getters', () => { ...@@ -120,7 +120,7 @@ describe('Diffs Module Getters', () => {
it('returns false when there are no discussions', () => { it('returns false when there are no discussions', () => {
expect( expect(
getters.diffHasAllCollpasedDiscussions(localState, { getters.diffHasAllCollapsedDiscussions(localState, {
getDiffFileDiscussions: () => [], getDiffFileDiscussions: () => [],
})(diffFileMock), })(diffFileMock),
).toEqual(false); ).toEqual(false);
...@@ -130,7 +130,7 @@ describe('Diffs Module Getters', () => { ...@@ -130,7 +130,7 @@ describe('Diffs Module Getters', () => {
discussionMock1.expanded = false; discussionMock1.expanded = false;
expect( expect(
getters.diffHasAllCollpasedDiscussions(localState, { getters.diffHasAllCollapsedDiscussions(localState, {
getDiffFileDiscussions: () => [discussionMock, discussionMock1], getDiffFileDiscussions: () => [discussionMock, discussionMock1],
})(diffFileMock), })(diffFileMock),
).toEqual(false); ).toEqual(false);
......
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