Commit 2b4db15b authored by Brandon Labuschagne's avatar Brandon Labuschagne

Merge branch '232503-editor-lite-to-snippet' into 'master'

Snippet Edit: replaced blob-content-edit with editor-lite component

See merge request gitlab-org/gitlab!44994
parents 155eba0e 774cee04
<script> <script>
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import BlobHeaderEdit from '~/blob/components/blob_edit_header.vue'; import BlobHeaderEdit from '~/blob/components/blob_edit_header.vue';
import BlobContentEdit from '~/blob/components/blob_edit_content.vue'; import EditorLite from '~/vue_shared/components/editor_lite.vue';
import { getBaseURL, joinPaths } from '~/lib/utils/url_utility'; import { getBaseURL, joinPaths } from '~/lib/utils/url_utility';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { SNIPPET_BLOB_CONTENT_FETCH_ERROR } from '~/snippets/constants'; import { SNIPPET_BLOB_CONTENT_FETCH_ERROR } from '~/snippets/constants';
...@@ -11,8 +11,8 @@ import { sprintf } from '~/locale'; ...@@ -11,8 +11,8 @@ import { sprintf } from '~/locale';
export default { export default {
components: { components: {
BlobHeaderEdit, BlobHeaderEdit,
BlobContentEdit,
GlLoadingIcon, GlLoadingIcon,
EditorLite,
}, },
inheritAttrs: false, inheritAttrs: false,
props: { props: {
...@@ -85,7 +85,7 @@ export default { ...@@ -85,7 +85,7 @@ export default {
size="lg" size="lg"
class="loading-animation prepend-top-20 gl-mb-6" class="loading-animation prepend-top-20 gl-mb-6"
/> />
<blob-content-edit <editor-lite
v-else v-else
:value="blob.content" :value="blob.content"
:file-global-id="blob.id" :file-global-id="blob.id"
......
---
title: Replaced blob-content-edit with editor-lite compoennt for Snippet edit form
merge_request: 44994
author:
type: changed
...@@ -13,7 +13,8 @@ exports[`Snippet Blob Edit component with loaded blob matches snapshot 1`] = ` ...@@ -13,7 +13,8 @@ exports[`Snippet Blob Edit component with loaded blob matches snapshot 1`] = `
value="foo/bar/test.md" value="foo/bar/test.md"
/> />
<blob-content-edit-stub <editor-lite-stub
editoroptions="[object Object]"
fileglobalid="blob_local_7" fileglobalid="blob_local_7"
filename="foo/bar/test.md" filename="foo/bar/test.md"
value="Lorem ipsum dolar sit amet, value="Lorem ipsum dolar sit amet,
......
...@@ -5,7 +5,7 @@ import waitForPromises from 'helpers/wait_for_promises'; ...@@ -5,7 +5,7 @@ import waitForPromises from 'helpers/wait_for_promises';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import SnippetBlobEdit from '~/snippets/components/snippet_blob_edit.vue'; import SnippetBlobEdit from '~/snippets/components/snippet_blob_edit.vue';
import BlobHeaderEdit from '~/blob/components/blob_edit_header.vue'; import BlobHeaderEdit from '~/blob/components/blob_edit_header.vue';
import BlobContentEdit from '~/blob/components/blob_edit_content.vue'; import EditorLite from '~/vue_shared/components/editor_lite.vue';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { joinPaths } from '~/lib/utils/url_utility'; import { joinPaths } from '~/lib/utils/url_utility';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import { deprecatedCreateFlash as createFlash } from '~/flash';
...@@ -48,7 +48,7 @@ describe('Snippet Blob Edit component', () => { ...@@ -48,7 +48,7 @@ describe('Snippet Blob Edit component', () => {
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
const findHeader = () => wrapper.find(BlobHeaderEdit); const findHeader = () => wrapper.find(BlobHeaderEdit);
const findContent = () => wrapper.find(BlobContentEdit); const findContent = () => wrapper.find(EditorLite);
const getLastUpdatedArgs = () => { const getLastUpdatedArgs = () => {
const event = wrapper.emitted()['blob-updated']; const event = wrapper.emitted()['blob-updated'];
...@@ -172,11 +172,13 @@ describe('Snippet Blob Edit component', () => { ...@@ -172,11 +172,13 @@ describe('Snippet Blob Edit component', () => {
expect(findContent().exists()).toBe(showContent); expect(findContent().exists()).toBe(showContent);
if (showContent) { if (showContent) {
expect(findContent().props()).toEqual({ expect(findContent().props()).toEqual(
expect.objectContaining({
value: TEST_BLOB_LOADED.content, value: TEST_BLOB_LOADED.content,
fileGlobalId: TEST_BLOB_LOADED.id, fileGlobalId: TEST_BLOB_LOADED.id,
fileName: TEST_BLOB_LOADED.path, fileName: TEST_BLOB_LOADED.path,
}); }),
);
} }
}); });
}); });
......
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