diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-04 12:08:20 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-04 12:08:20 +0300 |
commit | d80f3cd75e700b6e62910865bfd36734644ffa89 (patch) | |
tree | aa2fa2f2b4385854c13591bef8e74924ef661657 /spec/frontend/blob | |
parent | be81c1578d65f25edfde8aa550f190b8d3e6d976 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/blob')
-rw-r--r-- | spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js b/spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js new file mode 100644 index 00000000000..0170ef927cf --- /dev/null +++ b/spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js @@ -0,0 +1,46 @@ +import { shallowMount } from '@vue/test-utils'; +import Popover from '~/blob/suggest_gitlab_ci_yml/components/popover.vue'; +import Cookies from 'js-cookie'; + +const popoverTarget = 'gitlab-ci-yml-selector'; +const dismissKey = 'suggest_gitlab_ci_yml_99'; + +describe('Suggest gitlab-ci.yml Popover', () => { + let wrapper; + + function createWrapper() { + wrapper = shallowMount(Popover, { + propsData: { + target: popoverTarget, + cssClass: 'js-class', + dismissKey, + }, + }); + } + + afterEach(() => { + wrapper.destroy(); + wrapper = null; + }); + + describe('when no dismiss cookie is set', () => { + beforeEach(() => { + createWrapper(); + }); + + it('sets popoverDismissed to false', () => { + expect(wrapper.vm.popoverDismissed).toEqual(false); + }); + }); + + describe('when the dismiss cookie is set', () => { + beforeEach(() => { + Cookies.set(dismissKey, true); + createWrapper(); + }); + + it('sets popoverDismissed to true', () => { + expect(wrapper.vm.popoverDismissed).toEqual(true); + }); + }); +}); |