|
1 | 1 | # frozen_string_literal: true
|
2 | 2 | require_relative 'helper'
|
3 | 3 |
|
4 |
| -class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase |
| 4 | +class RDocMarkupToHtmlTest < RDoc::Markup::FormatterTestCase |
5 | 5 |
|
6 | 6 | add_visitor_tests
|
7 | 7 |
|
@@ -956,31 +956,34 @@ def util_format text
|
956 | 956 | end
|
957 | 957 |
|
958 | 958 | def test_accept_table
|
959 |
| - header = %w[Col1 Col2 Col3] |
| 959 | + header = %w[Col1 Col2 Col3 Col4] |
960 | 960 | body = [
|
961 |
| - %w[cell1_1 cell1_2 cell1_3], |
962 |
| - %w[cell2_1 cell2_2 cell2_3], |
963 |
| - ['<script>alert("foo");</script>',], |
964 |
| - %w[+code+ _em_ **strong**], |
| 961 | + %w[cell1_1 cell1_2 cell1_3 cell1_4], |
| 962 | + %w[cell2_1 cell2_2 cell2_3 cell2_4], |
| 963 | + ['<script>alert("foo");</script>'], |
| 964 | + %w[+code+ _em_ **strong** C1], |
965 | 965 | ]
|
966 |
| - aligns = [:left, :right, nil] |
| 966 | + aligns = [:left, :right, nil, :center] |
967 | 967 | @to.start_accepting
|
968 | 968 | @to.accept_table(header, body, aligns)
|
969 | 969 | res = @to.end_accepting
|
970 | 970 | assert_include(res[%r<<th[^<>]*>Col1</th>>], 'align="left"')
|
971 | 971 | assert_include(res[%r<<th[^<>]*>Col2</th>>], 'align="right"')
|
972 | 972 | assert_not_include(res[%r<<th[^<>]*>Col3</th>>], 'align=')
|
| 973 | + assert_include(res[%r<<th[^<>]*>Col4</th>>], 'align="center"') |
973 | 974 | assert_include(res[%r<<td[^<>]*>cell1_1</td>>], 'align="left"')
|
974 | 975 | assert_include(res[%r<<td[^<>]*>cell1_2</td>>], 'align="right"')
|
975 | 976 | assert_not_include(res[%r<<td[^<>]*>cell1_3</td>>], 'align=')
|
976 | 977 | assert_include(res[%r<<td[^<>]*>cell2_1</td>>], 'align="left"')
|
977 | 978 | assert_include(res[%r<<td[^<>]*>cell2_2</td>>], 'align="right"')
|
978 | 979 | assert_not_include(res[%r<<td[^<>]*>cell2_3</td>>], 'align=')
|
| 980 | + assert_include(res[%r<<td[^<>]*>cell2_4</td>>], 'align="center"') |
979 | 981 | assert_not_include(res, '<script>')
|
980 | 982 | assert_include(res[%r<<td[^<>]*>.*script.*</td>>], '<script>')
|
981 | 983 | assert_include(res[%r<<td[^<>]*>.*code.*</td>>], '<code>code</code>')
|
982 | 984 | assert_include(res[%r<<td[^<>]*>.*em.*</td>>], '<em>em</em>')
|
983 | 985 | assert_include(res[%r<<td[^<>]*>.*strong.*</td>>], '<strong>strong</strong>')
|
| 986 | + assert_include(res[%r<<td[^<>]*>C1</td>>], 'C1') |
984 | 987 | end
|
985 | 988 |
|
986 | 989 | def assert_escaped(unexpected, code)
|
|
0 commit comments