Commit 017f0562 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch '229960-anchor-tags-to-designs-is-not-working' into 'master'

Resolve "Anchor tags to Designs is not working"

See merge request gitlab-org/gitlab!37307
parents 5ea07326 2ef70d67
...@@ -107,6 +107,9 @@ export default { ...@@ -107,6 +107,9 @@ export default {
}, },
mounted() { mounted() {
this.toggleOnPasteListener(this.$route.name); this.toggleOnPasteListener(this.$route.name);
if (this.$route.path === '/designs') {
this.$el.scrollIntoView();
}
}, },
methods: { methods: {
resetFilesToBeSaved() { resetFilesToBeSaved() {
......
---
title: Resolve Anchor tags to Designs is not working
merge_request: 37307
author:
type: fixed
...@@ -25,6 +25,9 @@ const mockPageEl = { ...@@ -25,6 +25,9 @@ const mockPageEl = {
}; };
jest.spyOn(utils, 'getPageLayoutElement').mockReturnValue(mockPageEl); jest.spyOn(utils, 'getPageLayoutElement').mockReturnValue(mockPageEl);
const scrollIntoViewMock = jest.fn();
HTMLElement.prototype.scrollIntoView = scrollIntoViewMock;
const localVue = createLocalVue(); const localVue = createLocalVue();
const router = createRouter(); const router = createRouter();
localVue.use(VueRouter); localVue.use(VueRouter);
...@@ -567,5 +570,14 @@ describe('Design management index page', () => { ...@@ -567,5 +570,14 @@ describe('Design management index page', () => {
expect(mockPageEl.classList.remove).toHaveBeenCalledTimes(1); expect(mockPageEl.classList.remove).toHaveBeenCalledTimes(1);
expect(mockPageEl.classList.remove).toHaveBeenCalledWith(...DESIGN_DETAIL_LAYOUT_CLASSLIST); expect(mockPageEl.classList.remove).toHaveBeenCalledWith(...DESIGN_DETAIL_LAYOUT_CLASSLIST);
}); });
it('should trigger a scrollIntoView method if designs route is detected', () => {
router.replace({
path: '/designs',
});
createComponent(true);
expect(scrollIntoViewMock).toHaveBeenCalled();
});
}); });
}); });
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