require 'koara' require 'koara/html/html5renderer' require 'minitest/autorun' class Html5RendererTest < MiniTest::Unit::TestCase def setup @parser = Koara::Parser.new @renderer = Koara::Html::Html5Renderer.new() end def test_render @document = @parser.parse('Test') @document.accept(@renderer) assert_equal("

Test

", @renderer.output) end def test_render_hardwrap_true @renderer.hard_wrap = true; @document = @parser.parse("a\nb") @document.accept(@renderer) assert_equal("

a
\nb

", @renderer.output) end def test_no_partial_result expected = "\n" expected << "\n"; expected << " \n"; expected << "

Test

\n"; expected << " \n"; expected << "\n"; @renderer.partial = false; @document = @parser.parse('Test') @document.accept(@renderer) assert_equal(expected, @renderer.output) end def test_heading_ids_true @renderer.heading_ids = true; @document = @parser.parse('= A') @document.accept(@renderer) assert_equal("

A

", @renderer.output) end def test_heading_ids_true_multiple_words @renderer.heading_ids = true; @document = @parser.parse('= This is a test') @document.accept(@renderer) assert_equal("

This is a test

", @renderer.output) end end