-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test for no special behavior for mouseover cancelation
Follows whatwg/html#2398.
- Loading branch information
Showing
2 changed files
with
85 additions
and
5 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
html/webappapis/scripting/events/event-handler-processing-algorithm-manual.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Event handlers processing algorithm: manual tests</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-event-handler-processing-algorithm"> | ||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me"> | ||
|
||
<style> | ||
div[id^="d"] { | ||
width: 100px; | ||
height: 100px; | ||
background-color: blue; | ||
} | ||
</style> | ||
|
||
<div id="log"></div> | ||
|
||
<p>Mouseover these four divs</p> | ||
|
||
<div id="d1"></div> | ||
<div id="d2"></div> | ||
|
||
<div id="d3" onmouseover="return false"></div> | ||
<div id="d4" onmouseover="return true"></div> | ||
|
||
<script> | ||
"use strict"; | ||
async_test(t => { | ||
const div = document.querySelector("#d1"); | ||
|
||
div.onmouseover = t.step_func(() => false); | ||
div.addEventListener("mouseover", t.step_func_done(e => { | ||
assert_equals(e.defaultPrevented, true); | ||
})); | ||
}, "Listener added via JavaScript, returns false: cancels the event"); | ||
|
||
async_test(t => { | ||
const div = document.querySelector("#d2"); | ||
|
||
div.onmouseover = t.step_func(() => true); | ||
div.addEventListener("mouseover", t.step_func_done(e => { | ||
assert_equals(e.defaultPrevented, false); | ||
})); | ||
}, "Listener added via JavaScript, returns true: does not cancel the event"); | ||
|
||
async_test(t => { | ||
const div = document.querySelector("#d3"); | ||
|
||
div.addEventListener("mouseover", t.step_func_done(e => { | ||
assert_equals(e.defaultPrevented, true); | ||
})); | ||
}, "Listener added via markup, returns false: cancels the event"); | ||
|
||
async_test(t => { | ||
const div = document.querySelector("#d4"); | ||
|
||
div.addEventListener("mouseover", t.step_func_done(e => { | ||
assert_equals(e.defaultPrevented, false); | ||
})); | ||
}, "Listener added via markup, returns true: does not cancel the event"); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters