Commit cc93dbef authored by Rajat Jain's avatar Rajat Jain

Add tests header component

parent 72171edd
......@@ -76,7 +76,7 @@ export default {
<gl-tooltip :target="() => $refs.countBadge">
<p v-if="allowSubEpics" class="font-weight-bold m-0">
{{ __('Epics') }} &#8226;
<span class="text-secondary-400 font-weight-normal"
<span class="font-weight-normal"
>{{
sprintf(__('%{openedEpics} open, %{closedEpics} closed'), {
openedEpics: descendantCounts.openedEpics,
......@@ -87,7 +87,7 @@ export default {
</p>
<p class="font-weight-bold m-0">
{{ __('Issues') }} &#8226;
<span class="text-secondary-400 font-weight-normal"
<span class="font-weight-normal"
>{{
sprintf(__('%{openedIssues} open, %{closedIssues} closed'), {
openedIssues: descendantCounts.openedIssues,
......@@ -98,7 +98,7 @@ export default {
</p>
<p class="font-weight-bold m-0">
{{ __('Total weight') }} &#8226;
<span class="text-secondary-400 font-weight-normal">{{ totalWeight }} </span>
<span class="font-weight-normal">{{ totalWeight }} </span>
</p>
</gl-tooltip>
<div
......
......@@ -29,6 +29,10 @@ const createComponent = ({ slots } = {}) => {
isSubItem: false,
children,
});
store.dispatch('setWeightSum', {
openedIssues: 10,
closedIssues: 5,
});
store.dispatch('setChildrenCount', mockParentItem.descendantCounts);
return shallowMount(RelatedItemsTreeHeader, {
......@@ -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', () => {
beforeEach(() => {
wrapper = createComponent();
......@@ -235,6 +249,15 @@ describe('RelatedItemsTree', () => {
expect(issueIcon.isVisible()).toBe(true);
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