summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/syntax_highlighter_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/syntax_highlighter_test.rb b/test/syntax_highlighter_test.rb
index 9f01f7e1..bc33e60c 100644
--- a/test/syntax_highlighter_test.rb
+++ b/test/syntax_highlighter_test.rb
@@ -648,6 +648,23 @@ context 'Syntax Highlighter' do
assert_css 'code span.gp', output, 1
end
+ test 'should set starting line number to 1 by default in HTML output if linenums option is enabled' do
+ input = <<~'EOS'
+ [source%linenums,ruby]
+ ----
+ puts 'Hello, World!'
+ puts 'Goodbye, World!'
+ ----
+ EOS
+ output = convert_string_to_embedded input, attributes: { 'source-highlighter' => 'rouge' }
+ assert_css 'table.linenotable', output, 1
+ assert_css 'table.linenotable td.linenos', output, 1
+ assert_css 'table.linenotable td.linenos pre.lineno', output, 1
+ assert_css 'table.linenotable td.code', output, 1
+ assert_css 'table.linenotable td.code pre:not([class])', output, 1
+ assert_xpath %(//pre[@class="lineno"][text()="1\n2\n"]), output, 1
+ end
+
test 'should set starting line number in HTML output if linenums option is enabled and start attribute is set' do
input = <<~'EOS'
[source%linenums,ruby,start=9]