Merge branch 'master' of git://github.com/pivotal/jasmine
This commit is contained in:
commit
fd37be4dff
@ -61,13 +61,14 @@ module Jasmine
|
|||||||
end
|
end
|
||||||
|
|
||||||
class RunAdapter
|
class RunAdapter
|
||||||
def initialize(spec_files_or_proc, jasmine_files = nil)
|
def initialize(spec_files_or_proc, jasmine_files = nil, stylesheets = [])
|
||||||
@spec_files_or_proc = spec_files_or_proc
|
@spec_files_or_proc = spec_files_or_proc
|
||||||
@jasmine_files = jasmine_files || [
|
@jasmine_files = jasmine_files || [
|
||||||
"/__JASMINE_ROOT__/lib/" + File.basename(Dir.glob("#{Jasmine.root}/lib/jasmine*.js").first),
|
"/__JASMINE_ROOT__/lib/" + File.basename(Dir.glob("#{Jasmine.root}/lib/jasmine*.js").first),
|
||||||
"/__JASMINE_ROOT__/lib/TrivialReporter.js",
|
"/__JASMINE_ROOT__/lib/TrivialReporter.js",
|
||||||
"/__JASMINE_ROOT__/lib/json2.js"
|
"/__JASMINE_ROOT__/lib/json2.js"
|
||||||
]
|
]
|
||||||
|
@stylesheets = ["/__JASMINE_ROOT__/lib/jasmine.css"] + stylesheets
|
||||||
end
|
end
|
||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
@ -77,7 +78,7 @@ module Jasmine
|
|||||||
jasmine_files = @jasmine_files
|
jasmine_files = @jasmine_files
|
||||||
jasmine_files = jasmine_files.call if jasmine_files.respond_to?(:call)
|
jasmine_files = jasmine_files.call if jasmine_files.respond_to?(:call)
|
||||||
|
|
||||||
css_files = ["/__JASMINE_ROOT__/lib/jasmine.css"]
|
css_files = @stylesheets
|
||||||
|
|
||||||
body = ERB.new(File.read(File.join(File.dirname(__FILE__), "run.html"))).result(binding)
|
body = ERB.new(File.read(File.join(File.dirname(__FILE__), "run.html"))).result(binding)
|
||||||
[
|
[
|
||||||
@ -113,12 +114,12 @@ module Jasmine
|
|||||||
end
|
end
|
||||||
|
|
||||||
class SimpleServer
|
class SimpleServer
|
||||||
def self.start(port, spec_files_or_proc, mappings, jasmine_files = nil)
|
def self.start(port, spec_files_or_proc, mappings, jasmine_files = nil, stylesheets = [])
|
||||||
require 'thin'
|
require 'thin'
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
'/run.html' => Jasmine::Redirect.new('/'),
|
'/run.html' => Jasmine::Redirect.new('/'),
|
||||||
'/' => Jasmine::RunAdapter.new(spec_files_or_proc, jasmine_files)
|
'/' => Jasmine::RunAdapter.new(spec_files_or_proc, jasmine_files, stylesheets)
|
||||||
}
|
}
|
||||||
mappings.each do |from, to|
|
mappings.each do |from, to|
|
||||||
config[from] = Rack::File.new(to)
|
config[from] = Rack::File.new(to)
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
var jsApiReporter;
|
var jsApiReporter;
|
||||||
(function() {
|
(function() {
|
||||||
var jasmineEnv = jasmine.getEnv();
|
var jasmineEnv = jasmine.getEnv();
|
||||||
jasmineEnv.updateInterval = 1000;
|
|
||||||
|
|
||||||
jsApiReporter = new jasmine.JsApiReporter();
|
jsApiReporter = new jasmine.JsApiReporter();
|
||||||
var trivialReporter = new jasmine.TrivialReporter();
|
var trivialReporter = new jasmine.TrivialReporter();
|
||||||
|
@ -258,7 +258,7 @@ ul.inheritsList
|
|||||||
</div>
|
</div>
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:06 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Tue Oct 13 2009 14:46:34 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -300,7 +300,7 @@ ul.inheritsList
|
|||||||
</div>
|
</div>
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:06 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Tue Oct 13 2009 14:46:34 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -908,7 +908,7 @@ A convenience method that allows existing specs to be disabled temporarily durin
|
|||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -339,7 +339,7 @@ ul.inheritsList
|
|||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -507,7 +507,7 @@ ul.inheritsList
|
|||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -316,7 +316,7 @@ ul.inheritsList
|
|||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -316,7 +316,7 @@ ul.inheritsList
|
|||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -700,7 +700,7 @@ ul.inheritsList
|
|||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -316,7 +316,7 @@ ul.inheritsList
|
|||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -418,7 +418,7 @@ ul.inheritsList
|
|||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -396,7 +396,7 @@ ul.inheritsList
|
|||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -845,7 +845,7 @@ expect(foo.bar.callCount).toEqual(0);</pre>
|
|||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:06 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Oct 13 2009 14:46:34 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -436,7 +436,7 @@ ul.inheritsList
|
|||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:06 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Oct 13 2009 14:46:34 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -266,6 +266,29 @@ ul.inheritsList
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<table class="summaryTable" cellspacing="0" summary="A summary of the fields documented in the class jasmine.">
|
||||||
|
<caption>Field Summary</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Field Attributes</th>
|
||||||
|
<th scope="col">Field Name and Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="attributes"><static> </td>
|
||||||
|
<td class="nameDescription">
|
||||||
|
<div class="fixedFont">
|
||||||
|
jasmine.<b><a href="../symbols/jasmine.html#.UPDATE_INTERVAL">UPDATE_INTERVAL</a></b>
|
||||||
|
</div>
|
||||||
|
<div class="description">Large or small values here may result in slow test running & "Too much recursion" errors</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -389,6 +412,33 @@ Jasmine environment.</div>
|
|||||||
|
|
||||||
<!-- ============================== field details ========================== -->
|
<!-- ============================== field details ========================== -->
|
||||||
|
|
||||||
|
<div class="sectionTitle">
|
||||||
|
Field Detail
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a name=".UPDATE_INTERVAL"> </a>
|
||||||
|
<div class="fixedFont"><static>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="light">jasmine.</span><b>UPDATE_INTERVAL</b>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
Large or small values here may result in slow test running & "Too much recursion" errors
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ============================== method details ========================= -->
|
<!-- ============================== method details ========================= -->
|
||||||
|
|
||||||
@ -678,7 +728,7 @@ Jasmine environment.
|
|||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:05 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Oct 13 2009 14:46:33 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -316,7 +316,7 @@ ul.inheritsList
|
|||||||
<!-- ============================== footer ================================= -->
|
<!-- ============================== footer ================================= -->
|
||||||
<div class="fineprint" style="clear:both">
|
<div class="fineprint" style="clear:both">
|
||||||
|
|
||||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Sep 29 2009 22:08:06 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Tue Oct 13 2009 14:46:34 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,12 @@ jasmine.unimplementedMethod_ = function() {
|
|||||||
throw new Error("unimplemented method");
|
throw new Error("unimplemented method");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Large or small values here may result in slow test running & "Too much recursion" errors
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
jasmine.UPDATE_INTERVAL = 250;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows for bound functions to be comapred. Internal use only.
|
* Allows for bound functions to be comapred. Internal use only.
|
||||||
*
|
*
|
||||||
@ -183,6 +189,7 @@ jasmine.Spy = function(name) {
|
|||||||
* mySpy.argsForCall[1] = [7, 8];
|
* mySpy.argsForCall[1] = [7, 8];
|
||||||
*/
|
*/
|
||||||
this.argsForCall = [];
|
this.argsForCall = [];
|
||||||
|
this.calls = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -277,6 +284,7 @@ jasmine.Spy.prototype.reset = function() {
|
|||||||
this.wasCalled = false;
|
this.wasCalled = false;
|
||||||
this.callCount = 0;
|
this.callCount = 0;
|
||||||
this.argsForCall = [];
|
this.argsForCall = [];
|
||||||
|
this.calls = [];
|
||||||
this.mostRecentCall = {};
|
this.mostRecentCall = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -286,13 +294,10 @@ jasmine.createSpy = function(name) {
|
|||||||
spyObj.wasCalled = true;
|
spyObj.wasCalled = true;
|
||||||
spyObj.callCount++;
|
spyObj.callCount++;
|
||||||
var args = jasmine.util.argsToArray(arguments);
|
var args = jasmine.util.argsToArray(arguments);
|
||||||
//spyObj.mostRecentCall = {
|
|
||||||
// object: this,
|
|
||||||
// args: args
|
|
||||||
//};
|
|
||||||
spyObj.mostRecentCall.object = this;
|
spyObj.mostRecentCall.object = this;
|
||||||
spyObj.mostRecentCall.args = args;
|
spyObj.mostRecentCall.args = args;
|
||||||
spyObj.argsForCall.push(args);
|
spyObj.argsForCall.push(args);
|
||||||
|
spyObj.calls.push({object: this, args: args});
|
||||||
return spyObj.plan.apply(this, arguments);
|
return spyObj.plan.apply(this, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -517,7 +522,7 @@ jasmine.version_= {
|
|||||||
"major": 0,
|
"major": 0,
|
||||||
"minor": 9,
|
"minor": 9,
|
||||||
"build": 0,
|
"build": 0,
|
||||||
"revision": 1254287286
|
"revision": 1255470394
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @namespace
|
* @namespace
|
||||||
@ -591,9 +596,7 @@ jasmine.Env = function() {
|
|||||||
|
|
||||||
this.reporter = new jasmine.MultiReporter();
|
this.reporter = new jasmine.MultiReporter();
|
||||||
|
|
||||||
this.updateInterval = 0;
|
this.updateInterval = jasmine.UPDATE_INTERVAL
|
||||||
|
|
||||||
this.updateInterval = 0;
|
|
||||||
this.lastUpdate = 0;
|
this.lastUpdate = 0;
|
||||||
this.specFilter = function() {
|
this.specFilter = function() {
|
||||||
return true;
|
return true;
|
||||||
@ -1479,7 +1482,7 @@ jasmine.Queue = function(env) {
|
|||||||
this.offset = 0;
|
this.offset = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Queue.prototype.addBefore = function (block) {
|
jasmine.Queue.prototype.addBefore = function(block) {
|
||||||
this.blocks.unshift(block);
|
this.blocks.unshift(block);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1487,59 +1490,74 @@ jasmine.Queue.prototype.add = function(block) {
|
|||||||
this.blocks.push(block);
|
this.blocks.push(block);
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Queue.prototype.insertNext = function (block) {
|
jasmine.Queue.prototype.insertNext = function(block) {
|
||||||
this.blocks.splice((this.index + this.offset + 1), 0, block);
|
this.blocks.splice((this.index + this.offset + 1), 0, block);
|
||||||
this.offset++;
|
this.offset++;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Queue.prototype.start = function(onComplete) {
|
jasmine.Queue.prototype.start = function(onComplete) {
|
||||||
var self = this;
|
this.running = true;
|
||||||
self.running = true;
|
this.onComplete = onComplete;
|
||||||
self.onComplete = onComplete;
|
this.next_();
|
||||||
if (self.blocks[0]) {
|
|
||||||
self.blocks[0].execute(function () {
|
|
||||||
self._next();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
self.finish();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Queue.prototype.isRunning = function () {
|
jasmine.Queue.prototype.isRunning = function() {
|
||||||
return this.running;
|
return this.running;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Queue.prototype._next = function () {
|
jasmine.Queue.LOOP_DONT_RECURSE = true;
|
||||||
|
|
||||||
|
jasmine.Queue.prototype.next_ = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var doNext = function () {
|
var goAgain = true;
|
||||||
self.offset = 0;
|
|
||||||
self.index++;
|
while (goAgain) {
|
||||||
|
goAgain = false;
|
||||||
|
|
||||||
if (self.index < self.blocks.length) {
|
if (self.index < self.blocks.length) {
|
||||||
self.blocks[self.index].execute(function () {
|
var calledSynchronously = true;
|
||||||
self._next();
|
var completedSynchronously = false;
|
||||||
});
|
|
||||||
|
var onComplete = function () {
|
||||||
|
if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) {
|
||||||
|
completedSynchronously = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.offset = 0;
|
||||||
|
self.index++;
|
||||||
|
|
||||||
|
var now = new Date().getTime();
|
||||||
|
if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) {
|
||||||
|
self.env.lastUpdate = now;
|
||||||
|
self.env.setTimeout(function() {
|
||||||
|
self.next_();
|
||||||
|
}, 0);
|
||||||
|
} else {
|
||||||
|
if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) {
|
||||||
|
goAgain = true;
|
||||||
|
} else {
|
||||||
|
self.next_();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
self.blocks[self.index].execute(onComplete);
|
||||||
|
|
||||||
|
calledSynchronously = false;
|
||||||
|
if (completedSynchronously) {
|
||||||
|
onComplete();
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
self.finish();
|
self.running = false;
|
||||||
|
if (self.onComplete) {
|
||||||
|
self.onComplete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
var now = new Date().getTime();
|
|
||||||
if (this.env.updateInterval && now - this.env.lastUpdate > this.env.updateInterval) {
|
|
||||||
this.env.lastUpdate = now;
|
|
||||||
this.env.setTimeout(doNext, 0);
|
|
||||||
} else {
|
|
||||||
doNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
jasmine.Queue.prototype.finish = function () {
|
|
||||||
this.running = false;
|
|
||||||
if (this.onComplete) {
|
|
||||||
this.onComplete();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Queue.prototype.results = function () {
|
jasmine.Queue.prototype.results = function() {
|
||||||
var results = new jasmine.NestedResults();
|
var results = new jasmine.NestedResults();
|
||||||
for (var i = 0; i < this.blocks.length; i++) {
|
for (var i = 0; i < this.blocks.length; i++) {
|
||||||
if (this.blocks[i].results) {
|
if (this.blocks[i].results) {
|
||||||
|
76
spec/runner.html
Normal file
76
spec/runner.html
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Jasmine Test Runner</title>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../src/base.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/util.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/Env.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/Reporter.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/Block.js"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../src/JsApiReporter.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/Matchers.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/mock-timeout.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/MultiReporter.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/NestedResults.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/PrettyPrinter.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/Queue.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/Reporters.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/Runner.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/Spec.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/Suite.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/version.json"></script>
|
||||||
|
<script type="text/javascript" src="../src/WaitsBlock.js"></script>
|
||||||
|
<script type="text/javascript" src="../src/WaitsForBlock.js"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../lib/TrivialReporter.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function () {
|
||||||
|
var suites = [
|
||||||
|
'suites/SpySpec.js',
|
||||||
|
'suites/JsApiReporterSpec.js',
|
||||||
|
'suites/RunnerSpec.js',
|
||||||
|
'suites/EnvSpec.js',
|
||||||
|
'suites/NestedResultsSpec.js',
|
||||||
|
'suites/ExceptionsSpec.js',
|
||||||
|
'suites/TrivialReporterSpec.js',
|
||||||
|
'suites/MatchersSpec.js',
|
||||||
|
'suites/QueueSpec.js',
|
||||||
|
'suites/ReporterSpec.js',
|
||||||
|
'suites/MultiReporterSpec.js',
|
||||||
|
'suites/PrettyPrintSpec.js',
|
||||||
|
'suites/SpecSpec.js',
|
||||||
|
'suites/SuiteSpec.js',
|
||||||
|
'suites/SpecRunningSpec.js',
|
||||||
|
];
|
||||||
|
for (var i = 0; i < suites.length; i++) {
|
||||||
|
jasmine.include(suites[i], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
var jasmineEnv = jasmine.getEnv();
|
||||||
|
jasmineEnv.updateInterval = 1000;
|
||||||
|
|
||||||
|
var trivialReporter = new jasmine.TrivialReporter();
|
||||||
|
|
||||||
|
jasmineEnv.addReporter(trivialReporter);
|
||||||
|
|
||||||
|
jasmineEnv.specFilter = function(spec) {
|
||||||
|
return trivialReporter.specFilter(spec);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
jasmineEnv.execute();
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<link href="../lib/jasmine.css" rel="stylesheet"/>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,10 +1,12 @@
|
|||||||
describe("jasmine.Env", function() {
|
describe("jasmine.Env", function() {
|
||||||
|
var env;
|
||||||
|
beforeEach(function() {
|
||||||
|
env = new jasmine.Env();
|
||||||
|
env.updateInterval = 0;
|
||||||
|
});
|
||||||
|
|
||||||
describe('ids', function () {
|
describe('ids', function () {
|
||||||
var env;
|
|
||||||
beforeEach(function() {
|
|
||||||
env = new jasmine.Env();
|
|
||||||
});
|
|
||||||
it('nextSpecId should return consecutive integers, starting at 0', function () {
|
it('nextSpecId should return consecutive integers, starting at 0', function () {
|
||||||
expect(env.nextSpecId()).toEqual(0);
|
expect(env.nextSpecId()).toEqual(0);
|
||||||
expect(env.nextSpecId()).toEqual(1);
|
expect(env.nextSpecId()).toEqual(1);
|
||||||
@ -18,11 +20,9 @@ describe("jasmine.Env", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe("reporting", function() {
|
describe("reporting", function() {
|
||||||
var env;
|
|
||||||
var fakeReporter;
|
var fakeReporter;
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
env = new jasmine.Env();
|
|
||||||
fakeReporter = jasmine.createSpyObj("fakeReporter", ["log"]);
|
fakeReporter = jasmine.createSpyObj("fakeReporter", ["log"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ describe("jasmine.Env", function() {
|
|||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
jasmine.version_ = oldVersion;
|
jasmine.version_ = oldVersion;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should raise an error if version is not set', function () {
|
it('should raise an error if version is not set', function () {
|
||||||
jasmine.version_ = null;
|
jasmine.version_ = null;
|
||||||
var exception;
|
var exception;
|
||||||
|
@ -3,6 +3,7 @@ describe('Exceptions:', function() {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
env = new jasmine.Env();
|
env = new jasmine.Env();
|
||||||
|
env.updateInterval = 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('jasmine.formatException formats Firefox exception maessages as expected', function() {
|
it('jasmine.formatException formats Firefox exception maessages as expected', function() {
|
||||||
|
@ -6,6 +6,7 @@ describe('jasmine.jsApiReporter', function() {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
var env = new jasmine.Env();
|
var env = new jasmine.Env();
|
||||||
|
env.updateInterval = 0;
|
||||||
var suite = new jasmine.Suite(env);
|
var suite = new jasmine.Suite(env);
|
||||||
spec1 = new jasmine.Spec(env, suite, 'spec 1');
|
spec1 = new jasmine.Spec(env, suite, 'spec 1');
|
||||||
spec1.runs(function () {
|
spec1.runs(function () {
|
||||||
|
@ -3,6 +3,7 @@ describe("jasmine.Matchers", function() {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
env = new jasmine.Env();
|
env = new jasmine.Env();
|
||||||
|
env.updateInterval = 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
function match(value) {
|
function match(value) {
|
||||||
|
23
spec/suites/QueueSpec.js
Normal file
23
spec/suites/QueueSpec.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
describe("jasmine.Queue", function() {
|
||||||
|
it("should not call itself recursively, so we don't get stack overflow errors", function() {
|
||||||
|
var queue = new jasmine.Queue(new jasmine.Env());
|
||||||
|
queue.add(new jasmine.Block(null, function() {}));
|
||||||
|
queue.add(new jasmine.Block(null, function() {}));
|
||||||
|
queue.add(new jasmine.Block(null, function() {}));
|
||||||
|
queue.add(new jasmine.Block(null, function() {}));
|
||||||
|
|
||||||
|
var nestCount = 0;
|
||||||
|
var maxNestCount = 0;
|
||||||
|
var nextCallCount = 0;
|
||||||
|
queue.next_ = function() {
|
||||||
|
nestCount++;
|
||||||
|
if (nestCount > maxNestCount) maxNestCount = nestCount;
|
||||||
|
|
||||||
|
jasmine.Queue.prototype.next_.apply(queue, arguments);
|
||||||
|
nestCount--;
|
||||||
|
};
|
||||||
|
|
||||||
|
queue.start();
|
||||||
|
expect(maxNestCount).toEqual(1);
|
||||||
|
});
|
||||||
|
});
|
@ -4,7 +4,7 @@ describe('jasmine.Reporter', function() {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
env = new jasmine.Env();
|
env = new jasmine.Env();
|
||||||
|
env.updateInterval = 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should get called from the test runner', function() {
|
it('should get called from the test runner', function() {
|
||||||
|
@ -4,6 +4,7 @@ describe('RunnerTest', function() {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
env = new jasmine.Env();
|
env = new jasmine.Env();
|
||||||
|
env.updateInterval = 0;
|
||||||
|
|
||||||
fakeTimer = new jasmine.FakeTimer();
|
fakeTimer = new jasmine.FakeTimer();
|
||||||
env.setTimeout = fakeTimer.setTimeout;
|
env.setTimeout = fakeTimer.setTimeout;
|
||||||
|
@ -4,6 +4,7 @@ describe("jasmine spec running", function () {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
env = new jasmine.Env();
|
env = new jasmine.Env();
|
||||||
|
env.updateInterval = 0;
|
||||||
|
|
||||||
fakeTimer = new jasmine.FakeTimer();
|
fakeTimer = new jasmine.FakeTimer();
|
||||||
env.setTimeout = fakeTimer.setTimeout;
|
env.setTimeout = fakeTimer.setTimeout;
|
||||||
|
@ -2,6 +2,7 @@ describe('Spec', function () {
|
|||||||
var env, suite;
|
var env, suite;
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
env = new jasmine.Env();
|
env = new jasmine.Env();
|
||||||
|
env.updateInterval = 0;
|
||||||
suite = new jasmine.Suite(env, 'suite 1');
|
suite = new jasmine.Suite(env, 'suite 1');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -76,34 +77,34 @@ describe('Spec', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('results.passed', function () {
|
describe('results.passed', function () {
|
||||||
it('is true if all spec expectations pass', function () {
|
it('is true if all spec expectations pass', function () {
|
||||||
spec.runs(function () {
|
spec.runs(function () {
|
||||||
this.expect(true).toEqual(true);
|
this.expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
spec.execute();
|
||||||
|
expect(results.passed()).toEqual(true);
|
||||||
});
|
});
|
||||||
spec.execute();
|
|
||||||
expect(results.passed()).toEqual(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('is false if one spec expectation fails', function () {
|
it('is false if one spec expectation fails', function () {
|
||||||
spec.runs(function () {
|
spec.runs(function () {
|
||||||
this.expect(true).toEqual(false);
|
this.expect(true).toEqual(false);
|
||||||
|
});
|
||||||
|
spec.execute();
|
||||||
|
expect(results.passed()).toEqual(false);
|
||||||
});
|
});
|
||||||
spec.execute();
|
|
||||||
expect(results.passed()).toEqual(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('a spec with no expectations will return true', function () {
|
it('a spec with no expectations will return true', function () {
|
||||||
var specWithoutExpectations = new jasmine.Spec(env, suite);
|
var specWithoutExpectations = new jasmine.Spec(env, suite);
|
||||||
specWithoutExpectations.runs(function() {
|
specWithoutExpectations.runs(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
specWithoutExpectations.execute();
|
||||||
|
expect(results.passed()).toEqual(true);
|
||||||
});
|
});
|
||||||
specWithoutExpectations.execute();
|
|
||||||
expect(results.passed()).toEqual(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('an unexecuted spec will return true', function () {
|
it('an unexecuted spec will return true', function () {
|
||||||
expect(results.passed()).toEqual(true);
|
expect(results.passed()).toEqual(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
@ -4,6 +4,7 @@ describe('Suite', function() {
|
|||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
env = new jasmine.Env();
|
env = new jasmine.Env();
|
||||||
|
env.updateInterval = 0;
|
||||||
|
|
||||||
fakeTimer = new jasmine.FakeTimer();
|
fakeTimer = new jasmine.FakeTimer();
|
||||||
env.setTimeout = fakeTimer.setTimeout;
|
env.setTimeout = fakeTimer.setTimeout;
|
||||||
|
@ -11,9 +11,7 @@ jasmine.Env = function() {
|
|||||||
|
|
||||||
this.reporter = new jasmine.MultiReporter();
|
this.reporter = new jasmine.MultiReporter();
|
||||||
|
|
||||||
this.updateInterval = 0;
|
this.updateInterval = jasmine.UPDATE_INTERVAL
|
||||||
|
|
||||||
this.updateInterval = 0;
|
|
||||||
this.lastUpdate = 0;
|
this.lastUpdate = 0;
|
||||||
this.specFilter = function() {
|
this.specFilter = function() {
|
||||||
return true;
|
return true;
|
||||||
|
89
src/Queue.js
89
src/Queue.js
@ -6,7 +6,7 @@ jasmine.Queue = function(env) {
|
|||||||
this.offset = 0;
|
this.offset = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Queue.prototype.addBefore = function (block) {
|
jasmine.Queue.prototype.addBefore = function(block) {
|
||||||
this.blocks.unshift(block);
|
this.blocks.unshift(block);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -14,59 +14,74 @@ jasmine.Queue.prototype.add = function(block) {
|
|||||||
this.blocks.push(block);
|
this.blocks.push(block);
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Queue.prototype.insertNext = function (block) {
|
jasmine.Queue.prototype.insertNext = function(block) {
|
||||||
this.blocks.splice((this.index + this.offset + 1), 0, block);
|
this.blocks.splice((this.index + this.offset + 1), 0, block);
|
||||||
this.offset++;
|
this.offset++;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Queue.prototype.start = function(onComplete) {
|
jasmine.Queue.prototype.start = function(onComplete) {
|
||||||
var self = this;
|
this.running = true;
|
||||||
self.running = true;
|
this.onComplete = onComplete;
|
||||||
self.onComplete = onComplete;
|
this.next_();
|
||||||
if (self.blocks[0]) {
|
|
||||||
self.blocks[0].execute(function () {
|
|
||||||
self._next();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
self.finish();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Queue.prototype.isRunning = function () {
|
jasmine.Queue.prototype.isRunning = function() {
|
||||||
return this.running;
|
return this.running;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Queue.prototype._next = function () {
|
jasmine.Queue.LOOP_DONT_RECURSE = true;
|
||||||
|
|
||||||
|
jasmine.Queue.prototype.next_ = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var doNext = function () {
|
var goAgain = true;
|
||||||
self.offset = 0;
|
|
||||||
self.index++;
|
while (goAgain) {
|
||||||
|
goAgain = false;
|
||||||
|
|
||||||
if (self.index < self.blocks.length) {
|
if (self.index < self.blocks.length) {
|
||||||
self.blocks[self.index].execute(function () {
|
var calledSynchronously = true;
|
||||||
self._next();
|
var completedSynchronously = false;
|
||||||
});
|
|
||||||
|
var onComplete = function () {
|
||||||
|
if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) {
|
||||||
|
completedSynchronously = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.offset = 0;
|
||||||
|
self.index++;
|
||||||
|
|
||||||
|
var now = new Date().getTime();
|
||||||
|
if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) {
|
||||||
|
self.env.lastUpdate = now;
|
||||||
|
self.env.setTimeout(function() {
|
||||||
|
self.next_();
|
||||||
|
}, 0);
|
||||||
|
} else {
|
||||||
|
if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) {
|
||||||
|
goAgain = true;
|
||||||
|
} else {
|
||||||
|
self.next_();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
self.blocks[self.index].execute(onComplete);
|
||||||
|
|
||||||
|
calledSynchronously = false;
|
||||||
|
if (completedSynchronously) {
|
||||||
|
onComplete();
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
self.finish();
|
self.running = false;
|
||||||
|
if (self.onComplete) {
|
||||||
|
self.onComplete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
var now = new Date().getTime();
|
|
||||||
if (this.env.updateInterval && now - this.env.lastUpdate > this.env.updateInterval) {
|
|
||||||
this.env.lastUpdate = now;
|
|
||||||
this.env.setTimeout(doNext, 0);
|
|
||||||
} else {
|
|
||||||
doNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
jasmine.Queue.prototype.finish = function () {
|
|
||||||
this.running = false;
|
|
||||||
if (this.onComplete) {
|
|
||||||
this.onComplete();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.Queue.prototype.results = function () {
|
jasmine.Queue.prototype.results = function() {
|
||||||
var results = new jasmine.NestedResults();
|
var results = new jasmine.NestedResults();
|
||||||
for (var i = 0; i < this.blocks.length; i++) {
|
for (var i = 0; i < this.blocks.length; i++) {
|
||||||
if (this.blocks[i].results) {
|
if (this.blocks[i].results) {
|
||||||
|
13
src/base.js
13
src/base.js
@ -12,6 +12,12 @@ jasmine.unimplementedMethod_ = function() {
|
|||||||
throw new Error("unimplemented method");
|
throw new Error("unimplemented method");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Large or small values here may result in slow test running & "Too much recursion" errors
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
jasmine.UPDATE_INTERVAL = 250;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows for bound functions to be comapred. Internal use only.
|
* Allows for bound functions to be comapred. Internal use only.
|
||||||
*
|
*
|
||||||
@ -183,6 +189,7 @@ jasmine.Spy = function(name) {
|
|||||||
* mySpy.argsForCall[1] = [7, 8];
|
* mySpy.argsForCall[1] = [7, 8];
|
||||||
*/
|
*/
|
||||||
this.argsForCall = [];
|
this.argsForCall = [];
|
||||||
|
this.calls = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -277,6 +284,7 @@ jasmine.Spy.prototype.reset = function() {
|
|||||||
this.wasCalled = false;
|
this.wasCalled = false;
|
||||||
this.callCount = 0;
|
this.callCount = 0;
|
||||||
this.argsForCall = [];
|
this.argsForCall = [];
|
||||||
|
this.calls = [];
|
||||||
this.mostRecentCall = {};
|
this.mostRecentCall = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -286,13 +294,10 @@ jasmine.createSpy = function(name) {
|
|||||||
spyObj.wasCalled = true;
|
spyObj.wasCalled = true;
|
||||||
spyObj.callCount++;
|
spyObj.callCount++;
|
||||||
var args = jasmine.util.argsToArray(arguments);
|
var args = jasmine.util.argsToArray(arguments);
|
||||||
//spyObj.mostRecentCall = {
|
|
||||||
// object: this,
|
|
||||||
// args: args
|
|
||||||
//};
|
|
||||||
spyObj.mostRecentCall.object = this;
|
spyObj.mostRecentCall.object = this;
|
||||||
spyObj.mostRecentCall.args = args;
|
spyObj.mostRecentCall.args = args;
|
||||||
spyObj.argsForCall.push(args);
|
spyObj.argsForCall.push(args);
|
||||||
|
spyObj.calls.push({object: this, args: args});
|
||||||
return spyObj.plan.apply(this, arguments);
|
return spyObj.plan.apply(this, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user