diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-11 03:08:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-11 03:08:50 +0300 |
commit | ced6c9ae9a9a80c884cafbea9c717b578dfac326 (patch) | |
tree | 7cb0e78e0639df4b2b79be94ddae77c304bd3357 /spec/frontend/batch_comments | |
parent | 02c3b2af448be6a5004e8d833cbcbf8e5f185210 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/batch_comments')
-rw-r--r-- | spec/frontend/batch_comments/components/draft_note_spec.js | 21 | ||||
-rw-r--r-- | spec/frontend/batch_comments/components/preview_item_spec.js | 19 |
2 files changed, 24 insertions, 16 deletions
diff --git a/spec/frontend/batch_comments/components/draft_note_spec.js b/spec/frontend/batch_comments/components/draft_note_spec.js index ae7134b63c8..9e56b8aeb36 100644 --- a/spec/frontend/batch_comments/components/draft_note_spec.js +++ b/spec/frontend/batch_comments/components/draft_note_spec.js @@ -21,14 +21,11 @@ describe('Batch comments draft note component', () => { const getList = () => getByRole(wrapper.element, 'list'); - const createComponent = (propsData = { draft }, features = {}) => { + const createComponent = (propsData = { draft }) => { wrapper = shallowMount(localVue.extend(DraftNote), { store, propsData, localVue, - provide: { - glFeatures: { multilineComments: true, ...features }, - }, }); jest.spyOn(wrapper.vm.$store, 'dispatch').mockImplementation(); @@ -145,16 +142,14 @@ describe('Batch comments draft note component', () => { describe('multiline comments', () => { describe.each` - desc | props | features | event | expectedCalls - ${'with `draft.position`'} | ${draftWithLineRange} | ${{}} | ${'mouseenter'} | ${[['setSelectedCommentPositionHover', LINE_RANGE]]} - ${'with `draft.position`'} | ${draftWithLineRange} | ${{}} | ${'mouseleave'} | ${[['setSelectedCommentPositionHover']]} - ${'with `draft.position`'} | ${draftWithLineRange} | ${{ multilineComments: false }} | ${'mouseenter'} | ${[]} - ${'with `draft.position`'} | ${draftWithLineRange} | ${{ multilineComments: false }} | ${'mouseleave'} | ${[]} - ${'without `draft.position`'} | ${{}} | ${{}} | ${'mouseenter'} | ${[]} - ${'without `draft.position`'} | ${{}} | ${{}} | ${'mouseleave'} | ${[]} - `('$desc and features $features', ({ props, event, features, expectedCalls }) => { + desc | props | event | expectedCalls + ${'with `draft.position`'} | ${draftWithLineRange} | ${'mouseenter'} | ${[['setSelectedCommentPositionHover', LINE_RANGE]]} + ${'with `draft.position`'} | ${draftWithLineRange} | ${'mouseleave'} | ${[['setSelectedCommentPositionHover']]} + ${'without `draft.position`'} | ${{}} | ${'mouseenter'} | ${[]} + ${'without `draft.position`'} | ${{}} | ${'mouseleave'} | ${[]} + `('$desc', ({ props, event, expectedCalls }) => { beforeEach(() => { - createComponent({ draft: { ...draft, ...props } }, features); + createComponent({ draft: { ...draft, ...props } }); jest.spyOn(store, 'dispatch'); }); diff --git a/spec/frontend/batch_comments/components/preview_item_spec.js b/spec/frontend/batch_comments/components/preview_item_spec.js index 173b2710a30..08167a94068 100644 --- a/spec/frontend/batch_comments/components/preview_item_spec.js +++ b/spec/frontend/batch_comments/components/preview_item_spec.js @@ -56,17 +56,30 @@ describe('Batch comments draft preview item component', () => { createComponent(false, { file_path: 'index.js', file_hash: 'abc', - position: { new_line: 1 }, + position: { + line_range: { + start: { + new_line: 1, + type: 'new', + }, + }, + }, }); - expect(vm.$el.querySelector('.bold').textContent).toContain(':1'); + expect(vm.$el.querySelector('.bold').textContent).toContain(':+1'); }); it('renders old line position', () => { createComponent(false, { file_path: 'index.js', file_hash: 'abc', - position: { old_line: 2 }, + position: { + line_range: { + start: { + old_line: 2, + }, + }, + }, }); expect(vm.$el.querySelector('.bold').textContent).toContain(':2'); |