summaryrefslogtreecommitdiffstats
path: root/devtools/client/animationinspector/test/browser_animation_timeline_currentTime.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/client/animationinspector/test/browser_animation_timeline_currentTime.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/animationinspector/test/browser_animation_timeline_currentTime.js')
-rw-r--r--devtools/client/animationinspector/test/browser_animation_timeline_currentTime.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_currentTime.js b/devtools/client/animationinspector/test/browser_animation_timeline_currentTime.js
new file mode 100644
index 000000000..d5caaff28
--- /dev/null
+++ b/devtools/client/animationinspector/test/browser_animation_timeline_currentTime.js
@@ -0,0 +1,48 @@
+/* vim: set ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+requestLongerTimeout(2);
+
+// Check that the timeline toolbar displays the current time, and that it
+// changes when animations are playing, gets back to 0 when animations are
+// rewound, and stops when animations are paused.
+
+add_task(function* () {
+ yield addTab(URL_ROOT + "doc_simple_animation.html");
+
+ let {panel} = yield openAnimationInspector();
+ let label = panel.timelineCurrentTimeEl;
+ ok(label, "The current time label exists");
+
+ // On page load animations are playing so the time shoud change, although we
+ // don't want to test the exact value of the time displayed, just that it
+ // actually changes.
+ info("Make sure the time displayed actually changes");
+ yield isCurrentTimeLabelChanging(panel, true);
+
+ info("Pause the animations and check that the time stops changing");
+ yield clickTimelinePlayPauseButton(panel);
+ yield isCurrentTimeLabelChanging(panel, false);
+
+ info("Rewind the animations and check that the time stops changing");
+ yield clickTimelineRewindButton(panel);
+ yield isCurrentTimeLabelChanging(panel, false);
+ is(label.textContent, "00:00.000");
+});
+
+function* isCurrentTimeLabelChanging(panel, isChanging) {
+ let label = panel.timelineCurrentTimeEl;
+
+ let time1 = label.textContent;
+ yield new Promise(r => setTimeout(r, 200));
+ let time2 = label.textContent;
+
+ if (isChanging) {
+ ok(time1 !== time2, "The text displayed in the label changes with time");
+ } else {
+ is(time1, time2, "The text displayed in the label doesn't change");
+ }
+}