summaryrefslogtreecommitdiff
path: root/spec/helpers
diff options
context:
space:
mode:
authorPatrick Derichs <pderichs@gitlab.com>2019-07-15 13:29:56 +0200
committerPatrick Derichs <pderichs@gitlab.com>2019-08-05 16:01:43 +0200
commit927f608f2c4905e430d2df1c455cec793ef41aa9 (patch)
treed565c908ab14491ef9d5bf161d2e7cd3eaab597b /spec/helpers
parent52b857f119debb5a03c216c4199eb21a49d815b6 (diff)
downloadgitlab-ce-927f608f2c4905e430d2df1c455cec793ef41aa9.tar.gz
Fix HTML injection for label description
Add changelog entry Add spec
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/labels_helper_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/helpers/labels_helper_spec.rb b/spec/helpers/labels_helper_spec.rb
index 4f1cab38f34..1d57aaa0da5 100644
--- a/spec/helpers/labels_helper_spec.rb
+++ b/spec/helpers/labels_helper_spec.rb
@@ -278,4 +278,14 @@ describe LabelsHelper do
it { is_expected.to eq('Subscribe at group level') }
end
end
+
+ describe '#label_tooltip_title' do
+ let(:html) { '<img src="example.png">This is an image</img>' }
+ let(:label_with_html_content) { create(:label, title: 'test', description: html) }
+
+ it 'removes HTML' do
+ tooltip = label_tooltip_title(label_with_html_content)
+ expect(tooltip).to eq('This is an image')
+ end
+ end
end