зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1481015 [wpt PR 12310] - Add default prompt value for user prompt WebDriver tests, a=testonly
Automatic update from web-platform-testsAdd default prompt value for user prompt WebDriver tests (#12310) Add default prompt value for user prompt WebDriver tests When the JavaScript `prompt()` function is called without a default value, some browsers (like IE) return "undefined" for the default prompt value if the argument is omitted. This commit refactors the user prompt handler tests so that prompt() is called with an appropriate value for the default value argument, providing a consistent behavior across browsers. -- wpt-commits: 2db6b2a7d5ea2b10d2b895cf6956391be88e8297 wpt-pr: 12310
This commit is contained in:
Родитель
4f908ad1ee
Коммит
07f40221bf
|
@ -646787,7 +646787,7 @@
|
||||||
"support"
|
"support"
|
||||||
],
|
],
|
||||||
"webdriver/tests/support/fixtures.py": [
|
"webdriver/tests/support/fixtures.py": [
|
||||||
"b4a29968b58cac2dfbe6b2ee28abdc3501cf4e01",
|
"daeccb70e948b2564f7d78106dbee919b9cd7436",
|
||||||
"support"
|
"support"
|
||||||
],
|
],
|
||||||
"webdriver/tests/support/http_request.py": [
|
"webdriver/tests/support/http_request.py": [
|
||||||
|
|
|
@ -263,12 +263,19 @@ def create_dialog(session):
|
||||||
assert isinstance(text, basestring), "`text` parameter must be a string"
|
assert isinstance(text, basestring), "`text` parameter must be a string"
|
||||||
|
|
||||||
# Script completes itself when the user prompt has been opened.
|
# Script completes itself when the user prompt has been opened.
|
||||||
|
# For prompt() dialogs, add a value for the 'default' argument,
|
||||||
|
# as some user agents (IE, for example) do not produce consistent
|
||||||
|
# values for the default.
|
||||||
session.execute_async_script("""
|
session.execute_async_script("""
|
||||||
let dialog_type = arguments[0];
|
let dialog_type = arguments[0];
|
||||||
let text = arguments[1];
|
let text = arguments[1];
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
window.dialog_return_value = window[dialog_type](text);
|
if (dialog_type == 'prompt') {
|
||||||
|
window.dialog_return_value = window[dialog_type](text, '');
|
||||||
|
} else {
|
||||||
|
window.dialog_return_value = window[dialog_type](text);
|
||||||
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
""", args=(dialog_type, text))
|
""", args=(dialog_type, text))
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче