Commit 2ef70d67 authored by Natalia Tepluhina's avatar Natalia Tepluhina Committed by Ezekiel Kigbo

Resolve "Anchor tags to Designs is not working"

parent c639cb5b
...@@ -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