diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-17 18:09:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-17 18:09:01 +0300 |
commit | b304a72312465ed4c0a568ee6a6ea5e97f705c9b (patch) | |
tree | a2f25dbea26c81e88b169c55a6275e3969323e82 /spec/frontend/vue_mr_widget | |
parent | b84eeb256c4a780d902faee1f99ca9a711b3214a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_mr_widget')
-rw-r--r-- | spec/frontend/vue_mr_widget/components/mr_widget_suggest_pipeline_spec.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_suggest_pipeline_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_suggest_pipeline_spec.js new file mode 100644 index 00000000000..77293a5b187 --- /dev/null +++ b/spec/frontend/vue_mr_widget/components/mr_widget_suggest_pipeline_spec.js @@ -0,0 +1,52 @@ +import { mount } from '@vue/test-utils'; +import { GlLink } from '@gitlab/ui'; +import suggestPipelineComponent from '~/vue_merge_request_widget/components/mr_widget_suggest_pipeline.vue'; +import MrWidgetIcon from '~/vue_merge_request_widget/components/mr_widget_icon.vue'; + +describe('MRWidgetHeader', () => { + let wrapper; + const pipelinePath = '/foo/bar/add/pipeline/path'; + const iconName = 'status_notfound'; + + beforeEach(() => { + wrapper = mount(suggestPipelineComponent, { + propsData: { pipelinePath }, + }); + }); + + afterEach(() => { + wrapper.destroy(); + }); + + describe('template', () => { + it('renders add pipeline file link', () => { + const link = wrapper.find(GlLink); + + return wrapper.vm.$nextTick().then(() => { + expect(link.exists()).toBe(true); + expect(link.attributes().href).toBe(pipelinePath); + }); + }); + + it('renders the expected text', () => { + const messageText = /\s*No pipeline\s*Add the .gitlab-ci.yml file\s*to create one./; + + return wrapper.vm.$nextTick().then(() => { + expect(wrapper.text()).toMatch(messageText); + }); + }); + + it('renders widget icon', () => { + const icon = wrapper.find(MrWidgetIcon); + + return wrapper.vm.$nextTick().then(() => { + expect(icon.exists()).toBe(true); + expect(icon.props()).toEqual( + expect.objectContaining({ + name: iconName, + }), + ); + }); + }); + }); +}); |