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,77 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<title>JavaScript unit test file</title>
|
6
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
7
|
+
<script src="../assets/jsunittest.js" type="text/javascript"></script>
|
8
|
+
<script src="../../src/jshoulda.js" type="text/javascript"></script>
|
9
|
+
|
10
|
+
<script src="../../src/merge_methods.js" type="text/javascript"></script>
|
11
|
+
|
12
|
+
<link rel="stylesheet" href="../assets/unittest.css" type="text/css" />
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
|
16
|
+
<div id="content">
|
17
|
+
|
18
|
+
<div id="header">
|
19
|
+
<h1>JavaScript unit test file</h1>
|
20
|
+
<p>
|
21
|
+
This file tests <strong>merge_methods.js</strong>.
|
22
|
+
</p>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<!-- Log output (one per Runner, via {testLog: "testlog"} option)-->
|
26
|
+
<div id="testlog"></div>
|
27
|
+
|
28
|
+
<!-- Put sample/test html here -->
|
29
|
+
<div id="sample"></div>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<script type="text/javascript">
|
33
|
+
// <![CDATA[
|
34
|
+
|
35
|
+
context("A 'should' execution", {
|
36
|
+
setup: function() {
|
37
|
+
|
38
|
+
},
|
39
|
+
extra: function() {
|
40
|
+
return true;
|
41
|
+
},
|
42
|
+
assertLocalYipiyay : function(input, msg) {
|
43
|
+
this.assertEqual('yipiyay', input);
|
44
|
+
}
|
45
|
+
},
|
46
|
+
should("get access to extra properties defined on the configuration parameter", function() {
|
47
|
+
this.assertEqual(true, this.extra());
|
48
|
+
this.assertUndefined(this.extraInner);
|
49
|
+
this.assertLocalYipiyay('yipiyay');
|
50
|
+
}),
|
51
|
+
context("in an inner context", {
|
52
|
+
extraInner: function() {
|
53
|
+
return 'yay';
|
54
|
+
}
|
55
|
+
},
|
56
|
+
should("get access to its context extra properties", function() {
|
57
|
+
this.assertEqual('yay', this.extraInner());
|
58
|
+
}),
|
59
|
+
should("get access to its parent context extra properties", function() {
|
60
|
+
this.assertEqual(true, this.extra());
|
61
|
+
this.assertLocalYipiyay('yipiyay');
|
62
|
+
})
|
63
|
+
),
|
64
|
+
context("in a later inner context (after one that modified the Test.Unit)",
|
65
|
+
should("not have access to the extra properties defined by its sibling", function() {
|
66
|
+
this.assertUndefined(this.extraInner);
|
67
|
+
}),
|
68
|
+
should("have access to the extra properties defined by its parent", function() {
|
69
|
+
this.assertEqual(true, this.extra());
|
70
|
+
})
|
71
|
+
)
|
72
|
+
)();
|
73
|
+
|
74
|
+
// ]]>
|
75
|
+
</script>
|
76
|
+
</body>
|
77
|
+
</html>
|
@@ -0,0 +1,68 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<title>JavaScript unit test file</title>
|
6
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
7
|
+
<script src="../assets/jsunittest.js" type="text/javascript"></script>
|
8
|
+
<script src="../../src/jshoulda.js" type="text/javascript"></script>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../assets/unittest.css" type="text/css" />
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
|
14
|
+
<div id="content">
|
15
|
+
|
16
|
+
<div id="header">
|
17
|
+
<h1>JavaScript unit test file</h1>
|
18
|
+
<p>
|
19
|
+
This file tests runner reuse through <code>jShoulda.unifyRunner()</code>.
|
20
|
+
</p>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<!-- Log output (one per Runner, via {testLog: "testlog"} option)-->
|
24
|
+
<div id="testlog"></div>
|
25
|
+
|
26
|
+
<!-- Put sample/test html here -->
|
27
|
+
<div id="sample"></div>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<script type="text/javascript">
|
31
|
+
// <![CDATA[
|
32
|
+
|
33
|
+
|
34
|
+
new Test.Unit.Runner({
|
35
|
+
setup: function() { with(this) {
|
36
|
+
var runner = context("A context",
|
37
|
+
should("run tests", function() {
|
38
|
+
}),
|
39
|
+
context("which is an inner context",
|
40
|
+
should("run tests too", function() {
|
41
|
+
})
|
42
|
+
)
|
43
|
+
)({testLog: 'unexistant'}); // WHY is this neeeded?
|
44
|
+
runner.runTests = function() {};
|
45
|
+
this.runner = runner;
|
46
|
+
}},
|
47
|
+
|
48
|
+
// number of tests
|
49
|
+
testNumberOfTests : function() {
|
50
|
+
this.assertEqual(2, this.runner.tests.length);
|
51
|
+
},
|
52
|
+
|
53
|
+
// test names
|
54
|
+
testTestNames: function() {
|
55
|
+
this.assertEqual('A context should run tests', this.runner.tests[0].name);
|
56
|
+
this.assertEqual('A context which is an inner context should run tests too', this.runner.tests[1].name);
|
57
|
+
}
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
}, {testLog: "testlog"});
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
// ]]>
|
66
|
+
</script>
|
67
|
+
</body>
|
68
|
+
</html>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<title>JavaScript unit test file</title>
|
6
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
7
|
+
<script src="../assets/jsunittest.js" type="text/javascript"></script>
|
8
|
+
<script src="../../src/jshoulda.js" type="text/javascript"></script>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../assets/unittest.css" type="text/css" />
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
|
14
|
+
<div id="content">
|
15
|
+
|
16
|
+
<div id="header">
|
17
|
+
<h1>JavaScript unit test file</h1>
|
18
|
+
<p>
|
19
|
+
This file tests contexts without configuration object.
|
20
|
+
</p>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<!-- Log output (one per Runner, via {testLog: "testlog"} option)-->
|
24
|
+
<div id="testlog"></div>
|
25
|
+
|
26
|
+
<!-- Put sample/test html here -->
|
27
|
+
<div id="sample"></div>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<script type="text/javascript">
|
31
|
+
// <![CDATA[
|
32
|
+
|
33
|
+
context("A jShoulda context",
|
34
|
+
context('without configuration object',
|
35
|
+
should("run without a configuration object", function() {
|
36
|
+
this.assert(true);
|
37
|
+
})
|
38
|
+
),
|
39
|
+
context("with a configuration object", {
|
40
|
+
setup : function() {
|
41
|
+
this.foo = 1;
|
42
|
+
}
|
43
|
+
},
|
44
|
+
should("run its setup function", function() {
|
45
|
+
this.assertEqual(1, this.foo);
|
46
|
+
})
|
47
|
+
)
|
48
|
+
)({testLog: "testlog"});
|
49
|
+
// For each root context instance, specify the element id where results will be
|
50
|
+
// published; e.g. <div id="testlog"/> above.
|
51
|
+
// That is, you can have multiple root contexts on this page, just
|
52
|
+
// create more <div id="testlog2"></div> etc, and pass the element id to the hash above:
|
53
|
+
// e.g. {testLog: "testlog2"}
|
54
|
+
// ]]>
|
55
|
+
</script>
|
56
|
+
</body>
|
57
|
+
</html>
|
@@ -0,0 +1,77 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<title>JavaScript unit test file</title>
|
6
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
7
|
+
<script src="../assets/jsunittest.js" type="text/javascript"></script>
|
8
|
+
<script src="../../src/jshoulda.js" type="text/javascript"></script>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../assets/unittest.css" type="text/css" />
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
|
14
|
+
<div id="content">
|
15
|
+
|
16
|
+
<div id="header">
|
17
|
+
<h1>JavaScript unit test file</h1>
|
18
|
+
<p>
|
19
|
+
This file tests jShoulda style methods.
|
20
|
+
</p>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<!-- Log output (one per Runner, via {testLog: "testlog"} option)-->
|
24
|
+
<div id="testlog"></div>
|
25
|
+
|
26
|
+
<!-- Put sample/test html here -->
|
27
|
+
<div id="sample"></div>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<script type="text/javascript">
|
31
|
+
// <![CDATA[
|
32
|
+
|
33
|
+
function getPreviousTestWording(tableIndex) {
|
34
|
+
tableIndex = tableIndex || 0;
|
35
|
+
var rows = document.getElementsByTagName('table')[tableIndex].getElementsByTagName('tbody')[0].getElementsByTagName('tr');
|
36
|
+
return rows[rows.length - 2].getElementsByTagName('td')[0].innerHTML.replace(/^\s+|\s+$/g, '').replace(/\s+/, ' ');
|
37
|
+
}
|
38
|
+
|
39
|
+
context("jShoulda", {},
|
40
|
+
should("expose a useStyle method", function() {
|
41
|
+
this.assert(typeof jShoulda.useStyle == 'function');
|
42
|
+
}),
|
43
|
+
should('use connectors defined in styles', function() {
|
44
|
+
this.assertEqual('jShoulda should expose a useStyle method', getPreviousTestWording());
|
45
|
+
}),
|
46
|
+
should("raise exception when trying to use an undefined style ", function() {
|
47
|
+
this.assertRaise('UndefinedStyle', function() {
|
48
|
+
jShoulda.useStyle('porrompompero');
|
49
|
+
});
|
50
|
+
})
|
51
|
+
)({testLog: "testlog"});
|
52
|
+
|
53
|
+
|
54
|
+
jShoulda
|
55
|
+
.defineStyle('custom', {
|
56
|
+
context: [ 'un', 'Un', 'para', 'para' ],
|
57
|
+
should : [ 'deberia', 'debería' ],
|
58
|
+
unify : true
|
59
|
+
})
|
60
|
+
.useStyle('custom');
|
61
|
+
|
62
|
+
un("Choan",
|
63
|
+
para("ser feliz",
|
64
|
+
deberia("poder comer melocotones de Calanda todo el año", function() {
|
65
|
+
this.assertEqual('yum', 'yum');
|
66
|
+
})
|
67
|
+
),
|
68
|
+
deberia("sentirse feliz de su trabajo en jShoulda", function() {
|
69
|
+
this.assertEqual('Un Choan para ser feliz debería poder comer melocotones de Calanda todo el año', getPreviousTestWording());
|
70
|
+
})
|
71
|
+
)();
|
72
|
+
|
73
|
+
|
74
|
+
// ]]>
|
75
|
+
</script>
|
76
|
+
</body>
|
77
|
+
</html>
|
@@ -0,0 +1,69 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<title>JavaScript unit test file</title>
|
6
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
7
|
+
<script src="../assets/jsunittest.js" type="text/javascript"></script>
|
8
|
+
<script src="../../src/jshoulda.js" type="text/javascript"></script>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../assets/unittest.css" type="text/css" />
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
|
14
|
+
<div id="content">
|
15
|
+
|
16
|
+
<div id="header">
|
17
|
+
<h1>JavaScript unit test file</h1>
|
18
|
+
<p>
|
19
|
+
This file tests runner reuse through <code>jShoulda.unifyRunner()</code>.
|
20
|
+
</p>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<!-- Log output (one per Runner, via {testLog: "testlog"} option)-->
|
24
|
+
<div id="testlog"></div>
|
25
|
+
|
26
|
+
<!-- Put sample/test html here -->
|
27
|
+
<div id="sample"></div>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<script type="text/javascript">
|
31
|
+
// <![CDATA[
|
32
|
+
|
33
|
+
|
34
|
+
var runner1, runner2;
|
35
|
+
|
36
|
+
|
37
|
+
var runner0 = new Test.Unit.Runner({
|
38
|
+
|
39
|
+
testDummy : function() {
|
40
|
+
this.assert(true);
|
41
|
+
}
|
42
|
+
|
43
|
+
});
|
44
|
+
|
45
|
+
jShoulda.unifyRunners(runner0);
|
46
|
+
|
47
|
+
runner1 = context("An initial root context", {},
|
48
|
+
should("create a runner", function() {
|
49
|
+
this.assert(runner1 instanceof Test.Unit.Runner);
|
50
|
+
this.assertEqual(runner0, runner1);
|
51
|
+
})
|
52
|
+
)();
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
runner2 = context("A second root context, when using unifyRunners", {},
|
57
|
+
should("reuse the runner", function() {
|
58
|
+
this.assert(runner2 instanceof Test.Unit.Runner);
|
59
|
+
this.assertEqual(runner1, runner2);
|
60
|
+
})
|
61
|
+
)();
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
// ]]>
|
67
|
+
</script>
|
68
|
+
</body>
|
69
|
+
</html>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<title>JavaScript unit test file</title>
|
6
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
7
|
+
<script src="../assets/jsunittest.js" type="text/javascript"></script>
|
8
|
+
|
9
|
+
<script src="../../src/jshoulda.js" type="text/javascript"></script>
|
10
|
+
|
11
|
+
|
12
|
+
<link rel="stylesheet" href="../assets/unittest.css" type="text/css" />
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
|
16
|
+
<div id="content">
|
17
|
+
|
18
|
+
<div id="header">
|
19
|
+
<h1>JavaScript unit test file</h1>
|
20
|
+
<p>
|
21
|
+
This file tests <strong>unnamed_context.js</strong>.
|
22
|
+
</p>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<!-- Log output (one per Runner, via {testLog: "testlog"} option)-->
|
26
|
+
<div id="testlog"></div>
|
27
|
+
|
28
|
+
<!-- Put sample/test html here -->
|
29
|
+
<div id="sample"></div>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<script type="text/javascript">
|
33
|
+
// <![CDATA[
|
34
|
+
|
35
|
+
jShoulda.unifyRunners();
|
36
|
+
|
37
|
+
// This test uses a base unnamed context
|
38
|
+
context({
|
39
|
+
setup: function() {
|
40
|
+
this.a = 1;
|
41
|
+
}
|
42
|
+
},
|
43
|
+
should("run tests", function() {
|
44
|
+
this.assertEqual(1, this.a);
|
45
|
+
})
|
46
|
+
)();
|
47
|
+
|
48
|
+
context(
|
49
|
+
context("A context child of an unnamed context",
|
50
|
+
should("run tests", function() {
|
51
|
+
this.assert(true);
|
52
|
+
})
|
53
|
+
),
|
54
|
+
should("run tests", function() {
|
55
|
+
this.assert(true);
|
56
|
+
}),
|
57
|
+
context("",
|
58
|
+
should("run tests when it has no name", function() {
|
59
|
+
this.assert(true);
|
60
|
+
})
|
61
|
+
)
|
62
|
+
)();
|
63
|
+
|
64
|
+
// ]]>
|
65
|
+
</script>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
== 0.7.2 2008-10-08
|
2
|
+
|
3
|
+
* AJAX callback from IE6 working [choan]
|
4
|
+
* warning count passed back [choan]
|
5
|
+
|
6
|
+
== 0.7.1 2008-09-20
|
7
|
+
|
8
|
+
* Fixes for warning implementation [dchelimsky]
|
9
|
+
|
10
|
+
== 0.7.0 2008-08-11
|
11
|
+
|
12
|
+
* New helper: warning (alias: warn); use like info, error and fail helpers; has orange appearance in output
|
13
|
+
* New assertions: assertHasClass(element, class)
|
14
|
+
|
15
|
+
== 0.6.3 2008-03-03
|
16
|
+
|
17
|
+
* Remove some innerHTML calls as an IE6 fix [Michael Grosser]
|
18
|
+
|
19
|
+
== 0.6.2 2008-02-24
|
20
|
+
|
21
|
+
* Renamed DrNicTest with JsUnitTest
|
22
|
+
* Finished clean of "DrNicTest.inspect" -> "inspect"
|
23
|
+
* website: archive the tmbundle into the website
|
24
|
+
|
25
|
+
== 0.6.1 2008-02-20
|
26
|
+
|
27
|
+
* website: includes "getting started" archives
|
28
|
+
* ajax: fixed Firefox bug with xml.send()
|
29
|
+
|
30
|
+
== 0.6.0 2008-02-18
|
31
|
+
|
32
|
+
* Cannot remember
|
33
|
+
|
34
|
+
== 0.5.0 2008-02-17
|
35
|
+
|
36
|
+
* 1 major enhancement:
|
37
|
+
* Initial release
|