diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /spec/frontend/pages/dashboard | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) | |
download | gitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/frontend/pages/dashboard')
-rw-r--r-- | spec/frontend/pages/dashboard/projects/index/components/customize_homepage_banner_spec.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/frontend/pages/dashboard/projects/index/components/customize_homepage_banner_spec.js b/spec/frontend/pages/dashboard/projects/index/components/customize_homepage_banner_spec.js new file mode 100644 index 00000000000..b3a297ac2c5 --- /dev/null +++ b/spec/frontend/pages/dashboard/projects/index/components/customize_homepage_banner_spec.js @@ -0,0 +1,50 @@ +import { shallowMount } from '@vue/test-utils'; +import { GlBanner } from '@gitlab/ui'; +import MockAdapter from 'axios-mock-adapter'; +import CustomizeHomepageBanner from '~/pages/dashboard/projects/index/components/customize_homepage_banner.vue'; +import axios from '~/lib/utils/axios_utils'; + +const svgPath = '/illustrations/background'; +const provide = { + svgPath, + preferencesBehaviorPath: 'some/behavior/path', + calloutsPath: 'call/out/path', + calloutsFeatureId: 'some-feature-id', +}; + +const createComponent = () => { + return shallowMount(CustomizeHomepageBanner, { provide }); +}; + +describe('CustomizeHomepageBanner', () => { + let mockAxios; + let wrapper; + + beforeEach(() => { + mockAxios = new MockAdapter(axios); + wrapper = createComponent(); + }); + + afterEach(() => { + wrapper.destroy(); + wrapper = null; + mockAxios.restore(); + }); + + it('should render the banner when not dismissed', () => { + expect(wrapper.contains(GlBanner)).toBe(true); + }); + + it('should close the banner when dismiss is clicked', async () => { + mockAxios.onPost(provide.calloutsPath).replyOnce(200); + expect(wrapper.contains(GlBanner)).toBe(true); + wrapper.find(GlBanner).vm.$emit('close'); + + await wrapper.vm.$nextTick(); + expect(wrapper.contains(GlBanner)).toBe(false); + }); + + it('includes the body text from options', () => { + expect(wrapper.html()).toContain(wrapper.vm.$options.i18n.body); + }); +}); |