Commit bc309027 authored by Martin Wortschack's avatar Martin Wortschack

Todos: Replaces badge selector with a js- prefixed class

parent dc0c0860
...@@ -172,8 +172,12 @@ export default class Todos { ...@@ -172,8 +172,12 @@ export default class Todos {
updateBadges(data) { updateBadges(data) {
$(document).trigger('todo:toggle', data.count); $(document).trigger('todo:toggle', data.count);
document.querySelector('.js-todos-pending .badge').innerHTML = addDelimiter(data.count); document.querySelector('.js-todos-pending .js-todos-badge').innerHTML = addDelimiter(
document.querySelector('.js-todos-done .badge').innerHTML = addDelimiter(data.done_count); data.count,
);
document.querySelector('.js-todos-done .js-todos-badge').innerHTML = addDelimiter(
data.done_count,
);
} }
goToTodoUrl(e) { goToTodoUrl(e) {
......
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
= gl_tabs_nav({ class: 'gl-flex-grow-1 gl-border-0' }) do = gl_tabs_nav({ class: 'gl-flex-grow-1 gl-border-0' }) do
= gl_tab_link_to todos_filter_path(state: 'pending'), item_active: params[:state].blank? || params[:state] == 'pending', class: "js-todos-pending" do = gl_tab_link_to todos_filter_path(state: 'pending'), item_active: params[:state].blank? || params[:state] == 'pending', class: "js-todos-pending" do
= _("To Do") = _("To Do")
= gl_tab_counter_badge number_with_delimiter(todos_pending_count) = gl_tab_counter_badge(number_with_delimiter(todos_pending_count), { class: 'js-todos-badge' })
= gl_tab_link_to todos_filter_path(state: 'done'), item_active: params[:state] == 'done', class: "js-todos-done" do = gl_tab_link_to todos_filter_path(state: 'done'), item_active: params[:state] == 'done', class: "js-todos-done" do
= _("Done") = _("Done")
= gl_tab_counter_badge number_with_delimiter(todos_done_count) = gl_tab_counter_badge(number_with_delimiter(todos_done_count), { class: 'js-todos-badge' })
.nav-controls .nav-controls
- if @allowed_todos.any?(&:pending?) - if @allowed_todos.any?(&:pending?)
......
...@@ -94,13 +94,13 @@ describe('Todos', () => { ...@@ -94,13 +94,13 @@ describe('Todos', () => {
}); });
it('updates pending text', () => { it('updates pending text', () => {
expect(document.querySelector('.js-todos-pending .badge').innerHTML).toEqual( expect(document.querySelector('.js-todos-pending .js-todos-badge').innerHTML).toEqual(
addDelimiter(TEST_COUNT_BIG), addDelimiter(TEST_COUNT_BIG),
); );
}); });
it('updates done text', () => { it('updates done text', () => {
expect(document.querySelector('.js-todos-done .badge').innerHTML).toEqual( expect(document.querySelector('.js-todos-done .js-todos-badge').innerHTML).toEqual(
addDelimiter(TEST_DONE_COUNT_BIG), addDelimiter(TEST_DONE_COUNT_BIG),
); );
}); });
......
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