Skip to content

Commit 71c0b57

Browse files
committed
test: update html5 parent test to not rely on changing select rules
1 parent 22fe69e commit 71c0b57

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
@@ -319,17 +319,15 @@ def test_node_wrap
319319
end
320320

321321
def test_node_wrap_uses_parent_node_as_parsing_context_node
322-
doc = Nokogiri.HTML5("<html><body><select><option></option></select></body></html>")
323-
el = doc.at_css("option")
322+
doc = Nokogiri.HTML5("<html><body><p></p></body></html>")
323+
el = doc.at_css("p")
324324

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

329-
# parses because `optgroup` is valid in the context of a `select` element
330-
el.wrap("<optgroup></optgroup>")
331-
assert_equal("optgroup", el.parent.name)
332-
assert_equal("select", el.parent.parent.name)
328+
el.wrap("<div></div>")
329+
assert_equal("div", el.parent.name)
330+
assert_equal("body", el.parent.parent.name)
333331
end
334332

335333
def test_parse_in_context_of_foreign_namespace

0 commit comments

Comments
 (0)