Commit 719c925e authored by Filipa Lacerda's avatar Filipa Lacerda Committed by Jose Ivan Vargas

Merge branch 'changes-bar-sticky-fix' into 'master'

Fixes the diff changes buttons from toggling when scrolling

Closes #36698

See merge request !13894
parent 8111c216
export const isSticky = (el, scrollY, stickyTop) => {
const top = el.offsetTop - scrollY;
const top = Math.floor(el.offsetTop - scrollY);
if (top <= stickyTop) {
el.classList.add('is-stuck');
......
......@@ -253,6 +253,7 @@ import bp from './breakpoints';
loadDiff(source) {
if (this.diffsLoaded) {
document.dispatchEvent(new CustomEvent('scroll'));
return;
}
......
---
title: Fixed diff changes bar buttons from showing/hiding whilst scrolling
merge_request:
author:
type: fixed
......@@ -295,6 +295,17 @@ import 'vendor/jquery.scrollTo';
this.class.loadDiff('/foo/bar/merge_requests/1/diffs');
});
it('triggers scroll event when diff already loaded', function () {
spyOn(document, 'dispatchEvent');
this.class.diffsLoaded = true;
this.class.loadDiff('/foo/bar/merge_requests/1/diffs');
expect(
document.dispatchEvent,
).toHaveBeenCalledWith(new CustomEvent('scroll'));
});
describe('with inline diff', () => {
let noteId;
let noteLineNumId;
......
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