Skip to content

Commit 87a81f5

Browse files
committed
test: update html5 parent test to not rely on changing select rules
1 parent 70eb54c commit 87a81f5

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

test/html5/test_api.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,15 @@ def test_node_wrap
294294
end
295295

296296
def test_node_wrap_uses_parent_node_as_parsing_context_node
297-
doc = Nokogiri.HTML5("<html><body><select><option></option></select></body></html>")
298-
el = doc.at_css("option")
297+
doc = Nokogiri.HTML5("<html><body><p></p></body></html>")
298+
el = doc.at_css("p")
299299

300-
# fails to parse because `div` is not valid in the context of a `select` element
301-
exception = assert_raises(RuntimeError) { el.wrap("<div></div>") }
302-
assert_match(/Failed to parse .* in the context of a 'select' element/, exception.message)
300+
exception = assert_raises(RuntimeError) { el.wrap("<html></html>") }
301+
assert_match(/Failed to parse .* in the context of a 'body' element/, exception.message)
303302

304-
# parses because `optgroup` is valid in the context of a `select` element
305-
el.wrap("<optgroup></optgroup>")
306-
assert_equal("optgroup", el.parent.name)
307-
assert_equal("select", el.parent.parent.name)
303+
el.wrap("<div></div>")
304+
assert_equal("div", el.parent.name)
305+
assert_equal("body", el.parent.parent.name)
308306
end
309307

310308
def test_parse_in_context_of_foreign_namespace

0 commit comments

Comments
 (0)