newjs 1.5.1 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +11 -0
- data/Manifest.txt +162 -14
- data/{README.txt → README.rdoc} +1 -1
- data/Rakefile +25 -3
- data/app_generators/newjs_iphone/templates/Html/test/assets/jsunittest.js +41 -13
- data/app_generators/newjs_iphone/templates/Html/test/assets/unittest.css +4 -0
- data/features/development.feature +13 -0
- data/features/imported_files_for_generators.feature +19 -0
- data/features/steps/common.rb +205 -0
- data/features/steps/env.rb +6 -0
- data/javascript_test_generators/functional_test/functional_test_generator.rb +9 -1
- data/javascript_test_generators/functional_test/templates/test/assets/jshoulda.js +186 -0
- data/javascript_test_generators/functional_test/templates/test/test.html.erb +15 -1
- data/javascript_test_generators/unit_test/templates/test/assets/jshoulda.js +186 -0
- data/javascript_test_generators/unit_test/templates/test/test.html.erb +18 -20
- data/javascript_test_generators/unit_test/templates/test/test_jshoulda.html.erb +45 -0
- data/javascript_test_generators/unit_test/unit_test_generator.rb +11 -3
- data/lib/newjs.rb +3 -2
- data/newjs_iphone_generators/page/USAGE +5 -0
- data/newjs_iphone_generators/page/page_generator.rb +36 -0
- data/newjs_iphone_generators/page/templates/src/name.css.erb +0 -0
- data/newjs_iphone_generators/page/templates/src/name.html.erb +13 -0
- data/newjs_iphone_generators/page/templates/src/name.js.erb +4 -0
- data/newjs_iphone_generators/page/templates/test/fixtures/name.js.erb +5 -0
- data/newjs_iphone_generators/page/templates/test/unit/name_test.html.erb +61 -0
- data/rack_generators/javascript_test/USAGE +5 -0
- data/rack_generators/javascript_test/javascript_test_generator.rb +88 -0
- data/rack_generators/javascript_test/templates/assets/jshoulda.js +186 -0
- data/rack_generators/javascript_test/templates/assets/jsunittest.js +1004 -0
- data/rack_generators/javascript_test/templates/assets/unittest.css +54 -0
- data/rack_generators/javascript_test/templates/ext/jquery.js +3408 -0
- data/{app_generators/newjs_iphone/templates/Html/test/assets → rack_generators/javascript_test/templates/ext}/prototype.js +56 -122
- data/rack_generators/javascript_test/templates/library.js.erb +3 -0
- data/rack_generators/javascript_test/templates/test.html.erb +59 -0
- data/rack_generators/javascript_test/templates/test_jshoulda.html.erb +48 -0
- data/rails_generators/javascript_test/javascript_test_generator.rb +15 -3
- data/rails_generators/javascript_test/templates/assets/jshoulda.js +186 -0
- data/rails_generators/javascript_test/templates/test_jshoulda.html.erb +48 -0
- data/script/console +10 -0
- data/script/destroy +1 -1
- data/tasks/vendor/update/jshoulda.rake +18 -0
- data/tasks/vendor/update/jsunittest.rake +18 -0
- data/test/test_functional_test_generator.rb +13 -0
- data/test/test_generator_helper.rb +10 -1
- data/test/test_page_generator.rb +50 -0
- data/test/test_rack_javascript_test.rb +166 -0
- data/test/{test_javascript_test_generator.rb → test_rails_javascript_test_generator.rb} +15 -1
- data/test/test_unit_test_generator.rb +13 -0
- data/vendor/jshoulda/History.txt +108 -0
- data/vendor/jshoulda/License.txt +20 -0
- data/vendor/jshoulda/README.mdown +34 -0
- data/vendor/jshoulda/Rakefile +120 -0
- data/vendor/jshoulda/config/javascript_test_autotest.yml.sample +15 -0
- data/vendor/jshoulda/dist/jshoulda-0.0.1.js +62 -0
- data/vendor/jshoulda/dist/jshoulda-0.0.2.js +72 -0
- data/vendor/jshoulda/dist/jshoulda-0.0.3.js +72 -0
- data/vendor/jshoulda/dist/jshoulda-1.0.1.js +74 -0
- data/vendor/jshoulda/dist/jshoulda-1.0.js +72 -0
- data/vendor/jshoulda/dist/jshoulda-1.1.js +110 -0
- data/vendor/jshoulda/dist/jshoulda-1.2.1.js +186 -0
- data/vendor/jshoulda/dist/jshoulda-1.2.js +141 -0
- data/vendor/jshoulda/dist/jshoulda-1.2.x.js +142 -0
- data/vendor/jshoulda/dist/jshoulda.js +186 -0
- data/vendor/jshoulda/jshoulda/test/basic_test.html +42 -0
- data/vendor/jshoulda/lib/jstest.rb +382 -0
- data/vendor/jshoulda/lib/protodoc.rb +36 -0
- data/vendor/jshoulda/script/destroy +14 -0
- data/vendor/jshoulda/script/generate +14 -0
- data/vendor/jshoulda/script/js_autotest +1 -0
- data/vendor/jshoulda/script/rstakeout +97 -0
- data/vendor/jshoulda/site/asset_defaults.yaml +6 -0
- data/vendor/jshoulda/site/config.yaml +3 -0
- data/vendor/jshoulda/site/content/content.html +27 -0
- data/vendor/jshoulda/site/content/content.yaml +4 -0
- data/vendor/jshoulda/site/content/tutorial/tutorial.html +268 -0
- data/vendor/jshoulda/site/content/tutorial/tutorial.yaml +4 -0
- data/vendor/jshoulda/site/css/blackboard.css +88 -0
- data/vendor/jshoulda/site/css/jshoulda_site.css +33 -0
- data/vendor/jshoulda/site/css/unittest.css +42 -0
- data/vendor/jshoulda/site/example/minimal.html +55 -0
- data/vendor/jshoulda/site/js/editable.js +42 -0
- data/vendor/jshoulda/site/layouts/default/default.html +29 -0
- data/vendor/jshoulda/site/layouts/default/default.yaml +4 -0
- data/vendor/jshoulda/site/layouts/home_test/home_test.js +18 -0
- data/vendor/jshoulda/site/layouts/home_test/home_test.yaml +4 -0
- data/vendor/jshoulda/site/lib/analytics.rb +12 -0
- data/vendor/jshoulda/site/lib/default.rb +2 -0
- data/vendor/jshoulda/site/lib/example.rb +10 -0
- data/vendor/jshoulda/site/lib/hash.rb +11 -0
- data/vendor/jshoulda/site/lib/highlight.rb +17 -0
- data/vendor/jshoulda/site/page_defaults.yaml +10 -0
- data/vendor/jshoulda/site/templates/default/default.html +1 -0
- data/vendor/jshoulda/site/templates/default/default.yaml +4 -0
- data/vendor/jshoulda/src/HEADER +8 -0
- data/vendor/jshoulda/src/jshoulda.js +177 -0
- data/vendor/jshoulda/src/jshoulda.js.erb +3 -0
- data/vendor/jshoulda/tasks/bundle.rake +12 -0
- data/vendor/jshoulda/tasks/demo.rake +9 -0
- data/vendor/jshoulda/tasks/deploy.rake +29 -0
- data/{tasks → vendor/jshoulda/tasks}/environment.rake +0 -0
- data/vendor/jshoulda/tasks/javascript_test_autotest_tasks.rake +45 -0
- data/vendor/jshoulda/tasks/site.rake +74 -0
- data/vendor/jshoulda/test/assets/jsunittest.js +1004 -0
- data/vendor/jshoulda/test/assets/prototype.js +4324 -0
- data/{app_generators/newjs_iphone/templates/Html/test/assets/unittest.js → vendor/jshoulda/test/assets/prototype_unittest.js} +15 -9
- data/vendor/jshoulda/test/assets/unittest.css +50 -0
- data/vendor/jshoulda/test/unit/factory_test.html +82 -0
- data/vendor/jshoulda/test/unit/jshoulda2_test.html +85 -0
- data/vendor/jshoulda/test/unit/jshoulda_prototype_test.html +87 -0
- data/vendor/jshoulda/test/unit/jshoulda_test.html +86 -0
- data/vendor/jshoulda/test/unit/merge_methods_test.html +77 -0
- data/vendor/jshoulda/test/unit/names_and_count.html +68 -0
- data/vendor/jshoulda/test/unit/no_config_test.html +57 -0
- data/vendor/jshoulda/test/unit/styles_test.html +77 -0
- data/vendor/jshoulda/test/unit/unify_runners.html +69 -0
- data/vendor/jshoulda/test/unit/unnamed_context_test.html +67 -0
- data/vendor/jsunittest/Capfile +4 -0
- data/vendor/jsunittest/History.txt +37 -0
- data/{License.txt → vendor/jsunittest/License.txt} +0 -0
- data/vendor/jsunittest/README.txt +21 -0
- data/vendor/jsunittest/Rakefile +118 -0
- data/vendor/jsunittest/config/deploy.rb +20 -0
- data/vendor/jsunittest/config/website.yml.sample +2 -0
- data/vendor/jsunittest/dist/jsunittest-0.7.2.js +1004 -0
- data/vendor/jsunittest/dist/jsunittest.js +1004 -0
- data/vendor/jsunittest/dist/unittest.css +54 -0
- data/vendor/jsunittest/lib/jstest.rb +390 -0
- data/vendor/jsunittest/lib/protodoc.rb +36 -0
- data/vendor/jsunittest/script/destroy +14 -0
- data/vendor/jsunittest/script/generate +14 -0
- data/vendor/jsunittest/script/js_autotest +1 -0
- data/vendor/jsunittest/script/rstakeout +97 -0
- data/vendor/jsunittest/script/txt2html +75 -0
- data/vendor/jsunittest/src/HEADER +8 -0
- data/vendor/jsunittest/src/ajax.js +121 -0
- data/vendor/jsunittest/src/assertions.js +244 -0
- data/vendor/jsunittest/src/common.js +191 -0
- data/vendor/jsunittest/src/jsunittest.js +1004 -0
- data/vendor/jsunittest/src/logger.js +86 -0
- data/vendor/jsunittest/src/message_template.js +17 -0
- data/vendor/jsunittest/src/orig/unittest.js +484 -0
- data/vendor/jsunittest/src/prototype/event.js +72 -0
- data/vendor/jsunittest/src/prototype/template.js +33 -0
- data/vendor/jsunittest/src/runner.js +120 -0
- data/vendor/jsunittest/src/test_case.js +106 -0
- data/vendor/jsunittest/tasks/deploy.rake +29 -0
- data/vendor/jsunittest/tasks/environment.rake +7 -0
- data/vendor/jsunittest/tasks/javascript_test_autotest_tasks.rake +44 -0
- data/vendor/jsunittest/tasks/tmbundle.rake +24 -0
- data/vendor/jsunittest/tasks/website.rake +53 -0
- data/vendor/jsunittest/test/assets/example_test.html +50 -0
- data/{app_generators/newjs/templates → vendor/jsunittest}/test/assets/prototype.js +0 -0
- data/vendor/jsunittest/test/assets/unittest.css +54 -0
- data/{app_generators/newjs/templates → vendor/jsunittest}/test/assets/unittest.js +0 -0
- data/vendor/jsunittest/test/functional/jsunittest_test.html +209 -0
- data/vendor/jsunittest/test/unit/assertions_test.html +202 -0
- data/vendor/jsunittest/test/unit/common_test.html +61 -0
- data/vendor/jsunittest/test/unit/logger_test.html +98 -0
- data/vendor/jsunittest/test/unit/message_template_test.html +44 -0
- data/vendor/jsunittest/test/unit/runner_test.html +77 -0
- data/vendor/jsunittest/test/unit/template_test.html +57 -0
- data/vendor/jsunittest/test/unit/test_case_test.html +97 -0
- data/vendor/jsunittest/website/dist/jsunittest-0.7.2.js +1004 -0
- data/vendor/jsunittest/website/dist/jsunittest-getting-started.tar.gz +0 -0
- data/vendor/jsunittest/website/dist/jsunittest-getting-started.zip +0 -0
- data/vendor/jsunittest/website/dist/jsunittest-getting-started/assets/jsunittest.js +1004 -0
- data/vendor/jsunittest/website/dist/jsunittest-getting-started/assets/unittest.css +54 -0
- data/vendor/jsunittest/website/dist/jsunittest-getting-started/example_test.html +50 -0
- data/vendor/jsunittest/website/dist/jsunittest.js +1004 -0
- data/vendor/jsunittest/website/images/logo_bundle.png +0 -0
- data/vendor/jsunittest/website/images/passing_prototypejs_unittest_tests.jpg +0 -0
- data/vendor/jsunittest/website/index.html +94 -0
- data/vendor/jsunittest/website/index.txt +80 -0
- data/vendor/jsunittest/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/vendor/jsunittest/website/stylesheets/screen.css +138 -0
- data/vendor/jsunittest/website/template.html.erb +46 -0
- data/vendor/jsunittest/website/tmbundle/JavaScript Unit Testing.tmbundle.tar.gz +0 -0
- metadata +189 -24
- data/config/hoe.rb +0 -75
- data/config/requirements.rb +0 -17
- data/lib/newjs/version.rb +0 -9
- data/tasks/deployment.rake +0 -34
- data/tasks/jsunittest/update.rake +0 -18
- data/tasks/website.rake +0 -17
@@ -0,0 +1,88 @@
|
|
1
|
+
pre.blackboard .LatexSupport {
|
2
|
+
color: #FBDE2D;
|
3
|
+
}
|
4
|
+
pre.blackboard .OcamlInfixOperator {
|
5
|
+
color: #8DA6CE;
|
6
|
+
}
|
7
|
+
pre.blackboard .MetaFunctionCallPy {
|
8
|
+
color: #BECDE6;
|
9
|
+
}
|
10
|
+
pre.blackboard .Superclass {
|
11
|
+
color: #FF6400;
|
12
|
+
font-style: italic;
|
13
|
+
}
|
14
|
+
pre.blackboard .Constant {
|
15
|
+
color: #D8FA3C;
|
16
|
+
}
|
17
|
+
pre.blackboard {
|
18
|
+
background-color: #0C1021;
|
19
|
+
color: #F8F8F8;
|
20
|
+
}
|
21
|
+
pre.blackboard .OcamlFPConstant {
|
22
|
+
text-decoration: underline;
|
23
|
+
}
|
24
|
+
pre.blackboard .OcamlFPInfixOperator {
|
25
|
+
text-decoration: underline;
|
26
|
+
}
|
27
|
+
pre.blackboard .Support {
|
28
|
+
color: #8DA6CE;
|
29
|
+
}
|
30
|
+
pre.blackboard .OcamlOperator {
|
31
|
+
color: #F8F8F8;
|
32
|
+
}
|
33
|
+
pre.blackboard .Storage {
|
34
|
+
color: #FBDE2D;
|
35
|
+
}
|
36
|
+
pre.blackboard .line-numbers {
|
37
|
+
background-color: #253B76;
|
38
|
+
color: #FFFFFF;
|
39
|
+
}
|
40
|
+
pre.blackboard .StringInterpolation {
|
41
|
+
color: #FF6400;
|
42
|
+
}
|
43
|
+
pre.blackboard .InvalidIllegal {
|
44
|
+
background-color: #9D1E15;
|
45
|
+
color: #F8F8F8;
|
46
|
+
}
|
47
|
+
pre.blackboard .PlistUnquotedString {
|
48
|
+
color: #FFFFFF;
|
49
|
+
}
|
50
|
+
pre.blackboard .OcamlVariant {
|
51
|
+
color: #D5E0F3;
|
52
|
+
}
|
53
|
+
pre.blackboard .MetaTag {
|
54
|
+
color: #7F90AA;
|
55
|
+
}
|
56
|
+
pre.blackboard .LatexEnvironment {
|
57
|
+
background-color: #F7F7F8;
|
58
|
+
}
|
59
|
+
pre.blackboard .OcamlFPPrefixOperator {
|
60
|
+
text-decoration: underline;
|
61
|
+
}
|
62
|
+
pre.blackboard .OcamlPrefixOperator {
|
63
|
+
color: #8DA6CE;
|
64
|
+
}
|
65
|
+
pre.blackboard .EntityNameSection {
|
66
|
+
color: #FFFFFF;
|
67
|
+
}
|
68
|
+
pre.blackboard .String {
|
69
|
+
color: #61CE3C;
|
70
|
+
}
|
71
|
+
pre.blackboard .Keyword {
|
72
|
+
color: #FBDE2D;
|
73
|
+
}
|
74
|
+
pre.blackboard .LatexEnvironmentNested {
|
75
|
+
background-color: #7691F3;
|
76
|
+
}
|
77
|
+
pre.blackboard .InvalidDeprecated {
|
78
|
+
color: #AB2A1D;
|
79
|
+
font-style: italic;
|
80
|
+
}
|
81
|
+
pre.blackboard .Variable {
|
82
|
+
}
|
83
|
+
pre.blackboard .Entity {
|
84
|
+
color: #FF6400;
|
85
|
+
}
|
86
|
+
pre.blackboard .Comment {
|
87
|
+
color: #AEAEAE;
|
88
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
body {
|
2
|
+
width: 40em;
|
3
|
+
margin: 0 auto;
|
4
|
+
background: #fff0ef;
|
5
|
+
color: #200;
|
6
|
+
font: 1em/1.5 lucida grande, sans-serif;
|
7
|
+
}
|
8
|
+
|
9
|
+
pre {
|
10
|
+
background: #222;
|
11
|
+
color: #6f6;
|
12
|
+
padding: 1em;
|
13
|
+
overflow: auto;
|
14
|
+
}
|
15
|
+
|
16
|
+
p.download {
|
17
|
+
text-align: center;
|
18
|
+
margin: 2em 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
p.download a {
|
22
|
+
background: #eed0e0;
|
23
|
+
border: 2px solid #930;
|
24
|
+
padding: 1em;
|
25
|
+
}
|
26
|
+
|
27
|
+
a {
|
28
|
+
color: #930;
|
29
|
+
}
|
30
|
+
|
31
|
+
a:visited {
|
32
|
+
color: #333;
|
33
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#log {
|
2
|
+
padding-bottom: 1em;
|
3
|
+
border-bottom: 2px solid #000;
|
4
|
+
margin-bottom: 2em;
|
5
|
+
}
|
6
|
+
|
7
|
+
.logsummary {
|
8
|
+
margin-top: 1em;
|
9
|
+
margin-bottom: 1em;
|
10
|
+
padding: 1ex;
|
11
|
+
border: 1px solid #000;
|
12
|
+
font-weight: bold;
|
13
|
+
}
|
14
|
+
|
15
|
+
.logtable {
|
16
|
+
width:100%;
|
17
|
+
border-collapse: collapse;
|
18
|
+
border: 1px dotted #666;
|
19
|
+
}
|
20
|
+
|
21
|
+
.logtable td, .logtable th {
|
22
|
+
text-align: left;
|
23
|
+
padding: 3px 8px;
|
24
|
+
border: 1px dotted #666;
|
25
|
+
}
|
26
|
+
|
27
|
+
.logtable .passed {
|
28
|
+
background-color: #cfc;
|
29
|
+
}
|
30
|
+
|
31
|
+
.logtable .failed, .logtable .error {
|
32
|
+
background-color: #fcc;
|
33
|
+
}
|
34
|
+
|
35
|
+
.logtable td div.action_buttons {
|
36
|
+
display: inline;
|
37
|
+
}
|
38
|
+
|
39
|
+
.logtable td div.action_buttons input {
|
40
|
+
margin: 0 5px;
|
41
|
+
font-size: 10px;
|
42
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
7
|
+
|
8
|
+
<title>Minimal jShoulda unit test</title>
|
9
|
+
|
10
|
+
<script src="/js/jsunittest.js" type="text/javascript"></script>
|
11
|
+
<script src="/js/jshoulda.js" type="text/javascript"></script>
|
12
|
+
<link rel="stylesheet" href="/css/unittest.css" type="text/css" media="screen"/>
|
13
|
+
</head>
|
14
|
+
|
15
|
+
<body>
|
16
|
+
<h1>Minimal jShoulda unit test</h1>
|
17
|
+
|
18
|
+
<div id="testlog">
|
19
|
+
Your tests results are shown by default
|
20
|
+
in the element whose id is testlog.
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<script type="text/javascript">
|
24
|
+
// testing code must appear **after** the #testlog element
|
25
|
+
// the script may be included inline or referenced
|
26
|
+
|
27
|
+
// auxiliar function
|
28
|
+
function scriptExists(file) {
|
29
|
+
var scripts = document.getElementsByTagName('script');
|
30
|
+
var script;
|
31
|
+
for (var i = 0; i < scripts.length; i += 1) {
|
32
|
+
script = scripts[i];
|
33
|
+
if (script.src && script.src.indexOf(file) == script.src.length - file.length) {
|
34
|
+
return true;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
return false;
|
38
|
+
}
|
39
|
+
|
40
|
+
// our testing code
|
41
|
+
context('A minimal test', {
|
42
|
+
// setup and teardown functions are optional
|
43
|
+
},
|
44
|
+
should('include a call to jsunittest.js', function() {
|
45
|
+
this.assertEqual(true, scriptExists('jsunittest.js'));
|
46
|
+
}),
|
47
|
+
should('include a call to jshoulda.js', function() {
|
48
|
+
this.assertEqual(true, scriptExists('jshoulda.js'));
|
49
|
+
})
|
50
|
+
)();
|
51
|
+
|
52
|
+
</script>
|
53
|
+
|
54
|
+
</body>
|
55
|
+
</html>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
Test.Event.addEvent(window, 'load', function() {
|
2
|
+
var editable = document.getElementById('editable-test');
|
3
|
+
editable.title = 'Double click to edit';
|
4
|
+
var button = document.createElement('input');
|
5
|
+
button.type = 'button';
|
6
|
+
button.value = 'Run tests';
|
7
|
+
button.onclick = function() {
|
8
|
+
var ta = document.getElementById('editable-test');
|
9
|
+
var is_textarea = ta.tagName.toLowerCase() == 'textarea';
|
10
|
+
var code;
|
11
|
+
if (is_textarea) {
|
12
|
+
code = ta.value;
|
13
|
+
}
|
14
|
+
else {
|
15
|
+
code = stripTags(ta.getElementsByTagName('code')[0].innerHTML);
|
16
|
+
}
|
17
|
+
try {
|
18
|
+
var tr = eval(code);
|
19
|
+
tr.runTests();
|
20
|
+
} catch(ex) {
|
21
|
+
alert(ex.name + ': ' + ex.message);
|
22
|
+
}
|
23
|
+
};
|
24
|
+
editable.parentNode.insertBefore(button, editable.nextSibling);
|
25
|
+
editable.ondblclick = function() {
|
26
|
+
var content = this.getElementsByTagName('code')[0].innerHTML;
|
27
|
+
content = stripTags(content);
|
28
|
+
var ta = document.createElement('textarea');
|
29
|
+
ta.id = 'editable-test';
|
30
|
+
ta.style.width = editable.offsetWidth + 'px';
|
31
|
+
ta.style.height = editable.offsetHeight + 'px';
|
32
|
+
ta.cols = 40;
|
33
|
+
ta.value = content;
|
34
|
+
this.parentNode.insertBefore(ta, this);
|
35
|
+
this.parentNode.removeChild(this);
|
36
|
+
};
|
37
|
+
|
38
|
+
function stripTags(input) {
|
39
|
+
return input.replace(/<\/?[^>]*>/g, '')
|
40
|
+
}
|
41
|
+
});
|
42
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
7
|
+
|
8
|
+
<title><%= @page.title %></title>
|
9
|
+
|
10
|
+
<% if @page.path == '/' %>
|
11
|
+
<script src="/js/jsunittest.js" type="text/javascript"></script>
|
12
|
+
<script src="/js/editable.js" type="text/javascript"></script>
|
13
|
+
<script src="/js/jshoulda.js" type="text/javascript"></script>
|
14
|
+
<link rel="stylesheet" href="/css/unittest.css" type="text/css" media="screen"/>
|
15
|
+
<% end %>
|
16
|
+
<link rel="stylesheet" href="/css/jshoulda_site.css" type="text/css" media="screen"/>
|
17
|
+
<link rel="stylesheet" href="/css/blackboard.css" type="text/css" media="screen"/>
|
18
|
+
</head>
|
19
|
+
|
20
|
+
<body>
|
21
|
+
|
22
|
+
<h1><%= @page.title %></h1>
|
23
|
+
|
24
|
+
<%= @page.content %>
|
25
|
+
|
26
|
+
<%= analytics %>
|
27
|
+
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
context('A test', {
|
2
|
+
setup: function() {
|
3
|
+
this.foo = 1;
|
4
|
+
}
|
5
|
+
},
|
6
|
+
should('run its setup functions', function() {
|
7
|
+
this.assertEqual(1, this.foo);
|
8
|
+
}),
|
9
|
+
context('which is a "nested" test', {
|
10
|
+
setup: function() {
|
11
|
+
this.foo += 1;
|
12
|
+
}
|
13
|
+
},
|
14
|
+
should('run both setup functions', function() {
|
15
|
+
this.assertEqual(2, this.foo);
|
16
|
+
})
|
17
|
+
)
|
18
|
+
)();
|
@@ -0,0 +1,12 @@
|
|
1
|
+
def analytics
|
2
|
+
%[
|
3
|
+
<script type="text/javascript">
|
4
|
+
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
5
|
+
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
6
|
+
</script>
|
7
|
+
<script type="text/javascript">
|
8
|
+
var pageTracker = _gat._getTracker("UA-306448-11");
|
9
|
+
pageTracker._trackPageview();
|
10
|
+
</script>
|
11
|
+
]
|
12
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
def example(file, link = true)
|
2
|
+
code = File.read("example/#{file}")
|
3
|
+
language = File.basename(file).match(/\.([a-z]+)$/)[1]
|
4
|
+
h = ''
|
5
|
+
if link
|
6
|
+
url = "/example/#{file}"
|
7
|
+
h << %[<p>Check this example at <a href="#{url}">#{url}</a></p>]
|
8
|
+
end
|
9
|
+
h << highlight(code, language, {}, true)
|
10
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'uv'
|
2
|
+
|
3
|
+
def highlight(code, lang, attrs = {}, wrap = true)
|
4
|
+
theme = 'blackboard'
|
5
|
+
parsed = Uv.parse(code, 'xhtml', lang, false, theme)
|
6
|
+
parsed = parsed.sub(/^<pre[^>]*>/, '').sub(/\n*<\/pre>$/, '')
|
7
|
+
attrs[:class] ||= ''
|
8
|
+
attrs[:class] << ' ' << theme
|
9
|
+
attrs[:class].sub!(/^ /, '')
|
10
|
+
if wrap
|
11
|
+
prefix = %[<pre#{attrs.to_html_attrs}><code class="#{lang}">]
|
12
|
+
postfix = '</code></pre>'
|
13
|
+
prefix + parsed + postfix
|
14
|
+
else
|
15
|
+
parsed
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Hi, I'm a new page!
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/* jShoulda, version <%= APP_VERSION %>
|
2
|
+
* (c) 2008 Choan Galvez
|
3
|
+
*
|
4
|
+
* jShoulda is freely distributable under
|
5
|
+
* the terms of an MIT-style license.
|
6
|
+
* For details, see the web site: http://jshoulda.scriptia.net
|
7
|
+
*
|
8
|
+
*--------------------------------------------------------------------------*/
|
@@ -0,0 +1,177 @@
|
|
1
|
+
var jShoulda = function() {
|
2
|
+
// the test runner
|
3
|
+
var tr,
|
4
|
+
// handle all testcases with the same testrunner
|
5
|
+
unique = false,
|
6
|
+
// styles definitions
|
7
|
+
styles = {};
|
8
|
+
|
9
|
+
function dummy() {
|
10
|
+
};
|
11
|
+
|
12
|
+
function runQueue(queue, name, before, after, ext) {
|
13
|
+
var i, tests;
|
14
|
+
for (i = 0; i < queue.length; i += 1) {
|
15
|
+
tests = queue[i](name, before, after, ext);
|
16
|
+
if (tests)
|
17
|
+
tr.tests.push(tests);
|
18
|
+
}
|
19
|
+
before.pop();
|
20
|
+
after.pop();
|
21
|
+
}
|
22
|
+
|
23
|
+
function makeBatch(fn_a) {
|
24
|
+
var copy = fn_a.slice(0);
|
25
|
+
return function() {
|
26
|
+
for (var i = 0; i < copy.length; i += 1) {
|
27
|
+
copy[i].call(this);
|
28
|
+
}
|
29
|
+
};
|
30
|
+
}
|
31
|
+
|
32
|
+
function getContextAlias(prefix) {
|
33
|
+
if (prefix) prefix += ' ';
|
34
|
+
return function (name, config, args) {
|
35
|
+
var queue = Array.prototype.slice.call(arguments, 0);
|
36
|
+
var cName = '';
|
37
|
+
var obj = {};
|
38
|
+
// shift arguments if the first one is a string
|
39
|
+
if (typeof queue[0] == 'string') {
|
40
|
+
if (name) { cName += prefix; }
|
41
|
+
cName += queue.shift();
|
42
|
+
}
|
43
|
+
if (typeof queue[0] === 'object') {
|
44
|
+
obj = queue.shift();
|
45
|
+
}
|
46
|
+
|
47
|
+
obj.before = obj.setup || obj.before || dummy;
|
48
|
+
obj.after = obj.teardown || obj.after || dummy;
|
49
|
+
var beforeQueue;
|
50
|
+
var afterQueue;
|
51
|
+
var extensions = merge({}, obj || {});
|
52
|
+
|
53
|
+
return function(outerName, before, after, ext) {
|
54
|
+
// the root context gets no outerName or a configuration object
|
55
|
+
// as its first argument
|
56
|
+
var prefix = outerName;
|
57
|
+
var is_root = !!(outerName == undefined || typeof outerName == 'object');
|
58
|
+
if (is_root) {
|
59
|
+
tr = (tr && unique) ? tr : new Test.Unit.Runner({}, outerName || {});
|
60
|
+
prefix = '';
|
61
|
+
}
|
62
|
+
// shift arguments if the second one is a
|
63
|
+
// configuration object
|
64
|
+
beforeQueue = before ? before.push(obj.before) && before : [obj.before];
|
65
|
+
afterQueue = after ? after.push(obj.after) && after : [obj.after];
|
66
|
+
runQueue(queue, [prefix, cName].join(' ').replace(/^\s+/, ''), beforeQueue, afterQueue, merge(extensions, ext));
|
67
|
+
if (is_root) {
|
68
|
+
return tr;
|
69
|
+
}
|
70
|
+
return false; // do not add to the tests queue
|
71
|
+
};
|
72
|
+
};
|
73
|
+
};
|
74
|
+
|
75
|
+
function merge(sub, sup) {
|
76
|
+
for (var i in sup) {
|
77
|
+
if (i.search(/^(before|after|setup|teardown)$/) != -1) continue;
|
78
|
+
if (sup.hasOwnProperty(i)) {
|
79
|
+
sub[i] = sup[i];
|
80
|
+
}
|
81
|
+
}
|
82
|
+
return sub;
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
function getShouldAlias(connector) {
|
87
|
+
return function (name, fn) {
|
88
|
+
return function(prefix, before, after, extensions) {
|
89
|
+
var beforeBatch = makeBatch(before);
|
90
|
+
var afterBatch = makeBatch(after);
|
91
|
+
var unit = new Test.Unit.Testcase([prefix, name].join(' ' + connector + ' '), fn, beforeBatch, afterBatch);
|
92
|
+
merge(unit, extensions);
|
93
|
+
return unit;
|
94
|
+
};
|
95
|
+
};
|
96
|
+
}
|
97
|
+
|
98
|
+
function setShouldAlias(name, host) {
|
99
|
+
var connector = name;
|
100
|
+
if (typeof host == 'string') {
|
101
|
+
connector = host;
|
102
|
+
host = arguments[2];
|
103
|
+
}
|
104
|
+
host = host || window;
|
105
|
+
host[name] = getShouldAlias(connector);
|
106
|
+
return jShoulda;
|
107
|
+
}
|
108
|
+
|
109
|
+
function setContextAlias(name, host) {
|
110
|
+
var prefix = '';
|
111
|
+
if (typeof host == 'string') {
|
112
|
+
prefix = host;
|
113
|
+
host = arguments[2];
|
114
|
+
}
|
115
|
+
host = host || window;
|
116
|
+
host[name] = getContextAlias(prefix);
|
117
|
+
return jShoulda;
|
118
|
+
}
|
119
|
+
|
120
|
+
function useStyle(name) {
|
121
|
+
var style, i;
|
122
|
+
if (name in styles) {
|
123
|
+
style = styles[name];
|
124
|
+
if ('context' in style) {
|
125
|
+
for (i = 0; i < style.context.length; i += 2) {
|
126
|
+
setContextAlias(style.context[i], style.context[i+1]);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
if ('should' in style) {
|
130
|
+
for (i = 0; i < style.should.length; i += 2) {
|
131
|
+
setShouldAlias(style.should[i], style.should[i+1]);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
if (style.unify) unifyRunners();
|
135
|
+
}
|
136
|
+
else throw { name: 'UndefinedStyle', message: 'There is not "'+name+'" style defined' };
|
137
|
+
return jShoulda;
|
138
|
+
}
|
139
|
+
|
140
|
+
function defineStyle(name, opts, aliases) {
|
141
|
+
styles[name] = opts;
|
142
|
+
for (var i = 2; i < arguments.length; i += 1) {
|
143
|
+
styles[arguments[i]] = opts;
|
144
|
+
}
|
145
|
+
return jShoulda;
|
146
|
+
}
|
147
|
+
|
148
|
+
function unifyRunners (options) {
|
149
|
+
if (options) {
|
150
|
+
tr = options instanceof Test.Unit.Runner ? options : new Test.Unit.Runner({}, options || {});
|
151
|
+
}
|
152
|
+
unique = true;
|
153
|
+
return jShoulda;
|
154
|
+
}
|
155
|
+
|
156
|
+
return {
|
157
|
+
setShouldAlias : setShouldAlias,
|
158
|
+
setContextAlias : setContextAlias,
|
159
|
+
unifyRunners : unifyRunners,
|
160
|
+
useStyle : useStyle,
|
161
|
+
defineStyle: defineStyle
|
162
|
+
};
|
163
|
+
|
164
|
+
}();
|
165
|
+
|
166
|
+
jShoulda
|
167
|
+
.defineStyle('describe', {
|
168
|
+
context: [ 'describe', '' ],
|
169
|
+
should: [ 'it', '' ],
|
170
|
+
unify: false
|
171
|
+
}, 'it')
|
172
|
+
.defineStyle('context', {
|
173
|
+
context : [ 'context', '' ],
|
174
|
+
should : [ 'should', 'should' ],
|
175
|
+
unify : false
|
176
|
+
}, 'should')
|
177
|
+
.useStyle('should');
|