resin 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/amber/bin/amberc +4 -3
  2. data/amber/js/IDE.deploy.js +147 -45
  3. data/amber/js/IDE.js +155 -53
  4. data/amber/js/Kernel-Classes.deploy.js +20 -14
  5. data/amber/js/Kernel-Classes.js +29 -18
  6. data/amber/js/Kernel-Collections.deploy.js +82 -0
  7. data/amber/js/Kernel-Collections.js +102 -0
  8. data/amber/js/Kernel-Methods.deploy.js +374 -261
  9. data/amber/js/Kernel-Methods.js +417 -269
  10. data/amber/js/Kernel-Objects.deploy.js +90 -28
  11. data/amber/js/Kernel-Objects.js +121 -34
  12. data/amber/js/Kernel-Tests.deploy.js +35 -0
  13. data/amber/js/Kernel-Tests.js +45 -0
  14. data/amber/js/SUnit.deploy.js +175 -17
  15. data/amber/js/SUnit.js +237 -24
  16. data/amber/js/amber.js +2 -1
  17. data/amber/js/boot.js +74 -18
  18. data/amber/js/lib/es5-shim-2.0.2/CHANGES +93 -0
  19. data/amber/js/lib/es5-shim-2.0.2/CONTRIBUTORS.md +25 -0
  20. data/amber/js/lib/es5-shim-2.0.2/LICENSE +19 -0
  21. data/amber/js/lib/es5-shim-2.0.2/README.md +161 -0
  22. data/amber/js/lib/es5-shim-2.0.2/es5-sham.js +348 -0
  23. data/amber/js/lib/es5-shim-2.0.2/es5-sham.min.js +6 -0
  24. data/amber/js/lib/es5-shim-2.0.2/es5-shim.js +963 -0
  25. data/amber/js/lib/es5-shim-2.0.2/es5-shim.min.js +16 -0
  26. data/amber/js/lib/es5-shim-2.0.2/minify +2 -0
  27. data/amber/js/lib/es5-shim-2.0.2/package.json +31 -0
  28. data/amber/js/lib/es5-shim-2.0.2/tests/helpers/h-kill.js +59 -0
  29. data/amber/js/lib/es5-shim-2.0.2/tests/helpers/h-matchers.js +34 -0
  30. data/amber/js/lib/es5-shim-2.0.2/tests/helpers/h.js +3 -0
  31. data/amber/js/lib/es5-shim-2.0.2/tests/index.html +62 -0
  32. data/amber/js/lib/es5-shim-2.0.2/tests/lib/jasmine-html.js +190 -0
  33. data/amber/js/lib/es5-shim-2.0.2/tests/lib/jasmine.css +166 -0
  34. data/amber/js/lib/es5-shim-2.0.2/tests/lib/jasmine.js +2477 -0
  35. data/amber/js/lib/es5-shim-2.0.2/tests/lib/jasmine_favicon.png +0 -0
  36. data/amber/js/lib/es5-shim-2.0.2/tests/lib/json2.js +478 -0
  37. data/amber/js/lib/es5-shim-2.0.2/tests/spec/s-array.js +1138 -0
  38. data/amber/js/lib/es5-shim-2.0.2/tests/spec/s-date.js +117 -0
  39. data/amber/js/lib/es5-shim-2.0.2/tests/spec/s-function.js +147 -0
  40. data/amber/js/lib/es5-shim-2.0.2/tests/spec/s-object.js +84 -0
  41. data/amber/js/lib/es5-shim-2.0.2/tests/spec/s-string.js +24 -0
  42. data/amber/st/IDE.st +15 -16
  43. data/amber/st/Kernel-Classes.st +9 -9
  44. data/amber/st/Kernel-Collections.st +37 -0
  45. data/amber/st/Kernel-Methods.st +63 -8
  46. data/amber/st/Kernel-Objects.st +34 -7
  47. data/amber/st/Kernel-Tests.st +10 -0
  48. data/amber/st/SUnit.st +86 -9
  49. metadata +44 -21
  50. data/amber/js/compat.js +0 -22
@@ -0,0 +1,16 @@
1
+ (function(q){"function"==typeof define?define(q):"function"==typeof YUI?YUI.add("es5",q):q()})(function(){function q(a){a=+a;a!==a?a=0:0!==a&&(a!==1/0&&a!==-(1/0))&&(a=(0<a||-1)*Math.floor(Math.abs(a)));return a}function t(a){var b=typeof a;return null===a||"undefined"===b||"boolean"===b||"number"===b||"string"===b}Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError("Function.prototype.bind called on incompatible "+b);var d=r.call(arguments,
2
+ 1),c=function(){if(this instanceof c){var e=b.apply(this,d.concat(r.call(arguments)));return Object(e)===e?e:this}return b.apply(a,d.concat(r.call(arguments)))};b.prototype&&(c.prototype=Object.create(b.prototype));return c});var m=Function.prototype.call,p=Object.prototype,r=Array.prototype.slice,h=m.bind(p.toString),u=m.bind(p.hasOwnProperty);u(p,"__defineGetter__")&&(m.bind(p.__defineGetter__),m.bind(p.__defineSetter__),m.bind(p.__lookupGetter__),m.bind(p.__lookupSetter__));if(2!=[1,2].splice(0).length){var y=
3
+ Array.prototype.splice;Array.prototype.splice=function(a,b){return arguments.length?y.apply(this,[void 0===a?0:a,void 0===b?this.length-a:b].concat(r.call(arguments,2))):[]}}Array.isArray||(Array.isArray=function(a){return"[object Array]"==h(a)});var m=Object("a"),k="a"!=m[0]||!(0 in m);Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var d=l(this),c=k&&"[object String]"==h(this)?this.split(""):d,e=-1,f=c.length>>>0;if("[object Function]"!=h(a))throw new TypeError;for(;++e<f;)e in c&&
4
+ a.call(b,c[e],e,d)});Array.prototype.map||(Array.prototype.map=function(a,b){var d=l(this),c=k&&"[object String]"==h(this)?this.split(""):d,e=c.length>>>0,f=Array(e);if("[object Function]"!=h(a))throw new TypeError(a+" is not a function");for(var g=0;g<e;g++)g in c&&(f[g]=a.call(b,c[g],g,d));return f});Array.prototype.filter||(Array.prototype.filter=function(a,b){var d=l(this),c=k&&"[object String]"==h(this)?this.split(""):d,e=c.length>>>0,f=[],g;if("[object Function]"!=h(a))throw new TypeError(a+
5
+ " is not a function");for(var i=0;i<e;i++)i in c&&(g=c[i],a.call(b,g,i,d)&&f.push(g));return f});Array.prototype.every||(Array.prototype.every=function(a,b){var d=l(this),c=k&&"[object String]"==h(this)?this.split(""):d,e=c.length>>>0;if("[object Function]"!=h(a))throw new TypeError(a+" is not a function");for(var f=0;f<e;f++)if(f in c&&!a.call(b,c[f],f,d))return!1;return!0});Array.prototype.some||(Array.prototype.some=function(a,b){var d=l(this),c=k&&"[object String]"==h(this)?this.split(""):d,e=
6
+ c.length>>>0;if("[object Function]"!=h(a))throw new TypeError(a+" is not a function");for(var f=0;f<e;f++)if(f in c&&a.call(b,c[f],f,d))return!0;return!1});Array.prototype.reduce||(Array.prototype.reduce=function(a){var b=l(this),d=k&&"[object String]"==h(this)?this.split(""):b,c=d.length>>>0;if("[object Function]"!=h(a))throw new TypeError(a+" is not a function");if(!c&&1==arguments.length)throw new TypeError("reduce of empty array with no initial value");var e=0,f;if(2<=arguments.length)f=arguments[1];
7
+ else{do{if(e in d){f=d[e++];break}if(++e>=c)throw new TypeError("reduce of empty array with no initial value");}while(1)}for(;e<c;e++)e in d&&(f=a.call(void 0,f,d[e],e,b));return f});Array.prototype.reduceRight||(Array.prototype.reduceRight=function(a){var b=l(this),d=k&&"[object String]"==h(this)?this.split(""):b,c=d.length>>>0;if("[object Function]"!=h(a))throw new TypeError(a+" is not a function");if(!c&&1==arguments.length)throw new TypeError("reduceRight of empty array with no initial value");
8
+ var e,c=c-1;if(2<=arguments.length)e=arguments[1];else{do{if(c in d){e=d[c--];break}if(0>--c)throw new TypeError("reduceRight of empty array with no initial value");}while(1)}do c in this&&(e=a.call(void 0,e,d[c],c,b));while(c--);return e});if(!Array.prototype.indexOf||-1!=[0,1].indexOf(1,2))Array.prototype.indexOf=function(a){var b=k&&"[object String]"==h(this)?this.split(""):l(this),d=b.length>>>0;if(!d)return-1;var c=0;1<arguments.length&&(c=q(arguments[1]));for(c=0<=c?c:Math.max(0,d+c);c<d;c++)if(c in
9
+ b&&b[c]===a)return c;return-1};if(!Array.prototype.lastIndexOf||-1!=[0,1].lastIndexOf(0,-3))Array.prototype.lastIndexOf=function(a){var b=k&&"[object String]"==h(this)?this.split(""):l(this),d=b.length>>>0;if(!d)return-1;var c=d-1;1<arguments.length&&(c=Math.min(c,q(arguments[1])));for(c=0<=c?c:d-Math.abs(c);0<=c;c--)if(c in b&&a===b[c])return c;return-1};if(!Object.keys){var w=!0,x="toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable constructor".split(" "),z=x.length,
10
+ s;for(s in{toString:null})w=!1;Object.keys=function(a){if("object"!=typeof a&&"function"!=typeof a||null===a)throw new TypeError("Object.keys called on a non-object");var b=[],d;for(d in a)u(a,d)&&b.push(d);if(w)for(d=0;d<z;d++){var c=x[d];u(a,c)&&b.push(c)}return b}}if(!Date.prototype.toISOString||-1===(new Date(-621987552E5)).toISOString().indexOf("-000001"))Date.prototype.toISOString=function(){var a,b,d,c;if(!isFinite(this))throw new RangeError("Date.prototype.toISOString called on non-finite value.");
11
+ c=this.getUTCFullYear();a=this.getUTCMonth();c+=Math.floor(a/12);a=[(a%12+12)%12+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()];c=(0>c?"-":9999<c?"+":"")+("00000"+Math.abs(c)).slice(0<=c&&9999>=c?-4:-6);for(b=a.length;b--;)d=a[b],10>d&&(a[b]="0"+d);return c+"-"+a.slice(0,2).join("-")+"T"+a.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"};s=!1;try{s=Date.prototype.toJSON&&null===(new Date(NaN)).toJSON()&&-1!==(new Date(-621987552E5)).toJSON().indexOf("-000001")&&
12
+ Date.prototype.toJSON.call({toISOString:function(){return!0}})}catch(G){}s||(Date.prototype.toJSON=function(){var a=Object(this),b;a:if(t(a))b=a;else{b=a.valueOf;if("function"===typeof b&&(b=b.call(a),t(b)))break a;b=a.toString;if("function"===typeof b&&(b=b.call(a),t(b)))break a;throw new TypeError;}if("number"===typeof b&&!isFinite(b))return null;b=a.toISOString;if("function"!=typeof b)throw new TypeError("toISOString property is not callable");return b.call(a)});var g=Date,v=function(a,b){var d=
13
+ 1<b?1:0;return A[b]+Math.floor((a-1969+d)/4)-Math.floor((a-1901+d)/100)+Math.floor((a-1601+d)/400)+365*(a-1970)},n=function(a,b,d,c,e,f,h){var i=arguments.length;return this instanceof g?(i=1==i&&String(a)===a?new g(n.parse(a)):7<=i?new g(a,b,d,c,e,f,h):6<=i?new g(a,b,d,c,e,f):5<=i?new g(a,b,d,c,e):4<=i?new g(a,b,d,c):3<=i?new g(a,b,d):2<=i?new g(a,b):1<=i?new g(a):new g,i.constructor=n,i):g.apply(this,arguments)},B=RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d{3}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"),
14
+ A=[0,31,59,90,120,151,181,212,243,273,304,334,365],j;for(j in g)n[j]=g[j];n.now=g.now;n.UTC=g.UTC;n.prototype=g.prototype;n.prototype.constructor=Date;n.parse=function(a){var b=B.exec(a);if(b){var d=Number(b[1]),c=Number(b[2]||1)-1,e=Number(b[3]||1)-1,f=Number(b[4]||0),h=Number(b[5]||0),i=Number(b[6]||0),j=Number(b[7]||0),m=!b[4]||b[8]?0:Number(new Date(1970,0)),k="-"===b[9]?1:-1,l=Number(b[10]||0),b=Number(b[11]||0);if(f<(0<h||0<i||0<j?24:25)&&60>h&&60>i&&1E3>j&&-1<c&&12>c&&24>l&&60>b&&-1<e&&e<v(d,
15
+ c+1)-v(d,c))if(d=60*(24*(v(d,c)+e)+f+l*k),d=1E3*(60*(d+h+b*k)+i)+j+m,-864E13<=d&&864E13>=d)return d;return NaN}return g.parse.apply(this,arguments)};Date=n;Date.now||(Date.now=function(){return(new Date).getTime()});if("0".split(void 0,0).length){var C=String.prototype.split;String.prototype.split=function(a,b){return void 0===a&&0===b?[]:C.apply(this,arguments)}}if("".substr&&"b"!=="0b".substr(-1)){var D=String.prototype.substr;String.prototype.substr=function(a,b){return D.call(this,0>a?0>(a=this.length+
16
+ a)?0:a:a,b)}}j="\t\n\x0B\f\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff";if(!String.prototype.trim||j.trim()){j="["+j+"]";var E=RegExp("^"+j+j+"*"),F=RegExp(j+j+"*$");String.prototype.trim=function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(E,"").replace(F,"")}}var l=function(a){if(null==a)throw new TypeError("can't convert "+a+" to object");return Object(a)}});
@@ -0,0 +1,2 @@
1
+ closure < es5-shim.js > es5-shim.min.js
2
+ closure < es5-sham.js > es5-sham.min.js
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "es5-shim",
3
+ "version": "2.0.2",
4
+ "description": "ES5 as implementable on previous engines",
5
+ "homepage": "http://github.com/kriskowal/es5-shim/",
6
+ "contributors": [
7
+ "Kris Kowal <kris@cixar.com> (http://github.com/kriskowal/)",
8
+ "Sami Samhuri <sami.samhuri@gmail.com> (http://samhuri.net/)",
9
+ "Florian Schäfer <florian.schaefer@gmail.com> (http://github.com/fschaefer)",
10
+ "Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)",
11
+ "Kit Cambridge <kitcambridge@gmail.com> (http://kitcambridge.github.com)"
12
+ ],
13
+ "bugs": {
14
+ "mail": "kris@cixar.com",
15
+ "url": "http://github.com/kriskowal/es5-shim/issues"
16
+ },
17
+ "licenses": [
18
+ {
19
+ "type": "MIT",
20
+ "url": "http://github.com/kriskowal/es5-shim/raw/master/LICENSE"
21
+ }
22
+ ],
23
+ "main": "es5-shim.js",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "http://github.com/kriskowal/es5-shim.git"
27
+ },
28
+ "engines": {
29
+ "node": ">=0.2.0"
30
+ }
31
+ }
@@ -0,0 +1,59 @@
1
+ // This methods allows the killing of built-in functions,
2
+ // so the shim can take over with that implementation
3
+ var HLP = (function() {
4
+ "use strict";
5
+ var kill;
6
+
7
+ kill = function(_class, methods) {
8
+ /*if(!Array.isArray(methods))
9
+ return;*/
10
+ if(!_class.originals)
11
+ _class.originals = {};
12
+
13
+ for (var i = 0, len = methods.length; i < len; i++) {
14
+ var obj = methods[i];
15
+ _class.originals[obj] = _class[obj];
16
+ delete _class[obj];
17
+ if (obj in _class) {
18
+ // try something more aggressive since V8 at least
19
+ // appears to ignore the delete.
20
+ _class[obj] = null;
21
+ if (_class[obj]) {
22
+ console.log("Couln't overwrite", obj, "of", _class);
23
+ }
24
+ }
25
+ }
26
+ };
27
+ return { kill: kill };
28
+ }());
29
+
30
+ HLP.kill(Function.prototype, [
31
+ 'bind'
32
+ ]);
33
+
34
+ HLP.kill(Array, [
35
+ 'isArray'
36
+ ]);
37
+
38
+ HLP.kill(String.prototype, [
39
+ "trim"
40
+ ]);
41
+
42
+ HLP.kill(Object, [
43
+ 'keys'
44
+ ]);
45
+
46
+ HLP.kill(Date, [
47
+ 'now', 'parse'
48
+ ]);
49
+
50
+ HLP.kill(Date.prototype, [
51
+ "toJSON", "toISOString"
52
+ ]);
53
+
54
+ HLP.kill(Array.prototype, [
55
+ 'forEach', 'some', 'every',
56
+ 'indexOf', 'lastIndexOf',
57
+ 'map', 'filter',
58
+ 'reduce', 'reduceRight'
59
+ ]);
@@ -0,0 +1,34 @@
1
+ beforeEach(function() {
2
+ this.addMatchers({
3
+ toExactlyMatch: function(expected) {
4
+ var a1, a2,
5
+ l, i,
6
+ key,
7
+ actual = this.actual;
8
+
9
+ var getKeys = function(o) {
10
+ var a = [];
11
+ for(key in o) {
12
+ if(o.hasOwnProperty(key)) {
13
+ a.push(key);
14
+ }
15
+ }
16
+ return a;
17
+ }
18
+ a1 = getKeys(actual);
19
+ a2 = getKeys(expected);
20
+
21
+ l = a1.length;
22
+ if(l !== a2.length) {
23
+ return false;
24
+ }
25
+ for(i = 0; i < l; i++) {
26
+ key = a1[i];
27
+ expect(key).toEqual(a2[i]);
28
+ expect(actual[key]).toEqual(expected[key]);
29
+ }
30
+
31
+ return true;
32
+ }
33
+ })
34
+ });
@@ -0,0 +1,3 @@
1
+ function implement() {
2
+ throw 'Not implemented';
3
+ }
@@ -0,0 +1,62 @@
1
+ <!DOCTYPE HTML>
2
+ <html>
3
+ <head>
4
+ <title>Jasmine Spec Runner</title>
5
+
6
+ <link rel="shortcut icon" type="image/png" href="lib/jasmine_favicon.png">
7
+
8
+ <link rel="stylesheet" type="text/css" href="lib/jasmine.css">
9
+ <script type="text/javascript" src="lib/jasmine.js"></script>
10
+ <script type="text/javascript" src="lib/jasmine-html.js"></script>
11
+ <script type="text/javascript" src="lib/json2.js"></script>
12
+
13
+ <!-- include helper files here... -->
14
+ <script src="helpers/h.js"></script>
15
+ <script src="helpers/h-kill.js"></script>
16
+ <script src="helpers/h-matchers.js"></script>
17
+
18
+ <!-- include source files here... -->
19
+ <script src="../es5-shim.js"></script>
20
+
21
+ <!-- include spec files here... -->
22
+ <script src="spec/s-array.js"></script>
23
+ <script src="spec/s-function.js"></script>
24
+ <script src="spec/s-string.js"></script>
25
+ <script src="spec/s-object.js"></script>
26
+ <script src="spec/s-date.js"></script>
27
+
28
+
29
+ <script type="text/javascript">
30
+ (function() {
31
+ var jasmineEnv = jasmine.getEnv();
32
+ jasmineEnv.updateInterval = 1000;
33
+
34
+ var trivialReporter = new jasmine.TrivialReporter();
35
+
36
+ jasmineEnv.addReporter(trivialReporter);
37
+
38
+ jasmineEnv.specFilter = function(spec) {
39
+ return trivialReporter.specFilter(spec);
40
+ };
41
+
42
+ var currentWindowOnload = window.onload;
43
+
44
+ window.onload = function() {
45
+ if (currentWindowOnload) {
46
+ currentWindowOnload();
47
+ }
48
+ execJasmine();
49
+ };
50
+
51
+ function execJasmine() {
52
+ jasmineEnv.execute();
53
+ }
54
+
55
+ })();
56
+ </script>
57
+
58
+ </head>
59
+
60
+ <body>
61
+ </body>
62
+ </html>
@@ -0,0 +1,190 @@
1
+ jasmine.TrivialReporter = function(doc) {
2
+ this.document = doc || document;
3
+ this.suiteDivs = {};
4
+ this.logRunningSpecs = false;
5
+ };
6
+
7
+ jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
8
+ var el = document.createElement(type);
9
+
10
+ for (var i = 2; i < arguments.length; i++) {
11
+ var child = arguments[i];
12
+
13
+ if (typeof child === 'string') {
14
+ el.appendChild(document.createTextNode(child));
15
+ } else {
16
+ if (child) { el.appendChild(child); }
17
+ }
18
+ }
19
+
20
+ for (var attr in attrs) {
21
+ if (attr == "className") {
22
+ el[attr] = attrs[attr];
23
+ } else {
24
+ el.setAttribute(attr, attrs[attr]);
25
+ }
26
+ }
27
+
28
+ return el;
29
+ };
30
+
31
+ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
32
+ var showPassed, showSkipped;
33
+
34
+ this.outerDiv = this.createDom('div', { className: 'jasmine_reporter' },
35
+ this.createDom('div', { className: 'banner' },
36
+ this.createDom('div', { className: 'logo' },
37
+ this.createDom('span', { className: 'title' }, "Jasmine"),
38
+ this.createDom('span', { className: 'version' }, runner.env.versionString())),
39
+ this.createDom('div', { className: 'options' },
40
+ "Show ",
41
+ showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),
42
+ this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),
43
+ showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),
44
+ this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")
45
+ )
46
+ ),
47
+
48
+ this.runnerDiv = this.createDom('div', { className: 'runner running' },
49
+ this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),
50
+ this.runnerMessageSpan = this.createDom('span', {}, "Running..."),
51
+ this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, ""))
52
+ );
53
+
54
+ this.document.body.appendChild(this.outerDiv);
55
+
56
+ var suites = runner.suites();
57
+ for (var i = 0; i < suites.length; i++) {
58
+ var suite = suites[i];
59
+ var suiteDiv = this.createDom('div', { className: 'suite' },
60
+ this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
61
+ this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
62
+ this.suiteDivs[suite.id] = suiteDiv;
63
+ var parentDiv = this.outerDiv;
64
+ if (suite.parentSuite) {
65
+ parentDiv = this.suiteDivs[suite.parentSuite.id];
66
+ }
67
+ parentDiv.appendChild(suiteDiv);
68
+ }
69
+
70
+ this.startedAt = new Date();
71
+
72
+ var self = this;
73
+ showPassed.onclick = function(evt) {
74
+ if (showPassed.checked) {
75
+ self.outerDiv.className += ' show-passed';
76
+ } else {
77
+ self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');
78
+ }
79
+ };
80
+
81
+ showSkipped.onclick = function(evt) {
82
+ if (showSkipped.checked) {
83
+ self.outerDiv.className += ' show-skipped';
84
+ } else {
85
+ self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');
86
+ }
87
+ };
88
+ };
89
+
90
+ jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
91
+ var results = runner.results();
92
+ var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
93
+ this.runnerDiv.setAttribute("class", className);
94
+ //do it twice for IE
95
+ this.runnerDiv.setAttribute("className", className);
96
+ var specs = runner.specs();
97
+ var specCount = 0;
98
+ for (var i = 0; i < specs.length; i++) {
99
+ if (this.specFilter(specs[i])) {
100
+ specCount++;
101
+ }
102
+ }
103
+ var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
104
+ message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
105
+ this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild);
106
+
107
+ this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString()));
108
+ };
109
+
110
+ jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
111
+ var results = suite.results();
112
+ var status = results.passed() ? 'passed' : 'failed';
113
+ if (results.totalCount === 0) { // todo: change this to check results.skipped
114
+ status = 'skipped';
115
+ }
116
+ this.suiteDivs[suite.id].className += " " + status;
117
+ };
118
+
119
+ jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) {
120
+ if (this.logRunningSpecs) {
121
+ this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
122
+ }
123
+ };
124
+
125
+ jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
126
+ var results = spec.results();
127
+ var status = results.passed() ? 'passed' : 'failed';
128
+ if (results.skipped) {
129
+ status = 'skipped';
130
+ }
131
+ var specDiv = this.createDom('div', { className: 'spec ' + status },
132
+ this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
133
+ this.createDom('a', {
134
+ className: 'description',
135
+ href: '?spec=' + encodeURIComponent(spec.getFullName()),
136
+ title: spec.getFullName()
137
+ }, spec.description));
138
+
139
+
140
+ var resultItems = results.getItems();
141
+ var messagesDiv = this.createDom('div', { className: 'messages' });
142
+ for (var i = 0; i < resultItems.length; i++) {
143
+ var result = resultItems[i];
144
+
145
+ if (result.type == 'log') {
146
+ messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
147
+ } else if (result.type == 'expect' && result.passed && !result.passed()) {
148
+ messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
149
+
150
+ if (result.trace.stack) {
151
+ messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
152
+ }
153
+ }
154
+ }
155
+
156
+ if (messagesDiv.childNodes.length > 0) {
157
+ specDiv.appendChild(messagesDiv);
158
+ }
159
+
160
+ this.suiteDivs[spec.suite.id].appendChild(specDiv);
161
+ };
162
+
163
+ jasmine.TrivialReporter.prototype.log = function() {
164
+ var console = jasmine.getGlobal().console;
165
+ if (console && console.log) {
166
+ if (console.log.apply) {
167
+ console.log.apply(console, arguments);
168
+ } else {
169
+ console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
170
+ }
171
+ }
172
+ };
173
+
174
+ jasmine.TrivialReporter.prototype.getLocation = function() {
175
+ return this.document.location;
176
+ };
177
+
178
+ jasmine.TrivialReporter.prototype.specFilter = function(spec) {
179
+ var paramMap = {};
180
+ var params = this.getLocation().search.substring(1).split('&');
181
+ for (var i = 0; i < params.length; i++) {
182
+ var p = params[i].split('=');
183
+ paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
184
+ }
185
+
186
+ if (!paramMap.spec) {
187
+ return true;
188
+ }
189
+ return spec.getFullName().indexOf(paramMap.spec) === 0;
190
+ };
@@ -0,0 +1,166 @@
1
+ body {
2
+ font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif;
3
+ }
4
+
5
+
6
+ .jasmine_reporter a:visited, .jasmine_reporter a {
7
+ color: #303;
8
+ }
9
+
10
+ .jasmine_reporter a:hover, .jasmine_reporter a:active {
11
+ color: blue;
12
+ }
13
+
14
+ .run_spec {
15
+ float:right;
16
+ padding-right: 5px;
17
+ font-size: .8em;
18
+ text-decoration: none;
19
+ }
20
+
21
+ .jasmine_reporter {
22
+ margin: 0 5px;
23
+ }
24
+
25
+ .banner {
26
+ color: #303;
27
+ background-color: #fef;
28
+ padding: 5px;
29
+ }
30
+
31
+ .logo {
32
+ float: left;
33
+ font-size: 1.1em;
34
+ padding-left: 5px;
35
+ }
36
+
37
+ .logo .version {
38
+ font-size: .6em;
39
+ padding-left: 1em;
40
+ }
41
+
42
+ .runner.running {
43
+ background-color: yellow;
44
+ }
45
+
46
+
47
+ .options {
48
+ text-align: right;
49
+ font-size: .8em;
50
+ }
51
+
52
+
53
+
54
+
55
+ .suite {
56
+ border: 1px outset gray;
57
+ margin: 5px 0;
58
+ padding-left: 1em;
59
+ }
60
+
61
+ .suite .suite {
62
+ margin: 5px;
63
+ }
64
+
65
+ .suite.passed {
66
+ background-color: #dfd;
67
+ }
68
+
69
+ .suite.failed {
70
+ background-color: #fdd;
71
+ }
72
+
73
+ .spec {
74
+ margin: 5px;
75
+ padding-left: 1em;
76
+ clear: both;
77
+ }
78
+
79
+ .spec.failed, .spec.passed, .spec.skipped {
80
+ padding-bottom: 5px;
81
+ border: 1px solid gray;
82
+ }
83
+
84
+ .spec.failed {
85
+ background-color: #fbb;
86
+ border-color: red;
87
+ }
88
+
89
+ .spec.passed {
90
+ background-color: #bfb;
91
+ border-color: green;
92
+ }
93
+
94
+ .spec.skipped {
95
+ background-color: #bbb;
96
+ }
97
+
98
+ .messages {
99
+ border-left: 1px dashed gray;
100
+ padding-left: 1em;
101
+ padding-right: 1em;
102
+ }
103
+
104
+ .passed {
105
+ background-color: #cfc;
106
+ display: none;
107
+ }
108
+
109
+ .failed {
110
+ background-color: #fbb;
111
+ }
112
+
113
+ .skipped {
114
+ color: #777;
115
+ background-color: #eee;
116
+ display: none;
117
+ }
118
+
119
+
120
+ /*.resultMessage {*/
121
+ /*white-space: pre;*/
122
+ /*}*/
123
+
124
+ .resultMessage span.result {
125
+ display: block;
126
+ line-height: 2em;
127
+ color: black;
128
+ }
129
+
130
+ .resultMessage .mismatch {
131
+ color: black;
132
+ }
133
+
134
+ .stackTrace {
135
+ white-space: pre;
136
+ font-size: .8em;
137
+ margin-left: 10px;
138
+ max-height: 5em;
139
+ overflow: auto;
140
+ border: 1px inset red;
141
+ padding: 1em;
142
+ background: #eef;
143
+ }
144
+
145
+ .finished-at {
146
+ padding-left: 1em;
147
+ font-size: .6em;
148
+ }
149
+
150
+ .show-passed .passed,
151
+ .show-skipped .skipped {
152
+ display: block;
153
+ }
154
+
155
+
156
+ #jasmine_content {
157
+ position:fixed;
158
+ right: 100%;
159
+ }
160
+
161
+ .runner {
162
+ border: 1px solid gray;
163
+ display: block;
164
+ margin: 5px 0;
165
+ padding: 2px 0 2px 10px;
166
+ }