Enable/Unprefix Animations & Transitions, add basic tests

This patch remove the Web Animations & CSS Animation runtime flags (and enables both). Removes prefixed Aninamations & Transitions and adds some basic tests & test support API.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/760183003
This commit is contained in:
Rafael Weinstein 2014-12-10 10:38:34 -08:00
parent 7e969d1e78
commit 1850b45556
7 changed files with 96 additions and 3 deletions

View File

@ -0,0 +1,5 @@
Running 1 tests
ok 1 top should amimate from 0 to 100px
1 tests
1 pass
0 fail

View File

@ -0,0 +1,31 @@
<sky>
<import src="../resources/chai.sky" />
<import src="../resources/mocha.sky" />
<div id="example"></div>
<style>
#example {
width: 100px;
height: 100px;
background: red;
position: relative;
animation-name: anim;
animation-timing-function: linear;
animation-duration: 5s;
}
@keyframes anim {
0% { top: 0px; }
100% { top: 100px; }
}
</style>
<script>
var example = document.getElementById('example');
describe('top', function() {
it('should amimate from 0 to 100px', function() {
internals.pauseAnimations(3);
assert.equal('60px', getComputedStyle(example).top);
});
});
</script>
</sky>

View File

@ -0,0 +1,5 @@
Running 1 tests
ok 1 Element.animate opacity should amimate from 0 to 1
1 tests
1 pass
0 fail

View File

@ -0,0 +1,16 @@
<sky>
<import src="../resources/chai.sky" />
<import src="../resources/mocha.sky" />
<div id="example">Hello, Sky</div>
<script>
var example = document.getElementById('example');
describe('Element.animate opacity', function() {
it('should amimate from 0 to 1', function() {
example.animate([{ opacity: 0 }, { opacity: 1}], 2000);
internals.pauseAnimations(.5);
assert.equal(.25, getComputedStyle(example).opacity);
});
});
</script>
</sky>

View File

@ -0,0 +1,5 @@
Running 1 tests
ok 1 width should transition from 100px to 200px
1 tests
1 pass
0 fail

View File

@ -0,0 +1,31 @@
<sky>
<import src="../resources/chai.sky" />
<import src="../resources/mocha.sky" />
<div></div>
<style>
div {
width: 100px;
height: 100px;
background: red;
position: relative;
transition: width 2s;
transition-timing-function: linear;
}
div#example {
width: 200px;
}
</style>
<script>
var example = document.querySelector('div');
example.offsetWidth; // force a style resolution so that next line's assigment triggers the transition
example.id = "example";
describe('width', function() {
it('should transition from 100px to 200px', function() {
internals.pauseAnimations(1);
assert.equal('150px', getComputedStyle(example).width);
});
});
</script>
</sky>

View File

@ -324,7 +324,7 @@ h1 :hover {
}
.overallComments .open {
-webkit-transition: height .2s;
transition: height .2s;
height: 4em;
}
@ -407,7 +407,7 @@ h1 :hover {
font-family: sans-serif;
font-size: small;
font-style: normal;
-webkit-transition: opacity 0.5s;
transition: opacity 0.5s;
}
.LinkContainer a {
@ -487,7 +487,7 @@ div:focus {
padding: 0 3px;
outline: 1px solid #DDD;
color: #8FDF5F;
font-size: small;
font-size: small;
background-color: #EEE;
}