Bug 1508398 [wpt PR 14130] - Updating WebDriver scroll into view tests to support older user agents, a=testonly

Automatic update from web-platform-testswebdriver: update scroll into view tests to support older user agents (#14130)

Removing the use of ES6 constructs (fat-arrow and object shortcut
syntax) as well as adding use of alternatives for user agents that
do not support window.scrollX and window.scrollY.
--

wpt-commits: fcef20974685c994c830a23eae88906449fe93f7
wpt-pr: 14130
This commit is contained in:
jimevans 2018-11-22 10:34:35 +00:00 committed by moz-wptsync-bot
parent 8dcc5a26e1
commit da86a2fcf1

View File

@ -60,14 +60,13 @@ def test_partially_visible_does_not_scroll(session, offset):
<script>
window.clicks = [];
let target = document.querySelector("div");
target.addEventListener("click", ({{clientX, clientY}}) => window.clicks.push([clientX, clientY]));
target.addEventListener("click", function(e) {{ window.clicks.push([e.clientX, e.clientY]); }});
</script>
""".format(offset=offset))
target = session.find.css("div", all=False)
assert session.execute_script("return window.scrollY") == 0
assert session.execute_script("return window.scrollY || document.documentElement.scrollTop") == 0
response = element_click(session, target)
assert_success(response)
assert session.execute_script("return window.scrollY") == 0
assert session.execute_script("return window.scrollY || document.documentElement.scrollTop") == 0
click_point = assert_one_click(session)
assert click_point == center_point(target)