Commit 14d8c620 authored by Paul Slaughter's avatar Paul Slaughter

Async import more IDE things

Also update spec to await for errorMessage
component to be loaded.
parent 6c13a4fe
...@@ -13,10 +13,7 @@ import { performanceMarkAndMeasure } from '~/performance/utils'; ...@@ -13,10 +13,7 @@ import { performanceMarkAndMeasure } from '~/performance/utils';
import { modalTypes } from '../constants'; import { modalTypes } from '../constants';
import eventHub from '../eventhub'; import eventHub from '../eventhub';
import IdeSidebar from './ide_side_bar.vue'; import IdeSidebar from './ide_side_bar.vue';
import ErrorMessage from './error_message.vue'; import RepoEditor from './repo_editor.vue';
import CommitEditorHeader from './commit_sidebar/editor_header.vue';
import RepoTabs from './repo_tabs.vue';
import IdeStatusBar from './ide_status_bar.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { measurePerformance } from '../utils'; import { measurePerformance } from '../utils';
...@@ -32,13 +29,14 @@ eventHub.$on(WEBIDE_MEASURE_FILE_AFTER_INTERACTION, () => ...@@ -32,13 +29,14 @@ eventHub.$on(WEBIDE_MEASURE_FILE_AFTER_INTERACTION, () =>
export default { export default {
components: { components: {
IdeSidebar, IdeSidebar,
ErrorMessage, RepoEditor,
GlButton, GlButton,
GlLoadingIcon, GlLoadingIcon,
CommitEditorHeader, ErrorMessage: () => import(/* webpackChunkName: 'ide_runtime' */ './error_message.vue'),
RepoTabs, CommitEditorHeader: () =>
IdeStatusBar, import(/* webpackChunkName: 'ide_runtime' */ './commit_sidebar/editor_header.vue'),
RepoEditor: () => import(/* webpackChunkName: 'ide_runtime' */ './repo_editor.vue'), RepoTabs: () => import(/* webpackChunkName: 'ide_runtime' */ './repo_tabs.vue'),
IdeStatusBar: () => import(/* webpackChunkName: 'ide_runtime' */ './ide_status_bar.vue'),
FindFile: () => FindFile: () =>
import(/* webpackChunkName: 'ide_runtime' */ '~/vue_shared/components/file_finder/index.vue'), import(/* webpackChunkName: 'ide_runtime' */ '~/vue_shared/components/file_finder/index.vue'),
RightPane: () => import(/* webpackChunkName: 'ide_runtime' */ './panes/right.vue'), RightPane: () => import(/* webpackChunkName: 'ide_runtime' */ './panes/right.vue'),
......
import Vuex from 'vuex'; import Vuex from 'vuex';
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { createLocalVue, shallowMount } from '@vue/test-utils';
import waitForPromises from 'helpers/wait_for_promises';
import { createStore } from '~/ide/stores'; import { createStore } from '~/ide/stores';
import ErrorMessage from '~/ide/components/error_message.vue'; import ErrorMessage from '~/ide/components/error_message.vue';
import ide from '~/ide/components/ide.vue'; import ide from '~/ide/components/ide.vue';
...@@ -55,27 +56,24 @@ describe('WebIDE', () => { ...@@ -55,27 +56,24 @@ describe('WebIDE', () => {
describe('ide component, non-empty repo', () => { describe('ide component, non-empty repo', () => {
describe('error message', () => { describe('error message', () => {
it('does not show error message when it is not set', () => { it.each`
wrapper = createComponent({ errorMessage | exists
state: { ${null} | ${false}
errorMessage: null, ${{ text: 'error' }} | ${true}
}, `(
}); 'should error message exists=$exists when errorMessage=$errorMessage',
async ({ errorMessage, exists }) => {
expect(wrapper.find(ErrorMessage).exists()).toBe(false); wrapper = createComponent({
}); state: {
errorMessage,
it('shows error message when set', () => {
wrapper = createComponent({
state: {
errorMessage: {
text: 'error',
}, },
}, });
});
expect(wrapper.find(ErrorMessage).exists()).toBe(true); await waitForPromises();
});
expect(wrapper.find(ErrorMessage).exists()).toBe(exists);
},
);
}); });
describe('onBeforeUnload', () => { describe('onBeforeUnload', () => {
......
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