lib/capybara/node/actions.rb in capybara-3.32.2 vs lib/capybara/node/actions.rb in capybara-3.33.0

- old
+ new

@@ -306,20 +306,18 @@ private def find_select_or_datalist_input(from, options) synchronize(Capybara::Queries::BaseQuery.wait(options, session_options.default_max_wait_time)) do - begin - find(:select, from, **options) - rescue Capybara::ElementNotFound => select_error # rubocop:disable Naming/RescuedExceptionsVariableName - raise if %i[selected with_selected multiple].any? { |option| options.key?(option) } + find(:select, from, **options) + rescue Capybara::ElementNotFound => select_error # rubocop:disable Naming/RescuedExceptionsVariableName + raise if %i[selected with_selected multiple].any? { |option| options.key?(option) } - begin - find(:datalist_input, from, **options) - rescue Capybara::ElementNotFound => dlinput_error # rubocop:disable Naming/RescuedExceptionsVariableName - raise Capybara::ElementNotFound, "#{select_error.message} and #{dlinput_error.message}" - end + begin + find(:datalist_input, from, **options) + rescue Capybara::ElementNotFound => dlinput_error # rubocop:disable Naming/RescuedExceptionsVariableName + raise Capybara::ElementNotFound, "#{select_error.message} and #{dlinput_error.message}" end end end def select_datalist_option(input, value) @@ -365,21 +363,19 @@ def _check_with_label(selector, checked, locator, allow_label_click: session_options.automatic_label_click, **options) options[:allow_self] = true if locator.nil? synchronize(Capybara::Queries::BaseQuery.wait(options, session_options.default_max_wait_time)) do - begin - el = find(selector, locator, **options) - el.set(checked) - rescue StandardError => e - raise unless allow_label_click && catch_error?(e) + el = find(selector, locator, **options) + el.set(checked) + rescue StandardError => e + raise unless allow_label_click && catch_error?(e) - begin - el ||= find(selector, locator, **options.merge(visible: :all)) - el.session.find(:label, for: el, visible: true).click unless el.checked? == checked - rescue StandardError # swallow extra errors - raise original - raise e - end + begin + el ||= find(selector, locator, **options.merge(visible: :all)) + el.session.find(:label, for: el, visible: true).click unless el.checked? == checked + rescue StandardError # swallow extra errors - raise original + raise e end end end UPDATE_STYLE_SCRIPT = <<~'JS'