diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
commit | 9297025d0b7ddf095eb618dfaaab2ff8f2018d8b (patch) | |
tree | 865198c01d1824a9b098127baa3ab980c9cd2c06 /spec/lib/banzai/filter/quick_action_filter_spec.rb | |
parent | 6372471f43ee03c05a7c1f8b0c6ac6b8a7431dbe (diff) |
Add latest changes from gitlab-org/gitlab@16-7-stable-eev16.7.0-rc42
Diffstat (limited to 'spec/lib/banzai/filter/quick_action_filter_spec.rb')
-rw-r--r-- | spec/lib/banzai/filter/quick_action_filter_spec.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/lib/banzai/filter/quick_action_filter_spec.rb b/spec/lib/banzai/filter/quick_action_filter_spec.rb new file mode 100644 index 00000000000..a2a300d157c --- /dev/null +++ b/spec/lib/banzai/filter/quick_action_filter_spec.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Banzai::Filter::QuickActionFilter, feature_category: :team_planning do + let(:result) { {} } + + it 'detects action in paragraph' do + described_class.call('<p data-sourcepos="1:1-2:3">/quick</p>', {}, result) + + expect(result[:quick_action_paragraphs]).to match_array [{ start_line: 0, end_line: 1 }] + end + + it 'does not detect action in paragraph if no sourcepos' do + described_class.call('<p>/quick</p>', {}, result) + + expect(result[:quick_action_paragraphs]).to be_empty + end + + it 'does not detect action in blockquote' do + described_class.call('<blockquote data-sourcepos="1:1-1:1">/quick</blockquote>', {}, result) + + expect(result[:quick_action_paragraphs]).to be_empty + end + + it 'does not detect action in html block' do + described_class.call('<li data-sourcepos="1:1-1:1">/quick</li>', {}, result) + + expect(result[:quick_action_paragraphs]).to be_empty + end + + it 'does not detect action in code block' do + described_class.call('<code data-sourcepos="1:1-1:1">/quick</code>', {}, result) + + expect(result[:quick_action_paragraphs]).to be_empty + end +end |