# frozen_string_literal: true require 'test_helper' class HTMLPipelineTest < Converter::HTMLPipelineTestCase def setup @config = { 'html_pipeline' => { 'filters' => %w[markdownfilter sanitizationfilter emojifilter mentionfilter], 'context' => { 'asset_root' => 'http://foo.com/icons', 'base_url' => 'https://github.com/', 'commonmarker_extensions' => %w[table strikethrough tagfilter autolink] } }, 'markdown' => 'HTMLPipeline' } @markdown = Jekyll::Converters::Markdown.new @config end def test_passes_regular_options assert_equal '
Hey, @mojombo!
', @markdown.convert('**Hey, @mojombo**!').strip end def test_fail_when_a_library_dependency_is_not_met override = @config.dup override['html_pipeline']['filters'] << 'AutolinkFilter' markdown = Jekyll::Converters::Markdown.new override assert_raises(LoadError) { markdown.convert('http://www.github.com') } end def test_fail_when_a_context_dependency_is_not_met override = @config.dup override['html_pipeline'].delete 'context' markdown = Jekyll::Converters::Markdown.new override assert_raises(ArgumentError) { markdown.convert(':trollface:') } end def test_work_for_custom_filters require 'support/new_pipeline' override = @config.dup override['html_pipeline']['filters'] = ['HelpMarkdownFilter'] markdown = Jekyll::Converters::Markdown.new override text = "\n {{#tip}}\n **Tip**: Wow! \n {{/tip}}" assert_equal "