Sha256: 012a8cc781189592d9c994eb8f40f3c9fa3afe331d008efa9716a56dc60d76d8
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 KB
Contents
# frozen_string_literal: true require 'test_helper' class TestOrderedList < Minitest::Test include TestHelpers def test_default_configuration configuration = Jekyll::TableOfContents::Configuration.new({}) assert_equal configuration.ordered_list, false end def test_disabled_ordered_list configuration = Jekyll::TableOfContents::Configuration.new('ordered_list' => false) assert_equal configuration.ordered_list, false end def test_enabled_ordered_list configuration = Jekyll::TableOfContents::Configuration.new('ordered_list' => true) assert_equal configuration.ordered_list, true end def test_basic_ordered_list_top_heading parse_with_ordered_list html = @parser.toc assert_match(/^<ol class="section-nav">/, html) end def test_ordered_list_sub_headings parse_with_ordered_list html = @parser.toc assert_match(/<ol>\n<li class="toc-entry/, html) end def test_ordered_list_top_heading_with_classes parse_with_ordered_list_and_classes html = @parser.toc assert_match(/^<ol class="top-list-class">/, html) end def test_ordered_list_sub_headings_with_classes parse_with_ordered_list_and_classes html = @parser.toc assert_match(/<ol class="sublist-class">/, html) end def test_ordered_list_subheadings_with_classes_nested_structure parse_with_ordered_list_and_classes html = @parser.toc occurrences = html.scan(/<ol class="sublist-class">/).count assert_equal occurrences, 5 end private def parse_with_ordered_list read_html_and_create_parser('ordered_list' => true) end def parse_with_ordered_list_and_classes read_html_and_create_parser( 'ordered_list' => true, 'list_class' => 'top-list-class', 'sublist_class' => 'sublist-class' ) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jekyll-toc-0.15.0.rc | test/parser/test_ordered_list.rb |