Sha256: b1053117cf3d0d476a1da827514ba782bbd0fe3d91e16a8a0b26ce13f248539f

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

require 'test_helper'

class TestOptionError < Minitest::Test
  BASE_HTML = "<h1>h1</h1>"
  EXPECTED_HTML = <<-HTML
<ul class="section-nav">
<li class="toc-entry toc-h1"><a href="#h1">h1</a></li>
</ul>
  HTML

  def test_option_is_nil
    parser = Jekyll::TableOfContents::Parser.new(BASE_HTML, nil)
    doc = Nokogiri::HTML(parser.toc)
    expected = EXPECTED_HTML
    assert_equal(expected, doc.css('ul.section-nav').to_s)
  end

  def test_option_is_epmty_string
    parser = Jekyll::TableOfContents::Parser.new(BASE_HTML, "")
    doc = Nokogiri::HTML(parser.toc)
    expected = EXPECTED_HTML
    assert_equal(expected, doc.css('ul.section-nav').to_s)
  end

  def test_option_is_string
    parser = Jekyll::TableOfContents::Parser.new(BASE_HTML, "string")
    doc = Nokogiri::HTML(parser.toc)
    expected = EXPECTED_HTML
    assert_equal(expected, doc.css('ul.section-nav').to_s)
  end

  def test_option_is_array
    parser = Jekyll::TableOfContents::Parser.new(BASE_HTML, [])
    doc = Nokogiri::HTML(parser.toc)
    expected = EXPECTED_HTML
    assert_equal(expected, doc.css('ul.section-nav').to_s)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jekyll-toc-0.7.0.alpha1 test/test_option_error.rb
jekyll-toc-0.6.0 test/test_option_error.rb
jekyll-toc-0.5.2 test/test_option_error.rb
jekyll-toc-0.5.1 test/test_option_error.rb