Merge pull request #2506 from teamcapybara/style_fixes

Minor code cleanup
This commit is contained in:
Thomas Walpole 2021-10-23 22:18:02 -07:00 committed by GitHub
commit 97393be2c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 10 additions and 9 deletions

View File

@ -75,7 +75,7 @@ module Capybara
filter = %r{lib/capybara/|lib/rspec/|lib/minitest/}
new_trace = trace.take_while { |line| line !~ filter }
new_trace = trace.reject { |line| line =~ filter } if new_trace.empty?
new_trace = trace.grep_v(filter) if new_trace.empty?
new_trace = trace.dup if new_trace.empty?
new_trace.first.split(/:in /, 2).first

View File

@ -216,7 +216,7 @@ private
min, max, step = (native['min'] || 0).to_f, (native['max'] || 100).to_f, (native['step'] || 1).to_f
value = value.to_f
value = value.clamp(min, max)
value = ((value - min) / step).round * step + min
value = (((value - min) / step).round * step) + min
native['value'] = value.clamp(min, max)
end

View File

@ -43,7 +43,7 @@ module Capybara
when '"', "'"
selector << parse_string(char, str)
when '\\'
selector << char + str.getc
selector << (char + str.getc)
when ','
selectors << selector.strip
selector.clear

View File

@ -63,6 +63,7 @@ class Capybara::Selenium::ChromeNode < Capybara::Selenium::Node
def visible?
return super unless native_displayed?
begin
bridge.send(:execute, :is_element_displayed, id: native_id)
rescue Selenium::WebDriver::Error::UnknownCommandError

View File

@ -94,7 +94,7 @@ ffeature 'if ffeature aliases focused tag then' do # rubocop:disable RSpec/Focus
expect(example.metadata[:focus]).to eq true
end
scenario 'other scenarios also has metatag focus tag ' do |example|
scenario 'other scenarios also has metatag focus tag' do |example|
expect(example.metadata[:focus]).to eq true
end
end

View File

@ -88,7 +88,7 @@ Capybara::SpecHelper.run_specs TestSessions::SeleniumIE, 'selenium', capybara_sk
pending "Window 7 and 8.1 don't support 308 http status code"
when /#scroll_to can scroll an element to the center of the viewport$/,
/#scroll_to can scroll an element to the center of the scrolling element$/
pending " IE doesn't support ScrollToOptions"
pending "IE doesn't support ScrollToOptions"
when /#attach_file with multipart form should fire change once for each set of files uploaded$/,
/#attach_file with multipart form should fire change once when uploading multiple files from empty$/,
/#attach_file with multipart form should not break when using HTML5 multiple file input uploading multiple files$/