envjs 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/README +113 -0
  2. data/bin/envjsrb +239 -0
  3. data/bin/jquery-1.2.6-test.js +33 -0
  4. data/bin/jquery-1.3.1-test.js +33 -0
  5. data/bin/jquery-1.3.2-test.js +106 -0
  6. data/bin/prototype-1.6.0.3-test.js +82 -0
  7. data/bin/prototype_1.6.0.3_tmpl.txt +27 -0
  8. data/bin/test-jquery.sh +58 -0
  9. data/bin/test-prototype.sh +54 -0
  10. data/bin/tidy +0 -0
  11. data/lib/envjs/env.js +21549 -0
  12. data/lib/envjs/net/cgi.rb +94 -0
  13. data/lib/envjs/net/file.rb +75 -0
  14. data/lib/envjs/net.rb +3 -0
  15. data/lib/envjs/options.rb +11 -0
  16. data/lib/envjs/runtime.rb +280 -0
  17. data/lib/envjs/tempfile.rb +24 -0
  18. data/lib/envjs.rb +23 -0
  19. data/test/call-load-test.js +15 -0
  20. data/test/debug.js +53 -0
  21. data/test/firebug/errorIcon.png +0 -0
  22. data/test/firebug/firebug.css +209 -0
  23. data/test/firebug/firebug.html +23 -0
  24. data/test/firebug/firebug.js +672 -0
  25. data/test/firebug/firebugx.js +10 -0
  26. data/test/firebug/infoIcon.png +0 -0
  27. data/test/firebug/warningIcon.png +0 -0
  28. data/test/fixtures/html/events.html +171 -0
  29. data/test/fixtures/html/iframe1.html +46 -0
  30. data/test/fixtures/html/iframe1a.html +46 -0
  31. data/test/fixtures/html/iframe2.html +45 -0
  32. data/test/fixtures/html/iframe3.html +28 -0
  33. data/test/fixtures/html/iframeN.html +57 -0
  34. data/test/fixtures/html/malformed.html +181 -0
  35. data/test/fixtures/html/scope.html +81 -0
  36. data/test/fixtures/html/trivial.html +19 -0
  37. data/test/fixtures/html/with_js.html +26 -0
  38. data/test/fixtures/images/icon-blue.png +0 -0
  39. data/test/fixtures/js/external_script.js +1 -0
  40. data/test/fixtures/js/script.js +1 -0
  41. data/test/fixtures/js/script_error.js +2 -0
  42. data/test/html/events.html +171 -0
  43. data/test/html/iframe1.html +46 -0
  44. data/test/html/iframe1a.html +46 -0
  45. data/test/html/iframe2.html +45 -0
  46. data/test/html/iframe3.html +30 -0
  47. data/test/html/iframeN.html +57 -0
  48. data/test/html/malformed.html +181 -0
  49. data/test/html/scope.html +87 -0
  50. data/test/html/script.js +1 -0
  51. data/test/html/trivial.html +19 -0
  52. data/test/html/with_js.html +26 -0
  53. data/test/index.html +328 -0
  54. data/test/java-prototype.js +9 -0
  55. data/test/primary-tests.js +24 -0
  56. data/test/prototype-test.js +13 -0
  57. data/test/qunit/qunit/qunit.css +17 -0
  58. data/test/qunit/qunit/qunit.js +997 -0
  59. data/test/qunit.js +61 -0
  60. data/test/specs/dist/env.spec.js +1534 -0
  61. data/test/specs/envjs.spec.css +46 -0
  62. data/test/specs/parser/html.js +31 -0
  63. data/test/specs/parser/spec.html +40 -0
  64. data/test/specs/parser/xml.js +31 -0
  65. data/test/specs/qunit.bdd.js +210 -0
  66. data/test/specs/qunit.css +17 -0
  67. data/test/specs/qunit.js +997 -0
  68. data/test/specs/template/spec-0.js +31 -0
  69. data/test/specs/template/spec-1.js +31 -0
  70. data/test/specs/template/spec.html +40 -0
  71. data/test/specs/window/css.js +23 -0
  72. data/test/specs/window/dialog.js +25 -0
  73. data/test/specs/window/document.js +23 -0
  74. data/test/specs/window/event.js +25 -0
  75. data/test/specs/window/history.js +34 -0
  76. data/test/specs/window/location.js +34 -0
  77. data/test/specs/window/navigator.js +71 -0
  78. data/test/specs/window/screen.js +42 -0
  79. data/test/specs/window/spec.html +48 -0
  80. data/test/specs/window/timer.js +26 -0
  81. data/test/specs/window/window.js +53 -0
  82. data/test/specs/xhr/spec.html +47 -0
  83. data/test/specs/xhr/xhr.js +31 -0
  84. data/test/test.js +10 -0
  85. data/test/unit/dom.js +44 -0
  86. data/test/unit/elementmembers.js +60 -0
  87. data/test/unit/events.js +195 -0
  88. data/test/unit/fixtures/external_script.js +1 -0
  89. data/test/unit/iframe.js +234 -0
  90. data/test/unit/multi-window.js +212 -0
  91. data/test/unit/nu.validator.js +34 -0
  92. data/test/unit/onload.js +90 -0
  93. data/test/unit/parser.js +121 -0
  94. data/test/unit/prototypecompat.js +22 -0
  95. data/test/unit/proxy.js +6 -0
  96. data/test/unit/scope.js +209 -0
  97. data/test/unit/timer.js +115 -0
  98. data/test/unit/window.js +41 -0
  99. data/test/vendor/jQuery/README +2 -0
  100. data/test/vendor/prototype-1.6.0.3.js +4320 -0
  101. metadata +164 -0
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+ (function(Q){
5
+
6
+ Q.describe('TEMPLATE Spec',{
7
+ before:function(){
8
+ //setup
9
+ },
10
+ after:function(){
11
+ //tear down
12
+ }
13
+
14
+ }).should('provide the required w3c interfaces', function(){
15
+
16
+ expect(1);
17
+ ok(true, 'good job');
18
+
19
+ }).should('do something else', function(){
20
+
21
+ expect(1);
22
+ ok(true, 'good job');
23
+
24
+ }).pending('should do something new soon', function(){
25
+
26
+ expect(1);
27
+ ok(false, 'todo');
28
+ });
29
+
30
+ })(QUnit);
31
+
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+
5
+ (function(Q){
6
+
7
+ Q.describe('Another TEMPLATE Spec',{
8
+ before:function(){
9
+ //setup
10
+ },
11
+ after:function(){
12
+ //tear down
13
+ }
14
+
15
+ }).should('do something', function(){
16
+
17
+ expect(1);
18
+ ok(true, 'good job');
19
+
20
+ }).should('do something else', function(){
21
+
22
+ expect(1);
23
+ ok(true, 'good job');
24
+
25
+ }).pending('should do something new soon', function(){
26
+
27
+ expect(1);
28
+ ok(false, 'todo');
29
+ });
30
+
31
+ })(QUnit);
@@ -0,0 +1,40 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>TEMPLATE Spec</title>
6
+ <link rel="stylesheet" media="screen" href="../qunit.css"/>
7
+ <link rel="stylesheet" media="screen" href="../envjs.spec.css"/>
8
+ <link rel="stylesheet" media="screen" href="http://www.envjs.com/css/blueprint/screen.css"/>
9
+ <link rel="stylesheet" media="screen" href="http://www.envjs.com/css/site.css"/>
10
+ <script type='text/javascript' src='../qunit.js'></script>
11
+ <script type='text/javascript' src='../qunit.bdd.js'></script>
12
+
13
+ <!-- specs for this general api 'module' -->
14
+ <script type='text/javascript' src='spec-0.js'></script>
15
+ <script type='text/javascript' src='spec-1.js'></script>
16
+ </head>
17
+ <body class='container'>
18
+ <h2 id="qunit-banner">
19
+ <img id="envjs-icon"
20
+ src="../../fixtures/images/icon-blue.png"
21
+ height='40'/>
22
+ <span id="spec-title">Envjs TEMPLATE Spec</span>
23
+ </h2>
24
+ <h2 id="qunit-userAgent"></h2>
25
+ <div id='qunit-testrunner-toolbar'></div>
26
+ <div id='qunit-test-summary'>
27
+ <ol id='qunit-tests'></ol>
28
+ </div>
29
+ <div id="qunit-main" style="display:none;">
30
+ <!--
31
+ Test HTML here:
32
+
33
+ not required to be in here but it makes it convenient
34
+ by convention to avoid having to look at the html
35
+ artifacts the test may require or have generated as
36
+ a side effect.
37
+ -->
38
+ </div>
39
+ </body>
40
+ </html>
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+ (function(Q){
5
+
6
+ Q.describe('Window CSS',{
7
+
8
+ before:function(){
9
+ //setup
10
+ },
11
+ after:function(){
12
+ //tear down
13
+ }
14
+
15
+ }).should('provide the required w3c interfaces', function(){
16
+
17
+ expect(1);
18
+ ok(window.getComputedStyle, 'window.getComputedStyle');
19
+
20
+ });
21
+
22
+ })(QUnit);
23
+
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+
5
+ (function(Q){
6
+
7
+ Q.describe('Window Dialog',{
8
+
9
+ before:function(){
10
+ //setup
11
+ },
12
+ after:function(){
13
+ //tear down
14
+ }
15
+
16
+ }).should('provide the required w3c interfaces', function(){
17
+
18
+ expect(3);
19
+ ok(alert, 'alert');
20
+ ok(confirm, 'confirm');
21
+ ok(prompt, 'prompt');
22
+
23
+ });
24
+
25
+ })(QUnit);
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+
5
+ (function(Q){
6
+
7
+ Q.describe('Window Document',{
8
+
9
+ before:function(){
10
+ //setup
11
+ },
12
+ after:function(){
13
+ //tear down
14
+ }
15
+
16
+ }).should('provide the required w3c interfaces', function(){
17
+
18
+ expect(1);
19
+ ok(window.document === document, 'document is window.document');
20
+
21
+ });
22
+
23
+ })(QUnit);
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+
5
+ (function(Q){
6
+
7
+ Q.describe('Window Event',{
8
+
9
+ before:function(){
10
+ //setup
11
+ },
12
+ after:function(){
13
+ //tear down
14
+ }
15
+
16
+ }).should('provide the required w3c interfaces', function(){
17
+
18
+ expect(3);
19
+ ok(addEventListener, 'addEventListener');
20
+ ok(removeEventListener, 'removeEventListener');
21
+ ok(dispatchEvent, 'dispatchEvent');
22
+
23
+ })
24
+
25
+ })(QUnit);
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+
5
+ (function(Q){
6
+
7
+ Q.describe('Window History',{
8
+
9
+ before:function(){
10
+ //setup
11
+ },
12
+ after:function(){
13
+ //tear down
14
+ }
15
+
16
+ }).should('provide the required w3c interfaces', function(){
17
+
18
+ expect(8);
19
+ ok(history === window.history, "history is window.history");
20
+ ok(history.length, 'history.length');
21
+ ok(history.back, 'history.back');
22
+ ok(history.forward, 'history.forward');
23
+ ok(history.go, 'history.go');
24
+ ok(history.item, 'history.item');
25
+
26
+ //these are generally secured properties of the history
27
+ //object so we only check that the are defined since
28
+ //trying to access them will throw an exception
29
+ ok('current' in history, 'history.current');
30
+ ok('previous' in history, 'history.previous');
31
+
32
+ });
33
+
34
+ })(QUnit);
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+
5
+ (function(Q){
6
+
7
+ Q.describe('Window Location',{
8
+
9
+ before:function(){
10
+ //setup
11
+ },
12
+ after:function(){
13
+ //tear down
14
+ }
15
+
16
+ }).should('provide required w3c interfaces', function(){
17
+
18
+ expect(12);
19
+ ok(location === window.location, "location is window.location");
20
+ ok('href' in location, 'location.href');
21
+ ok('hash' in location, 'location.hash');
22
+ ok('host' in location, 'location.host');
23
+ ok('hostname' in location, 'location.hostname');
24
+ ok('pathname' in location, 'location.pathname');
25
+ ok('port' in location, 'location.port');
26
+ ok('search' in location, 'location.search');
27
+ ok(location.protocol, 'location.protocol');
28
+ ok(location.reload, 'location.reload');
29
+ ok(location.replace, 'location.replace');
30
+ ok(location.assign, 'location.assign');
31
+
32
+ });
33
+
34
+ })(QUnit);
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+
5
+ (function(Q){
6
+
7
+ Q.describe('Window Navigator',{
8
+
9
+ before:function(){
10
+ //setup
11
+ },
12
+ after:function(){
13
+ //tear down
14
+ }
15
+
16
+ }).should('provide the required w3c interfaces', function(){
17
+
18
+ expect(24);
19
+ ok(navigator === window.navigator, 'navigator is window.navigator');
20
+ ok(navigator.userAgent, 'userAgent');
21
+ ok(navigator.appCodeName, 'appCodeName');
22
+ ok(navigator.appName, 'appName');
23
+ ok(navigator.appVersion, 'appVersion');
24
+ ok(navigator.language, 'language');
25
+ ok(navigator.mimeTypes, 'mimeTypes');
26
+ ok(navigator.platform, 'platform');
27
+ ok(navigator.oscpu, 'oscpu');
28
+ ok(navigator.product, 'product');
29
+ ok(navigator.productSub, 'productSub');
30
+ ok(navigator.plugins, 'plugins');
31
+ ok(navigator.cookieEnabled, 'cookieEnabled');
32
+ ok(navigator.buildID, 'buildID');
33
+ ok(navigator.javaEnabled, 'javaEnabled');
34
+ ok(navigator.taintEnabled, 'taintEnabled');
35
+ ok(navigator.preference, 'preference');
36
+ ok(navigator.geolocation, 'geolocation');
37
+ ok(navigator.registerContentHandler, 'registerContentHandler');
38
+ ok(navigator.registerProtocolHandler, 'registerProtocolHandler');
39
+
40
+ //several properties will throw a security exception if they
41
+ //are accessed, so we only check that they exist
42
+ ok("vendor" in navigator, 'vendor');
43
+ ok("vendorSub" in navigator, 'vendorSub');
44
+ ok("securityPolicy" in navigator, 'securityPolicy');
45
+ ok("onLine" in navigator, 'onLine');
46
+
47
+ }).should('have the expected values', function(){
48
+
49
+ ok(navigator.userAgent, 'userAgent');
50
+ ok(navigator.appCodeName, 'appCodeName');
51
+ ok(navigator.appName, 'appName');
52
+ ok(navigator.appVersion, 'appVersion');
53
+ ok(navigator.language, 'language');
54
+ ok(navigator.mimeTypes, 'mimeTypes');
55
+ ok(navigator.platform, 'platform');
56
+ ok(navigator.oscpu, 'oscpu');
57
+ ok(navigator.product, 'product');
58
+ ok(navigator.productSub, 'productSub');
59
+ ok(navigator.plugins, 'plugins');
60
+ ok(navigator.cookieEnabled, 'cookieEnabled');
61
+ ok(navigator.buildID, 'buildID');
62
+ ok(navigator.javaEnabled, 'javaEnabled');
63
+ ok(navigator.taintEnabled, 'taintEnabled');
64
+ ok(navigator.preference, 'preference');
65
+ ok(navigator.geolocation, 'geolocation');
66
+ ok(navigator.registerContentHandler, 'registerContentHandler');
67
+ ok(navigator.registerProtocolHandler, 'registerProtocolHandler');
68
+
69
+ });
70
+
71
+ })(QUnit);
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+ (function(Q){
5
+
6
+ Q.describe('Window Screen',{
7
+
8
+ before:function(){
9
+ //setup
10
+ },
11
+ after:function(){
12
+ //tear down
13
+ }
14
+
15
+ }).should('provide the required w3c interfaces', function(){
16
+
17
+ expect(18);
18
+ ok(screen === window.screen , 'screen is window screen');
19
+ ok("top" in screen, 'top');
20
+ ok(screen.height, 'height');
21
+ ok(screen.width, 'width');
22
+ ok("left" in screen, 'left');
23
+ ok(screen.pixelDepth, 'pixelDepth');
24
+ ok(screen.colorDepth, 'colorDepth');
25
+ ok(screen.availWidth, 'availWidth');
26
+ ok(screen.availHeight, 'availHeight');
27
+ ok("availLeft" in screen, 'availLeft');
28
+ ok(screen.availTop, 'availTop');
29
+
30
+ //closely related function available at window
31
+ ok(moveBy, 'moveBy');
32
+ ok(moveTo, 'moveTo');
33
+ ok(resizeBy, 'resizeBy');
34
+ ok(resizeTo, 'resizeTo');
35
+ ok(scroll, 'scroll');
36
+ ok(scrollBy, 'scrollBy');
37
+ ok(scrollTo, 'scrollTo');
38
+
39
+ });
40
+
41
+ })(QUnit);
42
+
@@ -0,0 +1,48 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>Envjs Window Spec</title>
6
+ <link rel="stylesheet" media="screen" href="../qunit.css"/>
7
+ <link rel="stylesheet" media="screen" href="../envjs.spec.css"/>
8
+ <link rel="stylesheet" media="screen" href="http://www.envjs.com/css/blueprint/screen.css"/>
9
+ <link rel="stylesheet" media="screen" href="http://www.envjs.com/css/site.css"/>
10
+ <script type='text/javascript' src='../qunit.js'></script>
11
+ <script type='text/javascript' src='../qunit.bdd.js'></script>
12
+
13
+ <!-- specs for this general api 'module' -->
14
+ <script type='text/javascript' src='window.js'></script>
15
+ <script type='text/javascript' src='css.js'></script>
16
+ <script type='text/javascript' src='dialog.js'></script>
17
+ <script type='text/javascript' src='document.js'></script>
18
+ <script type='text/javascript' src='event.js'></script>
19
+ <script type='text/javascript' src='history.js'></script>
20
+ <script type='text/javascript' src='location.js'></script>
21
+ <script type='text/javascript' src='navigator.js'></script>
22
+ <script type='text/javascript' src='screen.js'></script>
23
+ <script type='text/javascript' src='timer.js'></script>
24
+ </head>
25
+ <body class='container'>
26
+ <h2 id="qunit-banner">
27
+ <img id="envjs-icon"
28
+ src="../../fixtures/images/icon-blue.png"
29
+ height='40'/>
30
+ <span id="spec-title">Envjs Window Spec</span>
31
+ </h2>
32
+ <h2 id="qunit-userAgent"></h2>
33
+ <div id='qunit-testrunner-toolbar'></div>
34
+ <div id='qunit-test-summary'>
35
+ <ol id='qunit-tests'></ol>
36
+ </div>
37
+ <div id="qunit-main" style="display:none;">
38
+ <!--
39
+ Test HTML here:
40
+
41
+ not required to be in here but it makes it convenient
42
+ by convention to avoid having to look at the html
43
+ artifacts the test may require or have generated as
44
+ a side effect.
45
+ -->
46
+ </div>
47
+ </body>
48
+ </html>
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+
5
+ (function(Q){
6
+
7
+ Q.describe('Window Timer',{
8
+
9
+ before:function(){
10
+ //setup
11
+ },
12
+ after:function(){
13
+ //tear down
14
+ }
15
+
16
+ }).should('provide the required w3c interfaces', function(){
17
+
18
+ expect(4);
19
+ ok(setTimeout, 'setTimeout');
20
+ ok(setInterval, 'setInterval');
21
+ ok(clearTimeout, 'clearTimeout');
22
+ ok(clearInterval, 'clearInterval');
23
+
24
+ });
25
+
26
+ })(QUnit);
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+ var global_scope=this;
5
+
6
+ (function(Q){
7
+
8
+ Q.describe('Window Basic Properties',{
9
+
10
+ before:function(){
11
+ //setup
12
+ },
13
+ after:function(){
14
+ //tear down
15
+ }
16
+
17
+ }).should('provide the required w3c interfaces', function(){
18
+
19
+ expect(19);
20
+ ok(window, 'window');
21
+ ok(self, 'self');
22
+ ok(top, 'top');
23
+ ok(parent, 'parent');
24
+ ok(window.toString(), '[object Window]');
25
+
26
+ //these values are usually the empty string ''
27
+ //so we just verify the property is available
28
+ ok('name' in window, 'name');
29
+ ok('status' in window, 'status');
30
+ ok('closed' in window, 'closed');
31
+ ok('defaultStatus' in window, 'defaultStatus');
32
+ ok('length' in window, 'length');
33
+ ok('opener' in window, 'opener');
34
+
35
+ ok(frames, 'frames');
36
+ ok(open, 'open');
37
+ ok(close, 'close');
38
+ ok(innerHeight, 'innerHeight');
39
+ ok(outerHeight, 'outerHeight');
40
+ ok(outerWidth, 'outerWidth');
41
+ ok(screenX, 'screenX');
42
+ ok(screenY, 'screenY');
43
+
44
+
45
+ }).should('have the expected values', function(){
46
+
47
+ equals( window, global_scope, 'window is the global scope "this"');
48
+ equals( window, self, 'self is an alias for window');
49
+ equals( window, top, 'top is an alias for window when the window is not in a frame');
50
+
51
+ });
52
+
53
+ })(QUnit);
@@ -0,0 +1,47 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>Envjs Window Spec</title>
6
+ <link rel="stylesheet" media="screen" href="../qunit.css"/>
7
+ <link rel="stylesheet" media="screen" href="../envjs.spec.css"/>
8
+ <link rel="stylesheet" media="screen" href="http://www.envjs.com/css/blueprint/screen.css"/>
9
+ <link rel="stylesheet" media="screen" href="http://www.envjs.com/css/site.css"/>
10
+ <script type='text/javascript' src='../qunit.js'></script>
11
+ <script type='text/javascript' src='../qunit.bdd.js'></script>
12
+
13
+ <!-- specs for this general api 'module' -->
14
+ <script type='text/javascript' src='css.js'></script>
15
+ <script type='text/javascript' src='dialog.js'></script>
16
+ <script type='text/javascript' src='document.js'></script>
17
+ <script type='text/javascript' src='event.js'></script>
18
+ <script type='text/javascript' src='history.js'></script>
19
+ <script type='text/javascript' src='location.js'></script>
20
+ <script type='text/javascript' src='navigator.js'></script>
21
+ <script type='text/javascript' src='window.js'></script>
22
+ <script type='text/javascript' src='timer.js'></script>
23
+ </head>
24
+ <body class='container'>
25
+ <h2 id="qunit-banner">
26
+ <img id="envjs-icon"
27
+ src="../../fixtures/images/icon-blue.png"
28
+ height='40'/>
29
+ <span id="spec-title">Envjs Window Spec</span>
30
+ </h2>
31
+ <h2 id="qunit-userAgent"></h2>
32
+ <div id='qunit-testrunner-toolbar'></div>
33
+ <div id='qunit-test-summary'>
34
+ <ol id='qunit-tests'></ol>
35
+ </div>
36
+ <div id="qunit-main" style="display:none;">
37
+ <!--
38
+ Test HTML here:
39
+
40
+ not required to be in here but it makes it convenient
41
+ by convention to avoid having to look at the html
42
+ artifacts the test may require or have generated as
43
+ a side effect.
44
+ -->
45
+ </div>
46
+ </body>
47
+ </html>
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @author thatcher
3
+ */
4
+
5
+ (function(Q){
6
+
7
+ Q.describe('Another TEMPLATE Spec',{
8
+ before:function(){
9
+ //setup
10
+ },
11
+ after:function(){
12
+ //tear down
13
+ }
14
+
15
+ }).should('do something', function(){
16
+
17
+ expect(1);
18
+ ok(true, 'good job');
19
+
20
+ }).should('do something else', function(){
21
+
22
+ expect(1);
23
+ ok(true, 'good job');
24
+
25
+ }).pending('should do something new soon', function(){
26
+
27
+ expect(1);
28
+ ok(false, 'todo');
29
+ });
30
+
31
+ })(QUnit);
data/test/test.js ADDED
@@ -0,0 +1,10 @@
1
+ whichJarFile = arguments[0];
2
+ whichTestFile = arguments[1];
3
+
4
+ multiwindow = !(whichJarFile == "rhino");
5
+ whichInterpreter = whichJarFile + " interpreter jar";
6
+
7
+ load("dist/env.rhino.js");
8
+ load("test/" + whichTestFile + ".js");
9
+
10
+ Envjs.wait();
data/test/unit/dom.js ADDED
@@ -0,0 +1,44 @@
1
+ // dependencies for the tests
2
+ $w = { }
3
+ $env = { debug: function() {} }
4
+ $openingWindow = $parentWindow = $initTop = null;
5
+ this.options = this.options || {}
6
+
7
+ load("src/window/window.js", "src/dom/node.js");
8
+
9
+ debugger;
10
+ module("dom");
11
+
12
+ test("Basic requirements", function() {
13
+ expect(5);
14
+ ok( Array.prototype.push, "Array.push()" );
15
+ ok( Function.prototype.apply, "Function.apply()" );
16
+ ok( document.getElementById, "getElementById" );
17
+ ok( document.getElementsByTagName, "getElementsByTagName" );
18
+ ok( RegExp, "RegExp" );
19
+ });
20
+
21
+
22
+ test("document.getElementById", function() {
23
+ expect(14);
24
+ try{ok (document.getElementById('body').id == "body", "Can get Element by id, expected id='body'");}catch(e){print(e);}
25
+ try{ok (document.getElementById('header').id == "header", "Can get Element by id, expected id='header'");}catch(e){print(e);}
26
+ try{ok (document.getElementById('banner').id == "banner", "Can get Element by id, expected id='banner'");}catch(e){print(e);}
27
+ try{ok (document.getElementById('userAgent').id == "userAgent", "Can get Element by id, expected id='userAgent'");}catch(e){print(e);}
28
+ try{ok (document.getElementById('nothiddendiv').id == "nothiddendiv", "Can get Element by id, expected id='nothiddendiv'");}catch(e){print(e);}
29
+ try{ok (document.getElementById('nothiddendivchild').id == "nothiddendivchild", "Can get Element by id, expected id='nothiddendivchild'");}catch(e){print(e);}
30
+ try{ok (document.getElementById('dl').id == "dl", "Can get Element by id, expected id='dl'");}catch(e){print(e);}
31
+ try{ok (document.getElementById('main').id == "main", "Can get Element by id, expected id='main'");}catch(e){print(e);}
32
+ try{ok (document.getElementById('firstp').id == "firstp", "Can get Element by id, expected id='firstp");}catch(e){print(e);}
33
+ try{ok (document.getElementById('simon1').id == "simon1", "Can get Element by id, expected id='simon1'");}catch(e){print(e);}
34
+ try{ok (document.getElementById('ap').id == "ap", "Can get Element by id, expected id='ap'");}catch(e){print(e);}
35
+ try{ok (document.getElementById('google').id == "google", "Can get Element by id, expected id='google'");}catch(e){print(e);}
36
+ try{ok (document.getElementById('groups').id == "groups", "Can get Element by id, expected id='groups'");}catch(e){print(e);}
37
+ try{ok (document.getElementById('台北Táiběi').id == "台北Táiběi", "Can get Element by UTF-8 id, expected id='台北Táiběi'");}catch(e){print(e);}
38
+ });
39
+
40
+ test("element.getElementsByTagName", function() {
41
+ expect(1);
42
+ var body = document.getElementById('body');
43
+ try{ok (body.getElementsByTagName('h1').length == 1, "Can get NodeList length : Expected 1 , Got " + body.getElementsByTagName('h1').length);}catch(e){print(e);}
44
+ });