Commit 2f08c27c authored by Florie Guibert's avatar Florie Guibert

Search epic by title in issues

Changelog: changed
parent bd7f09e2
......@@ -125,6 +125,7 @@ export default {
return {
fullPath: this.attrWorkspacePath,
title: this.searchTerm,
in: this.searchTerm && this.issuableAttribute === IssuableType.Epic ? 'TITLE' : undefined,
state: this.$options.IssuableAttributeState[this.issuableAttribute],
sort: this.issuableAttribute === IssuableType.Epic ? defaultEpicSort : null,
};
......
#import "./epic.fragment.graphql"
query issueEpics($fullPath: ID!, $title: String, $state: EpicState) {
query issueEpics(
$fullPath: ID!
$title: String
$state: EpicState
$in: [IssuableSearchableField!]
) {
workspace: group(fullPath: $fullPath) {
attributes: epics(
search: $title
in: $in
state: $state
includeAncestorGroups: true
includeDescendantGroups: false
......
......@@ -456,7 +456,7 @@ describe('SidebarDropdownWidget', () => {
});
});
describe('when a user is searching', () => {
describe('when a user is searching epics', () => {
const mockSearchTerm = 'foobar';
beforeEach(async () => {
......@@ -466,7 +466,7 @@ describe('SidebarDropdownWidget', () => {
await clickEdit();
});
it('sends a groupEpics query with the entered search term "foo"', async () => {
it('sends a groupEpics query with the entered search term "foo" and in TITLE param', async () => {
findSearchBox().vm.$emit('input', mockSearchTerm);
await wrapper.vm.$nextTick();
......@@ -478,6 +478,31 @@ describe('SidebarDropdownWidget', () => {
sort: 'TITLE_ASC',
state: 'opened',
title: mockSearchTerm,
in: 'TITLE',
});
});
});
describe('when a user is not searching', () => {
beforeEach(async () => {
groupEpicsSpy = jest.fn().mockResolvedValueOnce(emptyGroupEpicsResponse);
await createComponentWithApollo({ groupEpicsSpy });
await clickEdit();
});
it('sends a groupEpics query with empty title and undefined in param', async () => {
await wrapper.vm.$nextTick();
// Account for debouncing
jest.runAllTimers();
expect(groupEpicsSpy).toHaveBeenNthCalledWith(1, {
fullPath: mockIssue.groupPath,
sort: 'TITLE_ASC',
state: 'opened',
title: '',
in: undefined,
});
});
});
......
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