smparkes-envjs 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +101 -0
- data/bin/envjsrb +147 -0
- data/bin/jquery-1.2.6-test.js +33 -0
- data/bin/jquery-1.3.1-test.js +33 -0
- data/bin/jquery-1.3.2-test.js +98 -0
- data/bin/prototype-1.6.0.3-test.js +82 -0
- data/bin/prototype_1.6.0.3_tmpl.txt +27 -0
- data/bin/test-jquery.sh +58 -0
- data/bin/test-prototype.sh +54 -0
- data/bin/tidy +0 -0
- data/lib/envjs/env.js +10423 -0
- data/lib/envjs/net/file.rb +71 -0
- data/lib/envjs/net.rb +3 -0
- data/lib/envjs/runtime.rb +132 -0
- data/lib/envjs/runtime.rb.smp +133 -0
- data/lib/envjs/tempfile.rb +24 -0
- data/lib/envjs.rb +23 -0
- data/test/call-load-test.js +17 -0
- data/test/debug.js +53 -0
- data/test/envjs-call-load-test.js +3 -0
- data/test/envjs-prototype.js +3 -0
- data/test/html/events.html +171 -0
- data/test/html/iframe1.html +46 -0
- data/test/html/iframe1a.html +46 -0
- data/test/html/iframe2.html +45 -0
- data/test/html/iframe3.html +30 -0
- data/test/html/iframeN.html +57 -0
- data/test/html/scope.html +87 -0
- data/test/html/trivial.html +19 -0
- data/test/html/with_js.html +26 -0
- data/test/index.html +304 -0
- data/test/java-prototype.js +9 -0
- data/test/primaryTests.js +26 -0
- data/test/prototype.js +15 -0
- data/test/qunit/package.json +21 -0
- data/test/qunit/qunit/qunit.css +17 -0
- data/test/qunit/qunit/qunit.js +997 -0
- data/test/qunit/qunit/qunit.js.smp +1002 -0
- data/test/qunit/test/index.html +17 -0
- data/test/qunit/test/same.js +1368 -0
- data/test/qunit/test/test.js +136 -0
- data/test/qunit.js +61 -0
- data/test/qunit.smp/package.json +21 -0
- data/test/qunit.smp/qunit/qunit.css +17 -0
- data/test/qunit.smp/qunit/qunit.js +997 -0
- data/test/qunit.smp/test/index.html +17 -0
- data/test/qunit.smp/test/same.js +1368 -0
- data/test/qunit.smp/test/test.js +136 -0
- data/test/rhino-call-load-test.js +5 -0
- data/test/test-with-envs-jar.js +8 -0
- data/test/test-with-rhino-jar.js +9 -0
- data/test/unit/dom.js +43 -0
- data/test/unit/elementmembers.js +29 -0
- data/test/unit/events.js +195 -0
- data/test/unit/fixtures/external_script.js +1 -0
- data/test/unit/iframe.js +234 -0
- data/test/unit/multi-window.js +212 -0
- data/test/unit/onload.js +82 -0
- data/test/unit/parser.js +113 -0
- data/test/unit/prototypecompat.js +22 -0
- data/test/unit/proxy.js +6 -0
- data/test/unit/scope.js +209 -0
- data/test/unit/timer.js +115 -0
- data/test/unit/window.js +41 -0
- data/test/vendor/jQuery/README +2 -0
- data/test/vendor/prototype-1.6.0.3.js +4320 -0
- metadata +130 -0
@@ -0,0 +1,136 @@
|
|
1
|
+
test("module without setup/teardown (default)", function() {
|
2
|
+
expect(1);
|
3
|
+
ok(true);
|
4
|
+
});
|
5
|
+
|
6
|
+
test("expect in test", 3, function() {
|
7
|
+
ok(true);
|
8
|
+
ok(true);
|
9
|
+
ok(true);
|
10
|
+
});
|
11
|
+
|
12
|
+
test("expect in test", 1, function() {
|
13
|
+
ok(true);
|
14
|
+
});
|
15
|
+
|
16
|
+
module("setup test", {
|
17
|
+
setup: function() {
|
18
|
+
ok(true);
|
19
|
+
}
|
20
|
+
});
|
21
|
+
|
22
|
+
test("module with setup", function() {
|
23
|
+
expect(2);
|
24
|
+
ok(true);
|
25
|
+
});
|
26
|
+
|
27
|
+
var state;
|
28
|
+
|
29
|
+
module("setup/teardown test", {
|
30
|
+
setup: function() {
|
31
|
+
state = true;
|
32
|
+
ok(true);
|
33
|
+
},
|
34
|
+
teardown: function() {
|
35
|
+
ok(true);
|
36
|
+
}
|
37
|
+
});
|
38
|
+
|
39
|
+
test("module with setup/teardown", function() {
|
40
|
+
expect(3);
|
41
|
+
ok(true);
|
42
|
+
});
|
43
|
+
|
44
|
+
module("setup/teardown test 2");
|
45
|
+
|
46
|
+
test("module without setup/teardown", function() {
|
47
|
+
expect(1);
|
48
|
+
ok(true);
|
49
|
+
});
|
50
|
+
|
51
|
+
if (typeof setTimeout !== 'undefined') {
|
52
|
+
state = 'fail';
|
53
|
+
|
54
|
+
module("teardown and stop", {
|
55
|
+
teardown: function() {
|
56
|
+
equals(state, "done", "Test teardown.");
|
57
|
+
}
|
58
|
+
});
|
59
|
+
|
60
|
+
test("teardown must be called after test ended", function() {
|
61
|
+
expect(1);
|
62
|
+
stop();
|
63
|
+
setTimeout(function() {
|
64
|
+
state = "done";
|
65
|
+
start();
|
66
|
+
}, 13);
|
67
|
+
});
|
68
|
+
} // end setTimeout tests
|
69
|
+
|
70
|
+
if (typeof asyncTest !== 'undefined') {
|
71
|
+
module("asyncTest");
|
72
|
+
|
73
|
+
asyncTest("asyncTest", function() {
|
74
|
+
expect(2);
|
75
|
+
ok(true);
|
76
|
+
setTimeout(function() {
|
77
|
+
state = "done";
|
78
|
+
ok(true);
|
79
|
+
start();
|
80
|
+
}, 13);
|
81
|
+
});
|
82
|
+
|
83
|
+
asyncTest("asyncTest", 2, function() {
|
84
|
+
ok(true);
|
85
|
+
setTimeout(function() {
|
86
|
+
state = "done";
|
87
|
+
ok(true);
|
88
|
+
start();
|
89
|
+
}, 13);
|
90
|
+
});
|
91
|
+
} // end asyncTest tests
|
92
|
+
|
93
|
+
module("save scope", {
|
94
|
+
setup: function() {
|
95
|
+
this.foo = "bar";
|
96
|
+
},
|
97
|
+
teardown: function() {
|
98
|
+
same(this.foo, "bar");
|
99
|
+
}
|
100
|
+
});
|
101
|
+
test("scope check", function() {
|
102
|
+
expect(2);
|
103
|
+
same(this.foo, "bar");
|
104
|
+
});
|
105
|
+
|
106
|
+
module("simple testEnvironment setup", {
|
107
|
+
foo: "bar",
|
108
|
+
bugid: "#5311" // example of meta-data
|
109
|
+
});
|
110
|
+
test("scope check", function() {
|
111
|
+
same(this.foo, "bar");
|
112
|
+
});
|
113
|
+
test("modify testEnvironment",function() {
|
114
|
+
this.foo="hamster";
|
115
|
+
});
|
116
|
+
test("testEnvironment reset for next test",function() {
|
117
|
+
same(this.foo, "bar");
|
118
|
+
});
|
119
|
+
|
120
|
+
module("testEnvironment with object", {
|
121
|
+
options:{
|
122
|
+
recipe:"soup",
|
123
|
+
ingredients:["hamster","onions"]
|
124
|
+
}
|
125
|
+
});
|
126
|
+
test("scope check", function() {
|
127
|
+
same(this.options, {recipe:"soup",ingredients:["hamster","onions"]}) ;
|
128
|
+
});
|
129
|
+
test("modify testEnvironment",function() {
|
130
|
+
// since we do a shallow copy, the testEnvironment can be modified
|
131
|
+
this.options.ingredients.push("carrots");
|
132
|
+
});
|
133
|
+
test("testEnvironment reset for next test",function() {
|
134
|
+
same(this.options, {recipe:"soup",ingredients:["hamster","onions","carrots"]}, "Is this a bug or a feature? Could do a deep copy") ;
|
135
|
+
});
|
136
|
+
|
data/test/qunit.js
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
load("test/qunit/qunit/qunit.js");
|
2
|
+
|
3
|
+
(function(){
|
4
|
+
var assertion_index = 0;
|
5
|
+
|
6
|
+
var module_index = 0;
|
7
|
+
var module;
|
8
|
+
|
9
|
+
var test_index = 0;
|
10
|
+
var test;
|
11
|
+
|
12
|
+
QUnit.moduleStart = function(m,te) {
|
13
|
+
module = m;
|
14
|
+
module_index++;
|
15
|
+
};
|
16
|
+
|
17
|
+
QUnit.moduleDone = function(t,f,tx) {
|
18
|
+
var s = module_index + ". module "+t+": ";
|
19
|
+
if ( f ) {
|
20
|
+
s += f + " failure(s) in " + tx + " tests";
|
21
|
+
} else {
|
22
|
+
s += "all " + tx + " tests successful";
|
23
|
+
}
|
24
|
+
// print(s);
|
25
|
+
module = undefined;
|
26
|
+
};
|
27
|
+
|
28
|
+
QUnit.testStart = function(t) {
|
29
|
+
test = t;
|
30
|
+
test_index++;
|
31
|
+
};
|
32
|
+
|
33
|
+
QUnit.testDone = function(t) {
|
34
|
+
test = undefined;
|
35
|
+
}
|
36
|
+
|
37
|
+
QUnit.log = function(r,m) {
|
38
|
+
assertion_index++;
|
39
|
+
var test_string = "";
|
40
|
+
if ( module || test ) {
|
41
|
+
var test_string = "[";
|
42
|
+
if ( module ) {
|
43
|
+
test_string += module;
|
44
|
+
if ( test ) {
|
45
|
+
test_string += ": ";
|
46
|
+
}
|
47
|
+
}
|
48
|
+
if ( test ) {
|
49
|
+
test_string += test;
|
50
|
+
}
|
51
|
+
test_string += "] ";
|
52
|
+
}
|
53
|
+
var s = ( r ? "PASS (" : "FAIL (" ) + assertion_index + ") " + test_string + m;
|
54
|
+
print(s);
|
55
|
+
};
|
56
|
+
|
57
|
+
QUnit.done = function(f,t) {
|
58
|
+
print((t-f) + " Passed, " + f + " Failed, " + t + " Total Tests" );
|
59
|
+
};
|
60
|
+
|
61
|
+
})(QUnit);
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"name": "qunit",
|
3
|
+
"author": {
|
4
|
+
"name": "John Resig",
|
5
|
+
"email": "jeresig@gmail.com",
|
6
|
+
"url": "http://ejohn.org/"
|
7
|
+
},
|
8
|
+
"maintainer": {
|
9
|
+
"name": "Jörn Zaefferer",
|
10
|
+
"email": "joern.zaefferer@googlemail.com",
|
11
|
+
"url": "http://bassistance.de/"
|
12
|
+
},
|
13
|
+
"url": "http://docs.jquery.com/QUnit",
|
14
|
+
"license": {
|
15
|
+
"name": "MIT",
|
16
|
+
"url": "http://www.opensource.org/licenses/mit-license.php"
|
17
|
+
},
|
18
|
+
"description": "An easy-to-use JavaScript Unit Testing framework.",
|
19
|
+
"keywords": [ "testing", "unit", "jquery" ],
|
20
|
+
"lib": "qunit"
|
21
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
h1#qunit-header { padding: 15px; font-size: large; background-color: #06b; color: white; font-family: 'trebuchet ms', verdana, arial; margin: 0; }
|
2
|
+
h1#qunit-header a { color: white; }
|
3
|
+
|
4
|
+
h2#qunit-banner { height: 2em; border-bottom: 1px solid white; background-color: #eee; margin: 0; font-family: 'trebuchet ms', verdana, arial; }
|
5
|
+
h2#qunit-banner.pass { background-color: green; }
|
6
|
+
h2#qunit-banner.fail { background-color: red; }
|
7
|
+
|
8
|
+
h2#qunit-userAgent { padding: 10px; background-color: #eee; color: black; margin: 0; font-size: small; font-weight: normal; font-family: 'trebuchet ms', verdana, arial; font-size: 10pt; }
|
9
|
+
|
10
|
+
div#qunit-testrunner-toolbar { background: #eee; border-top: 1px solid black; padding: 10px; font-family: 'trebuchet ms', verdana, arial; margin: 0; font-size: 10pt; }
|
11
|
+
|
12
|
+
ol#qunit-tests { font-family: 'trebuchet ms', verdana, arial; font-size: 10pt; }
|
13
|
+
ol#qunit-tests li strong { cursor:pointer; }
|
14
|
+
ol#qunit-tests .pass { color: green; }
|
15
|
+
ol#qunit-tests .fail { color: red; }
|
16
|
+
|
17
|
+
p#qunit-testresult { margin-left: 1em; font-size: 10pt; font-family: 'trebuchet ms', verdana, arial; }
|