Fix binary files not showing anything in edit mode
This commit is contained in:
parent
e457f3fbff
commit
984f3b7dff
2 changed files with 20 additions and 6 deletions
|
@ -27,6 +27,8 @@ export default {
|
||||||
'changeFileContent',
|
'changeFileContent',
|
||||||
]),
|
]),
|
||||||
initMonaco() {
|
initMonaco() {
|
||||||
|
if (this.shouldHideEditor) return;
|
||||||
|
|
||||||
if (this.monacoInstance) {
|
if (this.monacoInstance) {
|
||||||
this.monacoInstance.setModel(null);
|
this.monacoInstance.setModel(null);
|
||||||
}
|
}
|
||||||
|
@ -94,8 +96,12 @@ export default {
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
id="ide"
|
id="ide"
|
||||||
v-if='!shouldHideEditor'
|
|
||||||
class="blob-viewer-container blob-editor-container"
|
class="blob-viewer-container blob-editor-container"
|
||||||
>
|
>
|
||||||
|
<div
|
||||||
|
v-if="shouldHideEditor"
|
||||||
|
v-html="activeFile.html"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -17,6 +17,7 @@ describe('RepoEditor', () => {
|
||||||
f.active = true;
|
f.active = true;
|
||||||
f.tempFile = true;
|
f.tempFile = true;
|
||||||
vm.$store.state.openFiles.push(f);
|
vm.$store.state.openFiles.push(f);
|
||||||
|
vm.$store.getters.activeFile.html = 'testing';
|
||||||
vm.monaco = true;
|
vm.monaco = true;
|
||||||
|
|
||||||
vm.$mount();
|
vm.$mount();
|
||||||
|
@ -31,18 +32,25 @@ describe('RepoEditor', () => {
|
||||||
it('renders an ide container', (done) => {
|
it('renders an ide container', (done) => {
|
||||||
Vue.nextTick(() => {
|
Vue.nextTick(() => {
|
||||||
expect(vm.shouldHideEditor).toBeFalsy();
|
expect(vm.shouldHideEditor).toBeFalsy();
|
||||||
|
expect(vm.$el.textContent.trim()).toBe('');
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when open file is binary and not raw', () => {
|
describe('when open file is binary and not raw', () => {
|
||||||
it('does not render the IDE', (done) => {
|
beforeEach((done) => {
|
||||||
vm.$store.getters.activeFile.binary = true;
|
vm.$store.getters.activeFile.binary = true;
|
||||||
|
|
||||||
Vue.nextTick(() => {
|
Vue.nextTick(done);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does not render the IDE', () => {
|
||||||
expect(vm.shouldHideEditor).toBeTruthy();
|
expect(vm.shouldHideEditor).toBeTruthy();
|
||||||
done();
|
});
|
||||||
});
|
|
||||||
|
it('shows activeFile html', () => {
|
||||||
|
expect(vm.$el.textContent.trim()).toBe('testing');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue