Fix repo_editor_spec because of async loader changes
This commit is contained in:
parent
a6a7a0e113
commit
0fdcb703d1
3 changed files with 17 additions and 4 deletions
|
@ -9,7 +9,7 @@ import RepoCommitSection from './repo_commit_section.vue';
|
|||
import RepoTabs from './repo_tabs.vue';
|
||||
import RepoFileButtons from './repo_file_buttons.vue';
|
||||
import RepoBinaryViewer from './repo_binary_viewer.vue';
|
||||
import RepoEditor from './repo_editor';
|
||||
import { repoEditorLoader } from './repo_editor';
|
||||
import RepoMiniMixin from './repo_mini_mixin';
|
||||
|
||||
function initRepo() {
|
||||
|
@ -44,7 +44,7 @@ function initRepo() {
|
|||
'repo-tabs': RepoTabs,
|
||||
'repo-file-buttons': RepoFileButtons,
|
||||
'repo-binary-viewer': RepoBinaryViewer,
|
||||
'repo-editor': RepoEditor,
|
||||
'repo-editor': repoEditorLoader,
|
||||
'repo-commit-section': RepoCommitSection,
|
||||
},
|
||||
});
|
||||
|
|
|
@ -106,7 +106,7 @@ const RepoEditor = {
|
|||
},
|
||||
};
|
||||
|
||||
function asyncLoadRepoEditor() {
|
||||
function repoEditorLoader() {
|
||||
return new Promise((resolve) => {
|
||||
monacoLoader(['vs/editor/editor.main'], () => {
|
||||
Store.monaco = monaco;
|
||||
|
@ -116,4 +116,7 @@ function asyncLoadRepoEditor() {
|
|||
});
|
||||
}
|
||||
|
||||
export default asyncLoadRepoEditor;
|
||||
export {
|
||||
RepoEditor as default,
|
||||
repoEditorLoader,
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Vue from 'vue';
|
||||
import repoEditor from '~/repo/repo_editor';
|
||||
import RepoStore from '~/repo/repo_store';
|
||||
|
||||
describe('RepoEditor', () => {
|
||||
function createComponent() {
|
||||
|
@ -9,6 +10,15 @@ describe('RepoEditor', () => {
|
|||
}
|
||||
|
||||
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();
|
||||
|
||||
expect(vm.$el.id).toEqual('ide');
|
||||
|
|
Loading…
Reference in a new issue