Commit 775d3d2b authored by Filipa Lacerda's avatar Filipa Lacerda
Browse files

Merge branch 'multi-file-editor-binary-editor' into 'master'

Fix binary files not showing anything in edit mode

See merge request gitlab-org/gitlab-ce!15124
......@@ -27,6 +27,8 @@
'changeFileContent',
]),
initMonaco() {
if (this.shouldHideEditor) return;
if (this.monacoInstance) {
this.monacoInstance.setModel(null);
}
......@@ -94,6 +96,5 @@
<template>
<div
id="ide"
v-if='!shouldHideEditor'
class="blob-viewer-container blob-editor-container"
>
......@@ -98,4 +99,9 @@
class="blob-viewer-container blob-editor-container"
>
<div
v-if="shouldHideEditor"
v-html="activeFile.html"
>
</div>
</div>
</template>
......@@ -17,6 +17,7 @@
f.active = true;
f.tempFile = true;
vm.$store.state.openFiles.push(f);
vm.$store.getters.activeFile.html = 'testing';
vm.monaco = true;
vm.$mount();
......@@ -31,8 +32,10 @@
it('renders an ide container', (done) => {
Vue.nextTick(() => {
expect(vm.shouldHideEditor).toBeFalsy();
expect(vm.$el.textContent.trim()).toBe('');
done();
});
});
describe('when open file is binary and not raw', () => {
......@@ -34,8 +37,8 @@
done();
});
});
describe('when open file is binary and not raw', () => {
it('does not render the IDE', (done) => {
beforeEach((done) => {
vm.$store.getters.activeFile.binary = true;
......@@ -40,9 +43,14 @@
vm.$store.getters.activeFile.binary = true;
Vue.nextTick(() => {
expect(vm.shouldHideEditor).toBeTruthy();
done();
});
Vue.nextTick(done);
});
it('does not render the IDE', () => {
expect(vm.shouldHideEditor).toBeTruthy();
});
it('shows activeFile html', () => {
expect(vm.$el.textContent.trim()).toBe('testing');
});
});
});
Supports Markdown
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