diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/javascripts/ide/components/ide_tree_list_spec.js | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) | |
download | gitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/javascripts/ide/components/ide_tree_list_spec.js')
-rw-r--r-- | spec/javascripts/ide/components/ide_tree_list_spec.js | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/spec/javascripts/ide/components/ide_tree_list_spec.js b/spec/javascripts/ide/components/ide_tree_list_spec.js deleted file mode 100644 index f63007c7dd2..00000000000 --- a/spec/javascripts/ide/components/ide_tree_list_spec.js +++ /dev/null @@ -1,77 +0,0 @@ -import Vue from 'vue'; -import IdeTreeList from '~/ide/components/ide_tree_list.vue'; -import store from '~/ide/stores'; -import { createComponentWithStore } from '../../helpers/vue_mount_component_helper'; -import { resetStore, file } from '../helpers'; -import { projectData } from '../mock_data'; - -describe('IDE tree list', () => { - const Component = Vue.extend(IdeTreeList); - const normalBranchTree = [file('fileName')]; - const emptyBranchTree = []; - let vm; - - const bootstrapWithTree = (tree = normalBranchTree) => { - store.state.currentProjectId = 'abcproject'; - store.state.currentBranchId = 'master'; - store.state.projects.abcproject = Object.assign({}, projectData); - Vue.set(store.state.trees, 'abcproject/master', { - tree, - loading: false, - }); - - vm = createComponentWithStore(Component, store, { - viewerType: 'edit', - }); - }; - - afterEach(() => { - vm.$destroy(); - - resetStore(vm.$store); - }); - - describe('normal branch', () => { - beforeEach(() => { - bootstrapWithTree(); - - spyOn(vm, 'updateViewer').and.callThrough(); - - vm.$mount(); - }); - - it('updates viewer on mount', () => { - expect(vm.updateViewer).toHaveBeenCalledWith('edit'); - }); - - it('renders loading indicator', done => { - store.state.trees['abcproject/master'].loading = true; - - vm.$nextTick(() => { - expect(vm.$el.querySelector('.multi-file-loading-container')).not.toBeNull(); - expect(vm.$el.querySelectorAll('.multi-file-loading-container').length).toBe(3); - - done(); - }); - }); - - it('renders list of files', () => { - expect(vm.$el.textContent).toContain('fileName'); - }); - }); - - describe('empty-branch state', () => { - beforeEach(() => { - bootstrapWithTree(emptyBranchTree); - - spyOn(vm, 'updateViewer').and.callThrough(); - - vm.$mount(); - }); - - it('does not load files if the branch is empty', () => { - expect(vm.$el.textContent).not.toContain('fileName'); - expect(vm.$el.textContent).toContain('No files'); - }); - }); -}); |