Bug 1182856 - Part 7: Test. r=cam
authorBoris Chiou <boris.chiou@gmail.com>
Thu, 07 Apr 2016 02:11:00 +0200
changeset 330671 a627b8fce0073fda398b78c3590566cea5485ca9
parent 330670 fdc53ebd6d2e4904bfaa252bd25e94f874607205
child 330672 474f2f3c105915264882ba0f9733e7d1ee986c95
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscam
bugs1182856
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1182856 - Part 7: Test. r=cam
layout/style/test/mochitest.ini
layout/style/test/test_transitions_with_displaynone.html
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -265,16 +265,17 @@ skip-if = (toolkit == 'gonk' && debug) |
 [test_transitions_events.html]
 [test_transitions.html]
 skip-if = (android_version == '18' && debug) # bug 1159532
 [test_transitions_bug537151.html]
 [test_transitions_dynamic_changes.html]
 [test_transitions_per_property.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 775227 # b2g(times out, needs more time + various failures) b2g-debug(times out, needs more time + various failures) b2g-desktop(times out, needs more time + various failures)
 [test_transitions_step_functions.html]
+[test_transitions_with_displaynone.html]
 [test_unclosed_parentheses.html]
 [test_unicode_range_loading.html]
 support-files = ../../reftests/fonts/markA.woff ../../reftests/fonts/markB.woff ../../reftests/fonts/markC.woff ../../reftests/fonts/markD.woff
 [test_units_angle.html]
 [test_units_frequency.html]
 [test_units_length.html]
 [test_units_time.html]
 [test_unprefixing_service.html]
new file mode 100644
--- /dev/null
+++ b/layout/style/test/test_transitions_with_displaynone.html
@@ -0,0 +1,71 @@
+<!doctype html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1182856
+-->
+<head>
+  <title>Test for Bug 1182856</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="animation_utils.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <style>
+  #display {
+    background: blue;
+    height: 10px;
+    width: 10px;
+  }
+  </style>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1182856">Mozilla Bug 1182856</a>
+
+<div id="display"></div>
+<pre id="test"></pre>
+
+<script type="application/javascript">
+'use strict';
+
+function TestDisplayNoneTurnOffTransitions(elem, cs, elemToDisplayNone, name) {
+  var ended = false;
+  var markEnded = function () {
+    ended = true;
+  };
+  elem.addEventListener('transitionend', markEnded, false);
+
+  cs.marginLeft; // flush
+  elem.style.marginLeft = "100px"; // start transition
+  is(cs.marginLeft, "0px", name + ": margin-left at 0s");
+
+  advance_clock(1000);
+  is(cs.marginLeft, "10px", name + ": margin-left at 1s");
+
+  elemToDisplayNone.style.display = "none";
+  is(cs.marginLeft, "100px", name + ": margin-left after display:none");
+
+  advance_clock(10000);
+  ok(!ended, name + ": Should not get transitionend");
+}
+
+advance_clock(0);
+
+// Set display:none on the target.
+var [div, cs] = new_div("margin-left: 0px; transition: margin-left 10s linear");
+TestDisplayNoneTurnOffTransitions(div, cs, div, "Set display:none on target");
+done_div();
+
+// Set display:none on the ancestor of the target.
+var [div, cs] = new_div("margin-left: 0px; transition: margin-left 10s linear");
+var ancestor = document.createElement("div");
+div.parentNode.insertBefore(ancestor, div);
+ancestor.appendChild(div);
+TestDisplayNoneTurnOffTransitions(div, cs, ancestor,
+                                  "Set display:none on ancestor");
+ancestor.parentNode.insertBefore(div, ancestor);
+ancestor.remove();
+done_div();
+
+SpecialPowers.DOMWindowUtils.restoreNormalRefresh();
+
+</script>
+</body>
+</html>