Commit e3930695 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'aalakkad/add-blocked-icon-to-blocked-issues-in-epic' into 'master'

Show blocked icon on epic blocked issues

See merge request gitlab-org/gitlab!72229
parents d06b49c5 e6a66ce2
...@@ -89,6 +89,7 @@ query childItems( ...@@ -89,6 +89,7 @@ query childItems(
iid iid
epicIssueId epicIssueId
title title
blocked
closedAt closedAt
state state
createdAt createdAt
......
...@@ -66,6 +66,9 @@ export default { ...@@ -66,6 +66,9 @@ export default {
isOpen() { isOpen() {
return this.item.state === ChildState.Open; return this.item.state === ChildState.Open;
}, },
isBlocked() {
return this.item.blocked;
},
isClosed() { isClosed() {
return this.item.state === ChildState.Closed; return this.item.state === ChildState.Closed;
}, },
...@@ -85,9 +88,15 @@ export default { ...@@ -85,9 +88,15 @@ export default {
if (this.item.type === ChildType.Epic) { if (this.item.type === ChildType.Epic) {
return this.isOpen ? 'epic' : 'epic-closed'; return this.isOpen ? 'epic' : 'epic-closed';
} }
if (this.isBlocked && this.isOpen) {
return 'issue-block';
}
return this.isOpen ? 'issues' : 'issue-closed'; return this.isOpen ? 'issues' : 'issue-closed';
}, },
stateIconClass() { stateIconClass() {
if (this.isBlocked && this.isOpen) {
return 'gl-text-red-500';
}
return this.isOpen return this.isOpen
? 'issue-token-state-icon-open gl-text-green-500' ? 'issue-token-state-icon-open gl-text-green-500'
: 'issue-token-state-icon-closed gl-text-blue-500'; : 'issue-token-state-icon-closed gl-text-blue-500';
......
...@@ -83,6 +83,8 @@ describe('RelatedItemsTree', () => { ...@@ -83,6 +83,8 @@ describe('RelatedItemsTree', () => {
const findCountBadge = () => wrapper.find({ ref: 'countBadge' }); const findCountBadge = () => wrapper.find({ ref: 'countBadge' });
const findIssueHealthStatus = () => wrapper.find('[data-testid="issue-health-status"]'); const findIssueHealthStatus = () => wrapper.find('[data-testid="issue-health-status"]');
const findEpicHealthStatus = () => wrapper.find('[data-testid="epic-health-status"]'); const findEpicHealthStatus = () => wrapper.find('[data-testid="epic-health-status"]');
const findIssueIcon = () => wrapper.find({ ref: 'stateIconMd' });
const findLink = () => wrapper.findComponent(GlLink);
const enableHealthStatus = () => { const enableHealthStatus = () => {
wrapper.vm.$store.commit('SET_INITIAL_CONFIG', { wrapper.vm.$store.commit('SET_INITIAL_CONFIG', {
...mockInitialConfig, ...mockInitialConfig,
...@@ -137,7 +139,19 @@ describe('RelatedItemsTree', () => { ...@@ -137,7 +139,19 @@ describe('RelatedItemsTree', () => {
}); });
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(wrapper.vm.isOpen).toBe(true); expect(findIssueIcon().attributes('name')).toBe('issues');
});
});
});
describe('isBlocked', () => {
it('returns true when `item.blocked` value is `true`', () => {
wrapper.setProps({
item: { ...mockItem, blocked: true },
});
return wrapper.vm.$nextTick(() => {
expect(findIssueIcon().attributes('name')).toBe('issue-block');
}); });
}); });
}); });
...@@ -149,7 +163,7 @@ describe('RelatedItemsTree', () => { ...@@ -149,7 +163,7 @@ describe('RelatedItemsTree', () => {
}); });
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(wrapper.vm.isClosed).toBe(true); expect(findIssueIcon().attributes('name')).toBe('issue-closed');
}); });
}); });
}); });
...@@ -173,7 +187,7 @@ describe('RelatedItemsTree', () => { ...@@ -173,7 +187,7 @@ describe('RelatedItemsTree', () => {
}); });
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(wrapper.vm.stateText).toBe('Opened'); expect(findIssueIcon().props('ariaLabel')).toBe('Opened');
}); });
}); });
...@@ -183,7 +197,7 @@ describe('RelatedItemsTree', () => { ...@@ -183,7 +197,7 @@ describe('RelatedItemsTree', () => {
}); });
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(wrapper.vm.stateText).toBe('Closed'); expect(findIssueIcon().props('ariaLabel')).toBe('Closed');
}); });
}); });
}); });
...@@ -195,7 +209,19 @@ describe('RelatedItemsTree', () => { ...@@ -195,7 +209,19 @@ describe('RelatedItemsTree', () => {
}); });
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(wrapper.vm.stateIconClass).toBe('issue-token-state-icon-open gl-text-green-500'); expect(findIssueIcon().attributes('class')).toContain(
'issue-token-state-icon-open gl-text-green-500',
);
});
});
it('return string `gl-text-red-500` when `item.blocked` value is `true`', () => {
wrapper.setProps({
item: { ...mockItem, blocked: true },
});
return wrapper.vm.$nextTick(() => {
expect(findIssueIcon().attributes('class')).toContain('gl-text-red-500');
}); });
}); });
...@@ -205,28 +231,23 @@ describe('RelatedItemsTree', () => { ...@@ -205,28 +231,23 @@ describe('RelatedItemsTree', () => {
}); });
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(wrapper.vm.stateIconClass).toBe( expect(findIssueIcon().attributes('class')).toContain(
'issue-token-state-icon-closed gl-text-blue-500', 'issue-token-state-icon-closed gl-text-blue-500',
); );
}); });
}); });
}); });
describe('itemId', () => { describe('itemHierarchy', () => {
it('returns string containing item id', () => { it('returns string containing item id and item path', () => {
expect(wrapper.vm.itemId).toBe('8'); const stateTooltip = wrapper.findAll(StateTooltip).at(0);
}); expect(stateTooltip.props('path')).toBe('gitlab-org/gitlab-shell#8');
});
describe('itemPath', () => {
it('returns string containing item path', () => {
expect(wrapper.vm.itemPath).toBe('gitlab-org/gitlab-shell');
}); });
}); });
describe('computedPath', () => { describe('computedPath', () => {
it('returns value of `itemWebPath` when it is defined', () => { it('returns value of `itemWebPath` when it is defined', () => {
expect(wrapper.vm.computedPath).toBe(mockItem.webPath); expect(findLink().attributes('href')).toBe(mockItem.webPath);
}); });
it('returns `null` when `itemWebPath` is empty', () => { it('returns `null` when `itemWebPath` is empty', () => {
...@@ -235,7 +256,7 @@ describe('RelatedItemsTree', () => { ...@@ -235,7 +256,7 @@ describe('RelatedItemsTree', () => {
}); });
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(wrapper.vm.computedPath).toBeNull(); expect(findLink().attributes('href')).toBeUndefined();
}); });
}); });
}); });
...@@ -276,7 +297,7 @@ describe('RelatedItemsTree', () => { ...@@ -276,7 +297,7 @@ describe('RelatedItemsTree', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.vm.stateIconName).toBe(stateIconName); expect(findIssueIcon().props('name')).toBe(stateIconName);
}); });
}); });
}); });
...@@ -336,10 +357,8 @@ describe('RelatedItemsTree', () => { ...@@ -336,10 +357,8 @@ describe('RelatedItemsTree', () => {
}); });
it('renders item link', () => { it('renders item link', () => {
const link = wrapper.findComponent(GlLink); expect(findLink().attributes('href')).toBe(mockItem.webPath);
expect(findLink().text()).toBe(mockItem.title);
expect(link.attributes('href')).toBe(mockItem.webPath);
expect(link.text()).toBe(mockItem.title);
}); });
it('renders item state tooltip for medium and small screens', () => { it('renders item state tooltip for medium and small screens', () => {
......
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