Commit ab3c8302 authored by Phil Hughes's avatar Phil Hughes

Fixes the diff changes buttons from toggling when scrolling

Closes #36698
parent c274da06
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