Commit cc93dbef authored by Rajat Jain's avatar Rajat Jain

Add tests header component

parent 72171edd
...@@ -76,7 +76,7 @@ export default { ...@@ -76,7 +76,7 @@ export default {
<gl-tooltip :target="() => $refs.countBadge"> <gl-tooltip :target="() => $refs.countBadge">
<p v-if="allowSubEpics" class="font-weight-bold m-0"> <p v-if="allowSubEpics" class="font-weight-bold m-0">
{{ __('Epics') }} &#8226; {{ __('Epics') }} &#8226;
<span class="text-secondary-400 font-weight-normal" <span class="font-weight-normal"
>{{ >{{
sprintf(__('%{openedEpics} open, %{closedEpics} closed'), { sprintf(__('%{openedEpics} open, %{closedEpics} closed'), {
openedEpics: descendantCounts.openedEpics, openedEpics: descendantCounts.openedEpics,
...@@ -87,7 +87,7 @@ export default { ...@@ -87,7 +87,7 @@ export default {
</p> </p>
<p class="font-weight-bold m-0"> <p class="font-weight-bold m-0">
{{ __('Issues') }} &#8226; {{ __('Issues') }} &#8226;
<span class="text-secondary-400 font-weight-normal" <span class="font-weight-normal"
>{{ >{{
sprintf(__('%{openedIssues} open, %{closedIssues} closed'), { sprintf(__('%{openedIssues} open, %{closedIssues} closed'), {
openedIssues: descendantCounts.openedIssues, openedIssues: descendantCounts.openedIssues,
...@@ -98,7 +98,7 @@ export default { ...@@ -98,7 +98,7 @@ export default {
</p> </p>
<p class="font-weight-bold m-0"> <p class="font-weight-bold m-0">
{{ __('Total weight') }} &#8226; {{ __('Total weight') }} &#8226;
<span class="text-secondary-400 font-weight-normal">{{ totalWeight }} </span> <span class="font-weight-normal">{{ totalWeight }} </span>
</p> </p>
</gl-tooltip> </gl-tooltip>
<div <div
......
...@@ -29,6 +29,10 @@ const createComponent = ({ slots } = {}) => { ...@@ -29,6 +29,10 @@ const createComponent = ({ slots } = {}) => {
isSubItem: false, isSubItem: false,
children, children,
}); });
store.dispatch('setWeightSum', {
openedIssues: 10,
closedIssues: 5,
});
store.dispatch('setChildrenCount', mockParentItem.descendantCounts); store.dispatch('setChildrenCount', mockParentItem.descendantCounts);
return shallowMount(RelatedItemsTreeHeader, { return shallowMount(RelatedItemsTreeHeader, {
...@@ -64,6 +68,16 @@ describe('RelatedItemsTree', () => { ...@@ -64,6 +68,16 @@ describe('RelatedItemsTree', () => {
}); });
}); });
describe('totalWeight', () => {
beforeEach(() => {
wrapper = createComponent();
});
it('total of openedIssues and closedIssues weight', () => {
expect(wrapper.vm.totalWeight).toBe(15);
});
});
describe('epic issue actions split button', () => { describe('epic issue actions split button', () => {
beforeEach(() => { beforeEach(() => {
wrapper = createComponent(); wrapper = createComponent();
...@@ -235,6 +249,15 @@ describe('RelatedItemsTree', () => { ...@@ -235,6 +249,15 @@ describe('RelatedItemsTree', () => {
expect(issueIcon.isVisible()).toBe(true); expect(issueIcon.isVisible()).toBe(true);
expect(issueIcon.props('name')).toBe('issues'); expect(issueIcon.props('name')).toBe('issues');
}); });
it('renders totalWeight count and gl-icon', () => {
const weightEl = wrapper.findAll('.issue-count-badge > span').at(2);
const weightIcon = weightEl.find(GlIcon);
expect(weightEl.text().trim()).toContain('15');
expect(weightIcon.isVisible()).toBe(true);
expect(weightIcon.props('name')).toBe('weight');
});
}); });
}); });
}); });
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