Skip to content

Commit 07e89a5

Browse files
committed
test: extend Nokogiri decorator tests to NodeSets
1 parent 82f0c9e commit 07e89a5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/unit/test_api.rb

+14
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ class UnitTestApi < Loofah::TestCase
5555
node_set.scrub!(:strip)
5656
end
5757

58+
it "scrubs fragment nodesets" do
59+
doc = Loofah.fragment(HTML)
60+
assert(node_set = doc.css("div"))
61+
assert_instance_of Nokogiri::XML::NodeSet, node_set
62+
node_set.scrub!(:strip)
63+
end
64+
5865
it "exposes serialize_root on HTML::DocumentFragment" do
5966
doc = Loofah.fragment(HTML)
6067
assert_equal HTML, doc.serialize_root.to_html
@@ -110,6 +117,13 @@ class UnitTestApi < Loofah::TestCase
110117
assert(node = doc.at_css("div"))
111118
node.scrub!(:strip)
112119
end
120+
121+
it "scrubs document nodesets" do
122+
doc = Loofah.xml_document(XML)
123+
assert(node_set = doc.css("div"))
124+
assert_instance_of Nokogiri::XML::NodeSet, node_set
125+
node_set.scrub!(:strip)
126+
end
113127
end
114128

115129
private

0 commit comments

Comments
 (0)