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/lib/banzai/filter/quick_action_filter_spec.rb')
-rw-r--r--spec/lib/banzai/filter/quick_action_filter_spec.rb37
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