f06c482b6f
Resolves: rhbz#1980885
47 lines
1.8 KiB
Diff
47 lines
1.8 KiB
Diff
From 4fe6b46f04f94b31bc39fe5be4f363b025ec0aaf Mon Sep 17 00:00:00 2001
|
|
From: Mike Dalessio <mike.dalessio@gmail.com>
|
|
Date: Thu, 13 May 2021 23:04:13 -0400
|
|
Subject: [PATCH] test: establish better baseline behavior for MS Word's html
|
|
format
|
|
|
|
because this is about to change in libxml 2.9.12
|
|
---
|
|
test/xml/test_node.rb | 20 ++++++++++++--------
|
|
1 file changed, 12 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/test/xml/test_node.rb b/test/xml/test_node.rb
|
|
index 5995055cb..54cc9eccd 100644
|
|
--- a/test/xml/test_node.rb
|
|
+++ b/test/xml/test_node.rb
|
|
@@ -1041,18 +1041,22 @@ def test_namespace_without_an_href_on_html_node
|
|
# describe how we handle microsoft word's HTML formatting.
|
|
# this test is descriptive, not prescriptive.
|
|
#
|
|
- skip("Xerces handles this edge case completely differently") unless Nokogiri.uses_libxml?
|
|
-
|
|
- xml = Nokogiri::HTML.parse(<<~EOF)
|
|
+ html = Nokogiri::HTML.parse(<<~EOF)
|
|
<div><o:p>foo</o:p></div>
|
|
EOF
|
|
-
|
|
- node = xml.at("p")
|
|
+ node = html.at("div").children.first
|
|
assert_not_nil(node)
|
|
|
|
- assert_equal(1, node.namespaces.keys.size)
|
|
- assert(node.namespaces.has_key?('xmlns:o'))
|
|
- assert_nil(node.namespaces['xmlns:o'])
|
|
+ if Nokogiri.uses_libxml?
|
|
+ assert_equal(1, node.namespaces.keys.size)
|
|
+ assert(node.namespaces.has_key?('xmlns:o'))
|
|
+ assert_nil(node.namespaces['xmlns:o'])
|
|
+ assert_equal("<p>foo</p>", node.to_html)
|
|
+ else
|
|
+ # Xerces does something completely different
|
|
+ assert_empty(node.namespaces.keys)
|
|
+ assert_equal("<o:p>foo</o:p>", node.to_html)
|
|
+ end
|
|
end
|
|
|
|
def test_xpath_results_have_document_and_are_decorated
|