jazrb 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +134 -0
  3. data/bin/autojaz +4 -0
  4. data/bin/jazrb +230 -0
  5. data/doc/jasmine/files.html +460 -0
  6. data/doc/jasmine/index.html +322 -0
  7. data/doc/jasmine/symbols/_global_.html +1083 -0
  8. data/doc/jasmine/symbols/jasmine.Block.html +417 -0
  9. data/doc/jasmine/symbols/jasmine.Clock.html +678 -0
  10. data/doc/jasmine/symbols/jasmine.Env.html +1135 -0
  11. data/doc/jasmine/symbols/jasmine.EnvjsReporter.html +328 -0
  12. data/doc/jasmine/symbols/jasmine.JsApiReporter.html +822 -0
  13. data/doc/jasmine/symbols/jasmine.Matchers.html +1106 -0
  14. data/doc/jasmine/symbols/jasmine.MultiReporter.html +394 -0
  15. data/doc/jasmine/symbols/jasmine.NestedResults.html +710 -0
  16. data/doc/jasmine/symbols/jasmine.Reporter.html +574 -0
  17. data/doc/jasmine/symbols/jasmine.Runner.html +710 -0
  18. data/doc/jasmine/symbols/jasmine.Spec.html +1372 -0
  19. data/doc/jasmine/symbols/jasmine.Spy.html +855 -0
  20. data/doc/jasmine/symbols/jasmine.Suite.html +705 -0
  21. data/doc/jasmine/symbols/jasmine.XMLReporter.html +328 -0
  22. data/doc/jasmine/symbols/jasmine.html +1359 -0
  23. data/doc/jasmine/symbols/jasmine.util.html +535 -0
  24. data/doc/jasmine/symbols/src/lib_EnvjsReporter.js.html +149 -0
  25. data/doc/jasmine/symbols/src/lib_TrivialReporter.js.html +127 -0
  26. data/doc/jasmine/symbols/src/lib_XMLReporter.js.html +210 -0
  27. data/doc/jasmine/symbols/src/src_Block.js.html +35 -0
  28. data/doc/jasmine/symbols/src/src_Env.js.html +233 -0
  29. data/doc/jasmine/symbols/src/src_JsApiReporter.js.html +110 -0
  30. data/doc/jasmine/symbols/src/src_Matchers.js.html +399 -0
  31. data/doc/jasmine/symbols/src/src_MultiReporter.js.html +36 -0
  32. data/doc/jasmine/symbols/src/src_NestedResults.js.html +88 -0
  33. data/doc/jasmine/symbols/src/src_PrettyPrinter.js.html +128 -0
  34. data/doc/jasmine/symbols/src/src_Queue.js.html +119 -0
  35. data/doc/jasmine/symbols/src/src_Reporter.js.html +35 -0
  36. data/doc/jasmine/symbols/src/src_Reporters.js.html +51 -0
  37. data/doc/jasmine/symbols/src/src_Runner.js.html +75 -0
  38. data/doc/jasmine/symbols/src/src_Spec.js.html +228 -0
  39. data/doc/jasmine/symbols/src/src_Suite.js.html +77 -0
  40. data/doc/jasmine/symbols/src/src_WaitsBlock.js.html +21 -0
  41. data/doc/jasmine/symbols/src/src_WaitsForBlock.js.html +45 -0
  42. data/doc/jasmine/symbols/src/src_base.js.html +566 -0
  43. data/doc/jasmine/symbols/src/src_mock-timeout.js.html +185 -0
  44. data/doc/jasmine/symbols/src/src_util.js.html +75 -0
  45. data/lib/autotest/discover.rb +3 -0
  46. data/lib/autotest/jazrb.rb +55 -0
  47. data/lib/jazrb/intro.js +46 -0
  48. data/lib/jazrb/jasmine/EnvjsReporter.js +141 -0
  49. data/lib/jazrb/jasmine/TrivialReporter.js +155 -0
  50. data/lib/jazrb/jasmine/XMLReporter.js +241 -0
  51. data/lib/jazrb/jasmine/consolex.js +28 -0
  52. data/lib/jazrb/jasmine/jasmine-0.10.0.js +2526 -0
  53. data/lib/jazrb/jasmine/jasmine.js +2526 -0
  54. data/lib/jazrb/jasmine/json2.js +478 -0
  55. data/lib/jazrb/options.rb +26 -0
  56. data/lib/jazrb/outro.js +3 -0
  57. data/lib/jazrb/qintro.js +113 -0
  58. data/lib/jazrb/qoutro.js +3 -0
  59. data/lib/jazrb/qunit/qunit.css +17 -0
  60. data/lib/jazrb/qunit/qunit.js +1027 -0
  61. data/lib/jazrb.rb +0 -0
  62. data/spec/example/hello_world_spec.js +29 -0
  63. data/spec/example/nested/HelloWorldSpec.js +13 -0
  64. data/spec/example/nested/SpecHelper.js +1 -0
  65. data/spec/example/plain_spec.js +8 -0
  66. data/spec/example/spec_helper.js +1 -0
  67. data/spec/spec_helper.js +18 -0
  68. data/spec/spec_runner.js +143 -0
  69. data/test/jazrb_test.rb +7 -0
  70. data/test/test_helper.rb +10 -0
  71. data/vendor/jasmine/MIT.LICENSE +20 -0
  72. data/vendor/jasmine/README.markdown +479 -0
  73. data/vendor/jasmine/Rakefile +155 -0
  74. data/vendor/jasmine/contrib/ruby/jasmine_runner.rb +334 -0
  75. data/vendor/jasmine/contrib/ruby/jasmine_spec_builder.rb +153 -0
  76. data/vendor/jasmine/contrib/ruby/run.html +47 -0
  77. data/vendor/jasmine/contrib/ruby/spec/jasmine_runner_spec.rb +71 -0
  78. data/vendor/jasmine/doc/files.html +460 -0
  79. data/vendor/jasmine/doc/index.html +322 -0
  80. data/vendor/jasmine/doc/symbols/_global_.html +1083 -0
  81. data/vendor/jasmine/doc/symbols/jasmine.Block.html +417 -0
  82. data/vendor/jasmine/doc/symbols/jasmine.Clock.html +678 -0
  83. data/vendor/jasmine/doc/symbols/jasmine.Env.html +1135 -0
  84. data/vendor/jasmine/doc/symbols/jasmine.EnvjsReporter.html +328 -0
  85. data/vendor/jasmine/doc/symbols/jasmine.JsApiReporter.html +822 -0
  86. data/vendor/jasmine/doc/symbols/jasmine.Matchers.html +1106 -0
  87. data/vendor/jasmine/doc/symbols/jasmine.MultiReporter.html +394 -0
  88. data/vendor/jasmine/doc/symbols/jasmine.NestedResults.html +710 -0
  89. data/vendor/jasmine/doc/symbols/jasmine.Reporter.html +574 -0
  90. data/vendor/jasmine/doc/symbols/jasmine.Runner.html +710 -0
  91. data/vendor/jasmine/doc/symbols/jasmine.Spec.html +1372 -0
  92. data/vendor/jasmine/doc/symbols/jasmine.Spy.html +855 -0
  93. data/vendor/jasmine/doc/symbols/jasmine.Suite.html +705 -0
  94. data/vendor/jasmine/doc/symbols/jasmine.XMLReporter.html +328 -0
  95. data/vendor/jasmine/doc/symbols/jasmine.html +1359 -0
  96. data/vendor/jasmine/doc/symbols/jasmine.util.html +535 -0
  97. data/vendor/jasmine/doc/symbols/src/lib_EnvjsReporter.js.html +149 -0
  98. data/vendor/jasmine/doc/symbols/src/lib_TrivialReporter.js.html +127 -0
  99. data/vendor/jasmine/doc/symbols/src/lib_XMLReporter.js.html +210 -0
  100. data/vendor/jasmine/doc/symbols/src/src_Block.js.html +35 -0
  101. data/vendor/jasmine/doc/symbols/src/src_Env.js.html +233 -0
  102. data/vendor/jasmine/doc/symbols/src/src_JsApiReporter.js.html +110 -0
  103. data/vendor/jasmine/doc/symbols/src/src_Matchers.js.html +399 -0
  104. data/vendor/jasmine/doc/symbols/src/src_MultiReporter.js.html +36 -0
  105. data/vendor/jasmine/doc/symbols/src/src_NestedResults.js.html +88 -0
  106. data/vendor/jasmine/doc/symbols/src/src_PrettyPrinter.js.html +128 -0
  107. data/vendor/jasmine/doc/symbols/src/src_Queue.js.html +119 -0
  108. data/vendor/jasmine/doc/symbols/src/src_Reporter.js.html +35 -0
  109. data/vendor/jasmine/doc/symbols/src/src_Reporters.js.html +51 -0
  110. data/vendor/jasmine/doc/symbols/src/src_Runner.js.html +75 -0
  111. data/vendor/jasmine/doc/symbols/src/src_Spec.js.html +228 -0
  112. data/vendor/jasmine/doc/symbols/src/src_Suite.js.html +77 -0
  113. data/vendor/jasmine/doc/symbols/src/src_WaitsBlock.js.html +21 -0
  114. data/vendor/jasmine/doc/symbols/src/src_WaitsForBlock.js.html +45 -0
  115. data/vendor/jasmine/doc/symbols/src/src_base.js.html +566 -0
  116. data/vendor/jasmine/doc/symbols/src/src_mock-timeout.js.html +185 -0
  117. data/vendor/jasmine/doc/symbols/src/src_util.js.html +75 -0
  118. data/vendor/jasmine/examples/html/example_suite.html +27 -0
  119. data/vendor/jasmine/examples/html/spec/example_suite.js +11 -0
  120. data/vendor/jasmine/examples/ruby/Rakefile +33 -0
  121. data/vendor/jasmine/examples/ruby/spec/example/example_spec.js +11 -0
  122. data/vendor/jasmine/examples/ruby/spec/jasmine_helper.rb +41 -0
  123. data/vendor/jasmine/examples/ruby/spec/jasmine_spec.rb +31 -0
  124. data/vendor/jasmine/examples/ruby/spec/saucelabs.yml +24 -0
  125. data/vendor/jasmine/geminstaller.yml +23 -0
  126. data/vendor/jasmine/images/fail-16.png +0 -0
  127. data/vendor/jasmine/images/fail.png +0 -0
  128. data/vendor/jasmine/images/go-16.png +0 -0
  129. data/vendor/jasmine/images/go.png +0 -0
  130. data/vendor/jasmine/images/pending-16.png +0 -0
  131. data/vendor/jasmine/images/pending.png +0 -0
  132. data/vendor/jasmine/images/question-bk.png +0 -0
  133. data/vendor/jasmine/images/questionbk-16.png +0 -0
  134. data/vendor/jasmine/images/spinner.gif +0 -0
  135. data/vendor/jasmine/jasmine.watchr +70 -0
  136. data/vendor/jasmine/lib/EnvjsReporter.js +141 -0
  137. data/vendor/jasmine/lib/TrivialReporter.js +155 -0
  138. data/vendor/jasmine/lib/XMLReporter.js +241 -0
  139. data/vendor/jasmine/lib/consolex.js +28 -0
  140. data/vendor/jasmine/lib/jasmine-0.10.0.js +2526 -0
  141. data/vendor/jasmine/lib/jasmine.css +86 -0
  142. data/vendor/jasmine/lib/json2.js +478 -0
  143. data/vendor/jasmine/spec/jasmine_helper.rb +44 -0
  144. data/vendor/jasmine/spec/jasmine_spec.rb +31 -0
  145. data/vendor/jasmine/spec/runner.html +43 -0
  146. data/vendor/jasmine/spec/runner.js +78 -0
  147. data/vendor/jasmine/spec/saucelabs.yml +24 -0
  148. data/vendor/jasmine/spec/suites/EnvSpec.js +71 -0
  149. data/vendor/jasmine/spec/suites/ExceptionsSpec.js +107 -0
  150. data/vendor/jasmine/spec/suites/JsApiReporterSpec.js +82 -0
  151. data/vendor/jasmine/spec/suites/MatchersSpec.js +589 -0
  152. data/vendor/jasmine/spec/suites/MockClockSpec.js +34 -0
  153. data/vendor/jasmine/spec/suites/MultiReporterSpec.js +30 -0
  154. data/vendor/jasmine/spec/suites/NestedResultsSpec.js +54 -0
  155. data/vendor/jasmine/spec/suites/PrettyPrintSpec.js +93 -0
  156. data/vendor/jasmine/spec/suites/QueueSpec.js +23 -0
  157. data/vendor/jasmine/spec/suites/ReporterSpec.js +60 -0
  158. data/vendor/jasmine/spec/suites/RunnerSpec.js +258 -0
  159. data/vendor/jasmine/spec/suites/SpecRunningSpec.js +1117 -0
  160. data/vendor/jasmine/spec/suites/SpecSpec.js +110 -0
  161. data/vendor/jasmine/spec/suites/SpySpec.js +187 -0
  162. data/vendor/jasmine/spec/suites/SuiteSpec.js +101 -0
  163. data/vendor/jasmine/spec/suites/TrivialReporterSpec.js +140 -0
  164. data/vendor/jasmine/spec/suites/UtilSpec.js +23 -0
  165. data/vendor/jasmine/src/Block.js +34 -0
  166. data/vendor/jasmine/src/Env.js +236 -0
  167. data/vendor/jasmine/src/JsApiReporter.js +103 -0
  168. data/vendor/jasmine/src/Matchers.js +326 -0
  169. data/vendor/jasmine/src/MultiReporter.js +28 -0
  170. data/vendor/jasmine/src/NestedResults.js +99 -0
  171. data/vendor/jasmine/src/PrettyPrinter.js +122 -0
  172. data/vendor/jasmine/src/Queue.js +210 -0
  173. data/vendor/jasmine/src/Reporter.js +27 -0
  174. data/vendor/jasmine/src/Reporters.js +43 -0
  175. data/vendor/jasmine/src/Runner.js +68 -0
  176. data/vendor/jasmine/src/Spec.js +254 -0
  177. data/vendor/jasmine/src/Suite.js +70 -0
  178. data/vendor/jasmine/src/WaitsBlock.js +13 -0
  179. data/vendor/jasmine/src/WaitsForBlock.js +38 -0
  180. data/vendor/jasmine/src/base.js +604 -0
  181. data/vendor/jasmine/src/mock-timeout.js +177 -0
  182. data/vendor/jasmine/src/util.js +67 -0
  183. data/vendor/jasmine/src/version.json +5 -0
  184. metadata +279 -0
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Holds results for a set of Jasmine spec. Allows for the results array to hold another jasmine.NestedResults
3
+ *
4
+ * @constructor
5
+ */
6
+ jasmine.NestedResults = function() {
7
+ /**
8
+ * The total count of results
9
+ */
10
+ this.totalCount = 0;
11
+ /**
12
+ * Number of passed results
13
+ */
14
+ this.passedCount = 0;
15
+ /**
16
+ * Number of failed results
17
+ */
18
+ this.failedCount = 0;
19
+ /**
20
+ * Was this suite/spec skipped?
21
+ */
22
+ this.skipped = false;
23
+ /**
24
+ * @ignore
25
+ */
26
+ this.items_ = [];
27
+ };
28
+
29
+ /**
30
+ * Roll up the result counts.
31
+ *
32
+ * @param result
33
+ */
34
+ jasmine.NestedResults.prototype.rollupCounts = function(result) {
35
+ this.totalCount += result.totalCount;
36
+ this.passedCount += result.passedCount;
37
+ this.failedCount += result.failedCount;
38
+ };
39
+
40
+ /**
41
+ * Tracks a result's message.
42
+ * @param message
43
+ */
44
+ jasmine.NestedResults.prototype.log = function(message) {
45
+ this.items_.push(new jasmine.MessageResult(message));
46
+ };
47
+
48
+ /**
49
+ * Getter for the results: message & results.
50
+ */
51
+ jasmine.NestedResults.prototype.getItems = function() {
52
+ return this.items_;
53
+ };
54
+
55
+ /**
56
+ * Adds a result, tracking counts (total, passed, & failed)
57
+ * @param {jasmine.ExpectationResult|jasmine.NestedResults} result
58
+ */
59
+ jasmine.NestedResults.prototype.addResult = function(result) {
60
+ if (result.type != 'MessageResult') {
61
+ if (result.items_) {
62
+ this.rollupCounts(result);
63
+ } else {
64
+ this.totalCount++;
65
+ if (result.passed()) {
66
+ this.passedCount++;
67
+ } else {
68
+ this.failedCount++;
69
+ }
70
+ }
71
+ }
72
+ this.items_.push(result);
73
+ };
74
+
75
+ /**
76
+ * @returns {Boolean} True if <b>everything</b> below passed
77
+ */
78
+ jasmine.NestedResults.prototype.passed = function() {
79
+ return this.passedCount === this.totalCount;
80
+ };
81
+
82
+ jasmine.NestedResults.prototype.block_start = function() {
83
+ this.block_totalCount = this.totalCount;
84
+ this.block_passedCount = this.passedCount;
85
+ this.block_failedCount = this.failedCount;
86
+ this.block_skipped = this.skipped;
87
+ this.items_length = this.items_.length;
88
+ };
89
+
90
+ jasmine.NestedResults.prototype.block_finish = function() {
91
+ };
92
+
93
+ jasmine.NestedResults.prototype.block_abort = function() {
94
+ this.totalCount = this.block_totalCount;
95
+ this.passedCount = this.block_passedCount;
96
+ this.failedCount = this.block_failedCount;
97
+ this.skipped = this.block_skipped;
98
+ this.items_ = this.items_.slice(0,this.items_length);
99
+ }
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Base class for pretty printing for expectation results.
3
+ */
4
+ jasmine.PrettyPrinter = function() {
5
+ this.ppNestLevel_ = 0;
6
+ };
7
+
8
+ /**
9
+ * Formats a value in a nice, human-readable string.
10
+ *
11
+ * @param value
12
+ */
13
+ jasmine.PrettyPrinter.prototype.format = function(value) {
14
+ if (this.ppNestLevel_ > 40) {
15
+ throw new Error('jasmine.PrettyPrinter: format() nested too deeply!');
16
+ }
17
+
18
+ this.ppNestLevel_++;
19
+ try {
20
+ if (value === jasmine.undefined) {
21
+ this.emitScalar('undefined');
22
+ } else if (value === null) {
23
+ this.emitScalar('null');
24
+ } else if (value.navigator /* && value.frames */ && value.setTimeout) {
25
+ this.emitScalar('<window>');
26
+ } else if (value instanceof jasmine.Matchers.Any) {
27
+ this.emitScalar(value.toString());
28
+ } else if (typeof value === 'string') {
29
+ this.emitString(value);
30
+ } else if (jasmine.isSpy(value)) {
31
+ this.emitScalar("spy on " + value.identity);
32
+ } else if (value instanceof RegExp) {
33
+ this.emitScalar(value.toString());
34
+ } else if (typeof value === 'function') {
35
+ this.emitScalar('Function');
36
+ } else if (typeof value.nodeType === 'number') {
37
+ this.emitScalar('HTMLNode');
38
+ } else if (value instanceof Date) {
39
+ this.emitScalar('Date(' + value + ')');
40
+ } else if (value.__Jasmine_been_here_before__) {
41
+ this.emitScalar('<circular reference: ' + (jasmine.isArray_(value) ? 'Array' : 'Object') + '>');
42
+ } else if (jasmine.isArray_(value) || typeof value == 'object') {
43
+ value.__Jasmine_been_here_before__ = true;
44
+ if (jasmine.isArray_(value)) {
45
+ this.emitArray(value);
46
+ } else {
47
+ this.emitObject(value);
48
+ }
49
+ delete value.__Jasmine_been_here_before__;
50
+ } else {
51
+ this.emitScalar(value.toString());
52
+ }
53
+ } finally {
54
+ this.ppNestLevel_--;
55
+ }
56
+ };
57
+
58
+ jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
59
+ for (var property in obj) {
60
+ if (property == '__Jasmine_been_here_before__') continue;
61
+ fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) != null) : false);
62
+ }
63
+ };
64
+
65
+ jasmine.PrettyPrinter.prototype.emitArray = jasmine.unimplementedMethod_;
66
+ jasmine.PrettyPrinter.prototype.emitObject = jasmine.unimplementedMethod_;
67
+ jasmine.PrettyPrinter.prototype.emitScalar = jasmine.unimplementedMethod_;
68
+ jasmine.PrettyPrinter.prototype.emitString = jasmine.unimplementedMethod_;
69
+
70
+ jasmine.StringPrettyPrinter = function() {
71
+ jasmine.PrettyPrinter.call(this);
72
+
73
+ this.string = '';
74
+ };
75
+ jasmine.util.inherit(jasmine.StringPrettyPrinter, jasmine.PrettyPrinter);
76
+
77
+ jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) {
78
+ this.append(value);
79
+ };
80
+
81
+ jasmine.StringPrettyPrinter.prototype.emitString = function(value) {
82
+ this.append("'" + value + "'");
83
+ };
84
+
85
+ jasmine.StringPrettyPrinter.prototype.emitArray = function(array) {
86
+ this.append('[ ');
87
+ for (var i = 0; i < array.length; i++) {
88
+ if (i > 0) {
89
+ this.append(', ');
90
+ }
91
+ this.format(array[i]);
92
+ }
93
+ this.append(' ]');
94
+ };
95
+
96
+ jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) {
97
+ var self = this;
98
+ this.append('{ ');
99
+ var first = true;
100
+
101
+ this.iterateObject(obj, function(property, isGetter) {
102
+ if (first) {
103
+ first = false;
104
+ } else {
105
+ self.append(', ');
106
+ }
107
+
108
+ self.append(property);
109
+ self.append(' : ');
110
+ if (isGetter) {
111
+ self.append('<getter>');
112
+ } else {
113
+ self.format(obj[property]);
114
+ }
115
+ });
116
+
117
+ this.append(' }');
118
+ };
119
+
120
+ jasmine.StringPrettyPrinter.prototype.append = function(value) {
121
+ this.string += value;
122
+ };
@@ -0,0 +1,210 @@
1
+ jasmine.Queue = function(env) {
2
+ this.env = env;
3
+ this.blocks = [];
4
+ this.running = false;
5
+ this.index = 0;
6
+ this.offset = 0;
7
+ this._stopped = 0;
8
+ };
9
+
10
+ jasmine.Queue.prototype.addBefore = function(block) {
11
+ this.blocks.unshift(block);
12
+ };
13
+
14
+ jasmine.Queue.prototype.add = function(block) {
15
+ this.blocks.push(block);
16
+ };
17
+
18
+ jasmine.Queue.prototype.insertNext = function(block) {
19
+ this.blocks.splice((this.index + this.offset + 1), 0, block);
20
+ this.offset++;
21
+ };
22
+
23
+ jasmine.Queue.prototype.start = function(onComplete) {
24
+ this.running = true;
25
+ this.onComplete = onComplete;
26
+ // debug("next_ !!!");
27
+ this.next_();
28
+ };
29
+
30
+ jasmine.Queue.prototype._start = function() {
31
+ var debug = window.console && window.console.debug || window.debug;
32
+ var self = this;
33
+ this._stopped--;
34
+ // debug("start " + this._stopped);
35
+ if(this._stopped == 0 && !this._signaled){
36
+ this._signaled = true;
37
+ // debug("next_ !!");
38
+ setTimeout(function(){
39
+ self._signaled = false;
40
+ self.next_();
41
+ },0);
42
+ }
43
+ if(this._timeout){
44
+ clearTimeout(this._timeout);
45
+ this._timeout = jasmine.undefined;
46
+ }
47
+ };
48
+
49
+ jasmine.Queue.prototype._stop = function(delay) {
50
+ var debug = window.console && window.console.debug || window.debug;
51
+ this._stopped++;
52
+ // debug("stop " + this._stopped);
53
+ if(this._stopped>0){
54
+ var self = this;
55
+ delay = delay || 4000;
56
+ if(this._timeout){
57
+ clearTimeout(this._timeout);
58
+ };
59
+ this._timeout = setTimeout(function test_timeout(){
60
+ // debug("failed");
61
+ self.blocks[0].spec.runs(function(){
62
+ self.blocks[0].spec.expect("test").toComplete();
63
+ });
64
+ self._start();
65
+ },delay);
66
+ }
67
+ };
68
+
69
+ jasmine.Queue.prototype._wait_for = function(condition, fn) {
70
+ var debug = window.console && window.console.debug || window.debug;
71
+ var self = this;
72
+ // debug(self.index,self.blocks[self.index],self.blocks[self.index].is_after);
73
+ self.blocks[0].spec.runs(function(){
74
+ // debug("queue " , self.blocks[0].spec.description,condition+"");
75
+ var timeout = function timeout() {
76
+ if(self._timeout) {
77
+ // debug("check " , self.blocks[0].spec.description,condition+"");
78
+ if(condition()){
79
+ // debug("okay " + self.blocks[0].spec.description);
80
+ fn && fn();
81
+ self._start();
82
+ } else {
83
+ // debug("retry");
84
+ setTimeout(timeout,50);
85
+ }
86
+ } else {
87
+ // debug("not going " + condition);
88
+ // debug("not going " + fn);
89
+ // debug("not going " + self.blocks[0].spec.description);
90
+ }
91
+ };
92
+ setTimeout(timeout,0);
93
+ // debug("?",self._stopped,condition+"");
94
+ self._stop();
95
+ });
96
+ self.blocks[self.index+1].is_after = self.blocks[self.index].is_after;
97
+ };
98
+
99
+ jasmine.Queue.prototype.isRunning = function() {
100
+ return this.running;
101
+ };
102
+
103
+ jasmine.Queue.LOOP_DONT_RECURSE = true;
104
+
105
+ jasmine.Queue.prototype.next_ = function() {
106
+ var debug = window.console && window.console.debug || window.debug;
107
+ // debug("next");
108
+ var self = this;
109
+ var goAgain = true;
110
+
111
+ // debug("stopped",this._stopped,self.index,self.blocks.length);
112
+ while (goAgain && this._stopped <= 0) {
113
+ goAgain = false;
114
+
115
+ if (self.index < self.blocks.length) {
116
+ var calledSynchronously = true;
117
+ var completedSynchronously = false;
118
+
119
+ var onComplete = function () {
120
+ if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) {
121
+ completedSynchronously = true;
122
+ return;
123
+ }
124
+
125
+ /*
126
+ if( self.blocks[self.index]._anticipate !== jasmine.undefined ) {
127
+ }
128
+ */
129
+
130
+ self.offset = 0;
131
+ self.index++;
132
+
133
+ var now = new Date().getTime();
134
+ if(!self._signaled){
135
+ if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) {
136
+ self.env.lastUpdate = now;
137
+ // debug("next_ 00");
138
+ this._signaled = true;
139
+ self.env.setTimeout(function() {
140
+ this._signaled = false;
141
+ self.next_();
142
+ }, 0);
143
+ } else {
144
+ if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) {
145
+ // debug("go again");
146
+ goAgain = true;
147
+ } else {
148
+ // debug("next_ 01");
149
+ self.next_();
150
+ }
151
+ }
152
+ }
153
+ };
154
+
155
+ var block = self.blocks[self.index];
156
+ var spec = block.spec;
157
+ var before = new Date().getTime();
158
+ var delay = 5000;
159
+ var runner = function runner() {
160
+ var saved = spec && spec.is_eventual;
161
+ try {
162
+ var now = new Date().getTime();
163
+ if(spec) {
164
+ if(now - before < delay){
165
+ spec.is_eventual = block.is_eventual;
166
+ spec.block_start();
167
+ }
168
+ }
169
+ block.execute(onComplete);
170
+ spec && spec.is_eventual&& spec.block_finish();
171
+ } catch(e) {
172
+ if(block.is_eventual){
173
+ spec && spec.block_abort();
174
+ setTimeout(function(){
175
+ runner();
176
+ },50);
177
+ } else {
178
+ throw e;
179
+ }
180
+ } finally {
181
+ spec && (spec.is_eventual = saved);
182
+ }
183
+ };
184
+ runner();
185
+
186
+ calledSynchronously = false;
187
+ if (completedSynchronously) {
188
+ onComplete();
189
+ }
190
+
191
+ } else {
192
+ self.running = false;
193
+ if (self.onComplete) {
194
+ self.onComplete();
195
+ }
196
+ }
197
+ }
198
+ };
199
+
200
+ jasmine.Queue.prototype.results = function() {
201
+ var results = new jasmine.NestedResults();
202
+ for (var i = 0; i < this.blocks.length; i++) {
203
+ if (this.blocks[i].results) {
204
+ results.addResult(this.blocks[i].results());
205
+ }
206
+ }
207
+ return results;
208
+ };
209
+
210
+
@@ -0,0 +1,27 @@
1
+ /** No-op base class for Jasmine reporters.
2
+ *
3
+ * @constructor
4
+ */
5
+ jasmine.Reporter = function() {
6
+ };
7
+
8
+ //noinspection JSUnusedLocalSymbols
9
+ jasmine.Reporter.prototype.reportRunnerStarting = function(runner) {
10
+ };
11
+
12
+ //noinspection JSUnusedLocalSymbols
13
+ jasmine.Reporter.prototype.reportRunnerResults = function(runner) {
14
+ };
15
+
16
+ //noinspection JSUnusedLocalSymbols
17
+ jasmine.Reporter.prototype.reportSuiteResults = function(suite) {
18
+ };
19
+
20
+ //noinspection JSUnusedLocalSymbols
21
+ jasmine.Reporter.prototype.reportSpecResults = function(spec) {
22
+ };
23
+
24
+ //noinspection JSUnusedLocalSymbols
25
+ jasmine.Reporter.prototype.log = function(str) {
26
+ };
27
+
@@ -0,0 +1,43 @@
1
+ /** JasmineReporters.reporter
2
+ * Base object that will get called whenever a Spec, Suite, or Runner is done. It is up to
3
+ * descendants of this object to do something with the results (see json_reporter.js)
4
+ *
5
+ * @deprecated
6
+ */
7
+ jasmine.Reporters = {};
8
+
9
+ /**
10
+ * @deprecated
11
+ * @param callbacks
12
+ */
13
+ jasmine.Reporters.reporter = function(callbacks) {
14
+ /**
15
+ * @deprecated
16
+ * @param callbacks
17
+ */
18
+ var that = {
19
+ callbacks: callbacks || {},
20
+
21
+ doCallback: function(callback, results) {
22
+ if (callback) {
23
+ callback(results);
24
+ }
25
+ },
26
+
27
+ reportRunnerResults: function(runner) {
28
+ that.doCallback(that.callbacks.runnerCallback, runner);
29
+ },
30
+ reportSuiteResults: function(suite) {
31
+ that.doCallback(that.callbacks.suiteCallback, suite);
32
+ },
33
+ reportSpecResults: function(spec) {
34
+ that.doCallback(that.callbacks.specCallback, spec);
35
+ },
36
+ log: function (str) {
37
+ if (this.console && this.console.log) this.console.log(str);
38
+ }
39
+ };
40
+
41
+ return that;
42
+ };
43
+
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Runner
3
+ *
4
+ * @constructor
5
+ * @param {jasmine.Env} env
6
+ */
7
+ jasmine.Runner = function(env) {
8
+ var self = this;
9
+ self.env = env;
10
+ self.queue = new jasmine.Queue(env);
11
+ self.before_ = [];
12
+ self.after_ = [];
13
+ self.suites_ = [];
14
+ };
15
+
16
+ jasmine.Runner.prototype.execute = function() {
17
+ var self = this;
18
+ if (self.env.reporter.reportRunnerStarting) {
19
+ self.env.reporter.reportRunnerStarting(this);
20
+ }
21
+ self.queue.start(function () {
22
+ self.finishCallback();
23
+ });
24
+ };
25
+
26
+ jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) {
27
+ beforeEachFunction.typeName = 'beforeEach';
28
+ this.before_.push(beforeEachFunction);
29
+ };
30
+
31
+ jasmine.Runner.prototype.afterEach = function(afterEachFunction) {
32
+ afterEachFunction.typeName = 'afterEach';
33
+ this.after_.push(afterEachFunction);
34
+ };
35
+
36
+
37
+ jasmine.Runner.prototype.finishCallback = function() {
38
+ this.env.reporter.reportRunnerResults(this);
39
+ };
40
+
41
+ jasmine.Runner.prototype.addSuite = function(suite) {
42
+ this.suites_.push(suite);
43
+ };
44
+
45
+ jasmine.Runner.prototype.add = function(block) {
46
+ if (block instanceof jasmine.Suite) {
47
+ this.addSuite(block);
48
+ }
49
+ this.queue.add(block);
50
+ };
51
+
52
+ jasmine.Runner.prototype.specs = function () {
53
+ var suites = this.suites();
54
+ var specs = [];
55
+ for (var i = 0; i < suites.length; i++) {
56
+ specs = specs.concat(suites[i].specs());
57
+ }
58
+ return specs;
59
+ };
60
+
61
+
62
+ jasmine.Runner.prototype.suites = function() {
63
+ return this.suites_;
64
+ };
65
+
66
+ jasmine.Runner.prototype.results = function() {
67
+ return this.queue.results();
68
+ };