Minor JS cleanup

This commit is contained in:
Thomas Walpole 2020-01-25 18:03:09 -08:00
parent 4a380967fd
commit 2a915e680b
3 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@ class Capybara::Selenium::ChromeNode < Capybara::Selenium::Node
# In Chrome 75+ files are appended (due to WebDriver spec - why?) so we have to clear here if its multiple and already set
if browser_version >= 75.0
driver.execute_script(<<~JS, self)
if (arguments[0].multiple && (arguments[0].files.length > 0)){
if (arguments[0].multiple && arguments[0].files.length){
arguments[0].value = null;
}
JS

View File

@ -18,7 +18,7 @@ class Capybara::Selenium::EdgeNode < Capybara::Selenium::Node
# In Chrome 75+ files are appended (due to WebDriver spec - why?) so we have to clear here if its multiple and already set
if chrome_edge?
driver.execute_script(<<~JS, self)
if (arguments[0].multiple && (arguments[0].files.length > 0)){
if (arguments[0].multiple && arguments[0].files.length){
arguments[0].value = null;
}
JS

View File

@ -26,7 +26,7 @@ class Capybara::Selenium::FirefoxNode < Capybara::Selenium::Node
def set_file(value) # rubocop:disable Naming/AccessorMethodName
# By default files are appended so we have to clear here if its multiple and already set
driver.execute_script(<<~JS, self)
if (arguments[0].multiple && (arguments[0].files.length > 0)){
if (arguments[0].multiple && arguments[0].files.length){
arguments[0].value = null;
}
JS