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/markdown_filter_spec.rb')
-rw-r--r--spec/lib/banzai/filter/markdown_filter_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/lib/banzai/filter/markdown_filter_spec.rb b/spec/lib/banzai/filter/markdown_filter_spec.rb
index 251e6efe50b..b4fb715b8f0 100644
--- a/spec/lib/banzai/filter/markdown_filter_spec.rb
+++ b/spec/lib/banzai/filter/markdown_filter_spec.rb
@@ -3,6 +3,7 @@
require 'spec_helper'
RSpec.describe Banzai::Filter::MarkdownFilter, feature_category: :team_planning do
+ using RSpec::Parameterized::TableSyntax
include FilterSpecHelper
describe 'markdown engine from context' do
@@ -22,6 +23,21 @@ RSpec.describe Banzai::Filter::MarkdownFilter, feature_category: :team_planning
end
end
+ describe 'parse_sourcepos' do
+ where(:sourcepos, :expected) do
+ '1:1-1:4' | { start: { row: 0, col: 0 }, end: { row: 0, col: 3 } }
+ '12:22-1:456' | { start: { row: 11, col: 21 }, end: { row: 0, col: 455 } }
+ '0:0-0:0' | { start: { row: 0, col: 0 }, end: { row: 0, col: 0 } }
+ '-1:2-3:-4' | nil
+ end
+
+ with_them do
+ it 'correctly parses' do
+ expect(described_class.parse_sourcepos(sourcepos)).to eq expected
+ end
+ end
+ end
+
describe 'code block' do
it 'adds language to lang attribute when specified' do
result = filter("```html\nsome code\n```", no_sourcepos: true)