mirror of
https://github.com/servo/servo.git
synced 2025-06-24 00:54:32 +01:00
55 lines
2 KiB
HTML
55 lines
2 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset=utf-8>
|
|
<title>Effect value computation tests for 'visibility' property</title>
|
|
<link rel="help" href="https://w3c.github.io/web-animations/#the-effect-value-of-a-keyframe-animation-effect">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="../../testcommon.js"></script>
|
|
<body>
|
|
<div id="log"></div>
|
|
<div id="target"></div>
|
|
<script>
|
|
'use strict';
|
|
|
|
test(function(t) {
|
|
var div = createDiv(t);
|
|
var anim = div.animate({ visibility: ['hidden','visible'] },
|
|
{ duration: 100 * MS_PER_SEC, fill: 'both' });
|
|
|
|
anim.currentTime = 0;
|
|
assert_equals(getComputedStyle(div).visibility, 'hidden',
|
|
'Visibility when progress = 0');
|
|
|
|
anim.currentTime = 10 * MS_PER_SEC + 1;
|
|
assert_equals(getComputedStyle(div).visibility, 'visible',
|
|
'Visibility when progress > 0 due to linear easing');
|
|
|
|
anim.finish();
|
|
assert_equals(getComputedStyle(div).visibility, 'visible',
|
|
'Visibility when progress = 1');
|
|
|
|
}, 'Visibility clamping behavior');
|
|
|
|
test(function(t) {
|
|
var div = createDiv(t);
|
|
var anim = div.animate({ visibility: ['hidden', 'visible'] },
|
|
{ duration: 100 * MS_PER_SEC, fill: 'both',
|
|
easing: 'cubic-bezier(0.25, -0.6, 0, 0.5)' });
|
|
|
|
anim.currentTime = 0;
|
|
assert_equals(getComputedStyle(div).visibility, 'hidden',
|
|
'Visibility when progress = 0');
|
|
|
|
// Timing function is below zero. So we expected visibility is hidden.
|
|
anim.currentTime = 10 * MS_PER_SEC + 1;
|
|
assert_equals(getComputedStyle(div).visibility, 'hidden',
|
|
'Visibility when progress < 0 due to cubic-bezier easing');
|
|
|
|
anim.currentTime = 60 * MS_PER_SEC;
|
|
assert_equals(getComputedStyle(div).visibility, 'visible',
|
|
'Visibility when progress > 0 due to cubic-bezier easing');
|
|
|
|
}, 'Visibility clamping behavior with an easing that has a negative component');
|
|
|
|
</script>
|
|
</body>
|