diff options
author | Phil Hughes <me@iamphill.com> | 2019-07-10 13:17:45 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-07-15 15:23:52 +0100 |
commit | 1e3877a9c86a3651b12c2f01310e68599b15f8b8 (patch) | |
tree | a65e005af158137f451c5a16bb9c542e5b81ee2c /spec | |
parent | 4d8babc809ebd13e4f583d5244a97b2955fd4af5 (diff) | |
download | gitlab-ce-1e3877a9c86a3651b12c2f01310e68599b15f8b8.tar.gz |
Added add to tree dropdown to Vue files breadcrumb
Diffstat (limited to 'spec')
-rw-r--r-- | spec/frontend/repository/components/breadcrumbs_spec.js | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/spec/frontend/repository/components/breadcrumbs_spec.js b/spec/frontend/repository/components/breadcrumbs_spec.js index 068fa317a87..707eae34793 100644 --- a/spec/frontend/repository/components/breadcrumbs_spec.js +++ b/spec/frontend/repository/components/breadcrumbs_spec.js @@ -1,12 +1,14 @@ import { shallowMount, RouterLinkStub } from '@vue/test-utils'; +import { GlDropdown } from '@gitlab/ui'; import Breadcrumbs from '~/repository/components/breadcrumbs.vue'; let vm; -function factory(currentPath) { +function factory(currentPath, extraProps = {}) { vm = shallowMount(Breadcrumbs, { propsData: { currentPath, + ...extraProps, }, stubs: { RouterLink: RouterLinkStub, @@ -41,4 +43,20 @@ describe('Repository breadcrumbs component', () => { .attributes('aria-current'), ).toEqual('page'); }); + + it('does not render add to tree dropdown when permissions are false', () => { + factory('/', { canCollaborate: false }); + + vm.setData({ userPermissions: { forkProject: false, createMergeRequestIn: false } }); + + expect(vm.find(GlDropdown).exists()).toBe(false); + }); + + it('renders add to tree dropdown when permissions are true', () => { + factory('/', { canCollaborate: true }); + + vm.setData({ userPermissions: { forkProject: true, createMergeRequestIn: true } }); + + expect(vm.find(GlDropdown).exists()).toBe(true); + }); }); |