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 {
const prevPath = breadcrumbs[index - 1]?.to || '';
const to = `${prevPath}/${path}`.replace(/\/+/, '/');
breadcrumbs.push({
path,
to,
text,
});
if (text) {
breadcrumbs.push({
path,
to,
text,
});
}
});
return breadcrumbs;
......
......@@ -160,9 +160,12 @@ describe('Iteration Breadcrumb', () => {
describe('when cadence is present', () => {
const cadenceTitle = 'cadencetitle';
const breadcrumbProps = () => findBreadcrumb().props('items');
it('is found in crumb items', async () => {
const cadenceSpy = jest.fn().mockResolvedValue({
let cadenceSpy;
beforeEach(async () => {
cadenceSpy = jest.fn().mockResolvedValue({
data: {
group: {
id: '',
......@@ -183,16 +186,25 @@ describe('Iteration Breadcrumb', () => {
},
},
});
});
it('is found in crumb items', async () => {
await router.push({ name: 'editIteration', params: { cadenceId: '123', iterationId: '1' } });
createComponentWithApollo({ readCadenceSpy: cadenceSpy });
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