Skip to content

Commit

Permalink
Test for handler functions not interfering with CSS id queries
Browse files Browse the repository at this point in the history
  • Loading branch information
twalpole committed Apr 12, 2019
1 parent 93d1a80 commit 4cbe7b5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions test/files/tlm.html
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@ <h3>Step 3: Upload the video file</h3>
</div>

<div id="abc.123" class='special.character'>Special character div</div>
<div id="partial_collision_id">Partial collision id</div>
<div id="footer">
A design by <a href="http://blog.geminigeek.com/wordpress-theme">GeminiGeek</a> &bull; Powered by <a href="http://wordpress.org">Wordpress</a><!--&bull; <a href="#">CSS</a> &bull; <a href="#">xHTML 1.0</a>-->
</div>
Expand Down
4 changes: 2 additions & 2 deletions test/html/sax/test_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions test/html/test_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4cbe7b5

Please sign in to comment.