Skip to content

Commit

Permalink
Use ceil before converting to an integer in BrowserHelpers.region_for (
Browse files Browse the repository at this point in the history
…#88)

This prevents creating a region that is one pixel too small due to
rounding down.
  • Loading branch information
asavageiv authored Nov 8, 2023
1 parent 7d1d087 commit fe828ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/capybara/screenshot/diff/browser_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def self.all_visible_regions_for(selector)
end

def self.region_for(element)
element.evaluate_script(GET_BOUNDING_CLIENT_RECT_SCRIPT).map { |point| point.negative? ? 0 : point.to_i }
element.evaluate_script(GET_BOUNDING_CLIENT_RECT_SCRIPT).map { |point| point.negative? ? 0 : point.ceil.to_i }
end

def self.session
Expand Down

0 comments on commit fe828ad

Please sign in to comment.