Consolidate JS updates to global To-Do counter into single utility

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

A todo:toggle event can be triggered on the document, which updates the To-Do counter (the blue one in the header).

We do this in a number of places, including epics, alert management, design management, and others (search codebase for todo:toggle). A number of it's uses, however, are untested.

We should create a shared utility function for this to make things easier to test, and to reduce possibility of bugs.

In doing so, we should also:

  • use .js-todos-count to select the todo counter everywhere, instead of .todos-count.

@viktomas raised this in !41960 (comment 410316010)

  • Investigate initializing the header so that we can improve testing coverage

@viktomas raised this in !41960 (comment 410316022)

Edited by 🤖 GitLab Bot 🤖