scripts.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Virtual World Framework</title>
  5. <script type="text/javascript" src="qunit.js"></script>
  6. <script type="text/javascript" src="../lib/async.js"></script>
  7. <script type="text/javascript" src="../lib/crypto.js"></script>
  8. <script type="text/javascript" src="../lib/md5.js"></script>
  9. <script type="text/javascript" src="../lib/alea.js"></script>
  10. <script type="text/javascript" src="../lib/mash.js"></script>
  11. <script type="text/javascript" src="../lib/vwf.js"></script>
  12. <script type="text/javascript" src="../lib/require.js"></script>
  13. <script type="text/javascript">
  14. require( {
  15. baseUrl: "../lib",
  16. paths: {
  17. jquery: "jquery-1.10.2.min",
  18. },
  19. }, [
  20. "domReady",
  21. "utility.js",
  22. // This is the common model implementation and an example model that connects the
  23. // simulation to a WebGL scene manager.
  24. "jquery",
  25. "vwf/configuration",
  26. "vwf/kernel/model",
  27. "vwf/model/javascript",
  28. "vwf/model/object",
  29. "vwf/model/stage/log",
  30. "vwf/kernel/view",
  31. "vwf/kernel/utility",
  32. "vwf/utility",
  33. "logger",
  34. ], function( ready, testUtility ) {
  35. ready( function() {
  36. vwf.initialize(
  37. /* models */ [ "vwf/model/javascript", "vwf/model/object" ],
  38. /* views */ [ ]
  39. );
  40. asyncTest( "Single script as string", function() {
  41. vwf.createChild( 0, testUtility.uniqueName( "node" ), {
  42. scripts: "this.tag = this.id"
  43. }, undefined, function( nodeID ) {
  44. equal( vwf.execute( nodeID, "this.tag" ), nodeID, "script as string created" );
  45. vwf.deleteNode( nodeID );
  46. start();
  47. } );
  48. } );
  49. asyncTest( "Single script with explicit text property", function() {
  50. vwf.createChild( 0, testUtility.uniqueName( "node" ), {
  51. scripts: { text: "this.tag = this.id" }
  52. }, undefined, function( nodeID ) {
  53. equal( vwf.execute( nodeID, "this.tag" ), nodeID, "script with explicit text property created" );
  54. vwf.deleteNode( nodeID );
  55. start();
  56. } );
  57. } );
  58. asyncTest( "Single script from URI", function() {
  59. vwf.createChild( 0, testUtility.uniqueName( "node" ), {
  60. scripts: { source: testUtility.dataURIFromScriptText( "this.tag = this.id" ) }
  61. }, undefined, function( nodeID ) {
  62. equal( vwf.execute( nodeID, "this.tag" ), nodeID, "script from URI created" );
  63. vwf.deleteNode( nodeID );
  64. start();
  65. } );
  66. } );
  67. asyncTest( "Array with script as string", function() {
  68. vwf.createChild( 0, testUtility.uniqueName( "node" ), {
  69. scripts: [ "this.tag = this.id" ]
  70. }, undefined, function( nodeID ) {
  71. equal( vwf.execute( nodeID, "this.tag" ), nodeID, "script as string created" );
  72. vwf.deleteNode( nodeID );
  73. start();
  74. } );
  75. } );
  76. asyncTest( "Array with script with explicit text property", function() {
  77. vwf.createChild( 0, testUtility.uniqueName( "node" ), {
  78. scripts: [ { text: "this.tag = this.id" } ]
  79. }, undefined, function( nodeID ) {
  80. equal( vwf.execute( nodeID, "this.tag" ), nodeID, "script with explicit text property created" );
  81. vwf.deleteNode( nodeID );
  82. start();
  83. } );
  84. } );
  85. asyncTest( "Array with script from URI", function() {
  86. vwf.createChild( 0, testUtility.uniqueName( "node" ), {
  87. scripts: [ { source: testUtility.dataURIFromScriptText( "this.tag = this.id" ) } ]
  88. }, undefined, function( nodeID ) {
  89. equal( vwf.execute( nodeID, "this.tag" ), nodeID, "script from URI created" );
  90. vwf.deleteNode( nodeID );
  91. start();
  92. } );
  93. } );
  94. } );
  95. } );
  96. </script>
  97. <link rel="stylesheet" type="text/css" href="qunit.css" />
  98. </head>
  99. <body>
  100. <h1 id="qunit-header">Virtual World Framework</h1>
  101. <h2 id="qunit-banner"></h2>
  102. <div id="qunit-testrunner-toolbar"></div>
  103. <h2 id="qunit-userAgent"></h2>
  104. <ol id="qunit-tests"></ol>
  105. <div id="qunit-fixture">test markup, will be hidden</div>
  106. </body>
  107. </html>