Bug 1122437 - 4 - Do not display the iteration count in animationplayer widget if the value is 1; r=miker

This commit is contained in:
Patrick Brosset 2015-01-23 17:50:14 +01:00
parent 882dba8238
commit e67db31d2d
4 changed files with 42 additions and 4 deletions

View File

@ -208,16 +208,20 @@ PlayerWidget.prototype = {
titleHTML += L10N.getStr("player.animationDurationLabel");
titleHTML += "<strong>" + L10N.getFormatStr("player.timeLabel",
this.getFormattedTime(state.duration)) + "</strong>";
if (state.delay) {
titleHTML += L10N.getStr("player.animationDelayLabel");
titleHTML += "<strong>" + L10N.getFormatStr("player.timeLabel",
this.getFormattedTime(state.delay)) + "</strong>";
}
titleHTML += L10N.getStr("player.animationIterationCountLabel");
let count = state.iterationCount || L10N.getStr("player.infiniteIterationCount");
titleHTML += "<strong>" + count + "</strong>";
titleHTML += "</span>"
if (state.iterationCount !== 1) {
titleHTML += L10N.getStr("player.animationIterationCountLabel");
let count = state.iterationCount || L10N.getStr("player.infiniteIterationCount");
titleHTML += "<strong>" + count + "</strong>";
}
titleHTML += "</span>";
titleEl.innerHTML = titleHTML;
// Timeline widget.

View File

@ -6,6 +6,7 @@ support-files =
head.js
[browser_animation_empty_on_invalid_nodes.js]
[browser_animation_iterationCount_hidden_by_default.js]
[browser_animation_panel_exists.js]
[browser_animation_participate_in_inspector_update.js]
[browser_animation_play_pause_button.js]

View File

@ -0,0 +1,24 @@
/* 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";
// Check that iteration count is only shown in the UI when it's different than 1
add_task(function*() {
yield addTab(TEST_URL_ROOT + "doc_simple_animation.html");
let {inspector, panel} = yield openAnimationInspector();
info("Selecting a node with an animation that doesn't repeat");
yield selectNode(".long", inspector);
let widget = panel.playerWidgets[0];
let metaDataLabels = widget.el.querySelectorAll(".animation-title .meta-data strong");
is(metaDataLabels.length, 1, "Only the duration is shown");
info("Selecting a node with an animation that repeats several times");
yield selectNode(".delayed", inspector);
widget = panel.playerWidgets[0];
let iterationLabel = widget.el.querySelectorAll(".animation-title .meta-data strong")[2];
is(iterationLabel.textContent, "10", "The iteration is shown");
});

View File

@ -57,6 +57,14 @@
animation: simple-animation 2s
}
.long {
top: 600px;
left: 10px;
background: blue;
animation: simple-animation 120s
}
@keyframes simple-animation {
100% {
transform: translateX(300px);
@ -78,5 +86,6 @@
<div class="ball delayed"></div>
<div class="ball multi-finite"></div>
<div class="ball short"></div>
<div class="ball long"></div>
</body>
</html>