Project

General

Profile

Defect #42332 » 42332-test.patch

Go MAEDA, 2025-05-26 01:57

View differences:

test/helpers/application_helper_test.rb
1732 1732
    end
1733 1733
  end
1734 1734

  
1735
  def test_section_edit_links_with_multiline_heading
1736
    raw = <<~RAW
1737
      # Wiki
1738

  
1739
      ## `Foo` Bar
1740

  
1741
      The heading above generates multiline HTML.
1742
      Don't assume heading tags are always single-line.
1743
      ```
1744
      <h2>
1745
      <code>Foo</code> Bar</h2>
1746
      ```
1747
    RAW
1748
    @project = Project.find(1)
1749
    set_language_if_valid 'en'
1750
    with_settings :text_formatting => 'common_mark' do
1751
      result =
1752
        textilizable(
1753
          raw,
1754
          :edit_section_links =>
1755
            {:controller => 'wiki', :action => 'edit',
1756
            :project_id => '1', :id => 'Test'}
1757
        ).delete("\n")
1758

  
1759
      assert_match(
1760
        Regexp.new(
1761
          '<div class="contextual heading-2" title="Edit this section" id="section-2">' \
1762
          '<a class="icon-only icon-edit" href="/projects/1/wiki/Test/edit\?section=2">' \
1763
          '<svg class="s18 icon-svg" aria-hidden="true"><use href="/assets/icons-.*\.svg#icon--edit"></use></svg>' \
1764
          '<span class="icon-label">Edit this section</span>' \
1765
          '</a></div>' \
1766
          '<a name="Foo-Bar"></a>' \
1767
          '<h2 ><code>Foo</code> Bar<a href="#Foo-Bar" class="wiki-anchor">&para;</a></h2>'
1768
        ),
1769
        result
1770
      )
1771
    end
1772
  end
1773

  
1735 1774
  def test_default_formatter
1736 1775
    with_settings :text_formatting => 'unknown' do
1737 1776
      text = 'a *link*: http://www.example.net/'
(2-2/2)