Commit 6d6b4758 authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch '211637-blob-path-name' into 'master'

Replaced blob name with path on Snippet view

See merge request gitlab-org/gitlab!30550
parents ac3206b8 c1b31f71
...@@ -28,12 +28,12 @@ export default { ...@@ -28,12 +28,12 @@ export default {
<div class="file-header-content d-flex align-items-center lh-100"> <div class="file-header-content d-flex align-items-center lh-100">
<slot name="filepathPrepend"></slot> <slot name="filepathPrepend"></slot>
<file-icon :file-name="blob.path" :size="18" aria-hidden="true" css-classes="mr-2" /> <template v-if="blob.path">
<strong <file-icon :file-name="blob.path" :size="18" aria-hidden="true" css-classes="mr-2" />
v-if="blob.name" <strong class="file-title-name qa-file-title-name mr-1 js-blob-header-filepath">{{
class="file-title-name qa-file-title-name mr-1 js-blob-header-filepath" blob.path
>{{ blob.name }}</strong }}</strong>
> </template>
<small class="mr-2">{{ blobSize }}</small> <small class="mr-2">{{ blobSize }}</small>
......
---
title: Updated snippet view to show path instead of name for a blob
merge_request: 30550
author:
type: changed
...@@ -8,14 +8,14 @@ exports[`Blob Header Filepath rendering matches the snapshot 1`] = ` ...@@ -8,14 +8,14 @@ exports[`Blob Header Filepath rendering matches the snapshot 1`] = `
<file-icon-stub <file-icon-stub
aria-hidden="true" aria-hidden="true"
cssclasses="mr-2" cssclasses="mr-2"
filename="dummy.md" filename="foo/bar/dummy.md"
size="18" size="18"
/> />
<strong <strong
class="file-title-name qa-file-title-name mr-1 js-blob-header-filepath" class="file-title-name qa-file-title-name mr-1 js-blob-header-filepath"
> >
dummy.md foo/bar/dummy.md
</strong> </strong>
<small <small
...@@ -26,8 +26,8 @@ exports[`Blob Header Filepath rendering matches the snapshot 1`] = ` ...@@ -26,8 +26,8 @@ exports[`Blob Header Filepath rendering matches the snapshot 1`] = `
<clipboard-button-stub <clipboard-button-stub
cssclass="btn-clipboard btn-transparent lh-100 position-static" cssclass="btn-clipboard btn-transparent lh-100 position-static"
gfm="\`dummy.md\`" gfm="\`foo/bar/dummy.md\`"
text="dummy.md" text="foo/bar/dummy.md"
title="Copy file path" title="Copy file path"
tooltipplacement="top" tooltipplacement="top"
/> />
......
...@@ -38,12 +38,12 @@ describe('Blob Header Filepath', () => { ...@@ -38,12 +38,12 @@ describe('Blob Header Filepath', () => {
.find('.js-blob-header-filepath') .find('.js-blob-header-filepath')
.text() .text()
.trim(), .trim(),
).toBe(MockBlob.name); ).toBe(MockBlob.path);
}); });
it('does not fail if the name is empty', () => { it('does not fail if the name is empty', () => {
const emptyName = ''; const emptyPath = '';
createComponent({ name: emptyName }); createComponent({ path: emptyPath });
expect(wrapper.find('.js-blob-header-filepath').exists()).toBe(false); expect(wrapper.find('.js-blob-header-filepath').exists()).toBe(false);
}); });
...@@ -84,7 +84,7 @@ describe('Blob Header Filepath', () => { ...@@ -84,7 +84,7 @@ describe('Blob Header Filepath', () => {
describe('functionality', () => { describe('functionality', () => {
it('sets gfm value correctly on the clipboard-button', () => { it('sets gfm value correctly on the clipboard-button', () => {
createComponent(); createComponent();
expect(wrapper.vm.gfmCopyText).toBe('`dummy.md`'); expect(wrapper.vm.gfmCopyText).toBe(`\`${MockBlob.path}\``);
}); });
}); });
}); });
...@@ -21,7 +21,7 @@ export const RichViewerMock = { ...@@ -21,7 +21,7 @@ export const RichViewerMock = {
export const Blob = { export const Blob = {
binary: false, binary: false,
name: 'dummy.md', name: 'dummy.md',
path: 'dummy.md', path: 'foo/bar/dummy.md',
rawPath: '/flightjs/flight/snippets/51/raw', rawPath: '/flightjs/flight/snippets/51/raw',
size: 75, size: 75,
simpleViewer: { simpleViewer: {
......
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