--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cm/media/js/lib/yui/yui3.0.0/examples/test/test-simple-example_clean.html Mon Nov 23 15:14:29 2009 +0100
@@ -0,0 +1,208 @@
+
+<!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>Simple Testing Example</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>Simple Testing Example</h1>
+
+<div class="exampleIntro">
+ <p>This example shows basic usage of the YUI Test framework for testing browser-based JavaScript code.
+ Two different <a href="/yui/test/#testcase"><code>TestCase</code></a> objects are created and added to a
+ <a href="/yui/test/#testsuite"><code>TestSuite</code></a> object. The <a href="/yui/test/#testrunner"><code>TestRunner</code></a>
+ is then used to run the tests once the page has loaded.</p>
+</div>
+
+<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
+
+<div id="testLogger"></div>
+<script type="text/javascript">
+YUI({base:"../../build/", timeout: 10000}).use("node", "console", "test",function (Y) {
+
+ Y.namespace("example.test");
+
+ Y.example.test.DataTestCase = new Y.Test.Case({
+
+ //name of the test case - if not provided, one is auto-generated
+ name : "Data Tests",
+
+ //---------------------------------------------------------------------
+ // setUp and tearDown methods - optional
+ //---------------------------------------------------------------------
+
+ /*
+ * Sets up data that is needed by each test.
+ */
+ setUp : function () {
+ this.data = {
+ name: "test",
+ year: 2007,
+ beta: true
+ };
+ },
+
+ /*
+ * Cleans up everything that was created by setUp().
+ */
+ tearDown : function () {
+ delete this.data;
+ },
+
+ //---------------------------------------------------------------------
+ // Test methods - names must begin with "test"
+ //---------------------------------------------------------------------
+
+ testName : function () {
+ var Assert = Y.Assert;
+
+ Assert.isObject(this.data);
+ Assert.isString(this.data.name);
+ Assert.areEqual("test", this.data.name);
+ },
+
+ testYear : function () {
+ var Assert = Y.Assert;
+
+ Assert.isObject(this.data);
+ Assert.isNumber(this.data.year);
+ Assert.areEqual(2007, this.data.year);
+ },
+
+ testBeta : function () {
+ var Assert = Y.Assert;
+
+ Assert.isObject(this.data);
+ Assert.isBoolean(this.data.beta);
+ Assert.isTrue(this.data.beta);
+ }
+
+ });
+
+ Y.example.test.ArrayTestCase = new Y.Test.Case({
+
+ //name of the test case - if not provided, one is auto-generated
+ name : "Array Tests",
+
+ //---------------------------------------------------------------------
+ // setUp and tearDown methods - optional
+ //---------------------------------------------------------------------
+
+ /*
+ * Sets up data that is needed by each test.
+ */
+ setUp : function () {
+ this.data = [0,1,2,3,4]
+ },
+
+ /*
+ * Cleans up everything that was created by setUp().
+ */
+ tearDown : function () {
+ delete this.data;
+ },
+
+ //---------------------------------------------------------------------
+ // Test methods - names must begin with "test"
+ //---------------------------------------------------------------------
+
+ testPop : function () {
+ var Assert = Y.Assert;
+
+ var value = this.data.pop();
+
+ Assert.areEqual(4, this.data.length);
+ Assert.areEqual(4, value);
+ },
+
+ testPush : function () {
+ var Assert = Y.Assert;
+
+ this.data.push(5);
+
+ Assert.areEqual(6, this.data.length);
+ Assert.areEqual(5, this.data[5]);
+ },
+
+ testSplice : function () {
+ var Assert = Y.Assert;
+
+ this.data.splice(2, 1, 6, 7);
+
+ Assert.areEqual(6, this.data.length);
+ Assert.areEqual(6, this.data[2]);
+ Assert.areEqual(7, this.data[3]);
+ }
+
+ });
+
+ Y.example.test.ExampleSuite = new Y.Test.Suite("Example Suite");
+ Y.example.test.ExampleSuite.add(Y.example.test.DataTestCase);
+ Y.example.test.ExampleSuite.add(Y.example.test.ArrayTestCase);
+
+ //create the console
+ var r = new Y.Console({
+ newestOnTop : false,
+ style: 'block' // to anchor in the example content
+ });
+
+ r.render('#testLogger');
+
+ Y.Test.Runner.add(Y.example.test.ExampleSuite);
+
+ //run the tests
+ Y.Test.Runner.run();
+
+});
+</script>
+
+<!--END SOURCE CODE FOR EXAMPLE =============================== -->
+
+</body>
+</html>