BigW Consortium Gitlab

Commit 7275b3dc by Jacob Schatz

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

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