Commit 7275b3dc authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'ide' of gitlab.com:gitlab-org/gitlab-ce into ide

parents 631118e7 5e4f18e2
......@@ -29,7 +29,7 @@ function initRepo() {
data: () => Store,
template: `
<div class="tree-content-holder">
<repo-sidebar/><div class="panel-right">
<repo-sidebar/><div class="panel-right" :class="{'edit-mode': readOnly}">
<repo-tabs/>
<repo-file-buttons/>
<repo-editor/>
......
......@@ -66,15 +66,9 @@ const RepoEditor = {
},
editMode() {
const panelClassList = document.querySelector('.panel-right').classList;
let readOnly = false;
const readOnly = !this.editMode;
if (this.editMode) {
panelClassList.add('edit-mode');
} else {
panelClassList.remove('edit-mode');
readOnly = true;
}
Store.readOnly = readOnly;
this.monacoInstance.updateOptions({
readOnly,
......
......@@ -60,6 +60,7 @@ const RepoStore = {
tree: false,
blob: false,
},
readOnly: true,
// mutations
......
......@@ -6,7 +6,7 @@ describe('ScrollHelper', () => {
describe('getScrollWidth', () => {
const parent = jasmine.createSpyObj('parent', ['css', 'appendTo', 'remove']);
const child = jasmine.createSpyObj('child', ['css', 'appendTo', 'outerWidth']);
const child = jasmine.createSpyObj('child', ['css', 'appendTo', 'get']);
let scrollWidth;
beforeEach(() => {
......@@ -15,7 +15,9 @@ describe('ScrollHelper', () => {
parent.css.and.returnValue(parent);
child.css.and.returnValue(child);
child.outerWidth.and.returnValue(width);
child.get.and.returnValue({
offsetWidth: width,
});
scrollWidth = ScrollHelper.getScrollWidth();
});
......@@ -35,7 +37,7 @@ describe('ScrollHelper', () => {
});
expect(child.appendTo).toHaveBeenCalledWith(parent);
expect(parent.appendTo).toHaveBeenCalledWith('body');
expect(child.outerWidth).toHaveBeenCalled();
expect(child.get).toHaveBeenCalledWith(0);
expect(parent.remove).toHaveBeenCalled();
expect(scrollWidth).toEqual(100 - width);
});
......
......@@ -40,7 +40,7 @@ describe('RepoBinaryViewer', () => {
Store.activeFile = activeFile;
const vm = createComponent();
expect(vm.$el.querySelector(':scope > div')).toEqual(activeFile.html);
expect(vm.$el.querySelector(':scope > div').innerHTML).toEqual(activeFile.html);
});
it('does not render if no binary', () => {
......
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