BigW Consortium Gitlab

Commit bcc5fc85 by Phil Hughes

Merge branch '33916-make-note-highlight-toggle-boolean-explcit' into 'master'

Fix note highlight being added when you don't have a URL fragment hash #note_xxx Closes #33916 See merge request !12293
parents 27664b7d 19e12aac
......@@ -322,7 +322,9 @@ const normalizeNewlines = function(str) {
Notes.updateNoteTargetSelector = function($note) {
const hash = gl.utils.getLocationHash();
$note.toggleClass('target', hash && $note.filter(`#${hash}`).length > 0);
// Needs to be an explicit true/false for the jQuery `toggleClass(force)`
const addTargetClass = Boolean(hash && $note.filter(`#${hash}`).length > 0);
$note.toggleClass('target', addTargetClass);
};
/*
......
......@@ -176,7 +176,7 @@ import '~/notes';
Notes.updateNoteTargetSelector($note);
expect($note.toggleClass).toHaveBeenCalledWith('target', null);
expect($note.toggleClass).toHaveBeenCalledWith('target', false);
});
});
......
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