# frozen_string_literal: true require 'spec_helper' RSpec.describe Banzai::Filter::AsciiDocSanitizationFilter do include FilterSpecHelper it 'preserves footnotes refs' do result = filter('

This paragraph has a footnote.[1]

').to_html expect(result).to eq('

This paragraph has a footnote.[1]

') end it 'preserves footnotes defs' do result = filter('
1. This is the text of the footnote.
').to_html expect(result).to eq(%(
1. This is the text of the footnote.
)) end it 'preserves user-content- prefixed ids on anchors' do result = filter('

A link to another location within an AsciiDoc document.

').to_html expect(result).to eq(%(

A link to another location within an AsciiDoc document.

)) end it 'preserves user-content- prefixed ids on div (blocks)' do html_content = <<~HTML

This is an open block

HTML output = <<~SANITIZED_HTML

This is an open block

SANITIZED_HTML expect(filter(html_content).to_html).to eq(output) end it 'preserves section anchor ids' do result = filter(%(

First section

)).to_html expect(result).to eq(%(

First section

)) end it 'removes non prefixed ids' do result = filter('

A link to another location within an AsciiDoc document.

').to_html expect(result).to eq(%(

A link to another location within an AsciiDoc document.

)) end end