Wait until listeners are set before triggering a 'click' event

This commit is contained in:
Alfredo Sumaran 2016-02-24 15:53:39 -05:00
parent 7fdc29715a
commit ccabbaa9b3

View file

@ -190,6 +190,10 @@ class @MergeRequestTabs
shrinkView: ->
$gutterIcon = $('.gutter-toggle i')
# Only when sidebar is collapsed
if $gutterIcon.is('.fa-angle-double-right')
$gutterIcon.closest('a').trigger('click')
# Wait until listeners are set
setTimeout( ->
# Only when sidebar is collapsed
if $gutterIcon.is('.fa-angle-double-right')
$gutterIcon.closest('a').trigger('click')
, 0)