diff options
Diffstat (limited to 'spec/frontend/diffs/components')
-rw-r--r-- | spec/frontend/diffs/components/diff_view_spec.js | 12 | ||||
-rw-r--r-- | spec/frontend/diffs/components/hidden_files_warning_spec.js | 18 |
2 files changed, 19 insertions, 11 deletions
diff --git a/spec/frontend/diffs/components/diff_view_spec.js b/spec/frontend/diffs/components/diff_view_spec.js index 9b8f0421b7c..f982749d1de 100644 --- a/spec/frontend/diffs/components/diff_view_spec.js +++ b/spec/frontend/diffs/components/diff_view_spec.js @@ -51,10 +51,18 @@ describe('DiffView', () => { it('renders a match line', () => { const wrapper = createWrapper({ - diffLines: [{ isMatchLineLeft: true, left: { rich_text: 'matched text', lineDraft: {} } }], + diffLines: [ + { + isMatchLineLeft: true, + left: { + rich_text: '@@ -4,12 +4,12 @@ import createFlash from '~/flash';', + lineDraft: {}, + }, + }, + ], }); expect(wrapper.find(DiffExpansionCell).exists()).toBe(true); - expect(wrapper.text()).toContain('matched text'); + expect(wrapper.text()).toContain("@@ -4,12 +4,12 @@ import createFlash from '~/flash';"); }); it.each` diff --git a/spec/frontend/diffs/components/hidden_files_warning_spec.js b/spec/frontend/diffs/components/hidden_files_warning_spec.js index 3f1f23a40f5..bbd4f5faeec 100644 --- a/spec/frontend/diffs/components/hidden_files_warning_spec.js +++ b/spec/frontend/diffs/components/hidden_files_warning_spec.js @@ -1,4 +1,6 @@ -import { shallowMount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import { GlButton } from '@gitlab/ui'; +import { __ } from '~/locale'; import HiddenFilesWarning from '~/diffs/components/hidden_files_warning.vue'; const propsData = { @@ -12,7 +14,7 @@ describe('HiddenFilesWarning', () => { let wrapper; const createComponent = () => { - wrapper = shallowMount(HiddenFilesWarning, { + wrapper = mount(HiddenFilesWarning, { propsData, }); }; @@ -26,22 +28,20 @@ describe('HiddenFilesWarning', () => { }); it('has a correct plain diff URL', () => { - const plainDiffLink = wrapper.findAll('a').wrappers.filter((x) => x.text() === 'Plain diff')[0]; + const plainDiffLink = wrapper.findAllComponents(GlButton).at(0); expect(plainDiffLink.attributes('href')).toBe(propsData.plainDiffPath); }); it('has a correct email patch URL', () => { - const emailPatchLink = wrapper - .findAll('a') - .wrappers.filter((x) => x.text() === 'Email patch')[0]; + const emailPatchLink = wrapper.findAllComponents(GlButton).at(1); expect(emailPatchLink.attributes('href')).toBe(propsData.emailPatchPath); }); it('has a correct visible/total files text', () => { - const filesText = wrapper.find('strong'); - - expect(filesText.text()).toBe('5 of 10'); + expect(wrapper.text()).toContain( + __('To preserve performance only 5 of 10 files are displayed.'), + ); }); }); |