Sha256: e89494d698b467839de2cc33f3f06e7d62d40a907c09b597fab67f9181e09fa3

Contents?: true

Size: 1.76 KB

Versions: 1

Compression:

Stored size: 1.76 KB

Contents

require 'test_helper'

class HTML5Test < Greenmat::TestCase
  def test_that_html5_works
    section = <<-HTML.chomp.strip_heredoc
      <section>
        <p>The quick brown fox jumps over the lazy dog.</p>
      </section>
    HTML

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

    assert_renders section, section
    assert_renders figure, figure
  end

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

    section_expected = <<-HTML.chomp.strip_heredoc
      <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>
    HTML

    header = <<-HTML
    <header>
        <hgroup>
            <h1>Section heading</h1>
            <h2>Subhead</h2>
        </hgroup>
    </header>
    HTML

    header_expected = <<-HTML.chomp.strip_heredoc
      <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>
    HTML

    assert_renders section_expected, section
    assert_renders header_expected, header
  end

  def test_script_tag_recognition
    html = <<-HTML.chomp.strip_heredoc
      <script type="text/javascript">
        alert('Foo!');
      </script>
    HTML

    assert_renders html, html
  end

  def test_new_html5_tags_not_escaped
    details = <<-HTML.chomp.strip_heredoc
      <details>
        log:

      </details>
    HTML

    assert_renders details, details
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
greenmat-3.5.1.0 test/html5_test.rb