From 05ec7b352fe777426a12a5962bb9c06b86d62961 Mon Sep 17 00:00:00 2001 From: Lukas Eipert Date: Mon, 15 Oct 2018 07:55:41 +0200 Subject: [PATCH] Remove obsolete usage of gl.lazyLoader.loadCheck In [!21565][0] we removed the loadCheck function from the LazyLoader for images. The function seemed to be obsolete before anyhow, because we make use of the MutationObserver in order to detect elements added / removed from the DOM. [0]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21565 --- app/assets/javascripts/main.js | 1 - app/assets/javascripts/right_sidebar.js | 2 -- ...ssuable-sidebar-out-of-collapsed-state.yml | 5 ++++ spec/javascripts/right_sidebar_spec.js | 28 ------------------- 4 files changed, 5 insertions(+), 31 deletions(-) create mode 100644 changelogs/unreleased/52532-unable-to-toggle-issuable-sidebar-out-of-collapsed-state.yml diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index e8aac51a299..a88b575ad99 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -202,7 +202,6 @@ document.addEventListener('DOMContentLoaded', () => { $('.navbar-toggler').on('click', () => { $('.header-content').toggleClass('menu-expanded'); - gl.lazyLoader.loadCheck(); }); // Show/hide comments on diff diff --git a/app/assets/javascripts/right_sidebar.js b/app/assets/javascripts/right_sidebar.js index 64f3dde5be7..6b3753f7966 100644 --- a/app/assets/javascripts/right_sidebar.js +++ b/app/assets/javascripts/right_sidebar.js @@ -57,8 +57,6 @@ Sidebar.prototype.sidebarToggleClicked = function (e, triggered) { $allGutterToggleIcons.removeClass('fa-angle-double-left').addClass('fa-angle-double-right'); $('aside.right-sidebar').removeClass('right-sidebar-collapsed').addClass('right-sidebar-expanded'); $('.layout-page').removeClass('right-sidebar-collapsed').addClass('right-sidebar-expanded'); - - if (gl.lazyLoader) gl.lazyLoader.loadCheck(); } $this.attr('data-original-title', tooltipLabel); diff --git a/changelogs/unreleased/52532-unable-to-toggle-issuable-sidebar-out-of-collapsed-state.yml b/changelogs/unreleased/52532-unable-to-toggle-issuable-sidebar-out-of-collapsed-state.yml new file mode 100644 index 00000000000..9abad3d2cd8 --- /dev/null +++ b/changelogs/unreleased/52532-unable-to-toggle-issuable-sidebar-out-of-collapsed-state.yml @@ -0,0 +1,5 @@ +--- +title: Allow Issue and Merge Request sidebar to be toggled from collapsed state +merge_request: 22353 +author: +type: fixed diff --git a/spec/javascripts/right_sidebar_spec.js b/spec/javascripts/right_sidebar_spec.js index 936e8f16c52..5a6cc5579bd 100644 --- a/spec/javascripts/right_sidebar_spec.js +++ b/spec/javascripts/right_sidebar_spec.js @@ -94,33 +94,5 @@ import Sidebar from '~/right_sidebar'; }); }); }); - - describe('sidebarToggleClicked', () => { - const event = jasmine.createSpyObj('event', ['preventDefault']); - - beforeEach(() => { - spyOn($.fn, 'hasClass').and.returnValue(false); - }); - - afterEach(() => { - gl.lazyLoader = undefined; - }); - - it('calls loadCheck if lazyLoader is set', () => { - gl.lazyLoader = jasmine.createSpyObj('lazyLoader', ['loadCheck']); - - Sidebar.prototype.sidebarToggleClicked(event); - - expect(gl.lazyLoader.loadCheck).toHaveBeenCalled(); - }); - - it('does not throw if lazyLoader is not defined', () => { - gl.lazyLoader = undefined; - - const toggle = Sidebar.prototype.sidebarToggleClicked.bind(null, event); - - expect(toggle).not.toThrow(); - }); - }); }); }).call(window); -- GitLab