1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

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