Commit ea680b73 authored by Phil Hughes's avatar Phil Hughes

specs

parent c83ed559
...@@ -282,8 +282,14 @@ ...@@ -282,8 +282,14 @@
opacity: 0.4; opacity: 0.4;
} }
.editor.original .cursors-layer { .editor.original {
display: none; .view-lines {
cursor: default;
}
.cursors-layer {
display: none;
}
} }
} }
} }
......
...@@ -62,6 +62,12 @@ describe('IDE activity bar', () => { ...@@ -62,6 +62,12 @@ describe('IDE activity bar', () => {
expect(vm.updateActivityBarView).toHaveBeenCalledWith(ActivityBarViews.commit); expect(vm.updateActivityBarView).toHaveBeenCalledWith(ActivityBarViews.commit);
}); });
it('calls updateActivityBarView with review value on click', () => {
vm.$el.querySelector('.js-ide-review-mode').click();
expect(vm.updateActivityBarView).toHaveBeenCalledWith(ActivityBarViews.review);
});
}); });
describe('active item', () => { describe('active item', () => {
......
import Vue from 'vue';
import IdeReview from '~/ide/components/ide_review.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 review mode', () => {
const Component = Vue.extend(IdeReview);
let vm;
beforeEach(() => {
store.state.currentProjectId = 'abcproject';
store.state.currentBranchId = 'master';
store.state.projects.abcproject = Object.assign({}, projectData);
Vue.set(store.state.trees, 'abcproject/master', {
tree: [file('fileName')],
loading: false,
});
vm = createComponentWithStore(Component, store).$mount();
});
afterEach(() => {
vm.$destroy();
resetStore(vm.$store);
});
it('renders list of files', () => {
expect(vm.$el.textContent).toContain('fileName');
});
});
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);
let vm;
beforeEach(() => {
store.state.currentProjectId = 'abcproject';
store.state.currentBranchId = 'master';
store.state.projects.abcproject = Object.assign({}, projectData);
Vue.set(store.state.trees, 'abcproject/master', {
tree: [file('fileName')],
loading: false,
});
vm = createComponentWithStore(Component, store, {
viewerType: 'edit',
});
spyOn(vm, 'updateViewer').and.callThrough();
vm.$mount();
});
afterEach(() => {
vm.$destroy();
resetStore(vm.$store);
});
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');
});
});
...@@ -5,7 +5,7 @@ import router from '~/ide/ide_router'; ...@@ -5,7 +5,7 @@ import router from '~/ide/ide_router';
import { createComponentWithStore } from '../../helpers/vue_mount_component_helper'; import { createComponentWithStore } from '../../helpers/vue_mount_component_helper';
import { file } from '../helpers'; import { file } from '../helpers';
describe('RepoFile', () => { fdescribe('RepoFile', () => {
let vm; let vm;
function createComponent(propsData) { function createComponent(propsData) {
...@@ -72,9 +72,47 @@ describe('RepoFile', () => { ...@@ -72,9 +72,47 @@ describe('RepoFile', () => {
it('renders a tooltip', () => { it('renders a tooltip', () => {
expect( expect(
vm.$el.querySelector('.ide-file-name span:nth-child(2)').dataset vm.$el.querySelector('.ide-file-name span:nth-child(2)').dataset.originalTitle,
.originalTitle,
).toContain('Locked by testuser'); ).toContain('Locked by testuser');
}); });
}); });
describe('folder', () => {
it('renders action dropdown', done => {
createComponent({
file: {
...file('t4'),
type: 'tree',
branchId: 'master',
projectId: 'project',
},
level: 0,
});
setTimeout(() => {
expect(vm.$el.querySelector('.ide-new-btn')).not.toBeNull();
done();
});
});
it('disables action dropdown', done => {
createComponent({
file: {
...file('t4'),
type: 'tree',
branchId: 'master',
projectId: 'project',
},
level: 0,
disableActionDropdown: true,
});
setTimeout(() => {
expect(vm.$el.querySelector('.ide-new-btn')).toBeNull();
done();
});
});
});
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment