Sha256: fd621a231954e05d70ef7d5f1b3322a999a6683a969c6ae5d79aafc3c24ac0a4

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

require 'test_helper'

class DocumentTest < Test::Unit::TestCase
  # setup for test
  def setup
    @doc = example_document(:asciidoc_index)
  end

  def test_title
    assert_equal "AsciiDoc Home Page", @doc.doctitle
    assert_equal 14, @doc.elements.size
    assert_equal :preamble, @doc.elements[0].context
    assert @doc.elements[1].is_a? ::Asciidoctor::Section
  end

  def test_with_no_title
    d = Asciidoctor::Document.new(["Snorf"])
    assert_nil d.doctitle
  end

  def test_with_header_footer
    result = render_string("= Title\n\npreamble")
    assert_xpath '/html', result, 1
    assert_xpath '//*[@id="header"]', result, 1
    assert_xpath '//*[@id="footer"]', result, 1
    assert_xpath '//*[@id="preamble"]', result, 1
  end

  def test_with_no_header_footer
    result = render_string("= Title\n\npreamble", :header_footer => false)
    assert_xpath '/html', result, 0
    assert_xpath '/*[@id="header"]', result, 0
    assert_xpath '/*[@id="footer"]', result, 0
    assert_xpath '/*[@id="preamble"]', result, 1
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
asciidoctor-0.0.7 test/document_test.rb
asciidoctor-0.0.6 test/document_test.rb