Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/inert/inert-inlines.html

Issue 2088453002: Implement the inert attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dmazzoni comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/dom/inert/inert-inlines.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-inlines.html b/third_party/WebKit/LayoutTests/fast/dom/inert/inert-inlines.html
new file mode 100644
index 0000000000000000000000000000000000000000..e228694493321bb44902d1ebc16654a5dc5b9a96
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/inert/inert-inlines.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+</head>
+<body>
+<a inert id="a" href="javascript:void(0)">Click me</a>
+<button inert id="button">Click me</button>
+<div inert id="div" style="background-color: blue; width: 50px; height: 50px">Click meeee</div>
+<span inert id="span">Click me</span>
+<script>
+function clickOn(element)
+{
+ if (!window.eventSender)
+ return;
+
+ var absoluteTop = 0;
+ var absoluteLeft = 0;
+ for (var parentNode = element; parentNode; parentNode = parentNode.offsetParent) {
+ absoluteLeft += parentNode.offsetLeft;
+ absoluteTop += parentNode.offsetTop;
+ }
+
+ var x = absoluteLeft + element.offsetWidth / 2;
+ var y = absoluteTop + element.offsetHeight / 2;
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ eventSender.mouseMoveTo(0, 0);
+}
+
+function eventFiredOnInertElement(e) {
+ e.target.style.background = 'red';
+ inertElementFiredOn = true;
+}
+
+inertElements = ['a', 'button', 'div', 'span']
+inertElements.forEach(function(id) {
+ element = document.getElementById(id);
+ element.addEventListener('click', eventFiredOnInertElement);
+ element.addEventListener('mousemove', eventFiredOnInertElement);
+});
+
+document.addEventListener('click', function(e) {
+ document.firedOn = true;
+});
+
+test(function() {
+ inertElements.forEach(function(id) {
+ expectedTarget = document;
+ element = document.getElementById(id);
+ inertElementFiredOn = false;
+ expectedTarget.firedOn = false;
+ clickOn(element);
+ assert_false(inertElementFiredOn, 'no event should be fired on ' + id);
+ assert_true(expectedTarget.firedOn, 'event should be fired on document instead of ' + id);
+ });
+}, 'Tests that inert inlines do not receive mouse events. ' +
+ 'To test manually, click on all the "Click me"s. The test ' +
+ 'fails if you see red.');
+
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698