diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/frontend/groups/components/item_caret_spec.js | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/frontend/groups/components/item_caret_spec.js')
-rw-r--r-- | spec/frontend/groups/components/item_caret_spec.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/frontend/groups/components/item_caret_spec.js b/spec/frontend/groups/components/item_caret_spec.js new file mode 100644 index 00000000000..bfe27be9b51 --- /dev/null +++ b/spec/frontend/groups/components/item_caret_spec.js @@ -0,0 +1,38 @@ +import Vue from 'vue'; + +import mountComponent from 'helpers/vue_mount_component_helper'; +import itemCaretComponent from '~/groups/components/item_caret.vue'; + +const createComponent = (isGroupOpen = false) => { + const Component = Vue.extend(itemCaretComponent); + + return mountComponent(Component, { + isGroupOpen, + }); +}; + +describe('ItemCaretComponent', () => { + let vm; + + afterEach(() => { + vm.$destroy(); + }); + + describe('template', () => { + it('should render component template correctly', () => { + vm = createComponent(); + expect(vm.$el.classList.contains('folder-caret')).toBeTruthy(); + expect(vm.$el.querySelectorAll('svg').length).toBe(1); + }); + + it('should render caret down icon if `isGroupOpen` prop is `true`', () => { + vm = createComponent(true); + expect(vm.$el.querySelector('svg use').getAttribute('xlink:href')).toContain('angle-down'); + }); + + it('should render caret right icon if `isGroupOpen` prop is `false`', () => { + vm = createComponent(); + expect(vm.$el.querySelector('svg use').getAttribute('xlink:href')).toContain('angle-right'); + }); + }); +}); |