diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-03-19 21:55:12 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-03-21 14:28:57 +0300 |
commit | 2b07702ad596d62234a88266f671824d125733fa (patch) | |
tree | bff82872d1b9decd181a89d6ed7b2a3fff2fb0d9 /spec | |
parent | dd2b4d7bc5cd5aa770bed08c5ffb79784e6e3fe0 (diff) |
Merge branch 'label-tooltip' into 'master'
Add label description in tooltip to labels in issue index and sidebar
The tooltip can get quite big, but it’s so useful to inform people about what these labels mean
new
![Screen_Shot_2016-03-08_at_11.48.28](/uploads/894baaaa1f789c3a2069a924d541e64b/Screen_Shot_2016-03-08_at_11.48.28.png)
![Screen_Shot_2016-03-08_at_11.48.20](/uploads/efe4fa0960054c4071b8f6bf83024403/Screen_Shot_2016-03-08_at_11.48.20.png)
@JobV writes on Slack:
> yeah I think it’s better than not, but I’d have to try it :smiley:
>
> cautious yes, revert if it’s annoying :wink:
See merge request !3124
Diffstat (limited to 'spec')
-rw-r--r-- | spec/helpers/labels_helper_spec.rb | 12 | ||||
-rw-r--r-- | spec/lib/banzai/filter/label_reference_filter_spec.rb | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/spec/helpers/labels_helper_spec.rb b/spec/helpers/labels_helper_spec.rb index 4f129eca183..eca8bc8ab2d 100644 --- a/spec/helpers/labels_helper_spec.rb +++ b/spec/helpers/labels_helper_spec.rb @@ -11,7 +11,7 @@ describe LabelsHelper do end it 'uses the instance variable' do - expect(link_to_label(label)).to match %r{<a href="/#{@project.to_reference}/issues\?label_name=#{label.name}">.*</a>} + expect(link_to_label(label)).to match %r{<a href="/#{@project.to_reference}/issues\?label_name=#{label.name}"><span class="[\w\s\-]*has_tooltip".*</span></a>} end end @@ -39,6 +39,14 @@ describe LabelsHelper do end end + context 'with a tooltip argument' do + context 'set to false' do + it 'does not include the has_tooltip class' do + expect(link_to_label(label, tooltip: false)).not_to match %r{has_tooltip} + end + end + end + context 'with block' do it 'passes the block to link_to' do link = link_to_label(label) { 'Foo' } @@ -49,7 +57,7 @@ describe LabelsHelper do context 'without block' do it 'uses render_colored_label as the link content' do expect(self).to receive(:render_colored_label). - with(label).and_return('Foo') + with(label, tooltip: true).and_return('Foo') expect(link_to_label(label)).to match('Foo') end end diff --git a/spec/lib/banzai/filter/label_reference_filter_spec.rb b/spec/lib/banzai/filter/label_reference_filter_spec.rb index e2d21f53b7e..4c1d4a2d24c 100644 --- a/spec/lib/banzai/filter/label_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/label_reference_filter_spec.rb @@ -56,7 +56,7 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do describe 'label span element' do it 'includes default classes' do doc = reference_filter("Label #{reference}") - expect(doc.css('a span').first.attr('class')).to eq 'label color-label' + expect(doc.css('a span').first.attr('class')).to eq 'label color-label has_tooltip' end it 'includes a style attribute' do |