Commit 24bf932b authored by Martin Wortschack's avatar Martin Wortschack

Merge branch...

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

DevOps Report: Add table cell tooltips

See merge request gitlab-org/gitlab!49687
parents 635a14b6 d74bd943
<script>
import { GlTooltipDirective } from '@gitlab/ui';
import { DEVOPS_ADOPTION_STRINGS } from '../constants';
const {
tableCell: { trueText, falseText },
} = DEVOPS_ADOPTION_STRINGS;
export default {
name: 'DevopsAdoptionTableCellFlag',
directives: {
GlTooltip: GlTooltipDirective,
},
props: {
enabled: {
type: Boolean,
required: true,
},
},
data() {
return {
tooltipText: this.enabled ? trueText : falseText,
};
},
};
</script>
<template>
<span class="circle" :class="{ 'circle-enabled': enabled }"></span>
<span
v-gl-tooltip.hover="tooltipText"
class="circle"
:class="{ 'circle-enabled': enabled }"
></span>
</template>
......@@ -93,6 +93,10 @@ export const DEVOPS_ADOPTION_STRINGS = {
confirm: s__('DevopsAdoption|Delete segment'),
error: s__('DevopsAdoption|An error occured while deleting the segment. Please try again.'),
},
tableCell: {
trueText: s__('DevopsAdoption|Adopted'),
falseText: s__('DevopsAdoption|Not adopted'),
},
};
export const DEVOPS_ADOPTION_TABLE_TEST_IDS = {
......
import { shallowMount } from '@vue/test-utils';
import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
import DevopsAdoptionTableCellFlag from 'ee/admin/dev_ops_report/components/devops_adoption_table_cell_flag.vue';
describe('DevopsAdoptionTableCellFlag', () => {
......@@ -10,6 +11,9 @@ describe('DevopsAdoptionTableCellFlag', () => {
enabled: true,
...props,
},
directives: {
GlTooltip: createMockDirective(),
},
});
};
......@@ -18,17 +22,35 @@ describe('DevopsAdoptionTableCellFlag', () => {
wrapper = null;
});
it('contains the circle-enabled class when enabled', () => {
createComponent();
describe('enabled', () => {
beforeEach(() => createComponent());
it('contains the circle-enabled class', () => {
expect(wrapper.classes()).toContain('circle');
expect(wrapper.classes()).toContain('circle-enabled');
});
it('does not contain the circle-enabled class when disabled', () => {
createComponent({ enabled: false });
it('contains a tooltip', () => {
const tooltip = getBinding(wrapper.element, 'gl-tooltip');
expect(tooltip).toBeDefined();
expect(tooltip.value).toBe('Adopted');
});
});
describe('disabled', () => {
beforeEach(() => createComponent({ enabled: false }));
it('does not contain the circle-enabled class', () => {
expect(wrapper.classes()).toContain('circle');
expect(wrapper.classes()).not.toContain('circle-enabled');
});
it('contains a tooltip', () => {
const tooltip = getBinding(wrapper.element, 'gl-tooltip');
expect(tooltip).toBeDefined();
expect(tooltip.value).toBe('Not adopted');
});
});
});
......@@ -9607,6 +9607,9 @@ msgstr ""
msgid "DevopsAdoption|Add new segment"
msgstr ""
msgid "DevopsAdoption|Adopted"
msgstr ""
msgid "DevopsAdoption|An error occured while deleting the segment. Please try again."
msgstr ""
......@@ -9679,6 +9682,9 @@ msgstr ""
msgid "DevopsAdoption|No filter results."
msgstr ""
msgid "DevopsAdoption|Not adopted"
msgstr ""
msgid "DevopsAdoption|Pipelines"
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