Minor JS cleanup
This commit is contained in:
parent
4a380967fd
commit
2a915e680b
|
@ -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
|
# 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
|
if browser_version >= 75.0
|
||||||
driver.execute_script(<<~JS, self)
|
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;
|
arguments[0].value = null;
|
||||||
}
|
}
|
||||||
JS
|
JS
|
||||||
|
|
|
@ -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
|
# 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?
|
if chrome_edge?
|
||||||
driver.execute_script(<<~JS, self)
|
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;
|
arguments[0].value = null;
|
||||||
}
|
}
|
||||||
JS
|
JS
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Capybara::Selenium::FirefoxNode < Capybara::Selenium::Node
|
||||||
def set_file(value) # rubocop:disable Naming/AccessorMethodName
|
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
|
# By default files are appended so we have to clear here if its multiple and already set
|
||||||
driver.execute_script(<<~JS, self)
|
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;
|
arguments[0].value = null;
|
||||||
}
|
}
|
||||||
JS
|
JS
|
||||||
|
|
Loading…
Reference in New Issue