Commit b7d34071 authored by Tom Quirk's avatar Tom Quirk

Add html_options to gl_tab_counter_badge

parent 60499082
......@@ -211,9 +211,10 @@ module TabHelper
end
end
def gl_tab_counter_badge(count)
def gl_tab_counter_badge(count, html_options = {})
badge_classes = %w[badge badge-muted badge-pill gl-badge sm gl-tab-counter-badge]
content_tag(:span,
count,
class: 'badge badge-muted badge-pill gl-badge sm gl-tab-counter-badge'
class: [*html_options[:class], badge_classes].join(' ')
)
end
......@@ -155,5 +155,11 @@ RSpec.describe TabHelper do
it 'creates a tab counter badge' do
expect(gl_tab_counter_badge(1)).to eq('<span class="badge badge-muted badge-pill gl-badge sm gl-tab-counter-badge">1</span>')
end
context 'with extra classes' do
it 'creates a tab counter badge with the correct class attribute' do
expect(gl_tab_counter_badge(1, { class: 'js-test' })).to eq('<span class="js-test badge badge-muted badge-pill gl-badge sm gl-tab-counter-badge">1</span>')
end
end
end
end
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