Sha256: ac512381cbad981a061905c7de9f0b4461ada354fcca95ba5c59238e9591de33

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redcarpet-3.2.1 test/html5_test.rb
redcarpet-3.2.0 test/html5_test.rb