Sha256: edec34832d87a0b771068303267ff05950440762bc48d40a709ae10aa769cade

Contents?: true

Size: 1.66 KB

Versions: 1

Compression:

Stored size: 1.66 KB

Contents

require 'test_helper'

context "Paragraphs" do
  test "rendered correctly" do
    assert_xpath "//p", render_string("Plain text for the win.\n\nYes, plainly."), 2
  end

  test "with title" do
    rendered = render_string(".Titled\nParagraph.\n\nWinning")
    
    assert_xpath "//div[@class='title']", rendered
    assert_xpath "//p", rendered, 2
  end

  test "no duplicate block before next section" do
    rendered = render_string("Title\n=====\n\nPreamble.\n\n== First Section\n\nParagraph 1\n\nParagraph 2\n\n\n== Second Section\n\nLast words")
    assert_xpath '//p[text()="Paragraph 2"]', rendered, 1
  end

  context "code" do
    test "literal paragraph" do
      assert_xpath "//pre/tt", render_string("    LITERALS\n\n    ARE LITERALLY\n\n    AWESOMMMME.")
    end

    test "listing paragraph" do
      assert_xpath "//div[@class='highlight']", render_string("----\nblah blah blah\n----")
    end

    test "source code paragraph" do
      assert_xpath "//div[@class='highlight']", render_string("[source, perl]\ndie 'zomg perl sucks';")
    end
  end

  context "special" do
    test "note multiline syntax" do
      assert_xpath "//div[@class='admonitionblock']", render_string("[NOTE]\nThis is a winner.")
    end

    test "note inline syntax" do
      assert_xpath "//div[@class='admonitionblock']", render_string("NOTE: This is important, fool!")
    end
  end

  context "comments" do
    test "line comment" do
      assert_no_match /comment/, render_string("first paragraph\n\n//comment\n\nsecond paragraph")
    end

    test "comment block" do
      assert_no_match /comment/, render_string("first paragraph\n\n////\ncomment\n////\n\nsecond paragraph")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asciidoctor-0.0.5 test/paragraphs_test.rb