From 4cbe7b54e04450d0aa2d15deef49ca82dfcbdc96 Mon Sep 17 00:00:00 2001 From: Thomas Walpole Date: Fri, 12 Apr 2019 14:17:45 -0700 Subject: [PATCH] Test for handler functions not interfering with CSS id queries --- test/files/tlm.html | 1 + test/html/sax/test_parser.rb | 4 ++-- test/html/test_document.rb | 9 +++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/test/files/tlm.html b/test/files/tlm.html index 3b2b52c982..ea2c73b459 100644 --- a/test/files/tlm.html +++ b/test/files/tlm.html @@ -827,6 +827,7 @@

Step 3: Upload the video file

Special character div
+
Partial collision id
diff --git a/test/html/sax/test_parser.rb b/test/html/sax/test_parser.rb index 6af9bcaa2a..b092b895df 100644 --- a/test/html/sax/test_parser.rb +++ b/test/html/sax/test_parser.rb @@ -29,9 +29,9 @@ def test_parse_file # Take a look at the comment in test_parse_document to know # a possible reason to this difference. if Nokogiri.uses_libxml? - assert_equal 1111, @parser.document.end_elements.length + assert_equal 1112, @parser.document.end_elements.length else - assert_equal 1120, @parser.document.end_elements.length + assert_equal 1121, @parser.document.end_elements.length end end diff --git a/test/html/test_document.rb b/test/html/test_document.rb index 62b3fc6b1f..d9b55f1c3c 100644 --- a/test/html/test_document.rb +++ b/test/html/test_document.rb @@ -496,6 +496,15 @@ def awesome divs }.new) end + def test_find_with_partial_id_collision_function + found_by_id = @html.css("#partial_collision_id", Class.new { + def collision nodes + [nodes.first] + end + }.new) + assert_equal 1, found_by_id.length + end + def test_dup_shallow found = @html.search('//div/a').first dup = found.dup(0)