Commit d184db85 authored by Scott Hampton's avatar Scott Hampton

Merge branch '297650-editor-is-not-shown-when-graphql-fields-are-missing' into 'master'

Trigger empty state only for missing file case

See merge request gitlab-org/gitlab!51653
parents 95471a4d 78aa9892
...@@ -126,7 +126,7 @@ export default { ...@@ -126,7 +126,7 @@ export default {
return this.$apollo.queries.content.loading; return this.$apollo.queries.content.loading;
}, },
isBlobContentError() { isBlobContentError() {
return this.failureType === LOAD_FAILURE_NO_FILE || this.failureType === LOAD_FAILURE_UNKNOWN; return this.failureType === LOAD_FAILURE_NO_FILE;
}, },
isCiConfigDataLoading() { isCiConfigDataLoading() {
return this.$apollo.queries.ciConfigData.loading; return this.$apollo.queries.ciConfigData.loading;
......
...@@ -448,16 +448,7 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => { ...@@ -448,16 +448,7 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => {
const expectedAlertMsg = const expectedAlertMsg =
'There is no .gitlab-ci.yml file in this repository, please add one and visit the Pipeline Editor again.'; 'There is no .gitlab-ci.yml file in this repository, please add one and visit the Pipeline Editor again.';
it('does not show editor or commit form', async () => { it('shows a 404 error message and does not show editor or commit form', async () => {
mockBlobContentData.mockRejectedValueOnce(new Error('My error!'));
createComponentWithApollo();
await waitForPromises();
expect(findEditorLite().exists()).toBe(false);
expect(findTextEditor().exists()).toBe(false);
});
it('shows a 404 error message', async () => {
mockBlobContentData.mockRejectedValueOnce({ mockBlobContentData.mockRejectedValueOnce({
response: { response: {
status: httpStatusCodes.NOT_FOUND, status: httpStatusCodes.NOT_FOUND,
...@@ -468,9 +459,11 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => { ...@@ -468,9 +459,11 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => {
await waitForPromises(); await waitForPromises();
expect(findAlert().text()).toBe(expectedAlertMsg); expect(findAlert().text()).toBe(expectedAlertMsg);
expect(findEditorLite().exists()).toBe(false);
expect(findTextEditor().exists()).toBe(false);
}); });
it('shows a 400 error message', async () => { it('shows a 400 error message and does not show editor or commit form', async () => {
mockBlobContentData.mockRejectedValueOnce({ mockBlobContentData.mockRejectedValueOnce({
response: { response: {
status: httpStatusCodes.BAD_REQUEST, status: httpStatusCodes.BAD_REQUEST,
...@@ -481,6 +474,8 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => { ...@@ -481,6 +474,8 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => {
await waitForPromises(); await waitForPromises();
expect(findAlert().text()).toBe(expectedAlertMsg); expect(findAlert().text()).toBe(expectedAlertMsg);
expect(findEditorLite().exists()).toBe(false);
expect(findTextEditor().exists()).toBe(false);
}); });
it('shows a unkown error message', async () => { it('shows a unkown error message', async () => {
...@@ -489,6 +484,8 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => { ...@@ -489,6 +484,8 @@ describe('~/pipeline_editor/pipeline_editor_app.vue', () => {
await waitForPromises(); await waitForPromises();
expect(findAlert().text()).toBe('The CI configuration was not loaded, please try again.'); expect(findAlert().text()).toBe('The CI configuration was not loaded, please try again.');
expect(findEditorLite().exists()).toBe(true);
expect(findTextEditor().exists()).toBe(true);
}); });
}); });
}); });
......
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