transition.html revision 85a258143f630b36522d3d1835a8e5a916dbad2c
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<html>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<head>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<title>Transition tests</title>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<link type="text/css" rel="stylesheet" href="/build/logreader/assets/skins/sam/logreader.css">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<script type="text/javascript" src="/build/yui/yui.js"></script>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<style>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster#demo {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster background: #ccc;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster border: 5px solid green;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster width: 200px;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster height: 200px;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster}
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster</style>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster</head>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<body class="yui3-skin-sam">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <h1>Transition Tests</h1>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster <div id="demo"></div>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster<script type="text/javascript">
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterYUI({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster filter: "debug",
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster logInclude: { TestRunner: true }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster}).use('transition', 'test', 'console', function (Y) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.namespace('Tests');
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Tests.Transition = (function(){
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington var suite = new Y.Test.Suite('Transition Tests');
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster suite.add(new Y.Test.Case({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster name: 'Multiple Transition Tests',
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster setUp: function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.one('#demo').setStyles({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster height: '200px',
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster width: '200px',
ce4d3fddc8fe2eddd68a20af9570b3cc63ece5abNeil Madden opacity: '1'
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington },
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'all chained callbacks should fire': function() {
ce4d3fddc8fe2eddd68a20af9570b3cc63ece5abNeil Madden var node = Y.one('#demo'),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test = this;
ce4d3fddc8fe2eddd68a20af9570b3cc63ece5abNeil Madden
ce4d3fddc8fe2eddd68a20af9570b3cc63ece5abNeil Madden node.transition({
ce4d3fddc8fe2eddd68a20af9570b3cc63ece5abNeil Madden width: 0
ce4d3fddc8fe2eddd68a20af9570b3cc63ece5abNeil Madden }, function(e) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.resume(function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual('0px', node.getComputedStyle('width'));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.transition({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster height: 0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }, function(e) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.resume(function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual('0px', node.getComputedStyle('height'));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.wait();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.wait(4000);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster },
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'last transition should win for same property': function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var node = Y.one('#demo'),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test = this;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.transition({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster opacity: 1
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }, function(e) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.resume(function() { // shouldnt fire
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.isNull(1);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.transition({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster opacity: 0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }, function(e) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.resume(function() { // shouldnt fire
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.isNull(1);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.transition({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster opacity: 1
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }, function(e) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.resume(function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual('1', node.getComputedStyle('opacity'));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington test.wait(4000);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster },
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'all serial callbacks should fire': function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var node = Y.one('#demo'),
ce4d3fddc8fe2eddd68a20af9570b3cc63ece5abNeil Madden test = this;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.transition({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster duration: 2,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster width: 0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }, function(e) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.resume(function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual('0px', node.getComputedStyle('width'));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.transition({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster duration: 1,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster height: 0
ce4d3fddc8fe2eddd68a20af9570b3cc63ece5abNeil Madden }, function(e) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.resume(function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual('0px', node.getComputedStyle('height'));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.wait(4000);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.wait(4000);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster },
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'all serial callbacks should fire (duration)': function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var node = Y.one('#demo'),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test = this;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.transition({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster duration: 1,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster width: 0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }, function(e) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.resume(function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual('0px', node.getComputedStyle('width'));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.wait(4000);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.transition({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster duration: 2,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster height: 0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }, function(e) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.resume(function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual('0px', node.getComputedStyle('height'));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.wait(4000);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster },
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'parallel transition should steal attribute': function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var node = Y.one('#demo'),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test = this;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.transition({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster width: 0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }, function(e) { // should never fire
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.resume(function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.isNull(1);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.wait(4000);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.transition({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster duration: 1,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster width: 0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }, function(e) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.resume(function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual('0px', node.getComputedStyle('width'));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.wait(4000);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster },
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'parallel transition should shorten duration': function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var node = Y.one('#demo'),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test = this;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.transition({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster easing: 'ease-in',
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster duration: 2,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster opacity: {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster value: 0,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster duration: 3
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster },
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster height: 0,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster width: 0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }, function(e) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.resume(function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual(2, parseInt(e.elapsedTime));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.transition({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster duration: 1,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster opacity: 0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }, function(e) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.resume(function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual('0', node.getComputedStyle('opacity'));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual(1, parseInt(e.elapsedTime));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.wait(4000);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.wait(4000);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster suite.add(new Y.Test.Case({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster name: 'Single Transition Tests',
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster setUp: function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var node = Y.one('#demo');
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (node) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.setStyles({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster height: '200px',
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster width: '200px',
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster opacity: '1'
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster },
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'should end at final value': function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var node = Y.one('#demo'),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test = this;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.transition({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster width: 0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }, function(e) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.resume(function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual('0px', node.getComputedStyle('width'));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.wait(4000);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster },
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'should end at final values': function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var node = Y.one('#demo'),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test = this;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.transition({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster width: 0,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster height: 0,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster opacity: 0
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington }, function(e) {
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington test.resume(function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual('0px', node.getComputedStyle('width'));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual('0px', node.getComputedStyle('height'));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual('0', node.getComputedStyle('opacity'));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.wait(4000);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster },
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster 'callback should fire after longest duration': function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster var node = Y.one('#demo'),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test = this;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.transition({
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster easing: 'ease-in',
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster duration: 1,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster opacity: {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster value: 0,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster duration: 2
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster },
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster height: 0,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster width: 0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }, function(e) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster test.resume(function() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual(2, parseInt(e.elapsedTime));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.setStyle('height', '100px');
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster node.setStyle('opacity', '1');
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Y.Assert.areEqual(1, node.getStyle('opacity'));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster });
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
test.wait(4000);
},
'transition:end should fire after longest duration': function() {
var node = Y.one('#demo'),
test = this,
config = {
easing: 'ease-in',
duration: 1,
opacity: {
value: 0,
duration: 2
},
height: 0,
width: 0
};
node.once('transition:end', function(e) {
test.resume(function() {
Y.Assert.areEqual(2, parseInt(e.elapsedTime));
Y.Assert.areSame(config, e.config);
node.setStyle('height', '100px');
node.setStyle('opacity', '1');
Y.Assert.areEqual(1, node.getStyle('opacity'));
});
});
node.transition(config);
test.wait(4000);
},
'setStyle should not transition': function() {
var node = Y.one('#demo'),
test = this;
node.setStyle('height', '100px');
Y.Assert.areEqual('100px', node.getComputedStyle('height'));
}
}));
//return it
return suite;
})();
new Y.Console({
verbose : true,
height: 600,
newestOnTop : false
}).render();
//add to the testrunner and run
Y.Test.Runner.add(Y.Tests.Transition);
Y.Test.Runner.run();
/*if (parent && parent != window) {
YAHOO.tool.TestManager.load();
} else {
YAHOO.tool.TestRunner.run();
}*/
});
</script>
</body>
</html>