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>2020-06-18 14:18:50 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 14:18:50 +0300
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/frontend/vue_shared/components/markdown/suggestion_diff_spec.js
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/frontend/vue_shared/components/markdown/suggestion_diff_spec.js')
-rw-r--r--spec/frontend/vue_shared/components/markdown/suggestion_diff_spec.js34
1 files changed, 22 insertions, 12 deletions
diff --git a/spec/frontend/vue_shared/components/markdown/suggestion_diff_spec.js b/spec/frontend/vue_shared/components/markdown/suggestion_diff_spec.js
index 162ac495385..232feb126dc 100644
--- a/spec/frontend/vue_shared/components/markdown/suggestion_diff_spec.js
+++ b/spec/frontend/vue_shared/components/markdown/suggestion_diff_spec.js
@@ -3,9 +3,10 @@ import SuggestionDiffComponent from '~/vue_shared/components/markdown/suggestion
import SuggestionDiffHeader from '~/vue_shared/components/markdown/suggestion_diff_header.vue';
import SuggestionDiffRow from '~/vue_shared/components/markdown/suggestion_diff_row.vue';
+const suggestionId = 1;
const MOCK_DATA = {
suggestion: {
- id: 1,
+ id: suggestionId,
diff_lines: [
{
can_receive_suggestion: false,
@@ -38,8 +39,10 @@ const MOCK_DATA = {
type: 'new',
},
],
+ is_applying_batch: true,
},
helpPagePath: 'path_to_docs',
+ batchSuggestionsInfo: [{ suggestionId }],
};
describe('Suggestion Diff component', () => {
@@ -70,17 +73,24 @@ describe('Suggestion Diff component', () => {
expect(wrapper.findAll(SuggestionDiffRow)).toHaveLength(3);
});
- it('emits apply event on sugestion diff header apply', () => {
- wrapper.find(SuggestionDiffHeader).vm.$emit('apply', 'test-event');
+ it.each`
+ event | childArgs | args
+ ${'apply'} | ${['test-event']} | ${[{ callback: 'test-event', suggestionId }]}
+ ${'applyBatch'} | ${[]} | ${[]}
+ ${'addToBatch'} | ${[]} | ${[suggestionId]}
+ ${'removeFromBatch'} | ${[]} | ${[suggestionId]}
+ `('emits $event event on sugestion diff header $event', ({ event, childArgs, args }) => {
+ wrapper.find(SuggestionDiffHeader).vm.$emit(event, ...childArgs);
- expect(wrapper.emitted('apply')).toBeDefined();
- expect(wrapper.emitted('apply')).toEqual([
- [
- {
- callback: 'test-event',
- suggestionId: 1,
- },
- ],
- ]);
+ expect(wrapper.emitted(event)).toBeDefined();
+ expect(wrapper.emitted(event)).toEqual([args]);
+ });
+
+ it('passes suggestion batch props to suggestion diff header', () => {
+ expect(wrapper.find(SuggestionDiffHeader).props()).toMatchObject({
+ batchSuggestionsCount: 1,
+ isBatched: true,
+ isApplyingBatch: MOCK_DATA.suggestion.is_applying_batch,
+ });
});
});