smparkes-envjs 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/envjsrb +157 -73
- data/bin/jquery-1.3.2-test.js +11 -4
- data/lib/envjs/env.js +935 -11028
- data/lib/envjs/net/cgi.rb +94 -0
- data/lib/envjs/net/file.rb +4 -4
- data/lib/envjs/runtime.rb +80 -24
- data/test/call-load-test.js +0 -2
- data/test/firebug/errorIcon.png +0 -0
- data/test/firebug/firebug.css +209 -0
- data/test/firebug/firebug.html +23 -0
- data/test/firebug/firebug.js +672 -0
- data/test/firebug/firebugx.js +10 -0
- data/test/firebug/infoIcon.png +0 -0
- data/test/firebug/warningIcon.png +0 -0
- data/test/fixtures/html/events.html +171 -0
- data/test/fixtures/html/iframe1.html +46 -0
- data/test/fixtures/html/iframe1a.html +46 -0
- data/test/fixtures/html/iframe2.html +45 -0
- data/test/fixtures/html/iframe3.html +28 -0
- data/test/fixtures/html/iframeN.html +57 -0
- data/test/fixtures/html/malformed.html +181 -0
- data/test/fixtures/html/scope.html +81 -0
- data/test/fixtures/html/trivial.html +19 -0
- data/test/fixtures/html/with_js.html +26 -0
- data/test/fixtures/images/icon-blue.png +0 -0
- data/test/fixtures/js/external_script.js +1 -0
- data/test/fixtures/js/script.js +1 -0
- data/test/fixtures/js/script_error.js +2 -0
- data/test/html/malformed.html +1 -0
- data/test/index.html +21 -19
- data/test/{primaryTests.js → primary-tests.js} +1 -3
- data/test/{prototype.js → prototype-test.js} +0 -2
- data/test/qunit/qunit/qunit.css +0 -0
- data/test/qunit/qunit/qunit.js +2 -2
- data/test/{qunit/qunit/qunit.js.smp → specs/dist/env.spec.js} +539 -7
- data/test/specs/envjs.spec.css +46 -0
- data/test/specs/parser/html.js +31 -0
- data/test/specs/parser/spec.html +40 -0
- data/test/specs/parser/xml.js +31 -0
- data/test/specs/qunit.bdd.js +210 -0
- data/test/{qunit.smp/qunit → specs}/qunit.css +0 -0
- data/test/{qunit.smp/qunit → specs}/qunit.js +2 -2
- data/test/specs/template/spec-0.js +31 -0
- data/test/specs/template/spec-1.js +31 -0
- data/test/specs/template/spec.html +40 -0
- data/test/specs/window/css.js +23 -0
- data/test/specs/window/dialog.js +25 -0
- data/test/specs/window/document.js +23 -0
- data/test/specs/window/event.js +25 -0
- data/test/specs/window/history.js +34 -0
- data/test/specs/window/location.js +34 -0
- data/test/specs/window/navigator.js +71 -0
- data/test/specs/window/screen.js +42 -0
- data/test/specs/window/spec.html +48 -0
- data/test/specs/window/timer.js +26 -0
- data/test/specs/window/window.js +53 -0
- data/test/specs/xhr/spec.html +47 -0
- data/test/specs/xhr/xhr.js +31 -0
- data/test/test.js +10 -0
- data/test/unit/elementmembers.js +31 -0
- data/test/unit/nu.validator.js +34 -0
- data/test/unit/onload.js +1 -3
- data/test/unit/parser.js +106 -98
- data/test/unit/prototypecompat.js +2 -2
- data/test/vendor/jQuery/1.3.2/ChangeLog.txt +98 -0
- data/test/vendor/jQuery/1.3.2/GPL-LICENSE.txt +278 -0
- data/test/vendor/jQuery/1.3.2/MIT-LICENSE.txt +20 -0
- data/test/vendor/jQuery/1.3.2/Makefile +154 -0
- data/test/vendor/jQuery/1.3.2/README +67 -0
- data/test/vendor/jQuery/1.3.2/build/ant-contrib-0.6.jar +0 -0
- data/test/vendor/jQuery/1.3.2/build/build/min.js +11 -0
- data/test/vendor/jQuery/1.3.2/build/build/pack.js +19 -0
- data/test/vendor/jQuery/1.3.2/build/js/Packer.js +209 -0
- data/test/vendor/jQuery/1.3.2/build/js/ParseMaster.js +106 -0
- data/test/vendor/jQuery/1.3.2/build/js/Words.js +62 -0
- data/test/vendor/jQuery/1.3.2/build/js/base2.js +978 -0
- data/test/vendor/jQuery/1.3.2/build/js/jsmin.js +316 -0
- data/test/vendor/jQuery/1.3.2/build/js/json.js +117 -0
- data/test/vendor/jQuery/1.3.2/build/js/pack.js +316 -0
- data/test/vendor/jQuery/1.3.2/build/js/parse.js +105 -0
- data/test/vendor/jQuery/1.3.2/build/js/writeFile.js +19 -0
- data/test/vendor/jQuery/1.3.2/build/js/xml.js +25 -0
- data/test/vendor/jQuery/1.3.2/build/js.jar +0 -0
- data/test/vendor/jQuery/1.3.2/build/runtest/env.js +1 -0
- data/test/vendor/jQuery/1.3.2/build/runtest/test.js +106 -0
- data/test/vendor/jQuery/1.3.2/build/runtest/testrunner.js +197 -0
- data/test/vendor/jQuery/1.3.2/build/speed/benchmarker.css +65 -0
- data/test/vendor/jQuery/1.3.2/build/speed/benchmarker.js +181 -0
- data/test/vendor/jQuery/1.3.2/build/speed/index.html +72 -0
- data/test/vendor/jQuery/1.3.2/build/speed/jquery-basis.js +3549 -0
- data/test/vendor/jQuery/1.3.2/build/style.xsl +99 -0
- data/test/vendor/jQuery/1.3.2/build/yuicompressor-2.4.2.jar +0 -0
- data/test/vendor/jQuery/1.3.2/build.xml +123 -0
- data/test/vendor/jQuery/1.3.2/dist/jquery.js +4376 -0
- data/test/vendor/jQuery/1.3.2/reminder.txt +3 -0
- data/test/vendor/jQuery/1.3.2/src/ajax.js +541 -0
- data/test/vendor/jQuery/1.3.2/src/core.js +1255 -0
- data/test/vendor/jQuery/1.3.2/src/data.js +145 -0
- data/test/vendor/jQuery/1.3.2/src/dimensions.js +49 -0
- data/test/vendor/jQuery/1.3.2/src/event.js +684 -0
- data/test/vendor/jQuery/1.3.2/src/fx.js +407 -0
- data/test/vendor/jQuery/1.3.2/src/intro.js +13 -0
- data/test/vendor/jQuery/1.3.2/src/offset.js +155 -0
- data/test/vendor/jQuery/1.3.2/src/outro.js +1 -0
- data/test/vendor/jQuery/1.3.2/src/selector.js +1015 -0
- data/test/vendor/jQuery/1.3.2/src/support.js +112 -0
- data/test/vendor/jQuery/1.3.2/test/data/cow.jpg +0 -0
- data/test/vendor/jQuery/1.3.2/test/data/dashboard.xml +11 -0
- data/test/vendor/jQuery/1.3.2/test/data/echoQuery.php +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/iframe.html +8 -0
- data/test/vendor/jQuery/1.3.2/test/data/json.php +9 -0
- data/test/vendor/jQuery/1.3.2/test/data/json_assigned_obj.js +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/json_obj.js +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/jsonp.php +10 -0
- data/test/vendor/jQuery/1.3.2/test/data/name.html +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/name.php +29 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/absolute.html +39 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/body.html +24 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/fixed.html +33 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/relative.html +31 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/scroll.html +39 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/static.html +31 -0
- data/test/vendor/jQuery/1.3.2/test/data/offset/table.html +43 -0
- data/test/vendor/jQuery/1.3.2/test/data/params_html.php +12 -0
- data/test/vendor/jQuery/1.3.2/test/data/test.html +7 -0
- data/test/vendor/jQuery/1.3.2/test/data/test.js +3 -0
- data/test/vendor/jQuery/1.3.2/test/data/test.php +7 -0
- data/test/vendor/jQuery/1.3.2/test/data/test2.html +5 -0
- data/test/vendor/jQuery/1.3.2/test/data/test3.html +3 -0
- data/test/vendor/jQuery/1.3.2/test/data/testrunner.js +1 -0
- data/test/vendor/jQuery/1.3.2/test/data/text.php +12 -0
- data/test/vendor/jQuery/1.3.2/test/data/with_fries.xml +25 -0
- data/test/vendor/jQuery/1.3.2/test/index.html +229 -0
- data/test/vendor/jQuery/1.3.2/test/jqenv-1259090275493.html +247 -0
- data/test/vendor/jQuery/1.3.2/test/jqenv-1259091671501.html +247 -0
- data/test/vendor/jQuery/1.3.2/test/jqenv-1259175319655.html +247 -0
- data/test/vendor/jQuery/1.3.2/test/offset.html +28 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/jquery/1.2.1/jquery.js +11 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/jquery/1.2.3/jquery.js +11 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/mootools/1.11/mootools.js +1577 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/prototype/1.6.0.2/prototype.js +4221 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/builder.js +131 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/controls.js +835 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/dragdrop.js +944 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/effects.js +1090 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/scriptaculous.js +51 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/slider.js +278 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.7.0/unittest.js +564 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/builder.js +136 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/controls.js +965 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/dragdrop.js +974 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/effects.js +1122 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/scriptaculous.js +58 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/slider.js +275 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/sound.js +55 -0
- data/test/vendor/jQuery/1.3.2/test/otherlibs/scriptaculous/1.8.1/unittest.js +568 -0
- data/test/vendor/jQuery/1.3.2/test/polluted.php +64 -0
- data/test/vendor/jQuery/1.3.2/test/qunit/testrunner.js +780 -0
- data/test/vendor/jQuery/1.3.2/test/qunit/testsuite.css +120 -0
- data/test/vendor/jQuery/1.3.2/test/test.js +41 -0
- data/test/vendor/jQuery/1.3.2/test/unit/ajax.js +856 -0
- data/test/vendor/jQuery/1.3.2/test/unit/core.js +1872 -0
- data/test/vendor/jQuery/1.3.2/test/unit/data.js +160 -0
- data/test/vendor/jQuery/1.3.2/test/unit/dimensions.js +86 -0
- data/test/vendor/jQuery/1.3.2/test/unit/event.js +670 -0
- data/test/vendor/jQuery/1.3.2/test/unit/fx.js +451 -0
- data/test/vendor/jQuery/1.3.2/test/unit/offset.js +173 -0
- data/test/vendor/jQuery/1.3.2/test/unit/selector.js +395 -0
- data/test/vendor/jQuery/1.3.2/test/xhtml.php +5 -0
- data/test/vendor/jQuery/1.3.2/version.txt +1 -0
- metadata +158 -22
- data/lib/envjs/runtime.rb.smp +0 -133
- data/test/envjs-call-load-test.js +0 -5
- data/test/envjs-prototype.js +0 -5
- data/test/qunit/package.json +0 -21
- data/test/qunit/test/index.html +0 -17
- data/test/qunit/test/same.js +0 -1368
- data/test/qunit/test/test.js +0 -136
- data/test/qunit.smp/package.json +0 -21
- data/test/qunit.smp/test/index.html +0 -17
- data/test/qunit.smp/test/same.js +0 -1368
- data/test/qunit.smp/test/test.js +0 -136
- data/test/rhino-call-load-test.js +0 -5
- data/test/rhino-prototype.js +0 -5
- data/test/test-with-envs-jar.js +0 -8
- data/test/test-with-rhino-jar.js +0 -9
@@ -8,13 +8,8 @@
|
|
8
8
|
* and GPL (GPL-LICENSE.txt) licenses.
|
9
9
|
*/
|
10
10
|
|
11
|
-
print(this);
|
12
|
-
|
13
11
|
(function(window) {
|
14
12
|
|
15
|
-
print(this);
|
16
|
-
print(window);
|
17
|
-
|
18
13
|
var QUnit = {
|
19
14
|
|
20
15
|
// Initialize the configuration options
|
@@ -166,7 +161,7 @@ var QUnit = {
|
|
166
161
|
|
167
162
|
var li = document.createElement("li");
|
168
163
|
li.className = assertion.result ? "pass" : "fail";
|
169
|
-
li.innerHTML = assertion.message || "(no message)";
|
164
|
+
li.innerHTML = config.currentModule+' : '+assertion.message || "(no message)";
|
170
165
|
ol.appendChild( li );
|
171
166
|
|
172
167
|
if ( assertion.result ) {
|
@@ -260,7 +255,7 @@ var QUnit = {
|
|
260
255
|
*/
|
261
256
|
ok: function ok(a, msg) {
|
262
257
|
QUnit.log(a, msg);
|
263
|
-
|
258
|
+
|
264
259
|
config.assertions.push({
|
265
260
|
result: !!a,
|
266
261
|
message: msg
|
@@ -1000,3 +995,540 @@ QUnit.jsDump = (function() {
|
|
1000
995
|
})();
|
1001
996
|
|
1002
997
|
})(this);
|
998
|
+
|
999
|
+
(function(Q){
|
1000
|
+
|
1001
|
+
Q.Spec = function(name){
|
1002
|
+
this.before = false;
|
1003
|
+
this.after = false;
|
1004
|
+
this.assigns = {};
|
1005
|
+
this.name = name;
|
1006
|
+
Q.module(name);
|
1007
|
+
};
|
1008
|
+
Q.Spec.reminders = {};
|
1009
|
+
|
1010
|
+
|
1011
|
+
// RSpec style describe
|
1012
|
+
// takes an arbitrary number of arguments that are contactenated as strings
|
1013
|
+
// the last argument is the configuration object
|
1014
|
+
// which can have before: after: callbacks
|
1015
|
+
function describe(){
|
1016
|
+
var args = [].splice.call(arguments, 0);
|
1017
|
+
// configuration function
|
1018
|
+
var bddconfig = (args[args.length - 1].constructor == Object) ? args.pop() : {};
|
1019
|
+
var spec = new Q.Spec(args.join(' '));
|
1020
|
+
spec.before = bddconfig['before'] || bddconfig['setup'];
|
1021
|
+
spec.after = bddconfig['after'] || bddconfig['teardown'];
|
1022
|
+
return spec;
|
1023
|
+
};
|
1024
|
+
|
1025
|
+
|
1026
|
+
|
1027
|
+
|
1028
|
+
// RSpec style test definition
|
1029
|
+
Q.Spec.prototype.it = function(name, callback ){
|
1030
|
+
var spec = this;
|
1031
|
+
if (spec.before)
|
1032
|
+
spec.before.apply(spec.assigns);
|
1033
|
+
Q.test(spec.name+" : "+name, function(){
|
1034
|
+
callback.apply(spec);
|
1035
|
+
});
|
1036
|
+
if (spec.after)
|
1037
|
+
spec.after.apply(spec.assigns);
|
1038
|
+
return spec;
|
1039
|
+
};
|
1040
|
+
|
1041
|
+
// Shoulda style test definition
|
1042
|
+
Q.Spec.prototype.should = function(name, callback){
|
1043
|
+
name = 'should ' + name;
|
1044
|
+
return this.it.apply(this, [name, callback]);
|
1045
|
+
};
|
1046
|
+
|
1047
|
+
Q.Spec.prototype.pending = function(name, callback, nowait){
|
1048
|
+
name = '<span style="color: #EB8531;" class="pending">deferred: ' + name + '</span>';
|
1049
|
+
Q.test(name, function(){
|
1050
|
+
Q.ok(true,'behavior pending');
|
1051
|
+
});
|
1052
|
+
return this;
|
1053
|
+
};
|
1054
|
+
|
1055
|
+
Q.Spec.prototype.should_eventually = function(name, callback, nowait){
|
1056
|
+
return this.pending(name, callback);
|
1057
|
+
};
|
1058
|
+
|
1059
|
+
Q.Spec.prototype.a = function(key){
|
1060
|
+
if (typeof key == 'undefined') {
|
1061
|
+
return this.assigns;
|
1062
|
+
}
|
1063
|
+
else {
|
1064
|
+
return this.assigns[key];
|
1065
|
+
}
|
1066
|
+
};
|
1067
|
+
|
1068
|
+
// aliases for describe
|
1069
|
+
Q.describe = describe;
|
1070
|
+
Q.context = describe;
|
1071
|
+
|
1072
|
+
// asserts that the method is defined (like respond_to?)
|
1073
|
+
Q.defined = function(object, method){
|
1074
|
+
return Q.ok(typeof object[method] == 'function', method + 'is not defined on' + object);
|
1075
|
+
};
|
1076
|
+
|
1077
|
+
// asserts that the object is of a certain type
|
1078
|
+
Q.isType = function(object, type){
|
1079
|
+
return Q.ok(object.constructor === type, object.toString() + ' is not of type ' + type + ', is ' + object.constructor);
|
1080
|
+
};
|
1081
|
+
|
1082
|
+
// assert a string matches a regex
|
1083
|
+
Q.match = function(matcher, string, message){
|
1084
|
+
return Q.ok(string.match(matcher), message);
|
1085
|
+
};
|
1086
|
+
|
1087
|
+
// assert that a matching error is raised
|
1088
|
+
// expected can be a regex, a string, or an object
|
1089
|
+
Q.raised = function(expected_error, callback){
|
1090
|
+
var error = '';
|
1091
|
+
try {
|
1092
|
+
callback.apply(this);
|
1093
|
+
}
|
1094
|
+
catch (e) {
|
1095
|
+
error = e;
|
1096
|
+
}
|
1097
|
+
message = "Expected error to match " + expected_error + " but was " + error.toString();
|
1098
|
+
if (expected_error.constructor == RegExp) {
|
1099
|
+
return Q.match(expected_error, error.toString(), message);
|
1100
|
+
}
|
1101
|
+
else
|
1102
|
+
if (expected_error.constructor == String) {
|
1103
|
+
return Q.equals(expected_error, error.toString(), message);
|
1104
|
+
}
|
1105
|
+
else {
|
1106
|
+
return Q.equals(expected_error, error, message);
|
1107
|
+
}
|
1108
|
+
};
|
1109
|
+
|
1110
|
+
|
1111
|
+
var log;
|
1112
|
+
try{
|
1113
|
+
if(Envjs)
|
1114
|
+
log = Envjs.log;
|
1115
|
+
}catch(e){
|
1116
|
+
try{
|
1117
|
+
log = console.log;
|
1118
|
+
}catch(e){
|
1119
|
+
log=function(){};
|
1120
|
+
}
|
1121
|
+
|
1122
|
+
}
|
1123
|
+
var assertion_index = 0;
|
1124
|
+
|
1125
|
+
var module_index = 0;
|
1126
|
+
var module;
|
1127
|
+
|
1128
|
+
var test_index = 0;
|
1129
|
+
var test;
|
1130
|
+
|
1131
|
+
Q._moduleStart = Q.moduleStart;
|
1132
|
+
Q.moduleStart = function(m, te){
|
1133
|
+
Q._moduleStart.apply(this, arguments);
|
1134
|
+
module = m;
|
1135
|
+
module_index++;
|
1136
|
+
};
|
1137
|
+
|
1138
|
+
Q._moduleDone = Q.moduleDone;
|
1139
|
+
Q.moduleDone = function(t, f, tx){
|
1140
|
+
Q._moduleDone.apply(this, arguments);
|
1141
|
+
var s = module_index + ". module " + t + ": ";
|
1142
|
+
if (f) {
|
1143
|
+
s += f + " failure(s) in " + tx + " tests";
|
1144
|
+
}
|
1145
|
+
else {
|
1146
|
+
s += "all " + tx + " tests successful";
|
1147
|
+
}
|
1148
|
+
// print(s);
|
1149
|
+
module = undefined;
|
1150
|
+
};
|
1151
|
+
|
1152
|
+
Q._testStart = Q.testStart;
|
1153
|
+
Q.testStart = function(t){
|
1154
|
+
Q._testStart.apply(this, arguments);
|
1155
|
+
test = t;
|
1156
|
+
test_index++;
|
1157
|
+
};
|
1158
|
+
|
1159
|
+
Q._testDone = Q.testDone;
|
1160
|
+
Q.testDone = function(t){
|
1161
|
+
Q._testDone.apply(this, arguments);
|
1162
|
+
test = undefined;
|
1163
|
+
}
|
1164
|
+
|
1165
|
+
Q._log = Q.log;
|
1166
|
+
Q.log = function(r, m){
|
1167
|
+
Q._log.apply(this, arguments);
|
1168
|
+
assertion_index++;
|
1169
|
+
var test_string = "";
|
1170
|
+
if (module || test) {
|
1171
|
+
var test_string = "[";
|
1172
|
+
if (module) {
|
1173
|
+
test_string += module;
|
1174
|
+
if (test) {
|
1175
|
+
test_string += ": ";
|
1176
|
+
}
|
1177
|
+
}
|
1178
|
+
if (test) {
|
1179
|
+
test_string += test;
|
1180
|
+
}
|
1181
|
+
test_string += "] ";
|
1182
|
+
}
|
1183
|
+
var s = (r ? "PASS (" : "FAIL (") + assertion_index + ") " + test_string + m;
|
1184
|
+
log(s);
|
1185
|
+
};
|
1186
|
+
|
1187
|
+
Q._done = Q.done;
|
1188
|
+
Q.done = function(f, t){
|
1189
|
+
Q._done.apply(this, arguments);
|
1190
|
+
log((t - f) + " Passed, " + f + " Failed, " + t + " Total Tests");
|
1191
|
+
try{
|
1192
|
+
if(Envjs){
|
1193
|
+
var scripts = document.getElementsByTagName('script');
|
1194
|
+
for(var i = 0;i<scripts.length;i++){
|
1195
|
+
//prevents scripts from being re-run when
|
1196
|
+
//we look at the results in the browser
|
1197
|
+
scripts[i].type='text/envjs';
|
1198
|
+
}
|
1199
|
+
Envjs.writeToFile(document.xml, Envjs.location('results.html'));
|
1200
|
+
}
|
1201
|
+
}catch(e){
|
1202
|
+
log('failed to print results to file.\n'+e);
|
1203
|
+
}
|
1204
|
+
};
|
1205
|
+
|
1206
|
+
})(QUnit);
|
1207
|
+
|
1208
|
+
/**
|
1209
|
+
* @author thatcher
|
1210
|
+
*/
|
1211
|
+
var global_scope=this;
|
1212
|
+
|
1213
|
+
(function(Q){
|
1214
|
+
|
1215
|
+
Q.describe('Window Basic Properties',{
|
1216
|
+
|
1217
|
+
before:function(){
|
1218
|
+
//setup
|
1219
|
+
},
|
1220
|
+
after:function(){
|
1221
|
+
//tear down
|
1222
|
+
}
|
1223
|
+
|
1224
|
+
}).should('provide the required w3c interfaces', function(){
|
1225
|
+
|
1226
|
+
expect(19);
|
1227
|
+
ok(window, 'window');
|
1228
|
+
ok(self, 'self');
|
1229
|
+
ok(top, 'top');
|
1230
|
+
ok(parent, 'parent');
|
1231
|
+
ok(window.toString(), '[object Window]');
|
1232
|
+
|
1233
|
+
//these values are usually the empty string ''
|
1234
|
+
//so we just verify the property is available
|
1235
|
+
ok('name' in window, 'name');
|
1236
|
+
ok('status' in window, 'status');
|
1237
|
+
ok('closed' in window, 'closed');
|
1238
|
+
ok('defaultStatus' in window, 'defaultStatus');
|
1239
|
+
ok('length' in window, 'length');
|
1240
|
+
ok('opener' in window, 'opener');
|
1241
|
+
|
1242
|
+
ok(frames, 'frames');
|
1243
|
+
ok(open, 'open');
|
1244
|
+
ok(close, 'close');
|
1245
|
+
ok(innerHeight, 'innerHeight');
|
1246
|
+
ok(outerHeight, 'outerHeight');
|
1247
|
+
ok(outerWidth, 'outerWidth');
|
1248
|
+
ok(screenX, 'screenX');
|
1249
|
+
ok(screenY, 'screenY');
|
1250
|
+
|
1251
|
+
|
1252
|
+
}).should('have the expected values', function(){
|
1253
|
+
|
1254
|
+
equals( window, global_scope, 'window is the global scope "this"');
|
1255
|
+
equals( window, self, 'self is an alias for window');
|
1256
|
+
equals( window, top, 'top is an alias for window when the window is not in a frame');
|
1257
|
+
|
1258
|
+
});
|
1259
|
+
|
1260
|
+
})(QUnit);/**
|
1261
|
+
* @author thatcher
|
1262
|
+
*/
|
1263
|
+
|
1264
|
+
(function(Q){
|
1265
|
+
|
1266
|
+
Q.describe('Window Location',{
|
1267
|
+
|
1268
|
+
before:function(){
|
1269
|
+
//setup
|
1270
|
+
},
|
1271
|
+
after:function(){
|
1272
|
+
//tear down
|
1273
|
+
}
|
1274
|
+
|
1275
|
+
}).should('provide required w3c interfaces', function(){
|
1276
|
+
|
1277
|
+
expect(12);
|
1278
|
+
ok(location === window.location, "location is window.location");
|
1279
|
+
ok('href' in location, 'location.href');
|
1280
|
+
ok('hash' in location, 'location.hash');
|
1281
|
+
ok('host' in location, 'location.host');
|
1282
|
+
ok('hostname' in location, 'location.hostname');
|
1283
|
+
ok('pathname' in location, 'location.pathname');
|
1284
|
+
ok('port' in location, 'location.port');
|
1285
|
+
ok('search' in location, 'location.search');
|
1286
|
+
ok(location.protocol, 'location.protocol');
|
1287
|
+
ok(location.reload, 'location.reload');
|
1288
|
+
ok(location.replace, 'location.replace');
|
1289
|
+
ok(location.assign, 'location.assign');
|
1290
|
+
|
1291
|
+
});
|
1292
|
+
|
1293
|
+
})(QUnit);/**
|
1294
|
+
* @author thatcher
|
1295
|
+
*/
|
1296
|
+
|
1297
|
+
(function(Q){
|
1298
|
+
|
1299
|
+
Q.describe('Window History',{
|
1300
|
+
|
1301
|
+
before:function(){
|
1302
|
+
//setup
|
1303
|
+
},
|
1304
|
+
after:function(){
|
1305
|
+
//tear down
|
1306
|
+
}
|
1307
|
+
|
1308
|
+
}).should('provide the required w3c interfaces', function(){
|
1309
|
+
|
1310
|
+
expect(8);
|
1311
|
+
ok(history === window.history, "history is window.history");
|
1312
|
+
ok(history.length, 'history.length');
|
1313
|
+
ok(history.back, 'history.back');
|
1314
|
+
ok(history.forward, 'history.forward');
|
1315
|
+
ok(history.go, 'history.go');
|
1316
|
+
ok(history.item, 'history.item');
|
1317
|
+
|
1318
|
+
//these are generally secured properties of the history
|
1319
|
+
//object so we only check that the are defined since
|
1320
|
+
//trying to access them will throw an exception
|
1321
|
+
ok('current' in history, 'history.current');
|
1322
|
+
ok('previous' in history, 'history.previous');
|
1323
|
+
|
1324
|
+
});
|
1325
|
+
|
1326
|
+
})(QUnit);/**
|
1327
|
+
* @author thatcher
|
1328
|
+
*/
|
1329
|
+
|
1330
|
+
(function(Q){
|
1331
|
+
|
1332
|
+
Q.describe('Window Navigator',{
|
1333
|
+
|
1334
|
+
before:function(){
|
1335
|
+
//setup
|
1336
|
+
},
|
1337
|
+
after:function(){
|
1338
|
+
//tear down
|
1339
|
+
}
|
1340
|
+
|
1341
|
+
}).should('provide the required w3c interfaces', function(){
|
1342
|
+
|
1343
|
+
expect(24);
|
1344
|
+
ok(navigator === window.navigator, 'navigator is window.navigator');
|
1345
|
+
ok(navigator.userAgent, 'userAgent');
|
1346
|
+
ok(navigator.appCodeName, 'appCodeName');
|
1347
|
+
ok(navigator.appName, 'appName');
|
1348
|
+
ok(navigator.appVersion, 'appVersion');
|
1349
|
+
ok(navigator.language, 'language');
|
1350
|
+
ok(navigator.mimeTypes, 'mimeTypes');
|
1351
|
+
ok(navigator.platform, 'platform');
|
1352
|
+
ok(navigator.oscpu, 'oscpu');
|
1353
|
+
ok(navigator.product, 'product');
|
1354
|
+
ok(navigator.productSub, 'productSub');
|
1355
|
+
ok(navigator.plugins, 'plugins');
|
1356
|
+
ok(navigator.cookieEnabled, 'cookieEnabled');
|
1357
|
+
ok(navigator.buildID, 'buildID');
|
1358
|
+
ok(navigator.javaEnabled, 'javaEnabled');
|
1359
|
+
ok(navigator.taintEnabled, 'taintEnabled');
|
1360
|
+
ok(navigator.preference, 'preference');
|
1361
|
+
ok(navigator.geolocation, 'geolocation');
|
1362
|
+
ok(navigator.registerContentHandler, 'registerContentHandler');
|
1363
|
+
ok(navigator.registerProtocolHandler, 'registerProtocolHandler');
|
1364
|
+
|
1365
|
+
//several properties will throw a security exception if they
|
1366
|
+
//are accessed, so we only check that they exist
|
1367
|
+
ok("vendor" in navigator, 'vendor');
|
1368
|
+
ok("vendorSub" in navigator, 'vendorSub');
|
1369
|
+
ok("securityPolicy" in navigator, 'securityPolicy');
|
1370
|
+
ok("onLine" in navigator, 'onLine');
|
1371
|
+
|
1372
|
+
}).should('have the expected values', function(){
|
1373
|
+
|
1374
|
+
ok(navigator.userAgent, 'userAgent');
|
1375
|
+
ok(navigator.appCodeName, 'appCodeName');
|
1376
|
+
ok(navigator.appName, 'appName');
|
1377
|
+
ok(navigator.appVersion, 'appVersion');
|
1378
|
+
ok(navigator.language, 'language');
|
1379
|
+
ok(navigator.mimeTypes, 'mimeTypes');
|
1380
|
+
ok(navigator.platform, 'platform');
|
1381
|
+
ok(navigator.oscpu, 'oscpu');
|
1382
|
+
ok(navigator.product, 'product');
|
1383
|
+
ok(navigator.productSub, 'productSub');
|
1384
|
+
ok(navigator.plugins, 'plugins');
|
1385
|
+
ok(navigator.cookieEnabled, 'cookieEnabled');
|
1386
|
+
ok(navigator.buildID, 'buildID');
|
1387
|
+
ok(navigator.javaEnabled, 'javaEnabled');
|
1388
|
+
ok(navigator.taintEnabled, 'taintEnabled');
|
1389
|
+
ok(navigator.preference, 'preference');
|
1390
|
+
ok(navigator.geolocation, 'geolocation');
|
1391
|
+
ok(navigator.registerContentHandler, 'registerContentHandler');
|
1392
|
+
ok(navigator.registerProtocolHandler, 'registerProtocolHandler');
|
1393
|
+
|
1394
|
+
});
|
1395
|
+
|
1396
|
+
})(QUnit);/**
|
1397
|
+
* @author thatcher
|
1398
|
+
*/
|
1399
|
+
|
1400
|
+
(function(Q){
|
1401
|
+
|
1402
|
+
Q.describe('Window Timer',{
|
1403
|
+
|
1404
|
+
before:function(){
|
1405
|
+
//setup
|
1406
|
+
},
|
1407
|
+
after:function(){
|
1408
|
+
//tear down
|
1409
|
+
}
|
1410
|
+
|
1411
|
+
}).should('provide the required w3c interfaces', function(){
|
1412
|
+
|
1413
|
+
expect(4);
|
1414
|
+
ok(setTimeout, 'setTimeout');
|
1415
|
+
ok(setInterval, 'setInterval');
|
1416
|
+
ok(clearTimeout, 'clearTimeout');
|
1417
|
+
ok(clearInterval, 'clearInterval');
|
1418
|
+
|
1419
|
+
});
|
1420
|
+
|
1421
|
+
})(QUnit);/**
|
1422
|
+
* @author thatcher
|
1423
|
+
*/
|
1424
|
+
|
1425
|
+
(function(Q){
|
1426
|
+
|
1427
|
+
Q.describe('Window Event',{
|
1428
|
+
|
1429
|
+
before:function(){
|
1430
|
+
//setup
|
1431
|
+
},
|
1432
|
+
after:function(){
|
1433
|
+
//tear down
|
1434
|
+
}
|
1435
|
+
|
1436
|
+
}).should('provide the required w3c interfaces', function(){
|
1437
|
+
|
1438
|
+
expect(3);
|
1439
|
+
ok(addEventListener, 'addEventListener');
|
1440
|
+
ok(removeEventListener, 'removeEventListener');
|
1441
|
+
ok(dispatchEvent, 'dispatchEvent');
|
1442
|
+
|
1443
|
+
})
|
1444
|
+
|
1445
|
+
})(QUnit);/**
|
1446
|
+
* @author thatcher
|
1447
|
+
*/
|
1448
|
+
(function(Q){
|
1449
|
+
|
1450
|
+
Q.describe('Window CSS',{
|
1451
|
+
|
1452
|
+
before:function(){
|
1453
|
+
//setup
|
1454
|
+
},
|
1455
|
+
after:function(){
|
1456
|
+
//tear down
|
1457
|
+
}
|
1458
|
+
|
1459
|
+
}).should('provide the required w3c interfaces', function(){
|
1460
|
+
|
1461
|
+
expect(1);
|
1462
|
+
ok(window.getComputedStyle, 'window.getComputedStyle');
|
1463
|
+
|
1464
|
+
});
|
1465
|
+
|
1466
|
+
})(QUnit);
|
1467
|
+
|
1468
|
+
/**
|
1469
|
+
* @author thatcher
|
1470
|
+
*/
|
1471
|
+
(function(Q){
|
1472
|
+
|
1473
|
+
Q.describe('Window Screen',{
|
1474
|
+
|
1475
|
+
before:function(){
|
1476
|
+
//setup
|
1477
|
+
},
|
1478
|
+
after:function(){
|
1479
|
+
//tear down
|
1480
|
+
}
|
1481
|
+
|
1482
|
+
}).should('provide the required w3c interfaces', function(){
|
1483
|
+
|
1484
|
+
expect(18);
|
1485
|
+
ok(screen === window.screen , 'screen is window screen');
|
1486
|
+
ok("top" in screen, 'top');
|
1487
|
+
ok(screen.height, 'height');
|
1488
|
+
ok(screen.width, 'width');
|
1489
|
+
ok("left" in screen, 'left');
|
1490
|
+
ok(screen.pixelDepth, 'pixelDepth');
|
1491
|
+
ok(screen.colorDepth, 'colorDepth');
|
1492
|
+
ok(screen.availWidth, 'availWidth');
|
1493
|
+
ok(screen.availHeight, 'availHeight');
|
1494
|
+
ok("availLeft" in screen, 'availLeft');
|
1495
|
+
ok(screen.availTop, 'availTop');
|
1496
|
+
|
1497
|
+
//closely related function available at window
|
1498
|
+
ok(moveBy, 'moveBy');
|
1499
|
+
ok(moveTo, 'moveTo');
|
1500
|
+
ok(resizeBy, 'resizeBy');
|
1501
|
+
ok(resizeTo, 'resizeTo');
|
1502
|
+
ok(scroll, 'scroll');
|
1503
|
+
ok(scrollBy, 'scrollBy');
|
1504
|
+
ok(scrollTo, 'scrollTo');
|
1505
|
+
|
1506
|
+
});
|
1507
|
+
|
1508
|
+
})(QUnit);
|
1509
|
+
|
1510
|
+
/**
|
1511
|
+
* @author thatcher
|
1512
|
+
*/
|
1513
|
+
|
1514
|
+
(function(Q){
|
1515
|
+
|
1516
|
+
Q.describe('Window Dialog',{
|
1517
|
+
|
1518
|
+
before:function(){
|
1519
|
+
//setup
|
1520
|
+
},
|
1521
|
+
after:function(){
|
1522
|
+
//tear down
|
1523
|
+
}
|
1524
|
+
|
1525
|
+
}).should('provide the required w3c interfaces', function(){
|
1526
|
+
|
1527
|
+
expect(3);
|
1528
|
+
ok(alert, 'alert');
|
1529
|
+
ok(confirm, 'confirm');
|
1530
|
+
ok(prompt, 'prompt');
|
1531
|
+
|
1532
|
+
});
|
1533
|
+
|
1534
|
+
})(QUnit);
|
@@ -0,0 +1,46 @@
|
|
1
|
+
html{
|
2
|
+
background-color:#333;
|
3
|
+
}
|
4
|
+
body.container{
|
5
|
+
margin-top:20px;
|
6
|
+
border:none;
|
7
|
+
background-color:#333;
|
8
|
+
}
|
9
|
+
body.container strong {
|
10
|
+
text-transform:none;
|
11
|
+
}
|
12
|
+
h2#qunit-banner {
|
13
|
+
-moz-border-radius:30px;
|
14
|
+
padding:10px 10px 50px 10px;
|
15
|
+
text-align:center;
|
16
|
+
}
|
17
|
+
h2#qunit-banner.pass {
|
18
|
+
background-color:#66BB66;
|
19
|
+
text-align:center;
|
20
|
+
}
|
21
|
+
h2#qunit-banner #envjs-icon{
|
22
|
+
margin:5px 5px 0 20px;
|
23
|
+
}
|
24
|
+
h2#qunit-userAgent {
|
25
|
+
-moz-border-radius:0px;
|
26
|
+
background-color:#111;
|
27
|
+
color:white;
|
28
|
+
text-align:center;
|
29
|
+
margin:-40px 0 0 0;
|
30
|
+
padding:10px;
|
31
|
+
}
|
32
|
+
#qunit-test-summary{
|
33
|
+
-moz-border-radius-bottomleft:30px;
|
34
|
+
-moz-border-radius-bottomright:30px;
|
35
|
+
background-color:#338;
|
36
|
+
color:#99FFFF;
|
37
|
+
}
|
38
|
+
#qunit-tests{
|
39
|
+
background-color:#fff;
|
40
|
+
margin:0 0 40px;
|
41
|
+
padding:15px 60px;
|
42
|
+
}
|
43
|
+
p#qunit-testresult {
|
44
|
+
text-align:center;
|
45
|
+
padding:0 0 20px;
|
46
|
+
}
|
@@ -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('do something', 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,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>Envjs HTML5 Parser 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 HTML5 Parser 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>
|