Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-12-01 18:10:12 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-01 18:10:12 +0300
commitc3ddbeb162e4261f4ce3df291909fadeba637995 (patch)
tree374741e3458db992f944819c5cc9f11ed3aa3a4a /spec/frontend
parent79c94e595b13bd4b4522e725e6096a41ff1a27ec (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/diffs/store/actions_spec.js43
-rw-r--r--spec/frontend/diffs/store/mutations_spec.js11
2 files changed, 51 insertions, 3 deletions
diff --git a/spec/frontend/diffs/store/actions_spec.js b/spec/frontend/diffs/store/actions_spec.js
index 88c03cbaece..be3b30e8e7a 100644
--- a/spec/frontend/diffs/store/actions_spec.js
+++ b/spec/frontend/diffs/store/actions_spec.js
@@ -2062,11 +2062,48 @@ describe('DiffsStoreActions', () => {
describe('toggleFileCommentForm', () => {
it('commits TOGGLE_FILE_COMMENT_FORM', () => {
+ const file = getDiffFileMock();
return testAction(
diffActions.toggleFileCommentForm,
- 'path',
- {},
- [{ type: types.TOGGLE_FILE_COMMENT_FORM, payload: 'path' }],
+ file.file_path,
+ {
+ diffFiles: [file],
+ },
+ [
+ { type: types.TOGGLE_FILE_COMMENT_FORM, payload: file.file_path },
+ {
+ type: types.SET_FILE_COLLAPSED,
+ payload: { filePath: file.file_path, collapsed: false },
+ },
+ ],
+ [],
+ );
+ });
+
+ it('always opens if file is collapsed', () => {
+ const file = {
+ ...getDiffFileMock(),
+ viewer: {
+ ...getDiffFileMock().viewer,
+ manuallyCollapsed: true,
+ },
+ };
+ return testAction(
+ diffActions.toggleFileCommentForm,
+ file.file_path,
+ {
+ diffFiles: [file],
+ },
+ [
+ {
+ type: types.SET_FILE_COMMENT_FORM,
+ payload: { filePath: file.file_path, expanded: true },
+ },
+ {
+ type: types.SET_FILE_COLLAPSED,
+ payload: { filePath: file.file_path, collapsed: false },
+ },
+ ],
[],
);
});
diff --git a/spec/frontend/diffs/store/mutations_spec.js b/spec/frontend/diffs/store/mutations_spec.js
index fdcf7c3eeab..a5be41aa69f 100644
--- a/spec/frontend/diffs/store/mutations_spec.js
+++ b/spec/frontend/diffs/store/mutations_spec.js
@@ -1045,6 +1045,17 @@ describe('DiffsStoreMutations', () => {
});
});
+ describe('SET_FILE_COMMENT_FORM', () => {
+ it('toggles diff files hasCommentForm', () => {
+ const state = { diffFiles: [{ file_path: 'path', hasCommentForm: false }] };
+ const expanded = true;
+
+ mutations[types.SET_FILE_COMMENT_FORM](state, { filePath: 'path', expanded });
+
+ expect(state.diffFiles[0].hasCommentForm).toEqual(expanded);
+ });
+ });
+
describe('ADD_DRAFT_TO_FILE', () => {
it('adds draft to diff file', () => {
const state = { diffFiles: [{ file_path: 'path', drafts: [] }] };