require 'rails_helper'
require 'html_normalize'
describe HtmlNormalize do
def n(html)
HtmlNormalize.normalize(html)
end
it "handles attributes without values" do
expect(n "").to eq("")
end
it "handles self closing tags" do
source = <<-HTML
boo
HTML
expect(n source).to eq(source.strip)
end
it "Can handle aside" do
source = <<~HTML
HTML
expected = <<~HTML
HTML
expect(n expected).to eq(n source)
end
it "Can normalize attributes" do
source = "b"
same = "b"
expect(n source).to eq(n same)
end
it "Can indent divs nicely" do
source = "
hello world
"
expected = <<~HTML
hello world
HTML
expect(n source).to eq(expected.strip)
end
end