| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491 | 
							- <!DOCTYPE html>
 
- <html>
 
-   <head>
 
-     <title>Virtual World Framework</title>
 
-     <script type="text/javascript" src="qunit.js"></script>
 
-     <script type="text/javascript" src="../lib/async.js"></script>
 
-     <script type="text/javascript" src="../lib/crypto.js"></script>
 
-     <script type="text/javascript" src="../lib/md5.js"></script>
 
-     <script type="text/javascript" src="../lib/alea.js"></script>
 
-     <script type="text/javascript" src="../lib/mash.js"></script>
 
-     <script type="text/javascript" src="../lib/vwf.js"></script>
 
-     <script type="text/javascript" src="../lib/require.js"></script>
 
-     <script type="text/javascript">
 
-       require( {
 
-         baseUrl: "../lib",
 
-         paths: {
 
-           jquery: "jquery-1.10.2.min",
 
-         },
 
-       }, [
 
-         "domReady",
 
-         "utility.js",
 
-         "jquery",
 
-         "vwf/configuration",
 
-         "vwf/kernel/model",
 
-         "vwf/model/javascript",
 
-         "vwf/model/object",
 
-         "vwf/model/stage/log",
 
-         "vwf/kernel/view",
 
-         "vwf/view/document",
 
-         "vwf/kernel/utility",
 
-         "vwf/utility",
 
-         "logger",
 
-       ], function( ready, testUtility ) {
 
-         // Test the JavaScript node proxy and node initialization.
 
-         ready( function() {
 
-           vwf.initialize(
 
-             /* models */ [ "vwf/model/javascript", "vwf/model/object" ],
 
-             /*  views */ [ "vwf/view/document" ]
 
-           );
 
-           // Member name priority on the node
 
-           asyncTest( "Member name priority", function() {
 
-             createFixture( function( fixtureID ) {
 
-               vwf.execute( fixtureID, "this.a" );
 
-               equal( vwf.execute( fixtureID, "this.result" ), "a-property", "properties override methods" );
 
-               vwf.execute( fixtureID, "this.b()" );
 
-               equal( vwf.execute( fixtureID, "this.result" ), "b-method", "methods override events" );
 
-               vwf.execute( fixtureID, "this.c()" );
 
-               equal( vwf.execute( fixtureID, "this.result" ), "c-event", "events override children" );
 
-               vwf.execute( fixtureID, "this.d.p" );
 
-               equal( vwf.execute( fixtureID, "this.result" ), "d-child", "children override nothing" );
 
-               start();
 
-             } );
 
-           } );
 
-           // Member name priority on the future node
 
-           asyncTest( "Future member name priority", function() {
 
-             createFixture( function( fixtureID ) {
 
-               vwf.execute( fixtureID, "this.future( 0.001 ).a" );
 
-               vwf.execute( fixtureID, "this.future( 0.002 ).b()" );
 
-               vwf.execute( fixtureID, "this.future( 0.003 ).c()" );
 
-               vwf.execute( fixtureID, "this.d.future( 0.004 ).p" );
 
-               testUtility.runFutureAssertions( [
 
-                 { relative: 0.001, assertion: function() {
 
-                     equal( vwf.execute( fixtureID, "this.result" ), "a-property", "properties override methods" ) } },
 
-                 { relative: 0.002, assertion: function() {
 
-                     equal( vwf.execute( fixtureID, "this.result" ), "b-method", "methods override events" ) } },
 
-                 { relative: 0.003, assertion: function() {
 
-                     equal( vwf.execute( fixtureID, "this.result" ), "c-event", "events override children" ) } },
 
-                 { relative: 0.004, assertion: function() {
 
-                     equal( vwf.execute( fixtureID, "this.result" ), "d-child", "children override nothing" ) } },
 
-               ] );
 
-             } );
 
-           } );
 
-           // Completion order when `node.initialize` creates child nodes.
 
-           // The child callbacks should arrive after the parent's `initialize` in the order the
 
-           // children were created, and all children created by the parent's `initialize` should be
 
-           // ready and visible before the first callback runs.
 
-           asyncTest( "Initialize creating children", function() {
 
-             vwf.createChild( 0, testUtility.uniqueName( "fixture" ), {
 
-               // A custom prototype shared by the parent and children to store the log. The dummy
 
-               // property is to make this prototype different so that it won't be shared with the
 
-               // other tests.
 
-               extends: {
 
-                 properties: {
 
-                   "initialize-creating-children": true,
 
-                   log: [],
 
-                 }
 
-               },
 
-               scripts: [
 
-                 'this.initialize = function() { ' +
 
-                   'Object.getPrototypeOf( this ).log.push( "parent before" ); ' +
 
-                   'this.children.create( "child1", { ' +
 
-                   '}, function( child ) { ' +
 
-                     'Object.getPrototypeOf( this ).log.push( "child1 callback " + this.childNames() ); ' +
 
-                   '} ); ' +
 
-                   'this.children.create( "child2", { ' +
 
-                   '}, function( child ) { ' +
 
-                     'Object.getPrototypeOf( this ).log.push( "child2 callback " + this.childNames() ); ' +
 
-                   '} ); ' +
 
-                   'Object.getPrototypeOf( this ).log.push( "parent after" ); ' +
 
-                 '}; ' +
 
-                 'this.childNames = function() { ' +
 
-                   'return this.children.map( function( child ) { return child.name } ).join( "+" ); ' +
 
-                 '};'
 
-               ]
 
-             }, undefined, function( parentID ) {
 
-               vwf.execute( parentID, 'Object.getPrototypeOf( this ).log.push( "parent callback" )' );
 
-               deepEqual( vwf.execute( parentID, "Object.getPrototypeOf( this ).log" ), [
 
-                 "parent before",                    // initialize begins
 
-                 "parent after",                     // initialize ends before children complete
 
-                 "child1 callback child1+child2",    // first child callback (both children ready)
 
-                 "child2 callback child1+child2",    // second child callback (both children ready)
 
-                 "parent callback",                  // parent completes after children complete
 
-               ], "initialize runs, then children complete, then parent completes" );
 
-               start();
 
-             } );
 
-           } );
 
-           // Completion order when `node.initialize` creates child nodes with `initialize` functions
 
-           // that create child nodes.
 
-           asyncTest( "Initialize creating children with initialize that creates children", function() {
 
-             vwf.createChild( 0, testUtility.uniqueName( "fixture" ), {
 
-               // A custom prototype shared by the parent and children to store the log. The dummy
 
-               // property is to make this prototype different so that it won't be shared with the
 
-               // other tests.
 
-               extends: {
 
-                 properties: {
 
-                   "initialize-creating-children-with-initialize-that-creates-children": true,
 
-                   log: [],
 
-                 }
 
-               },
 
-               scripts: [
 
-                 'this.initialize = function() { ' +
 
-                   'Object.getPrototypeOf( this ).log.push( "parent before" ); ' +
 
-                   'this.children.create( "child1", { ' +
 
-                     'extends: Object.getPrototypeOf( this ).id, ' +
 
-                     'scripts: [ ' +
 
-                       '\'this.initialize = function() { ' +
 
-                         'this.children.create( "child1a", { ' +
 
-                         '}, function( child ) { ' +
 
-                           'Object.getPrototypeOf( this ).log.push( "child1a callback " + this.childNames() ); ' +
 
-                         '} ); ' +
 
-                         'this.children.create( "child1b", { ' +
 
-                         '}, function( child ) { ' +
 
-                           'Object.getPrototypeOf( this ).log.push( "child1b callback " + this.childNames() ); ' +
 
-                         '} ); ' +
 
-                       '}; ' +
 
-                       'this.childNames = function() { ' +
 
-                         'return this.children.map( function( child ) { return child.name } ).join( "+" ); ' +
 
-                       '}; \'' +
 
-                     '] ' +
 
-                   '}, function( child ) { ' +
 
-                     'Object.getPrototypeOf( this ).log.push( "child1 callback " + this.childNames() ); ' +
 
-                   '} ); ' +
 
-                   'this.children.create( "child2", { ' +
 
-                   '}, function( child ) { ' +
 
-                     'Object.getPrototypeOf( this ).log.push( "child2 callback " + this.childNames() ); ' +
 
-                   '} ); ' +
 
-                   'Object.getPrototypeOf( this ).log.push( "parent after" ); ' +
 
-                 '}; ' +
 
-                 'this.childNames = function() { ' +
 
-                   'return this.children.map( function( child ) { return child.name } ).join( "+" ); ' +
 
-                 '};'
 
-               ]
 
-             }, undefined, function( parentID ) {
 
-               vwf.execute( parentID, 'Object.getPrototypeOf( this ).log.push( "parent callback" )' );
 
-               deepEqual( vwf.execute( parentID, "Object.getPrototypeOf( this ).log" ), [
 
-                 "parent before",                    // initialize begins
 
-                 "parent after",                     // initialize ends before children complete
 
-                 "child1a callback child1a+child1b", // child1's first child completes (both grandchildren ready)
 
-                 "child1b callback child1a+child1b", // child1's second child completes (both grandchildren ready)
 
-                 "child1 callback child1+child2",    // child1 completes after child1 children complete (child1 & child2 ready)
 
-                 "child2 callback child1+child2",    // child2 completes after child2 children complete (child1 & child2 ready)
 
-                 "parent callback",                  // parent completes after children complete
 
-               ], "initialize runs, then first grandchildren complete, then children complete, then parent completes" );
 
-               start();
 
-             } );
 
-           } );
 
-           // Completion order when a non-async action creates nodes.
 
-           // The node callbacks should arrive after the action completes but before the next action
 
-           // is started.
 
-           asyncTest( "Non-async action creating nodes", function() {
 
-             vwf.createChild( 0, testUtility.uniqueName( "fixture" ), {
 
-               // A custom prototype shared by the parent and children to store the log. The dummy
 
-               // property is to make this prototype different so that it won't be shared with the
 
-               // other tests.
 
-               extends: {
 
-                 properties: {
 
-                   "action-creating-nodes": true,
 
-                   log: [],
 
-                 }
 
-               },
 
-               methods: {
 
-                 m1:
 
-                   'Object.getPrototypeOf( this ).log.push( "method1 before" ); ' +
 
-                   'this.children.create( "child1", { ' +
 
-                   '}, function( child ) { ' +
 
-                     'Object.getPrototypeOf( this ).log.push( "child1 callback " + this.childNames() ); ' +
 
-                   '} ); ' +
 
-                   'Object.getPrototypeOf( this ).log.push( "method1 after" );',
 
-                 m2:
 
-                   'Object.getPrototypeOf( this ).log.push( "method2 before" ); ' +
 
-                   'this.children.create( "child2", { ' +
 
-                   '}, function( child ) { ' +
 
-                     'Object.getPrototypeOf( this ).log.push( "child2 callback " + this.childNames() ); ' +
 
-                   '} ); ' +
 
-                   'Object.getPrototypeOf( this ).log.push( "method2 after" );',
 
-                 n:
 
-                   'Object.getPrototypeOf( this ).log.push( "future method" );',
 
-               },
 
-               scripts: [
 
-                 'this.childNames = function() { ' +
 
-                   'return this.children.map( function( child ) { return child.name } ).join( "+" ); ' +
 
-                 '};'
 
-               ]
 
-             }, undefined, function( parentID ) {
 
-               vwf.execute( parentID, "this.m1()" ); // m1() and m2() should both run to completion
 
-               vwf.execute( parentID, "this.m2()" ); // ... before the children they create complete
 
-               vwf.execute( parentID, "this.future( 0.001 ).n()" ); // next action starts after the children complete
 
-               deepEqual( vwf.execute( parentID, "Object.getPrototypeOf( this ).log" ), [
 
-                 "method1 before",                   // m1 begins
 
-                 "method1 after",                    // ... and ends without interruption
 
-                 "method2 before",                   // m2 begins immedately after
 
-                 "method2 after",                    // ... and ends without interruption
 
-               ], "action completes before the children" );
 
-               testUtility.runFutureAssertions( [
 
-                 // Called when time leaves t+0, after actions at time t+0 run.
 
-                 { relative: 0, assertion: function() {
 
-                     deepEqual( vwf.execute( parentID, "Object.getPrototypeOf( this ).log" ), [
 
-                       "method1 before",
 
-                       "method1 after",
 
-                       "method2 before",
 
-                       "method2 after",
 
-                       "child1 callback child1+child2", // m1 and m2 children complete in the order
 
-                       "child2 callback child1+child2", // ... started, after the action
 
-                     ], "children complete after the action" ) } },
 
-                 // Called when time leaves t+0.001.
 
-                 { relative: 0.001, assertion: function() {
 
-                     deepEqual( vwf.execute( parentID, "Object.getPrototypeOf( this ).log" ), [
 
-                       "method1 before",
 
-                       "method1 after",
 
-                       "method2 before",
 
-                       "method2 after",
 
-                       "child1 callback child1+child2",
 
-                       "child2 callback child1+child2",
 
-                       "future method",              // children complete before the next action
 
-                     ], "children complete before the next action" ) } },
 
-               ] );
 
-             } );
 
-           } );
 
-           // Completion order when multiple non-async actions create nodes.
 
-           // The node callbacks should arrive after each action completes but before the one starts.
 
-           asyncTest( "Multiple non-async actions creating nodes", function() {
 
-             vwf.createChild( 0, testUtility.uniqueName( "fixture" ), {
 
-               // A custom prototype shared by the parent and children to store the log. The dummy
 
-               // property is to make this prototype different so that it won't be shared with the
 
-               // other tests.
 
-               extends: {
 
-                 properties: {
 
-                   "multiple-actions-creating-nodes": true,
 
-                   log: [],
 
-                 }
 
-               },
 
-               methods: {
 
-                 m1:
 
-                   'Object.getPrototypeOf( this ).log.push( "method1 before" ); ' +
 
-                   'this.children.create( "child1", { ' +
 
-                   '}, function( child ) { ' +
 
-                     'Object.getPrototypeOf( this ).log.push( "child1 callback " + this.childNames() ); ' +
 
-                   '} ); ' +
 
-                   'Object.getPrototypeOf( this ).log.push( "method1 after" );',
 
-                 m2:
 
-                   'Object.getPrototypeOf( this ).log.push( "method2 before" ); ' +
 
-                   'this.children.create( "child2", { ' +
 
-                   '}, function( child ) { ' +
 
-                     'Object.getPrototypeOf( this ).log.push( "child2 callback " + this.childNames() ); ' +
 
-                   '} ); ' +
 
-                   'Object.getPrototypeOf( this ).log.push( "method2 after" );',
 
-                 n:
 
-                   'Object.getPrototypeOf( this ).log.push( "future method" );',
 
-               },
 
-               scripts: [
 
-                 'this.childNames = function() { ' +
 
-                   'return this.children.map( function( child ) { return child.name } ).join( "+" ); ' +
 
-                 '};'
 
-               ]
 
-             }, undefined, function( parentID ) {
 
-               vwf.execute( parentID, "this.future( 0 ).m1()" ); // m1's child should complete after m1 and before m2
 
-               vwf.execute( parentID, "this.future( 0 ).m2()" ); // m2's child should complete after m2 but still within time t+0
 
-               vwf.execute( parentID, "this.future( 0.001 ).n()" ); // next action starts after m1 & m2 children complete
 
-               testUtility.runFutureAssertions( [
 
-                 // Called when time leaves t+0, after actions at time t+0 run.
 
-                 { relative: 0, assertion: function() {
 
-                     deepEqual( vwf.execute( parentID, "Object.getPrototypeOf( this ).log" ), [
 
-                       "method1 before",             // m1 begins
 
-                       "method1 after",              // ... and ends without interruption
 
-                       "child1 callback child1",     // m1 child completes after the m1 action before starting m2
 
-                       "method2 before",             // m2 begins
 
-                       "method2 after",              // ... and ends without interruption
 
-                       "child2 callback child1+child2", // m2 child completes after the m2 action
 
-                     ], "children complete after each action" ) } },
 
-                 // Called when time leaves t+0.001.
 
-                 { relative: 0.001, assertion: function() {
 
-                     deepEqual( vwf.execute( parentID, "Object.getPrototypeOf( this ).log" ), [
 
-                       "method1 before",
 
-                       "method1 after",
 
-                       "child1 callback child1",
 
-                       "method2 before",
 
-                       "method2 after",
 
-                       "child2 callback child1+child2",
 
-                       "future method",              // children complete before the next action
 
-                     ], "children complete before the next action" ) } },
 
-               ] );
 
-             } );
 
-           } );
 
-           // == Helper functions =====================================================================
 
-           // Create a node with conflicting property, method, event and child names.
 
-           function createFixture( callback ) {
 
-             vwf.createChild( 0, testUtility.uniqueName( "fixture" ), {
 
-               extends:
 
-                 "http://vwf.example.com/node.vwf",
 
-               
 
-               properties: {
 
-                 a: {
 
-                   get: "return this.result = 'a-property'",
 
-                 }
 
-               },
 
-               methods: {
 
-                 a: "return this.result = 'a-method'",
 
-                 b: "return this.result = 'b-method'",
 
-               },
 
-               events: {
 
-                 a: undefined,
 
-                 b: undefined,
 
-                 c: undefined,
 
-               },
 
-               children: {
 
-                 a: { properties: { p: { get: "return this.parent.result = 'a-child'" } } },
 
-                 b: { properties: { p: { get: "return this.parent.result = 'b-child'" } } },
 
-                 c: { properties: { p: { get: "return this.parent.result = 'c-child'" } } },
 
-                 d: { properties: { p: { get: "return this.parent.result = 'd-child'" } } },
 
-               },
 
-               scripts: [
 
-                 "this.events.a = this.events.add( function() { this.result = 'a-event' }, this )",
 
-                 "this.events.b = this.events.add( function() { this.result = 'b-event' }, this )",
 
-                 "this.events.c = this.events.add( function() { this.result = 'c-event' }, this )",
 
-                 "this.result = undefined",
 
-               ],
 
-             }, undefined, function( fixtureID ) {
 
-               callback( fixtureID );
 
-             } );
 
-           }
 
-         } );
 
-       } );
 
-     </script>
 
-     <link rel="stylesheet" type="text/css" href="qunit.css" />
 
-   </head>
 
-   <body>
 
-     <h1 id="qunit-header">Virtual World Framework</h1>
 
-     <h2 id="qunit-banner"></h2>
 
-     <div id="qunit-testrunner-toolbar"></div>
 
-     <h2 id="qunit-userAgent"></h2>
 
-     <ol id="qunit-tests"></ol>
 
-     <div id="qunit-fixture">test markup, will be hidden</div>
 
-   </body>
 
- </html>
 
 
  |