Defect #42332 » 42332-test.patch
| test/helpers/application_helper_test.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
def test_section_edit_links_with_multiline_heading
|
||
|
raw = <<~RAW
|
||
|
# Wiki
|
||
|
## `Foo` Bar
|
||
|
The heading above generates multiline HTML.
|
||
|
Don't assume heading tags are always single-line.
|
||
|
```
|
||
|
<h2>
|
||
|
<code>Foo</code> Bar</h2>
|
||
|
```
|
||
|
RAW
|
||
|
@project = Project.find(1)
|
||
|
set_language_if_valid 'en'
|
||
|
with_settings :text_formatting => 'common_mark' do
|
||
|
result =
|
||
|
textilizable(
|
||
|
raw,
|
||
|
:edit_section_links =>
|
||
|
{:controller => 'wiki', :action => 'edit',
|
||
|
:project_id => '1', :id => 'Test'}
|
||
|
).delete("\n")
|
||
|
assert_match(
|
||
|
Regexp.new(
|
||
|
'<div class="contextual heading-2" title="Edit this section" id="section-2">' \
|
||
|
'<a class="icon-only icon-edit" href="/projects/1/wiki/Test/edit\?section=2">' \
|
||
|
'<svg class="s18 icon-svg" aria-hidden="true"><use href="/assets/icons-.*\.svg#icon--edit"></use></svg>' \
|
||
|
'<span class="icon-label">Edit this section</span>' \
|
||
|
'</a></div>' \
|
||
|
'<a name="Foo-Bar"></a>' \
|
||
|
'<h2 ><code>Foo</code> Bar<a href="#Foo-Bar" class="wiki-anchor">¶</a></h2>'
|
||
|
),
|
||
|
result
|
||
|
)
|
||
|
end
|
||
|
end
|
||
|
def test_default_formatter
|
||
|
with_settings :text_formatting => 'unknown' do
|
||
|
text = 'a *link*: http://www.example.net/'
|
||
- « Previous
- 1
- 2
- Next »