Commit 2109cef2 authored by Alexander Turinske's avatar Alexander Turinske

Abstract out id creation

- update tests
parent 03d3f3b7
...@@ -29,20 +29,25 @@ export default { ...@@ -29,20 +29,25 @@ export default {
default: '', default: '',
}, },
}, },
computed: {
iconId() {
return `reportInfo-${this.title}`;
},
},
}; };
</script> </script>
<template> <template>
<span class="vertical-align-middle text-muted js-help ml-2"> <span class="vertical-align-middle text-muted js-help ml-2">
<gl-icon <gl-icon
:id="'reportInfo' + title" :id="iconId"
name="question" name="question"
class="author-link suggestion-help-hover" class="author-link suggestion-help-hover"
:aria-label="__('help')" :aria-label="__('help')"
:size="14" :size="14"
data-testid="icon2" data-testid="icon2"
/> />
<gl-popover :target="'reportInfo' + title" placement="top" :title="title"> <gl-popover :target="iconId" placement="top" :title="title">
<div class="mb-2">{{ text }}</div> <div class="mb-2">{{ text }}</div>
<gl-link v-if="documentationLink" target="_blank" :href="documentationLink"> <gl-link v-if="documentationLink" target="_blank" :href="documentationLink">
<span class="vertical-align-middle">{{ documentationText }}</span> <span class="vertical-align-middle">{{ documentationText }}</span>
......
...@@ -7,11 +7,11 @@ import { TEST_HOST } from 'helpers/test_constants'; ...@@ -7,11 +7,11 @@ import { TEST_HOST } from 'helpers/test_constants';
describe('Approval Check Popover', () => { describe('Approval Check Popover', () => {
let wrapper; let wrapper;
const title = 'Title';
beforeEach(() => { beforeEach(() => {
wrapper = shallowMount(component, { wrapper = shallowMount(component, {
propsData: { propsData: { title },
title: 'Title',
},
}); });
}); });
...@@ -43,8 +43,8 @@ describe('Approval Check Popover', () => { ...@@ -43,8 +43,8 @@ describe('Approval Check Popover', () => {
it('should render gl-popover with correct props', () => { it('should render gl-popover with correct props', () => {
expect(wrapper.find(GlPopover).props()).toMatchObject({ expect(wrapper.find(GlPopover).props()).toMatchObject({
title: 'Title', title,
target: 'reportInfo', target: `reportInfo-${title}`,
placement: 'top', placement: 'top',
}); });
}); });
......
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