Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/tab_helper_spec.rb')
-rw-r--r--spec/helpers/tab_helper_spec.rb28
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/helpers/tab_helper_spec.rb b/spec/helpers/tab_helper_spec.rb
index 346bfc7850c..e5e88466946 100644
--- a/spec/helpers/tab_helper_spec.rb
+++ b/spec/helpers/tab_helper_spec.rb
@@ -36,7 +36,15 @@ RSpec.describe TabHelper do
expect(gl_tab_link_to('/url') { 'block content' }).to match(/block content/)
end
- it 'creates a tab with custom classes' do
+ it 'creates a tab with custom classes for enclosing list item without content block provided' do
+ expect(gl_tab_link_to('Link', '/url', { tab_class: 'my-class' })).to match(/<li class=".*my-class.*"/)
+ end
+
+ it 'creates a tab with custom classes for enclosing list item with content block provided' do
+ expect(gl_tab_link_to('/url', { tab_class: 'my-class' }) { 'Link' }).to match(/<li class=".*my-class.*"/)
+ end
+
+ it 'creates a tab with custom classes for anchor element' do
expect(gl_tab_link_to('Link', '/url', { class: 'my-class' })).to match(/<a class=".*my-class.*"/)
end
@@ -150,4 +158,22 @@ RSpec.describe TabHelper do
end
end
end
+
+ describe 'gl_tab_counter_badge' 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
+
+ context 'with data attributes' do
+ it 'creates a tab counter badge with the data attributes' do
+ expect(gl_tab_counter_badge(1, { data: { some_attribute: 'foo' } })).to eq('<span class="badge badge-muted badge-pill gl-badge sm gl-tab-counter-badge" data-some-attribute="foo">1</span>')
+ end
+ end
+ end
end