Commit 687f02f5 authored by Simon Knox's avatar Simon Knox

Merge branch 'ss/fix-extra-separator-cadence-breadcrumb' into 'master'

Remove extra separator in breadcrumb for cadences

See merge request gitlab-org/gitlab!73591
parents f7dcd5be fb3117c2
...@@ -59,11 +59,13 @@ export default { ...@@ -59,11 +59,13 @@ export default {
const prevPath = breadcrumbs[index - 1]?.to || ''; const prevPath = breadcrumbs[index - 1]?.to || '';
const to = `${prevPath}/${path}`.replace(/\/+/, '/'); const to = `${prevPath}/${path}`.replace(/\/+/, '/');
breadcrumbs.push({ if (text) {
path, breadcrumbs.push({
to, path,
text, to,
}); text,
});
}
}); });
return breadcrumbs; return breadcrumbs;
......
...@@ -160,9 +160,12 @@ describe('Iteration Breadcrumb', () => { ...@@ -160,9 +160,12 @@ describe('Iteration Breadcrumb', () => {
describe('when cadence is present', () => { describe('when cadence is present', () => {
const cadenceTitle = 'cadencetitle'; const cadenceTitle = 'cadencetitle';
const breadcrumbProps = () => findBreadcrumb().props('items');
it('is found in crumb items', async () => { let cadenceSpy;
const cadenceSpy = jest.fn().mockResolvedValue({
beforeEach(async () => {
cadenceSpy = jest.fn().mockResolvedValue({
data: { data: {
group: { group: {
id: '', id: '',
...@@ -183,16 +186,25 @@ describe('Iteration Breadcrumb', () => { ...@@ -183,16 +186,25 @@ describe('Iteration Breadcrumb', () => {
}, },
}, },
}); });
});
it('is found in crumb items', async () => {
await router.push({ name: 'editIteration', params: { cadenceId: '123', iterationId: '1' } }); await router.push({ name: 'editIteration', params: { cadenceId: '123', iterationId: '1' } });
createComponentWithApollo({ readCadenceSpy: cadenceSpy }); createComponentWithApollo({ readCadenceSpy: cadenceSpy });
await waitForPromises(); await waitForPromises();
expect(breadcrumbProps().some(({ text }) => text === cadenceTitle)).toBe(true);
});
const breadcrumbProps = findBreadcrumb().props('items'); it('does not pass a breadcrumb without a title', async () => {
await router.push({ name: 'index' });
createComponentWithApollo({ readCadenceSpy: cadenceSpy });
await waitForPromises();
expect(breadcrumbProps.some(({ text }) => text === cadenceTitle)).toBe(true); expect(breadcrumbProps().some(({ text }) => text === '')).toBe(false);
}); });
}); });
......
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