<div id="testLogger"></div>

<script>
YUI().use('node', 'test-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 : "Asynchronous 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"
        //---------------------------------------------------------------------

        testWait : function (){
            var Assert = Y.Assert;

            //do some assertions now
            Assert.isTrue(this.data.beta);
            Assert.isNumber(this.data.year);

            //wait five seconds and do some more
            this.wait(function(){

                Assert.isString(this.data.name);

            }, 5000);

        }

    });

    //create the console
    (new Y.Test.Console({
        newestOnTop : false,
        filters: {
            pass: true,
            fail: true
        }
    })).render('#testLogger');

    Y.Test.Runner.add(Y.example.test.AsyncTestCase);

    //run the tests
    Y.Test.Runner.run();
});

</script>
