Skip to content

Commit

Permalink
test: extend Nokogiri decorator tests to NodeSets
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Jan 17, 2021
1 parent 82f0c9e commit 07e89a5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/unit/test_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ class UnitTestApi < Loofah::TestCase
node_set.scrub!(:strip)
end

it "scrubs fragment nodesets" do
doc = Loofah.fragment(HTML)
assert(node_set = doc.css("div"))
assert_instance_of Nokogiri::XML::NodeSet, node_set
node_set.scrub!(:strip)
end

it "exposes serialize_root on HTML::DocumentFragment" do
doc = Loofah.fragment(HTML)
assert_equal HTML, doc.serialize_root.to_html
Expand Down Expand Up @@ -110,6 +117,13 @@ class UnitTestApi < Loofah::TestCase
assert(node = doc.at_css("div"))
node.scrub!(:strip)
end

it "scrubs document nodesets" do
doc = Loofah.xml_document(XML)
assert(node_set = doc.css("div"))
assert_instance_of Nokogiri::XML::NodeSet, node_set
node_set.scrub!(:strip)
end
end

private
Expand Down

0 comments on commit 07e89a5

Please sign in to comment.