blob: a2a300d157c83549c575ebcce4af183dc5bb8000 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
|