Commit b7a71ef2 authored by Simon Knox's avatar Simon Knox

Merge branch 'fguibert/fix-board-subgroup-path' into 'master'

Boards - Fix subgroup path [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!61085
parents 664b6528 88fae32d
......@@ -21,7 +21,7 @@ export default {
groupPathForActiveIssue: (_, getters) => {
const { referencePath = '' } = getters.activeBoardItem;
return referencePath.slice(0, referencePath.indexOf('/'));
return referencePath.slice(0, referencePath.lastIndexOf('/'));
},
projectPathForActiveIssue: (_, getters) => {
......
......@@ -110,6 +110,15 @@ describe('Boards - Getters', () => {
);
});
it('returns group path of last subgroup for the active issue', () => {
const mockActiveIssue = {
referencePath: 'gitlab-org/subgroup/subsubgroup/gitlab-test#1',
};
expect(getters.groupPathForActiveIssue({}, { activeBoardItem: mockActiveIssue })).toEqual(
'gitlab-org/subgroup/subsubgroup',
);
});
it('returns empty string as group path when active issue is an empty object', () => {
const mockActiveIssue = {};
expect(getters.groupPathForActiveIssue({}, { activeBoardItem: mockActiveIssue })).toEqual('');
......
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