Sha256: ac311c96eb578cfe10b97fae1ba5d58055486e7dd466eba9eed7b047354f027d

Contents?: true

Size: 1.32 KB

Versions: 23

Compression:

Stored size: 1.32 KB

Contents

require 'test_helper'

class HTML5Test < Redcarpet::TestCase
  def test_that_html5_works
    section = <<EOS
<section>
  <p>The quick brown fox jumps over the lazy dog.</p>
</section>
EOS

    figure = <<EOS
<figure>
  <img src="http://example.org/image.jpg" alt="">
  <figcaption>
    <p>Hello world!</p>
  </figcaption>
</figure>
EOS

    assert_renders section, section
    assert_renders figure, figure
  end

  def test_that_html5_works_with_code_blocks
    section = <<EOS
\t<section>
\t\t<p>The quick brown fox jumps over the lazy dog.</p>
\t</section>
EOS

    section_expected = <<EOE
<pre><code>&lt;section&gt;
    &lt;p&gt;The quick brown fox jumps over the lazy dog.&lt;/p&gt;
&lt;/section&gt;
</code></pre>
EOE

    header = <<EOS
    <header>
        <hgroup>
            <h1>Section heading</h1>
            <h2>Subhead</h2>
        </hgroup>
    </header>
EOS

    header_expected = <<EOE
<pre><code>&lt;header&gt;
    &lt;hgroup&gt;
        &lt;h1&gt;Section heading&lt;/h1&gt;
        &lt;h2&gt;Subhead&lt;/h2&gt;
    &lt;/hgroup&gt;
&lt;/header&gt;
</code></pre>
EOE

    assert_renders section_expected, section
    assert_renders header_expected, header
  end

  def test_script_tag_recognition
    markdown = <<-Md
<script type="text/javascript">
  alert('Foo!');
</script>
Md
    assert_renders markdown, markdown
  end
end

Version data entries

23 entries across 23 versions & 5 rubygems

Version Path
mumukit-content-type-1.11.1 vendor/bundle/ruby/2.6.0/gems/redcarpet-3.3.4/test/html5_test.rb
tdiary-5.0.2 vendor/bundle/gems/redcarpet-3.3.4/test/html5_test.rb
tdiary-5.0.1 vendor/bundle/gems/redcarpet-3.3.4/test/html5_test.rb
redcarpet_yt-0.1.0 test/html5_test.rb
redcarpet_yt-0.0.10 test/html5_test.rb
redcarpet_yt-0.0.9 test/html5_test.rb
redcarpet_yt-0.0.8 test/html5_test.rb
redcarpet_yt-0.0.7 test/html5_test.rb
redcarpet_yt-0.0.6 test/html5_test.rb
redcarpet_yt-0.0.5 test/html5_test.rb
redcarpet_yt-0.0.4 test/html5_test.rb
redcarpet_yt-0.0.3 test/html5_test.rb
redcarpet_yt-0.0.2 test/html5_test.rb
redcarpet_yt-0.0.1 test/html5_test.rb
redcarpet-3.3.4 test/html5_test.rb
redcarpet-3.3.3 test/html5_test.rb
tight-redcarpet-3.3.2t test/html5_test.rb
redcarpet-3.3.2 test/html5_test.rb
redcarpet-3.3.1 test/html5_test.rb
redcarpet-3.3.0 test/html5_test.rb