Bug 1317386 - Test pointer interactability of first element in paint order; r=automatedtester

When returning the tree of interactable elemenets under the cursor, we
want to test the first one against the passed element, not that there
are _any_ interactable elements under the cursor.

MozReview-Commit-ID: AUvKAWKHgZk

--HG--
extra : rebase_source : 69563be46dbb18c4c814d6615b1bd2f97179b816
This commit is contained in:
Andreas Tolfsen 2016-11-15 11:21:32 +00:00
Родитель 5be6b803bf
Коммит 3c262bd4f4
2 изменённых файлов: 98 добавлений и 4 удалений

Просмотреть файл

@ -937,7 +937,7 @@ element.isInteractable = function(el) {
*/
element.isPointerInteractable = function(el) {
let tree = element.getInteractableElementTree(el, el.ownerDocument);
return tree.length > 0;
return tree[0] === el;
};
/**

Просмотреть файл

@ -101,6 +101,100 @@ class TestClick(TestLegacyClick):
self.marionette.delete_session()
self.marionette.start_session({"specificationLevel": 1})
@skip("fails with spec compatible interactability checks")
def test_clicking_an_element_that_is_not_displayed_raises(self):
pass
def test_click_element_obscured_by_absolute_positioned_element(self):
self.marionette.navigate(inline("""
<style>
* { margin: 0; padding: 0; }
div { display: block; width: 100%; height: 100%; }
#obscured { background-color: blue }
#overlay { background-color: red; position: absolute; top: 0; }
</style>
<div id=obscured></div>
<div id=overlay></div>"""))
overlay = self.marionette.find_element(By.ID, "overlay")
obscured = self.marionette.find_element(By.ID, "obscured")
overlay.click()
with self.assertRaises(ElementNotVisibleException):
obscured.click()
def test_centre_outside_viewport_vertically(self):
self.marionette.navigate(inline("""
<style>
* { margin: 0; padding: 0; }
div {
display: block;
position: absolute;
background-color: blue;
width: 200px;
height: 200px;
/* move centre point off viewport vertically */
top: -105px;
}
</style>
<div></div>"""))
self.marionette.find_element(By.TAG_NAME, "div").click()
def test_centre_outside_viewport_horizontally(self):
self.marionette.navigate(inline("""
<style>
* { margin: 0; padding: 0; }
div {
display: block;
position: absolute;
background-color: blue;
width: 200px;
height: 200px;
/* move centre point off viewport horizontally */
left: -105px;
}
</style>
<div></div>"""))
self.marionette.find_element(By.TAG_NAME, "div").click()
def test_centre_outside_viewport(self):
self.marionette.navigate(inline("""
<style>
* { margin: 0; padding: 0; }
div {
display: block;
position: absolute;
background-color: blue;
width: 200px;
height: 200px;
/* move centre point off viewport */
left: -105px;
top: -105px;
}
</style>
<div></div>"""))
self.marionette.find_element(By.TAG_NAME, "div").click()
def test_css_transforms(self):
self.marionette.navigate(inline("""
<style>
* { margin: 0; padding: 0; }
div {
display: block;
background-color: blue;
width: 200px;
height: 200px;
transform: translateX(-105px);
}
</style>
<div></div>"""))
self.marionette.find_element(By.TAG_NAME, "div").click()