BigW Consortium Gitlab

Fix repo_editor_spec because of async loader changes

parent a6a7a0e1
...@@ -9,7 +9,7 @@ import RepoCommitSection from './repo_commit_section.vue'; ...@@ -9,7 +9,7 @@ import RepoCommitSection from './repo_commit_section.vue';
import RepoTabs from './repo_tabs.vue'; import RepoTabs from './repo_tabs.vue';
import RepoFileButtons from './repo_file_buttons.vue'; import RepoFileButtons from './repo_file_buttons.vue';
import RepoBinaryViewer from './repo_binary_viewer.vue'; import RepoBinaryViewer from './repo_binary_viewer.vue';
import RepoEditor from './repo_editor'; import { repoEditorLoader } from './repo_editor';
import RepoMiniMixin from './repo_mini_mixin'; import RepoMiniMixin from './repo_mini_mixin';
function initRepo() { function initRepo() {
...@@ -44,7 +44,7 @@ function initRepo() { ...@@ -44,7 +44,7 @@ function initRepo() {
'repo-tabs': RepoTabs, 'repo-tabs': RepoTabs,
'repo-file-buttons': RepoFileButtons, 'repo-file-buttons': RepoFileButtons,
'repo-binary-viewer': RepoBinaryViewer, 'repo-binary-viewer': RepoBinaryViewer,
'repo-editor': RepoEditor, 'repo-editor': repoEditorLoader,
'repo-commit-section': RepoCommitSection, 'repo-commit-section': RepoCommitSection,
}, },
}); });
......
...@@ -106,7 +106,7 @@ const RepoEditor = { ...@@ -106,7 +106,7 @@ const RepoEditor = {
}, },
}; };
function asyncLoadRepoEditor() { function repoEditorLoader() {
return new Promise((resolve) => { return new Promise((resolve) => {
monacoLoader(['vs/editor/editor.main'], () => { monacoLoader(['vs/editor/editor.main'], () => {
Store.monaco = monaco; Store.monaco = monaco;
...@@ -116,4 +116,7 @@ function asyncLoadRepoEditor() { ...@@ -116,4 +116,7 @@ function asyncLoadRepoEditor() {
}); });
} }
export default asyncLoadRepoEditor; export {
RepoEditor as default,
repoEditorLoader,
};
import Vue from 'vue'; import Vue from 'vue';
import repoEditor from '~/repo/repo_editor'; import repoEditor from '~/repo/repo_editor';
import RepoStore from '~/repo/repo_store';
describe('RepoEditor', () => { describe('RepoEditor', () => {
function createComponent() { function createComponent() {
...@@ -9,6 +10,15 @@ describe('RepoEditor', () => { ...@@ -9,6 +10,15 @@ describe('RepoEditor', () => {
} }
it('renders an ide container', () => { it('renders an ide container', () => {
const monacoInstance = jasmine.createSpyObj('monacoInstance', ['onMouseUp', 'onKeyUp', 'setModel']);
const monaco = {
editor: jasmine.createSpyObj('editor', ['create']),
};
RepoStore.monaco = monaco;
monaco.editor.create.and.returnValue(monacoInstance);
spyOn(repoEditor.watch, 'blobRaw');
const vm = createComponent(); const vm = createComponent();
expect(vm.$el.id).toEqual('ide'); expect(vm.$el.id).toEqual('ide');
......
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