Commit df79193d authored by Martin Wortschack's avatar Martin Wortschack

Merge branch...

Merge branch '271250-fe-devops-report-adding-preparing-state-and-tooltips-in-segment-table' into 'master'

Add "preparing" state to devops adoption table

See merge request gitlab-org/gitlab!49570
parents ed439d2d 2109a499
......@@ -110,7 +110,15 @@ export default {
<template #cell(name)="{ item }">
<div :data-testid="$options.testids.SEGMENT">
<strong>{{ item.name }}</strong>
<strong v-if="item.latestSnapshot">{{ item.name }}</strong>
<template v-else>
<span class="gl-text-gray-400">{{ item.name }}</span>
<gl-icon
v-gl-tooltip.hover="$options.i18n.pendingTooltip"
name="hourglass"
class="gl-text-gray-400"
/>
</template>
</div>
</template>
......
......@@ -90,6 +90,7 @@ export const DEVOPS_ADOPTION_STRINGS = {
tooltip: s__('DevopsAdoption|At least 1 security scan of any type run in pipeline'),
},
},
pendingTooltip: s__('DevopsAdoption|Segment data pending until the start of next month'),
},
deleteModal: {
title: s__('DevopsAdoption|Confirm delete segment'),
......
......@@ -33,6 +33,12 @@ describe('DevopsAdoptionTable', () => {
const findCol = testId => findTable().find(`[data-testid="${testId}"]`);
const findColRowChild = (col, row, child) =>
findTable()
.findAll(`[data-testid="${col}"]`)
.at(row)
.find(child);
const findColSubComponent = (colTestId, childComponent) =>
findCol(colTestId).find(childComponent);
......@@ -82,8 +88,38 @@ describe('DevopsAdoptionTable', () => {
});
describe('table fields', () => {
it('displays the correct segment name', () => {
expect(findCol(TEST_IDS.SEGMENT).text()).toBe('Segment 1');
describe('segment name', () => {
it('displays the correct segment name', () => {
expect(findCol(TEST_IDS.SEGMENT).text()).toBe('Segment 1');
});
describe('pending state (no snapshot data available)', () => {
it('grays the text out', () => {
const name = findColRowChild(TEST_IDS.SEGMENT, 1, 'span');
expect(name.classes()).toStrictEqual(['gl-text-gray-400']);
});
describe('hourglass icon', () => {
let icon;
beforeEach(() => {
icon = findColRowChild(TEST_IDS.SEGMENT, 1, GlIcon);
});
it('displays the icon', () => {
expect(icon.exists()).toBe(true);
expect(icon.props('name')).toBe('hourglass');
});
it('contains a tooltip', () => {
const tooltip = getBinding(icon.element, 'gl-tooltip');
expect(tooltip).toBeDefined();
expect(tooltip.value).toBe('Segment data pending until the start of next month');
});
});
});
});
it.each`
......
......@@ -56,6 +56,17 @@ export const devopsAdoptionSegmentsData = {
},
__typename: 'devopsSegment',
},
{
name: 'Segment 2',
id: 2,
groups: [
{
id: 'gid://gitlab/Group/1',
},
],
latestSnapshot: null,
__typename: 'devopsSegment',
},
],
__typename: 'devopsAdoptionSegments',
};
......
......@@ -17,7 +17,7 @@ describe('addSegmentToCache', () => {
expect.objectContaining({
data: {
devopsAdoptionSegments: {
nodes: devopsAdoptionSegmentsData.nodes,
nodes: [devopsAdoptionSegmentsData.nodes[0]],
},
},
}),
......
......@@ -9736,6 +9736,9 @@ msgstr ""
msgid "DevopsAdoption|Segment"
msgstr ""
msgid "DevopsAdoption|Segment data pending until the start of next month"
msgstr ""
msgid "DevopsAdoption|There was an error fetching Groups. Please refresh the page to try again."
msgstr ""
......
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