Revision 6ff8cb60aab43a83cc52b509b2eede8c474db652 authored by Eric Willigers on 05 September 2018, 09:19:05 UTC, committed by Eric Willigers on 05 September 2018, 09:37:23 UTC
Test the parsing and serialization of the longhand properties from
CSS Animations and CSS Transitions.

Relevant browser bugs:

Edge animation-duration should reject negatives
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/18347049/

Edge and Safari incorrectly accept unitless 0 on <time> values
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/18348525/
https://bugs.webkit.org/show_bug.cgi?id=113230
1 parent beeef72
Raw File
Event-returnValue.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Event.returnValue</title>
  <link rel="author" title="Chris Rebert" href="http://chrisrebert.com">
  <link rel="help" href="https://dom.spec.whatwg.org/#dom-event-returnvalue">
  <meta name="flags" content="dom">
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
</head>
<body>
  <div id="log"></div>
  <script>
test(function() {
  var ev = new Event("foo");
  assert_true(ev.returnValue, "returnValue");
}, "When an event is created, returnValue should be initialized to true.");
test(function() {
  var ev = new Event("foo", {"cancelable": false});
  assert_false(ev.cancelable, "cancelable (before)");
  ev.preventDefault();
  assert_false(ev.cancelable, "cancelable (after)");
  assert_true(ev.returnValue, "returnValue");
}, "preventDefault() should not change returnValue if cancelable is false.");
test(function() {
  var ev = new Event("foo", {"cancelable": false});
  assert_false(ev.cancelable, "cancelable (before)");
  ev.returnValue = false;
  assert_false(ev.cancelable, "cancelable (after)");
  assert_true(ev.returnValue, "returnValue");
}, "returnValue=false should have no effect if cancelable is false.");
test(function() {
  var ev = new Event("foo", {"cancelable": true});
  assert_true(ev.cancelable, "cancelable (before)");
  ev.preventDefault();
  assert_true(ev.cancelable, "cancelable (after)");
  assert_false(ev.returnValue, "returnValue");
}, "preventDefault() should change returnValue if cancelable is true.");
test(function() {
  var ev = new Event("foo", {"cancelable": true});
  assert_true(ev.cancelable, "cancelable (before)");
  ev.returnValue = false;
  assert_true(ev.cancelable, "cancelable (after)");
  assert_false(ev.returnValue, "returnValue");
}, "returnValue should change returnValue if cancelable is true.");
test(function() {
  var ev = document.createEvent("Event");
  ev.returnValue = false;
  ev.initEvent("foo", true, true);
  assert_true(ev.bubbles, "bubbles");
  assert_true(ev.cancelable, "cancelable");
  assert_true(ev.returnValue, "returnValue");
}, "initEvent should unset returnValue.");
test(function() {
  var ev = new Event("foo", {"cancelable": true});
  ev.preventDefault();
  ev.returnValue = true;// no-op
  assert_true(ev.defaultPrevented);
  assert_false(ev.returnValue);
}, "returnValue=true should have no effect once the canceled flag was set.");
  </script>
</body>
</html>
back to top