diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-10 21:09:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-10 21:09:00 +0300 |
commit | c57e10faab0abb213e7a18274fd5a98ba87a5c09 (patch) | |
tree | de0195e28dfe19fbfeb5bffa8fde4f511288d8ef /spec/frontend | |
parent | 11e5d1b9ca3efa7be34ddebb708a6aedb4e91639 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/ide/components/ide_status_mr_spec.js | 59 | ||||
-rw-r--r-- | spec/frontend/ide/components/panes/right_spec.js | 22 |
2 files changed, 59 insertions, 22 deletions
diff --git a/spec/frontend/ide/components/ide_status_mr_spec.js b/spec/frontend/ide/components/ide_status_mr_spec.js new file mode 100644 index 00000000000..4d9ad61201d --- /dev/null +++ b/spec/frontend/ide/components/ide_status_mr_spec.js @@ -0,0 +1,59 @@ +import { shallowMount } from '@vue/test-utils'; +import { GlIcon, GlLink } from '@gitlab/ui'; +import { TEST_HOST } from 'helpers/test_constants'; +import IdeStatusMr from '~/ide/components/ide_status_mr.vue'; + +const TEST_TEXT = '!9001'; +const TEST_URL = `${TEST_HOST}merge-requests/9001`; + +describe('ide/components/ide_status_mr', () => { + let wrapper; + + const createComponent = props => { + wrapper = shallowMount(IdeStatusMr, { + propsData: props, + }); + }; + const findIcon = () => wrapper.find(GlIcon); + const findLink = () => wrapper.find(GlLink); + + afterEach(() => { + wrapper.destroy(); + }); + + describe('when mounted', () => { + beforeEach(() => { + createComponent({ + text: TEST_TEXT, + url: TEST_URL, + }); + }); + + it('renders icon', () => { + const icon = findIcon(); + + expect(icon.exists()).toBe(true); + expect(icon.props()).toEqual( + expect.objectContaining({ + name: 'merge-request', + }), + ); + }); + + it('renders link', () => { + const link = findLink(); + + expect(link.exists()).toBe(true); + expect(link.attributes()).toEqual( + expect.objectContaining({ + href: TEST_URL, + }), + ); + expect(link.text()).toEqual(TEST_TEXT); + }); + + it('renders text', () => { + expect(wrapper.text()).toBe(`Merge request ${TEST_TEXT}`); + }); + }); +}); diff --git a/spec/frontend/ide/components/panes/right_spec.js b/spec/frontend/ide/components/panes/right_spec.js index 7e408be96fc..84b2d440b60 100644 --- a/spec/frontend/ide/components/panes/right_spec.js +++ b/spec/frontend/ide/components/panes/right_spec.js @@ -75,28 +75,6 @@ describe('ide/components/panes/right.vue', () => { }); }); - describe('merge request tab', () => { - it('is shown if there is a currentMergeRequestId', () => { - store.state.currentMergeRequestId = 1; - - createComponent(); - - expect(wrapper.find(CollapsibleSidebar).props('extensionTabs')).toEqual( - expect.arrayContaining([ - expect.objectContaining({ - show: true, - title: 'Merge Request', - views: expect.arrayContaining([ - expect.objectContaining({ - name: rightSidebarViews.mergeRequestInfo.name, - }), - ]), - }), - ]), - ); - }); - }); - describe('clientside live preview tab', () => { it('is shown if there is a packageJson and clientsidePreviewEnabled', () => { Vue.set(store.state.entries, 'package.json', { |