Commit 95a0d73e authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera Committed by Illya Klymov

Add elipsis to overflowing tag name

- add tooltip
- add tests
parent f6c40a9e
...@@ -104,9 +104,15 @@ export default { ...@@ -104,9 +104,15 @@ export default {
}, },
fields() { fields() {
const tagClass = this.isDesktop ? 'w-25' : ''; const tagClass = this.isDesktop ? 'w-25' : '';
const tagInnerClass = this.isDesktop ? 'mw-m' : 'gl-justify-content-end';
return [ return [
{ key: LIST_KEY_CHECKBOX, label: '', class: 'gl-w-16' }, { key: LIST_KEY_CHECKBOX, label: '', class: 'gl-w-16' },
{ key: LIST_KEY_TAG, label: LIST_LABEL_TAG, class: `${tagClass} js-tag-column` }, {
key: LIST_KEY_TAG,
label: LIST_LABEL_TAG,
class: `${tagClass} js-tag-column`,
innerClass: tagInnerClass,
},
{ key: LIST_KEY_IMAGE_ID, label: LIST_LABEL_IMAGE_ID }, { key: LIST_KEY_IMAGE_ID, label: LIST_LABEL_IMAGE_ID },
{ key: LIST_KEY_SIZE, label: LIST_LABEL_SIZE }, { key: LIST_KEY_SIZE, label: LIST_LABEL_SIZE },
{ key: LIST_KEY_LAST_UPDATED, label: LIST_LABEL_LAST_UPDATED }, { key: LIST_KEY_LAST_UPDATED, label: LIST_LABEL_LAST_UPDATED },
...@@ -329,17 +335,24 @@ export default { ...@@ -329,17 +335,24 @@ export default {
@change="updateSelectedItems(index)" @change="updateSelectedItems(index)"
/> />
</template> </template>
<template #cell(name)="{item}"> <template #cell(name)="{item, field}">
<span ref="rowName"> <div ref="rowName" :class="[field.innerClass, 'gl-display-flex']">
{{ item.name }} <span
</span> v-gl-tooltip
<clipboard-button data-testid="rowNameText"
v-if="item.location" :title="item.name"
ref="rowClipboardButton" class="gl-text-overflow-ellipsis gl-overflow-hidden gl-white-space-nowrap"
:title="item.location" >
:text="item.location" {{ item.name }}
css-class="btn-default btn-transparent btn-clipboard" </span>
/> <clipboard-button
v-if="item.location"
ref="rowClipboardButton"
:title="item.location"
:text="item.location"
css-class="btn-default btn-transparent btn-clipboard"
/>
</div>
</template> </template>
<template #cell(short_revision)="{value}"> <template #cell(short_revision)="{value}">
<span ref="rowShortRevision"> <span ref="rowShortRevision">
......
---
title: Add elipsis to container registry tag name
merge_request: 31584
author:
type: fixed
...@@ -37,6 +37,7 @@ describe('Details Page', () => { ...@@ -37,6 +37,7 @@ describe('Details Page', () => {
const findAllCheckboxes = () => wrapper.findAll('.js-row-checkbox'); const findAllCheckboxes = () => wrapper.findAll('.js-row-checkbox');
const findCheckedCheckboxes = () => findAllCheckboxes().filter(c => c.attributes('checked')); const findCheckedCheckboxes = () => findAllCheckboxes().filter(c => c.attributes('checked'));
const findFirsTagColumn = () => wrapper.find('.js-tag-column'); const findFirsTagColumn = () => wrapper.find('.js-tag-column');
const findFirstTagNameText = () => wrapper.find('[data-testid="rowNameText"]');
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.find(GlAlert);
const routeId = window.btoa(JSON.stringify({ name: 'foo', tags_path: 'bar' })); const routeId = window.btoa(JSON.stringify({ name: 'foo', tags_path: 'bar' }));
...@@ -248,15 +249,24 @@ describe('Details Page', () => { ...@@ -248,15 +249,24 @@ describe('Details Page', () => {
}); });
}); });
describe('tag cell', () => { describe('name cell', () => {
it('tag column has a tooltip with the tag name', () => {
mountComponent();
expect(findFirstTagNameText().attributes('title')).toBe(tagsListResponse.data[0].name);
});
describe('on desktop viewport', () => { describe('on desktop viewport', () => {
beforeEach(() => { beforeEach(() => {
mountComponent(); mountComponent();
}); });
it('has class w-25', () => { it('table header has class w-25', () => {
expect(findFirsTagColumn().classes()).toContain('w-25'); expect(findFirsTagColumn().classes()).toContain('w-25');
}); });
it('tag column has the mw-m class', () => {
expect(findFirstRowItem('rowName').classes()).toContain('mw-m');
});
}); });
describe('on mobile viewport', () => { describe('on mobile viewport', () => {
...@@ -268,9 +278,13 @@ describe('Details Page', () => { ...@@ -268,9 +278,13 @@ describe('Details Page', () => {
}); });
}); });
it('does not has class w-25', () => { it('table header does not have class w-25', () => {
expect(findFirsTagColumn().classes()).not.toContain('w-25'); expect(findFirsTagColumn().classes()).not.toContain('w-25');
}); });
it('tag column has the gl-justify-content-end class', () => {
expect(findFirstRowItem('rowName').classes()).toContain('gl-justify-content-end');
});
}); });
}); });
......
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