Skip to content

Commit 9421076

Browse files
committed
unit testing
1 parent 5a74a2a commit 9421076

File tree

10 files changed

+3570
-9
lines changed

10 files changed

+3570
-9
lines changed

.jshintrc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"globals": {
3+
"define": true,
4+
"module": true,
5+
"DEBUG": true
6+
},
7+
8+
"asi": false,
9+
"boss": true,
10+
"browser": true,
11+
"curly": true,
12+
"eqeqeq": true,
13+
"eqnull": true,
14+
"immed": true,
15+
"lastsemic": true,
16+
"latedef": true,
17+
"laxbreak": true,
18+
"laxcomma": true,
19+
"newcap": true,
20+
"noarg": true,
21+
"nomen": false,
22+
"plusplus": false,
23+
"sub": true,
24+
"undef": true,
25+
"white": false
26+
}

Gruntfile.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ module.exports = function(grunt) {
66
// validate JS
77
jshint: {
88
all: [
9-
"Gruntfile.js", "src/**/*.js", "test/**/*.js"
10-
]
9+
"Gruntfile.js", "src/**/*.js", "test/spec/*.js"
10+
],
11+
options : {
12+
jshintrc : '.jshintrc'
13+
}
1114
},
1215
// minify
1316
uglify: {
1417
options: {
15-
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
18+
banner: '/*! <%= pkg.name %> v<%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
1619
},
1720
build: {
1821
src: 'src/<%= pkg.name %>.js',

dist/rmoop.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rmoop.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@ Object.prototype.extend = function() {
2525
for (var prop in inst) {
2626
if (inst.hasOwnProperty(prop)) {
2727
obj[prop] = inst[prop];
28+
// make public methods
29+
this[prop] = inst[prop];
2830
}
2931
}
3032
}
3133

34+
35+
3236
return obj;
3337
};
3438

test/SpecRunner.html

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2+
"http://www.w3.org/TR/html4/loose.dtd">
3+
<html>
4+
<head>
5+
<title>Jasmine Spec Runner</title>
6+
7+
<link rel="shortcut icon" type="image/png" href="lib/jasmine-1.3.0/jasmine_favicon.png">
8+
<link rel="stylesheet" type="text/css" href="lib/jasmine-1.3.0/jasmine.css">
9+
<script type="text/javascript" src="lib/jasmine-1.3.0/jasmine.js"></script>
10+
<script type="text/javascript" src="lib/jasmine-1.3.0/jasmine-html.js"></script>
11+
12+
<!-- include source files here... -->
13+
<script type="text/javascript" src="../src/rmoop.js"></script>
14+
15+
<!-- include spec files here... -->
16+
<script type="text/javascript" src="spec/RmoopSpec.js"></script>
17+
18+
<script type="text/javascript">
19+
(function() {
20+
var jasmineEnv = jasmine.getEnv();
21+
jasmineEnv.updateInterval = 1000;
22+
23+
var htmlReporter = new jasmine.HtmlReporter();
24+
25+
jasmineEnv.addReporter(htmlReporter);
26+
27+
jasmineEnv.specFilter = function(spec) {
28+
return htmlReporter.specFilter(spec);
29+
};
30+
31+
var currentWindowOnload = window.onload;
32+
33+
window.onload = function() {
34+
if (currentWindowOnload) {
35+
currentWindowOnload();
36+
}
37+
execJasmine();
38+
};
39+
40+
function execJasmine() {
41+
jasmineEnv.execute();
42+
}
43+
44+
})();
45+
</script>
46+
47+
</head>
48+
49+
<body>
50+
</body>
51+
</html>

test/lib/jasmine-1.3.0/MIT.LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2008-2011 Pivotal Labs
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)