--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cm/media/js/lib/yui/yui3.0.0/examples/test/test-async-event-tests_clean.html Mon Nov 23 15:14:29 2009 +0100
@@ -0,0 +1,134 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<title>Asynchronous Event Testing</title>
+
+<style type="text/css">
+/*margin and padding on body element
+ can introduce errors in determining
+ element position and are not recommended;
+ we turn them off as a foundation for YUI
+ CSS treatments. */
+body {
+ margin:0;
+ padding:0;
+}
+</style>
+
+<link type="text/css" rel="stylesheet" href="../../build/cssfonts/fonts-min.css" />
+<script type="text/javascript" src="../../build/yui/yui-min.js"></script>
+
+
+<!--begin custom header content for this example-->
+<style type="text/css">
+#testLogger {
+ margin-bottom: 1em;
+}
+
+#testLogger .yui-console .yui-console-title {
+ border: 0 none;
+ color: #000;
+ font-size: 13px;
+ font-weight: bold;
+ margin: 0;
+ text-transform: none;
+}
+#testLogger .yui-console .yui-console-entry-meta {
+ margin: 0;
+}
+
+.yui-skin-sam .yui-console-entry-pass .yui-console-entry-cat {
+ background: #070;
+ color: #fff;
+}
+</style>
+
+<!--end custom header content for this example-->
+
+</head>
+
+<body class=" yui-skin-sam">
+
+<h1>Asynchronous Event Testing</h1>
+
+<div class="exampleIntro">
+ <p>This example shows how to create an asynchronous test with the YUI Test framework for testing browser-based JavaScript code.
+ A code>Y.Test.Case</code></a> object is created to test the
+ <code>Y.Anim</code> object. The test waits until the animation is complete
+ before checking the settings of the animated element.</p>
+</div>
+
+<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
+
+<div id="testLogger"></div>
+<div id="testDiv" style="position:absolute;width:10px;height:10px; background-color:red"></div>
+<script type="text/javascript">
+YUI({base:"../../build/", timeout: 10000}).use("anim", "console", "test",function (Y) {
+
+ Y.namespace("example.test");
+
+ Y.example.test.AsyncTestCase = new Y.Test.Case({
+
+ //name of the test case - if not provided, one is auto-generated
+ name : "Animation Tests",
+
+ //---------------------------------------------------------------------
+ // Test methods - names must begin with "test"
+ //---------------------------------------------------------------------
+
+ testAnimation : function (){
+
+ var myAnim = new Y.Anim({
+ node: '#testDiv',
+ to: {
+ width: 400
+ },
+ duration: 3,
+ easing: Y.Easing.easeOut
+ });
+
+ //assign oncomplete handler
+ myAnim.on("end", function(){
+
+ //tell the TestRunner to resume
+ this.resume(function(){
+
+ Y.Assert.areEqual(document.getElementById("testDiv").offsetWidth, 400, "Width of the DIV should be 400.");
+
+ });
+
+ }, this, true);
+
+ //start the animation
+ myAnim.run();
+
+ //wait until something happens
+ this.wait();
+
+ }
+
+ });
+
+ //create the console
+ var r = new Y.Console({
+ newestOnTop : false,
+ style: 'block' // to anchor in the example content
+ });
+
+ r.render('#testLogger');
+
+ //create the logger
+ Y.Test.Runner.add(Y.example.test.AsyncTestCase);
+
+ //run the tests
+ Y.Test.Runner.run();
+});
+
+</script>
+
+<!--END SOURCE CODE FOR EXAMPLE =============================== -->
+
+</body>
+</html>