Merge branch 'master' of git@github.com:pivotal/jasmine
Conflicts: spec/runner.html
This commit is contained in:
commit
6b3bf1b3ba
@ -31,9 +31,11 @@ open `examples/test/html/example_suite.html` in your favorite browser.
|
|||||||
|
|
||||||
Releases
|
Releases
|
||||||
----------
|
----------
|
||||||
0.9.0 beta [[download]](http://github.com/pivotal/jasmine/zipball/master)
|
0.10.0 [[download]](http://github.com/pivotal/jasmine/zipball/master)
|
||||||
`git clone git://github.com/pivotal/jasmine.git`
|
`git clone git://github.com/pivotal/jasmine.git`
|
||||||
|
|
||||||
|
0.9.0 [[download]](http://github.com/pivotal/jasmine/zipball/0.9.0)
|
||||||
|
|
||||||
0.8.0 [[download]](http://github.com/pivotal/jasmine/zipball/0.8.0)
|
0.8.0 [[download]](http://github.com/pivotal/jasmine/zipball/0.8.0)
|
||||||
|
|
||||||
### Which Release Should I Use?
|
### Which Release Should I Use?
|
||||||
@ -261,11 +263,11 @@ A suite can have a beforeEach declaration. It takes a function that is run befor
|
|||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
suiteWideFoo = 1;
|
suiteWideFoo = 1;
|
||||||
}
|
});
|
||||||
|
|
||||||
it('should equal bar', function () {
|
it('should equal bar', function () {
|
||||||
expect(suiteWideFoo).toEqual(1);
|
expect(suiteWideFoo).toEqual(1);
|
||||||
};
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
A runner can also have beforeEach declarations. Runner beforeEach functions are executed before every spec in all suites, and execute BEFORE suite beforeEach functions. For example:
|
A runner can also have beforeEach declarations. Runner beforeEach functions are executed before every spec in all suites, and execute BEFORE suite beforeEach functions. For example:
|
||||||
@ -280,11 +282,11 @@ A runner can also have beforeEach declarations. Runner beforeEach functions are
|
|||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
runnerWideFoo.push('suite');
|
runnerWideFoo.push('suite');
|
||||||
}
|
});
|
||||||
|
|
||||||
it('should equal bar', function () {
|
it('should equal bar', function () {
|
||||||
expect(runnerWideFoo).toEqual(['runner', 'suite']);
|
expect(runnerWideFoo).toEqual(['runner', 'suite']);
|
||||||
};
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
#### afterEach
|
#### afterEach
|
||||||
@ -296,11 +298,11 @@ Similarly, there is an afterEach declaration. It takes a function that is run a
|
|||||||
var suiteWideFoo;
|
var suiteWideFoo;
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
suiteWideFoo = 0;
|
suiteWideFoo = 0;
|
||||||
}
|
});
|
||||||
|
|
||||||
it('should equal 1', function () {
|
it('should equal 1', function () {
|
||||||
expect(suiteWideFoo).toEqual(1);
|
expect(suiteWideFoo).toEqual(1);
|
||||||
};
|
});
|
||||||
|
|
||||||
it('should equal 0 after', function () {
|
it('should equal 0 after', function () {
|
||||||
expect(suiteWideFoo).toEqual(0);
|
expect(suiteWideFoo).toEqual(0);
|
||||||
@ -319,11 +321,11 @@ A runner can also have an afterEach declarations. Runner afterEach functions are
|
|||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
runnerWideFoo.push('suite');
|
runnerWideFoo.push('suite');
|
||||||
}
|
});
|
||||||
|
|
||||||
it('should be empty', function () {
|
it('should be empty', function () {
|
||||||
expect(runnerWideFoo).toEqual([]);
|
expect(runnerWideFoo).toEqual([]);
|
||||||
};
|
});
|
||||||
|
|
||||||
it('should be populated after', function () {
|
it('should be populated after', function () {
|
||||||
expect(runnerWideFoo).toEqual(['suite', 'runner']);
|
expect(runnerWideFoo).toEqual(['suite', 'runner']);
|
||||||
@ -350,14 +352,14 @@ Jasmine supports nested describes. An example:
|
|||||||
it('nested expectation', function () {
|
it('nested expectation', function () {
|
||||||
expect(suiteWideFoo).toEqual(0);
|
expect(suiteWideFoo).toEqual(0);
|
||||||
expect(nestedSuiteBar).toEqual(1);
|
expect(nestedSuiteBar).toEqual(1);
|
||||||
};
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('top-level describe', function () {
|
it('top-level describe', function () {
|
||||||
expect(suiteWideFoo).toEqual(0);
|
expect(suiteWideFoo).toEqual(0);
|
||||||
expect(nestedSuiteBar).toEqual(undefined);
|
expect(nestedSuiteBar).toEqual(undefined);
|
||||||
};
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
### Spies
|
### Spies
|
||||||
@ -367,15 +369,15 @@ Jasmine integrates 'spies' that permit many spying, mocking, and faking behavior
|
|||||||
Here are a few examples:
|
Here are a few examples:
|
||||||
|
|
||||||
var Klass = function () {
|
var Klass = function () {
|
||||||
}
|
};
|
||||||
|
|
||||||
var Klass.prototype.method = function (arg) {
|
var Klass.prototype.method = function (arg) {
|
||||||
return arg;
|
return arg;
|
||||||
}
|
};
|
||||||
|
|
||||||
var Klass.prototype.methodWithCallback = function (callback) {
|
var Klass.prototype.methodWithCallback = function (callback) {
|
||||||
return callback('foo');
|
return callback('foo');
|
||||||
}
|
};
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
|
@ -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)
|
||||||
@ -185,6 +186,8 @@ module Jasmine
|
|||||||
@dir_mappings = dir_mappings
|
@dir_mappings = dir_mappings
|
||||||
@jasmine_files = jasmine_files
|
@jasmine_files = jasmine_files
|
||||||
@browser = options[:browser] || 'firefox'
|
@browser = options[:browser] || 'firefox'
|
||||||
|
@stylesheets = options[:stylesheets] || []
|
||||||
|
|
||||||
|
|
||||||
@selenium_pid = nil
|
@selenium_pid = nil
|
||||||
@jasmine_server_pid = nil
|
@jasmine_server_pid = nil
|
||||||
@ -213,7 +216,7 @@ module Jasmine
|
|||||||
|
|
||||||
@jasmine_server_pid = fork do
|
@jasmine_server_pid = fork do
|
||||||
Process.setpgrp
|
Process.setpgrp
|
||||||
Jasmine::SimpleServer.start(@jasmine_server_port, @spec_files, @dir_mappings, @jasmine_files)
|
Jasmine::SimpleServer.start(@jasmine_server_port, @spec_files, @dir_mappings, @jasmine_files, @stylesheets)
|
||||||
exit! 0
|
exit! 0
|
||||||
end
|
end
|
||||||
puts "jasmine server started. pid is #{@jasmine_server_pid}"
|
puts "jasmine server started. pid is #{@jasmine_server_pid}"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
|
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
|
||||||
<title>Jasmine suite</title>
|
<title>Jasmine suite</title>
|
||||||
<% css_files.each do |css_file| %>
|
<% css_files.each do |css_file| %>
|
||||||
<link rel="stylesheet" href="<%= css_file %>" type="text/css" media="screen" />
|
<link rel="stylesheet" href="<%= css_file %>" type="text/css" media="screen"/>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% jasmine_files.each do |jasmine_file| %>
|
<% jasmine_files.each do |jasmine_file| %>
|
||||||
@ -15,7 +15,7 @@
|
|||||||
var jsApiReporter;
|
var jsApiReporter;
|
||||||
(function() {
|
(function() {
|
||||||
var jasmineEnv = jasmine.getEnv();
|
var jasmineEnv = jasmine.getEnv();
|
||||||
|
|
||||||
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 Mon Oct 05 2009 22:35:02 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Fri Oct 16 2009 20:09:17 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 Mon Oct 05 2009 22:35:02 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Fri Oct 16 2009 20:09:17 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 Mon Oct 05 2009 22:35:01 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 16 2009 20:09:16 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 Mon Oct 05 2009 22:35:01 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 16 2009 20:09:16 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 Mon Oct 05 2009 22:35:01 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 16 2009 20:09:16 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 Mon Oct 05 2009 22:35:01 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 16 2009 20:09:16 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 Mon Oct 05 2009 22:35:01 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 16 2009 20:09:16 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 Mon Oct 05 2009 22:35:01 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 16 2009 20:09:16 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 Mon Oct 05 2009 22:35:01 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 16 2009 20:09:16 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 Mon Oct 05 2009 22:35:01 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 16 2009 20:09:16 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 Mon Oct 05 2009 22:35:02 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 16 2009 20:09:16 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 Mon Oct 05 2009 22:35:02 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 16 2009 20:09:16 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 Mon Oct 05 2009 22:35:02 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 16 2009 20:09:17 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -728,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 Mon Oct 05 2009 22:35:01 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 16 2009 20:09:16 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 Mon Oct 05 2009 22:35:02 GMT-0700 (PDT)
|
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 16 2009 20:09:17 GMT-0700 (PDT)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -26,108 +26,119 @@
|
|||||||
<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">attr</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">attrs</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">attr</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">attrs</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">attr</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'className'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">attr</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'className'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 21</span> </span><span class="WHIT"> </span><span class="NAME">el.setAttribute</span><span class="PUNC">(</span><span class="STRN">'class'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">attrs</span><span class="PUNC">[</span><span class="NAME">attr</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 21</span> </span><span class="WHIT"> </span><span class="NAME">el.setAttribute</span><span class="PUNC">(</span><span class="STRN">'class'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">attrs</span><span class="PUNC">[</span><span class="NAME">attr</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="COMM">//twice for ie</span><span class="WHIT">
|
||||||
<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="NAME">el</span><span class="PUNC">[</span><span class="NAME">attr</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">attrs</span><span class="PUNC">[</span><span class="NAME">attr</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="NAME">el.setAttribute</span><span class="PUNC">(</span><span class="STRN">'className'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">attrs</span><span class="PUNC">[</span><span class="NAME">attr</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 24</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 24</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="NAME">el</span><span class="PUNC">[</span><span class="NAME">attr</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">attrs</span><span class="PUNC">[</span><span class="NAME">attr</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 26</span>
|
<span class='line'> 26</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 27</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">el</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 27</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 28</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 28</span>
|
||||||
<span class='line'> 29</span>
|
<span class='line'> 29</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">el</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 30</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.reportRunnerStarting</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">runner</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 30</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 31</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">suites</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">runner.suites</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 31</span>
|
||||||
<span class='line'> 32</span>
|
<span class='line'> 32</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.reportRunnerStarting</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">runner</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 33</span> </span><span class="WHIT"> </span><span class="NAME">this.runnerDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'runner running'</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 33</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">suites</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">runner.suites</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 34</span> </span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'a'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'runSpec'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">href</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'?'</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"run all"</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 34</span>
|
||||||
<span class='line'> 35</span> </span><span class="WHIT"> </span><span class="NAME">this.runnerMessageSpan</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'span'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"Running..."</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 35</span> </span><span class="WHIT"> </span><span class="NAME">this.runnerDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'runner running'</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="NAME">this.document.body.appendChild</span><span class="PUNC">(</span><span class="NAME">this.runnerDiv</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'a'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'run_spec'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">href</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'?'</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"run all"</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 37</span>
|
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="NAME">this.runnerMessageSpan</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'span'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"Running..."</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 38</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">suites.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 38</span> </span><span class="WHIT"> </span><span class="NAME">this.document.body.appendChild</span><span class="PUNC">(</span><span class="NAME">this.runnerDiv</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 39</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">suite</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">suites</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 39</span>
|
||||||
<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">suiteDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'suite'</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">suites.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'a'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'runSpec'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">href</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'?spec='</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">suite.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"run"</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">suite</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">suites</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="NAME">suite.description</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">suiteDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'suite'</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="NAME">this.suiteDivs</span><span class="PUNC">[</span><span class="NAME">suite.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">suiteDiv</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'a'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'run_spec'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">href</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'?spec='</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">suite.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"run"</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">parentDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.document.body</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'a'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'description'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">href</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'?spec='</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">suite.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">suite.description</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">suite.parentSuite</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="NAME">this.suiteDivs</span><span class="PUNC">[</span><span class="NAME">suite.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">suiteDiv</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="NAME">parentDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.suiteDivs</span><span class="PUNC">[</span><span class="NAME">suite.parentSuite.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">parentDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.document.body</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">suite.parentSuite</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="NAME">parentDiv.appendChild</span><span class="PUNC">(</span><span class="NAME">suiteDiv</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="NAME">parentDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.suiteDivs</span><span class="PUNC">[</span><span class="NAME">suite.parentSuite.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 49</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 49</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 50</span>
|
<span class='line'> 50</span> </span><span class="WHIT"> </span><span class="NAME">parentDiv.appendChild</span><span class="PUNC">(</span><span class="NAME">suiteDiv</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 51</span> </span><span class="WHIT"> </span><span class="NAME">this.startedAt</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Date</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 51</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 52</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 52</span>
|
||||||
<span class='line'> 53</span>
|
<span class='line'> 53</span> </span><span class="WHIT"> </span><span class="NAME">this.startedAt</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Date</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 54</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.reportRunnerResults</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">runner</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 54</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 55</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">runner.results</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 55</span>
|
||||||
<span class='line'> 56</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">className</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">results.failedCount</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"runner failed"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"runner passed"</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 56</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.reportRunnerResults</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">runner</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 57</span> </span><span class="WHIT"> </span><span class="NAME">this.runnerDiv.setAttribute</span><span class="PUNC">(</span><span class="STRN">"class"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 57</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">runner.results</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 58</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">message</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">results.failedCount</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" failure"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">results.failedCount</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">""</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"s"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 58</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">className</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">results.failedCount</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"runner failed"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"runner passed"</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 59</span> </span><span class="WHIT"> </span><span class="NAME">message</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">" in "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Date</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">getTime</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">this.startedAt.getTime</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NUMB">1000</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"s"</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 59</span> </span><span class="WHIT"> </span><span class="NAME">this.runnerDiv.setAttribute</span><span class="PUNC">(</span><span class="STRN">"class"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 60</span> </span><span class="WHIT"> </span><span class="NAME">this.runnerMessageSpan.replaceChild</span><span class="PUNC">(</span><span class="NAME">this.document.createTextNode</span><span class="PUNC">(</span><span class="NAME">message</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.runnerMessageSpan.firstChild</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 60</span> </span><span class="WHIT"> </span><span class="COMM">//do it twice for IE</span><span class="WHIT">
|
||||||
<span class='line'> 61</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 61</span> </span><span class="WHIT"> </span><span class="NAME">this.runnerDiv.setAttribute</span><span class="PUNC">(</span><span class="STRN">"className"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 62</span>
|
<span class='line'> 62</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">specs</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">runner.specs</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 63</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.reportSuiteResults</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">suite</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 63</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">specCount</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">suite.results</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">specs.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">results.passed</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'passed'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'failed'</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this.specFilter</span><span class="PUNC">(</span><span class="NAME">specs</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 66</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">results.totalCount</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// todo: change this to check results.skipped</span><span class="WHIT">
|
<span class='line'> 66</span> </span><span class="WHIT"> </span><span class="NAME">specCount</span><span class="PUNC">++</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 67</span> </span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'skipped'</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 67</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 68</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 68</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 69</span> </span><span class="WHIT"> </span><span class="NAME">this.suiteDivs</span><span class="PUNC">[</span><span class="NAME">suite.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">className</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">" "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">status</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 69</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">message</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">specCount</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" spec"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">specCount</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">""</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"s"</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">", "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">results.failedCount</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" failure"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">results.failedCount</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">""</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"s"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 70</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 70</span> </span><span class="WHIT"> </span><span class="NAME">message</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">" in "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Date</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">getTime</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">this.startedAt.getTime</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">/</span><span class="WHIT"> </span><span class="NUMB">1000</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"s"</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 71</span>
|
<span class='line'> 71</span> </span><span class="WHIT"> </span><span class="NAME">this.runnerMessageSpan.replaceChild</span><span class="PUNC">(</span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'a'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'description'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">href</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'?'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this.runnerMessageSpan.firstChild</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 72</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.reportSpecResults</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">spec</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 72</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 73</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">spec.results</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 73</span>
|
||||||
<span class='line'> 74</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">results.passed</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'passed'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'failed'</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 74</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.reportSuiteResults</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">suite</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 75</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">results.skipped</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 75</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">suite.results</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 76</span> </span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'skipped'</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 76</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">results.passed</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'passed'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'failed'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 77</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 77</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">results.totalCount</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// todo: change this to check results.skipped</span><span class="WHIT">
|
||||||
<span class='line'> 78</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">specDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'spec '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 78</span> </span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'skipped'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 79</span> </span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'a'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'runSpec'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">href</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'?spec='</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">spec.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"run"</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
<span class='line'> 79</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 80</span> </span><span class="WHIT"> </span><span class="NAME">spec.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 80</span> </span><span class="WHIT"> </span><span class="NAME">this.suiteDivs</span><span class="PUNC">[</span><span class="NAME">suite.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">className</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">" "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">status</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 81</span>
|
<span class='line'> 81</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 82</span>
|
<span class='line'> 82</span>
|
||||||
<span class='line'> 83</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">resultItems</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">results.getItems</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 83</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.reportSpecResults</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">spec</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 84</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">resultItems.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 84</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">spec.results</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 85</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">resultItems</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 85</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">results.passed</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'passed'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'failed'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 86</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">result.passed</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">result.passed</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 86</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">results.skipped</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 87</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">resultMessageDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'resultMessage fail'</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 87</span> </span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'skipped'</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 88</span> </span><span class="WHIT"> </span><span class="NAME">resultMessageDiv.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">result.message</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// todo: lame; mend</span><span class="WHIT">
|
<span class='line'> 88</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'> 89</span> </span><span class="WHIT"> </span><span class="NAME">specDiv.appendChild</span><span class="PUNC">(</span><span class="NAME">resultMessageDiv</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 89</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">specDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'spec '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">status</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 90</span> </span><span class="WHIT"> </span><span class="NAME">specDiv.appendChild</span><span class="PUNC">(</span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'stackTrace'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">result.trace.stack</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 90</span> </span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'a'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'run_spec'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">href</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'?spec='</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">spec.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"run"</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
||||||
<span class='line'> 91</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 91</span> </span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'a'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'description'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">href</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'?spec='</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">spec.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">spec.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 92</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'> 92</span>
|
||||||
<span class='line'> 93</span>
|
<span class='line'> 93</span>
|
||||||
<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="NAME">this.suiteDivs</span><span class="PUNC">[</span><span class="NAME">spec.suite.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">appendChild</span><span class="PUNC">(</span><span class="NAME">specDiv</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">resultItems</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">results.getItems</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 95</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 95</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">resultItems.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 96</span>
|
<span class='line'> 96</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">resultItems</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 97</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.log</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'> 97</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">result.passed</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">result.passed</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'> 98</span> </span><span class="WHIT"> </span><span class="NAME">console.log.apply</span><span class="PUNC">(</span><span class="NAME">console</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 98</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">resultMessageDiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'resultMessage fail'</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'> 99</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'> 99</span> </span><span class="WHIT"> </span><span class="NAME">resultMessageDiv.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">result.message</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// todo: lame; mend</span><span class="WHIT">
|
||||||
<span class='line'>100</span>
|
<span class='line'>100</span> </span><span class="WHIT"> </span><span class="NAME">specDiv.appendChild</span><span class="PUNC">(</span><span class="NAME">resultMessageDiv</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>101</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.getLocation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>101</span> </span><span class="WHIT"> </span><span class="NAME">specDiv.appendChild</span><span class="PUNC">(</span><span class="NAME">this.createDom</span><span class="PUNC">(</span><span class="STRN">'div'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">className</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'stackTrace'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">result.trace.stack</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>102</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.document.location</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>102</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>103</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>103</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>104</span>
|
<span class='line'>104</span>
|
||||||
<span class='line'>105</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.specFilter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">spec</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>105</span> </span><span class="WHIT"> </span><span class="NAME">this.suiteDivs</span><span class="PUNC">[</span><span class="NAME">spec.suite.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">appendChild</span><span class="PUNC">(</span><span class="NAME">specDiv</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>106</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">paramMap</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>106</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>107</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.getLocation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">search.substring</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">split</span><span class="PUNC">(</span><span class="STRN">'&'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>107</span>
|
||||||
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">params.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>108</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.log</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>109</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">p</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">split</span><span class="PUNC">(</span><span class="STRN">'='</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>109</span> </span><span class="WHIT"> </span><span class="NAME">console.log.apply</span><span class="PUNC">(</span><span class="NAME">console</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>110</span> </span><span class="WHIT"> </span><span class="NAME">paramMap</span><span class="PUNC">[</span><span class="NAME">decodeURIComponent</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">decodeURIComponent</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>110</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>111</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>111</span>
|
||||||
<span class='line'>112</span>
|
<span class='line'>112</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.getLocation</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>113</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">paramMap</span><span class="PUNC">[</span><span class="STRN">"spec"</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>113</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.document.location</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>114</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">spec.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="NAME">paramMap</span><span class="PUNC">[</span><span class="STRN">"spec"</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>114</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>115</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>115</span>
|
||||||
<span class='line'>116</span>
|
<span class='line'>116</span> </span><span class="NAME">jasmine.TrivialReporter.prototype.specFilter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">spec</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>117</span> </span><span class="COMM">//protect against console.log incidents</span><span class="WHIT">
|
<span class='line'>117</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">paramMap</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>118</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="PUNC">(</span><span class="STRN">"console"</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">window</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="PUNC">(</span><span class="STRN">"firebug"</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">console</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>118</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.getLocation</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">search.substring</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">split</span><span class="PUNC">(</span><span class="STRN">'&'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>119</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">names</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="STRN">"log"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"debug"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"info"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"warn"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"error"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"assert"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"dir"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"dirxml"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"group"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"groupEnd"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"time"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"timeEnd"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"count"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"trace"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"profile"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"profileEnd"</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>119</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">params.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
<span class='line'>120</span> </span><span class="WHIT"> </span><span class="NAME">window.console</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>120</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">p</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">params</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">split</span><span class="PUNC">(</span><span class="STRN">'='</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>121</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">names.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">++</span><span class="NAME">i</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>121</span> </span><span class="WHIT"> </span><span class="NAME">paramMap</span><span class="PUNC">[</span><span class="NAME">decodeURIComponent</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">decodeURIComponent</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>122</span> </span><span class="WHIT"> </span><span class="NAME">window.console</span><span class="PUNC">[</span><span class="NAME">names</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
<span class='line'>122</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
<span class='line'>123</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
<span class='line'>123</span>
|
||||||
<span class='line'>124</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>124</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">paramMap</span><span class="PUNC">[</span><span class="STRN">"spec"</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>125</span> </span><span class="PUNC">}</span><span class="WHIT">
|
<span class='line'>125</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">spec.getFullName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="NAME">paramMap</span><span class="PUNC">[</span><span class="STRN">"spec"</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
<span class='line'>126</span> </span></pre></body></html>
|
<span class='line'>126</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>127</span>
|
||||||
|
<span class='line'>128</span> </span><span class="COMM">//protect against console.log incidents</span><span class="WHIT">
|
||||||
|
<span class='line'>129</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="PUNC">(</span><span class="STRN">"console"</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">window</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="PUNC">(</span><span class="STRN">"firebug"</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">console</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>130</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">names</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="STRN">"log"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"debug"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"info"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"warn"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"error"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"assert"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"dir"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"dirxml"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"group"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"groupEnd"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"time"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"timeEnd"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"count"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"trace"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"profile"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"profileEnd"</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>131</span> </span><span class="WHIT"> </span><span class="NAME">window.console</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>132</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">names.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">++</span><span class="NAME">i</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>133</span> </span><span class="WHIT"> </span><span class="NAME">window.console</span><span class="PUNC">[</span><span class="NAME">names</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||||
|
<span class='line'>134</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||||
|
<span class='line'>135</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>136</span> </span><span class="PUNC">}</span><span class="WHIT">
|
||||||
|
<span class='line'>137</span> </span></pre></body></html>
|
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>Jasmine Test Runner</title>
|
<title>Jasmine Test Runner</title>
|
||||||
</head>
|
</head>
|
||||||
<script type="text/javascript" src="../../lib/jasmine-0.9.0.js"></script>
|
<script type="text/javascript" src="../../lib/jasmine-0.10.0.js"></script>
|
||||||
<script type="text/javascript" src="../../lib/TrivialReporter.js"></script>
|
<script type="text/javascript" src="../../lib/TrivialReporter.js"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="../../lib/jasmine.css">
|
<link rel="stylesheet" type="text/css" href="../../lib/jasmine.css">
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarA
|
|||||||
for (var attr in attrs) {
|
for (var attr in attrs) {
|
||||||
if (attr == 'className') {
|
if (attr == 'className') {
|
||||||
el.setAttribute('class', attrs[attr]);
|
el.setAttribute('class', attrs[attr]);
|
||||||
|
//twice for ie
|
||||||
|
el.setAttribute('className', attrs[attr]);
|
||||||
} else {
|
} else {
|
||||||
el[attr] = attrs[attr];
|
el[attr] = attrs[attr];
|
||||||
}
|
}
|
||||||
@ -31,15 +33,15 @@ jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
|
|||||||
var suites = runner.suites();
|
var suites = runner.suites();
|
||||||
|
|
||||||
this.runnerDiv = this.createDom('div', { className: 'runner running' },
|
this.runnerDiv = this.createDom('div', { className: 'runner running' },
|
||||||
this.createDom('a', { className: 'runSpec', href: '?' }, "run all"),
|
this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),
|
||||||
this.runnerMessageSpan = this.createDom('span', {}, "Running..."));
|
this.runnerMessageSpan = this.createDom('span', {}, "Running..."));
|
||||||
this.document.body.appendChild(this.runnerDiv);
|
this.document.body.appendChild(this.runnerDiv);
|
||||||
|
|
||||||
for (var i = 0; i < suites.length; i++) {
|
for (var i = 0; i < suites.length; i++) {
|
||||||
var suite = suites[i];
|
var suite = suites[i];
|
||||||
var suiteDiv = this.createDom('div', { className: 'suite' },
|
var suiteDiv = this.createDom('div', { className: 'suite' },
|
||||||
this.createDom('a', { className: 'runSpec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
|
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
|
||||||
suite.description);
|
this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
|
||||||
this.suiteDivs[suite.getFullName()] = suiteDiv;
|
this.suiteDivs[suite.getFullName()] = suiteDiv;
|
||||||
var parentDiv = this.document.body;
|
var parentDiv = this.document.body;
|
||||||
if (suite.parentSuite) {
|
if (suite.parentSuite) {
|
||||||
@ -55,9 +57,18 @@ jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
|
|||||||
var results = runner.results();
|
var results = runner.results();
|
||||||
var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
|
var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
|
||||||
this.runnerDiv.setAttribute("class", className);
|
this.runnerDiv.setAttribute("class", className);
|
||||||
var message = results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
|
//do it twice for IE
|
||||||
|
this.runnerDiv.setAttribute("className", className);
|
||||||
|
var specs = runner.specs();
|
||||||
|
var specCount = 0;
|
||||||
|
for (var i = 0; i < specs.length; i++) {
|
||||||
|
if (this.specFilter(specs[i])) {
|
||||||
|
specCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
|
||||||
message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
|
message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
|
||||||
this.runnerMessageSpan.replaceChild(this.document.createTextNode(message), this.runnerMessageSpan.firstChild);
|
this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild);
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
|
jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
|
||||||
@ -76,8 +87,8 @@ jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
|
|||||||
status = 'skipped';
|
status = 'skipped';
|
||||||
}
|
}
|
||||||
var specDiv = this.createDom('div', { className: 'spec ' + status },
|
var specDiv = this.createDom('div', { className: 'spec ' + status },
|
||||||
this.createDom('a', { className: 'runSpec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
|
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
|
||||||
spec.getFullName());
|
this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, spec.getFullName()));
|
||||||
|
|
||||||
|
|
||||||
var resultItems = results.getItems();
|
var resultItems = results.getItems();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
|
* Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var jasmine = {};
|
var jasmine = {};
|
||||||
@ -14,7 +14,7 @@ jasmine.unimplementedMethod_ = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Large or small values here may result in slow test running & "Too much recursion" errors
|
* Large or small values here may result in slow test running & "Too much recursion" errors
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
jasmine.UPDATE_INTERVAL = 250;
|
jasmine.UPDATE_INTERVAL = 250;
|
||||||
|
|
||||||
@ -29,7 +29,14 @@ jasmine.UPDATE_INTERVAL = 250;
|
|||||||
jasmine.bindOriginal_ = function(base, name) {
|
jasmine.bindOriginal_ = function(base, name) {
|
||||||
var original = base[name];
|
var original = base[name];
|
||||||
return function() {
|
return function() {
|
||||||
return original.apply(base, arguments);
|
if (original.apply) {
|
||||||
|
return original.apply(base, arguments);
|
||||||
|
} else {
|
||||||
|
//IE support
|
||||||
|
if (base == window) {
|
||||||
|
return window[name].apply(window, arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -71,10 +78,10 @@ jasmine.getEnv = function() {
|
|||||||
*/
|
*/
|
||||||
jasmine.isArray_ = function(value) {
|
jasmine.isArray_ = function(value) {
|
||||||
return value &&
|
return value &&
|
||||||
typeof value === 'object' &&
|
typeof value === 'object' &&
|
||||||
typeof value.length === 'number' &&
|
typeof value.length === 'number' &&
|
||||||
typeof value.splice === 'function' &&
|
typeof value.splice === 'function' &&
|
||||||
!(value.propertyIsEnumerable('length'));
|
!(value.propertyIsEnumerable('length'));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,7 +130,7 @@ jasmine.any = function(clazz) {
|
|||||||
* Spies are torn down at the end of every spec.
|
* Spies are torn down at the end of every spec.
|
||||||
*
|
*
|
||||||
* Note: Do <b>not</b> call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj.
|
* Note: Do <b>not</b> call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* // a stub
|
* // a stub
|
||||||
* var myStub = jasmine.createSpy('myStub'); // can be used anywhere
|
* var myStub = jasmine.createSpy('myStub'); // can be used anywhere
|
||||||
@ -168,7 +175,8 @@ jasmine.Spy = function(name) {
|
|||||||
/**
|
/**
|
||||||
* The acutal function this spy stubs.
|
* The acutal function this spy stubs.
|
||||||
*/
|
*/
|
||||||
this.plan = function() {};
|
this.plan = function() {
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* Tracking of the most recent call to the spy.
|
* Tracking of the most recent call to the spy.
|
||||||
* @example
|
* @example
|
||||||
@ -189,6 +197,7 @@ jasmine.Spy = function(name) {
|
|||||||
* mySpy.argsForCall[1] = [7, 8];
|
* mySpy.argsForCall[1] = [7, 8];
|
||||||
*/
|
*/
|
||||||
this.argsForCall = [];
|
this.argsForCall = [];
|
||||||
|
this.calls = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -198,7 +207,7 @@ jasmine.Spy = function(name) {
|
|||||||
* var foo = {
|
* var foo = {
|
||||||
* bar: function() { // do some stuff }
|
* bar: function() { // do some stuff }
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* // defining a spy on an existing property: foo.bar
|
* // defining a spy on an existing property: foo.bar
|
||||||
* spyOn(foo, 'bar').andCallThrough();
|
* spyOn(foo, 'bar').andCallThrough();
|
||||||
*/
|
*/
|
||||||
@ -283,6 +292,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 = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -292,22 +302,19 @@ 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);
|
||||||
};
|
};
|
||||||
|
|
||||||
var spy = new jasmine.Spy(name);
|
var spy = new jasmine.Spy(name);
|
||||||
|
|
||||||
for(var prop in spy) {
|
for (var prop in spy) {
|
||||||
spyObj[prop] = spy[prop];
|
spyObj[prop] = spy[prop];
|
||||||
}
|
}
|
||||||
|
|
||||||
spyObj.reset();
|
spyObj.reset();
|
||||||
|
|
||||||
return spyObj;
|
return spyObj;
|
||||||
@ -411,7 +418,7 @@ var waits = function(timeout) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits for the latchFunction to return true before proceeding to the next runs()-defined block.
|
* Waits for the latchFunction to return true before proceeding to the next runs()-defined block.
|
||||||
*
|
*
|
||||||
* @param {Number} timeout
|
* @param {Number} timeout
|
||||||
* @param {Function} latchFunction
|
* @param {Function} latchFunction
|
||||||
* @param {String} message
|
* @param {String} message
|
||||||
@ -521,9 +528,9 @@ jasmine.include = function(url, opt_global) {
|
|||||||
|
|
||||||
jasmine.version_= {
|
jasmine.version_= {
|
||||||
"major": 0,
|
"major": 0,
|
||||||
"minor": 9,
|
"minor": 10,
|
||||||
"build": 0,
|
"build": 0,
|
||||||
"revision": 1254807302
|
"revision": 1255748957
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @namespace
|
* @namespace
|
||||||
@ -1413,7 +1420,7 @@ jasmine.PrettyPrinter.prototype.format = function(value) {
|
|||||||
jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
||||||
for (var property in obj) {
|
for (var property in obj) {
|
||||||
if (property == '__Jasmine_been_here_before__') continue;
|
if (property == '__Jasmine_been_here_before__') continue;
|
||||||
fn(property, obj.__lookupGetter__(property) != null);
|
fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) != null) : false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1483,7 +1490,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);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1491,59 +1498,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) {
|
||||||
@ -1643,6 +1665,15 @@ jasmine.Runner.prototype.getAllSuites = function() {
|
|||||||
return this.suites_;
|
return this.suites_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
jasmine.Runner.prototype.specs = function () {
|
||||||
|
var suites = this.suites();
|
||||||
|
var specs = [];
|
||||||
|
for (var i = 0; i < suites.length; i++) {
|
||||||
|
specs = specs.concat(suites[i].specs());
|
||||||
|
}
|
||||||
|
return specs;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
jasmine.Runner.prototype.suites = function() {
|
jasmine.Runner.prototype.suites = function() {
|
||||||
return this.suites_;
|
return this.suites_;
|
||||||
@ -2132,25 +2163,42 @@ jasmine.Clock = {
|
|||||||
if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) {
|
if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) {
|
||||||
throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
|
throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
installed: null
|
installed: null
|
||||||
};
|
};
|
||||||
jasmine.Clock.installed = jasmine.Clock.real;
|
jasmine.Clock.installed = jasmine.Clock.real;
|
||||||
|
|
||||||
|
//else for IE support
|
||||||
window.setTimeout = function(funcToCall, millis) {
|
window.setTimeout = function(funcToCall, millis) {
|
||||||
return jasmine.Clock.installed.setTimeout.apply(this, arguments);
|
if (jasmine.Clock.installed.setTimeout.apply) {
|
||||||
|
return jasmine.Clock.installed.setTimeout.apply(this, arguments);
|
||||||
|
} else {
|
||||||
|
return jasmine.Clock.installed.setTimeout(funcToCall, millis);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
window.setInterval = function(funcToCall, millis) {
|
window.setInterval = function(funcToCall, millis) {
|
||||||
return jasmine.Clock.installed.setInterval.apply(this, arguments);
|
if (jasmine.Clock.installed.setInterval.apply) {
|
||||||
|
return jasmine.Clock.installed.setInterval.apply(this, arguments);
|
||||||
|
} else {
|
||||||
|
return jasmine.Clock.installed.setInterval(funcToCall, millis);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
window.clearTimeout = function(timeoutKey) {
|
window.clearTimeout = function(timeoutKey) {
|
||||||
return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
|
if (jasmine.Clock.installed.clearTimeout.apply) {
|
||||||
|
return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
|
||||||
|
} else {
|
||||||
|
return jasmine.Clock.installed.clearTimeout(timeoutKey);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
window.clearInterval = function(timeoutKey) {
|
window.clearInterval = function(timeoutKey) {
|
||||||
return jasmine.Clock.installed.clearInterval.apply(this, arguments);
|
if (jasmine.Clock.installed.clearTimeout.apply) {
|
||||||
|
return jasmine.Clock.installed.clearInterval.apply(this, arguments);
|
||||||
|
} else {
|
||||||
|
return jasmine.Clock.installed.clearInterval(timeoutKey);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -1,39 +1,27 @@
|
|||||||
body {
|
body {
|
||||||
font: 14px "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif;
|
font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
|
||||||
padding-top: 20px;
|
|
||||||
font-weight: bold;
|
|
||||||
font: 24px; /* "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; */
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
body .run_spec {
|
||||||
margin-top: 5px;
|
float:right;
|
||||||
padding-left: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fail {
|
|
||||||
background: url( ../images/fail-16.png ) no-repeat;
|
|
||||||
padding-left: 20px;
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
|
|
||||||
.failInSummary {
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
|
|
||||||
.runner {
|
|
||||||
border: 1px outset gray;
|
|
||||||
margin: 5px;
|
|
||||||
padding-left: 1em;
|
|
||||||
padding-right: 1em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.runner.running {
|
.runner.running {
|
||||||
background-color: yellow;
|
background-color: yellow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.runner {
|
||||||
|
border: 1px solid gray;
|
||||||
|
margin: 5px;
|
||||||
|
padding-left: 1em;
|
||||||
|
padding-right: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.suite {
|
.suite {
|
||||||
border: 1px outset gray;
|
border: 1px outset gray;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
@ -54,11 +42,11 @@ p {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.passed {
|
.passed {
|
||||||
background-color: lightgreen;
|
background-color: #cfc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.failed {
|
.failed {
|
||||||
background-color: pink;
|
background-color: #fdd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.skipped {
|
.skipped {
|
||||||
@ -66,9 +54,9 @@ p {
|
|||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
.resultMessage {
|
/*.resultMessage {*/
|
||||||
white-space: pre;
|
/*white-space: pre;*/
|
||||||
}
|
/*}*/
|
||||||
|
|
||||||
.stackTrace {
|
.stackTrace {
|
||||||
white-space: pre;
|
white-space: pre;
|
||||||
@ -81,10 +69,6 @@ p {
|
|||||||
background: #eef;
|
background: #eef;
|
||||||
}
|
}
|
||||||
|
|
||||||
.runSpec {
|
|
||||||
margin-left: 5px;
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
#jasmine_content {
|
#jasmine_content {
|
||||||
position:fixed;
|
position:fixed;
|
||||||
|
@ -8,56 +8,69 @@
|
|||||||
<script type="text/javascript" src="../src/util.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/Env.js"></script>
|
||||||
<script type="text/javascript" src="../src/Reporter.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/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/MultiReporter.js"></script>
|
||||||
<script type="text/javascript" src="../src/NestedResults.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/PrettyPrinter.js"></script>
|
||||||
<script type="text/javascript" src="../src/Block.js"></script>
|
<script type="text/javascript" src="../src/Queue.js"></script>
|
||||||
<script type="text/javascript" src="../src/WaitsBlock.js"></script>
|
|
||||||
<script type="text/javascript" src="../src/WaitsForBlock.js"></script>
|
|
||||||
<script type="text/javascript" src="../src/Reporters.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/Runner.js"></script>
|
||||||
<script type="text/javascript" src="../src/Spec.js"></script>
|
<script type="text/javascript" src="../src/Spec.js"></script>
|
||||||
<script type="text/javascript" src="../src/Queue.js"></script>
|
|
||||||
<script type="text/javascript" src="../src/Suite.js"></script>
|
<script type="text/javascript" src="../src/Suite.js"></script>
|
||||||
<script type="text/javascript" src="../src/mock-timeout.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" src="../lib/TrivialReporter.js"></script>
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jasmine.include('suites/EnvSpec.js', true);
|
(function () {
|
||||||
jasmine.include('suites/ExceptionsSpec.js', true);
|
var suites = [
|
||||||
jasmine.include('suites/MatchersSpec.js', true);
|
'suites/EnvSpec.js',
|
||||||
jasmine.include('suites/MultiReporterSpec.js', true);
|
'suites/ExceptionsSpec.js',
|
||||||
jasmine.include('suites/NestedResultsSpec.js', true);
|
'suites/JsApiReporterSpec.js',
|
||||||
jasmine.include('suites/PrettyPrintSpec.js', true);
|
'suites/MatchersSpec.js',
|
||||||
jasmine.include('suites/ReporterSpec.js', true);
|
'suites/MultiReporterSpec.js',
|
||||||
jasmine.include('suites/RunnerSpec.js', true);
|
'suites/NestedResultsSpec.js',
|
||||||
jasmine.include('suites/SpecRunningSpec.js', true);
|
'suites/PrettyPrintSpec.js',
|
||||||
jasmine.include('suites/SpySpec.js', true);
|
'suites/ReporterSpec.js',
|
||||||
jasmine.include('suites/SuiteSpec.js', true);
|
'suites/RunnerSpec.js',
|
||||||
jasmine.include('suites/TrivialReporterSpec.js', true);
|
'suites/QueueSpec.js',
|
||||||
|
'suites/SpecSpec.js',
|
||||||
|
'suites/SpecRunningSpec.js',
|
||||||
|
'suites/SpySpec.js',
|
||||||
|
'suites/SuiteSpec.js',
|
||||||
|
'suites/TrivialReporterSpec.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>
|
</script>
|
||||||
|
|
||||||
<link href="../lib/jasmine.css" rel="stylesheet"/>
|
<link href="../lib/jasmine.css" rel="stylesheet"/>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
|
|
||||||
|
|
||||||
var jasmineEnv = jasmine.getEnv();
|
|
||||||
var trivialReporter = new jasmine.TrivialReporter();
|
|
||||||
jasmineEnv.addReporter(trivialReporter);
|
|
||||||
jasmineEnv.specFilter = function(spec) {
|
|
||||||
return trivialReporter.specFilter(spec);
|
|
||||||
};
|
|
||||||
window.onload = function() {
|
|
||||||
jasmineEnv.execute();
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -13,11 +13,6 @@ describe("jasmine.Env", function() {
|
|||||||
expect(env.nextSpecId()).toEqual(2);
|
expect(env.nextSpecId()).toEqual(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('nextSuiteId should return consecutive integers, starting at 0', function () {
|
|
||||||
expect(env.nextSuiteId()).toEqual(0);
|
|
||||||
expect(env.nextSuiteId()).toEqual(1);
|
|
||||||
expect(env.nextSuiteId()).toEqual(2);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
describe("reporting", function() {
|
describe("reporting", function() {
|
||||||
var fakeReporter;
|
var fakeReporter;
|
||||||
|
@ -28,7 +28,8 @@ describe("jasmine.pp", function () {
|
|||||||
it("should stringify objects properly", function() {
|
it("should stringify objects properly", function() {
|
||||||
expect(jasmine.pp({foo: 'bar'})).toEqual("{ foo : 'bar' }");
|
expect(jasmine.pp({foo: 'bar'})).toEqual("{ foo : 'bar' }");
|
||||||
expect(jasmine.pp({foo:'bar', baz:3, nullValue: null, undefinedValue: undefined})).toEqual("{ foo : 'bar', baz : 3, nullValue : null, undefinedValue : undefined }");
|
expect(jasmine.pp({foo:'bar', baz:3, nullValue: null, undefinedValue: undefined})).toEqual("{ foo : 'bar', baz : 3, nullValue : null, undefinedValue : undefined }");
|
||||||
expect(jasmine.pp({foo: function () { }, bar: [1, 2, 3]})).toEqual("{ foo : Function, bar : [ 1, 2, 3 ] }");
|
expect(jasmine.pp({foo: function () {
|
||||||
|
}, bar: [1, 2, 3]})).toEqual("{ foo : Function, bar : [ 1, 2, 3 ] }");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should indicate circular object references", function() {
|
it("should indicate circular object references", function() {
|
||||||
@ -39,8 +40,18 @@ describe("jasmine.pp", function () {
|
|||||||
|
|
||||||
it("should indicate getters on objects as such", function() {
|
it("should indicate getters on objects as such", function() {
|
||||||
var sampleValue = {id: 1};
|
var sampleValue = {id: 1};
|
||||||
sampleValue.__defineGetter__('calculatedValue', function() { throw new Error("don't call me!"); });
|
if (sampleValue.__defineGetter__) {
|
||||||
expect(jasmine.pp(sampleValue)).toEqual("{ id : 1, calculatedValue : <getter> }");
|
//not supported in IE!
|
||||||
|
sampleValue.__defineGetter__('calculatedValue', function() {
|
||||||
|
throw new Error("don't call me!");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (sampleValue.__defineGetter__) {
|
||||||
|
expect(jasmine.pp(sampleValue)).toEqual("{ id : 1, calculatedValue : <getter> }");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
expect(jasmine.pp(sampleValue)).toEqual("{ id : 1 }");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should stringify HTML nodes properly", function() {
|
it("should stringify HTML nodes properly", function() {
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
});
|
@ -33,8 +33,8 @@ describe('RunnerTest', function() {
|
|||||||
|
|
||||||
env.describe('suite 2', function () {
|
env.describe('suite 2', function () {
|
||||||
env.it('test 2-1', function() {
|
env.it('test 2-1', function() {
|
||||||
foo++;
|
foo++;
|
||||||
this.expect(foo).toEqual(1);
|
this.expect(foo).toEqual(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -44,9 +44,40 @@ describe('RunnerTest', function() {
|
|||||||
expect(runnerResults.totalCount).toEqual(3);
|
expect(runnerResults.totalCount).toEqual(3);
|
||||||
expect(runnerResults.passedCount).toEqual(3);
|
expect(runnerResults.passedCount).toEqual(3);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('should provide all specs', function () {
|
||||||
|
var foo;
|
||||||
|
env.beforeEach(function () {
|
||||||
|
foo = 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
env.describe('suite 1', function () {
|
||||||
|
env.it('test 1-1', function() {
|
||||||
|
foo++;
|
||||||
|
this.expect(foo).toEqual(1);
|
||||||
|
});
|
||||||
|
env.it('test 1-2', function() {
|
||||||
|
foo++;
|
||||||
|
this.expect(foo).toEqual(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
env.describe('suite 2', function () {
|
||||||
|
env.it('test 2-1', function() {
|
||||||
|
foo++;
|
||||||
|
this.expect(foo).toEqual(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
env.currentRunner().execute();
|
||||||
|
|
||||||
|
|
||||||
|
expect(env.currentRunner().specs().length).toEqual(3);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('afterEach', function() {
|
describe('afterEach', function() {
|
||||||
it('should run after each spec for all suites', function () {
|
it('should run after each spec for all suites', function () {
|
||||||
var foo = 3;
|
var foo = 3;
|
||||||
env.afterEach(function () {
|
env.afterEach(function () {
|
||||||
@ -64,7 +95,7 @@ describe('RunnerTest', function() {
|
|||||||
|
|
||||||
env.describe('suite 2', function () {
|
env.describe('suite 2', function () {
|
||||||
env.it('test 2-1', function() {
|
env.it('test 2-1', function() {
|
||||||
this.expect(foo).toEqual(1);
|
this.expect(foo).toEqual(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ jasmine.PrettyPrinter.prototype.format = function(value) {
|
|||||||
jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
||||||
for (var property in obj) {
|
for (var property in obj) {
|
||||||
if (property == '__Jasmine_been_here_before__') continue;
|
if (property == '__Jasmine_been_here_before__') continue;
|
||||||
fn(property, obj.__lookupGetter__(property) != null);
|
fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) != null) : false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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) {
|
||||||
|
@ -54,6 +54,15 @@ jasmine.Runner.prototype.getAllSuites = function() {
|
|||||||
return this.suites_;
|
return this.suites_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
jasmine.Runner.prototype.specs = function () {
|
||||||
|
var suites = this.suites();
|
||||||
|
var specs = [];
|
||||||
|
for (var i = 0; i < suites.length; i++) {
|
||||||
|
specs = specs.concat(suites[i].specs());
|
||||||
|
}
|
||||||
|
return specs;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
jasmine.Runner.prototype.suites = function() {
|
jasmine.Runner.prototype.suites = function() {
|
||||||
return this.suites_;
|
return this.suites_;
|
||||||
|
43
src/base.js
43
src/base.js
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
|
* Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.
|
||||||
*
|
*
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
var jasmine = {};
|
var jasmine = {};
|
||||||
@ -14,7 +14,7 @@ jasmine.unimplementedMethod_ = function() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Large or small values here may result in slow test running & "Too much recursion" errors
|
* Large or small values here may result in slow test running & "Too much recursion" errors
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
jasmine.UPDATE_INTERVAL = 250;
|
jasmine.UPDATE_INTERVAL = 250;
|
||||||
|
|
||||||
@ -29,7 +29,14 @@ jasmine.UPDATE_INTERVAL = 250;
|
|||||||
jasmine.bindOriginal_ = function(base, name) {
|
jasmine.bindOriginal_ = function(base, name) {
|
||||||
var original = base[name];
|
var original = base[name];
|
||||||
return function() {
|
return function() {
|
||||||
return original.apply(base, arguments);
|
if (original.apply) {
|
||||||
|
return original.apply(base, arguments);
|
||||||
|
} else {
|
||||||
|
//IE support
|
||||||
|
if (base == window) {
|
||||||
|
return window[name].apply(window, arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -71,10 +78,10 @@ jasmine.getEnv = function() {
|
|||||||
*/
|
*/
|
||||||
jasmine.isArray_ = function(value) {
|
jasmine.isArray_ = function(value) {
|
||||||
return value &&
|
return value &&
|
||||||
typeof value === 'object' &&
|
typeof value === 'object' &&
|
||||||
typeof value.length === 'number' &&
|
typeof value.length === 'number' &&
|
||||||
typeof value.splice === 'function' &&
|
typeof value.splice === 'function' &&
|
||||||
!(value.propertyIsEnumerable('length'));
|
!(value.propertyIsEnumerable('length'));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,7 +130,7 @@ jasmine.any = function(clazz) {
|
|||||||
* Spies are torn down at the end of every spec.
|
* Spies are torn down at the end of every spec.
|
||||||
*
|
*
|
||||||
* Note: Do <b>not</b> call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj.
|
* Note: Do <b>not</b> call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* // a stub
|
* // a stub
|
||||||
* var myStub = jasmine.createSpy('myStub'); // can be used anywhere
|
* var myStub = jasmine.createSpy('myStub'); // can be used anywhere
|
||||||
@ -168,7 +175,8 @@ jasmine.Spy = function(name) {
|
|||||||
/**
|
/**
|
||||||
* The acutal function this spy stubs.
|
* The acutal function this spy stubs.
|
||||||
*/
|
*/
|
||||||
this.plan = function() {};
|
this.plan = function() {
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* Tracking of the most recent call to the spy.
|
* Tracking of the most recent call to the spy.
|
||||||
* @example
|
* @example
|
||||||
@ -189,6 +197,7 @@ jasmine.Spy = function(name) {
|
|||||||
* mySpy.argsForCall[1] = [7, 8];
|
* mySpy.argsForCall[1] = [7, 8];
|
||||||
*/
|
*/
|
||||||
this.argsForCall = [];
|
this.argsForCall = [];
|
||||||
|
this.calls = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -198,7 +207,7 @@ jasmine.Spy = function(name) {
|
|||||||
* var foo = {
|
* var foo = {
|
||||||
* bar: function() { // do some stuff }
|
* bar: function() { // do some stuff }
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* // defining a spy on an existing property: foo.bar
|
* // defining a spy on an existing property: foo.bar
|
||||||
* spyOn(foo, 'bar').andCallThrough();
|
* spyOn(foo, 'bar').andCallThrough();
|
||||||
*/
|
*/
|
||||||
@ -283,6 +292,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 = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -292,22 +302,19 @@ 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);
|
||||||
};
|
};
|
||||||
|
|
||||||
var spy = new jasmine.Spy(name);
|
var spy = new jasmine.Spy(name);
|
||||||
|
|
||||||
for(var prop in spy) {
|
for (var prop in spy) {
|
||||||
spyObj[prop] = spy[prop];
|
spyObj[prop] = spy[prop];
|
||||||
}
|
}
|
||||||
|
|
||||||
spyObj.reset();
|
spyObj.reset();
|
||||||
|
|
||||||
return spyObj;
|
return spyObj;
|
||||||
@ -411,7 +418,7 @@ var waits = function(timeout) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits for the latchFunction to return true before proceeding to the next runs()-defined block.
|
* Waits for the latchFunction to return true before proceeding to the next runs()-defined block.
|
||||||
*
|
*
|
||||||
* @param {Number} timeout
|
* @param {Number} timeout
|
||||||
* @param {Function} latchFunction
|
* @param {Function} latchFunction
|
||||||
* @param {String} message
|
* @param {String} message
|
||||||
|
@ -134,25 +134,42 @@ jasmine.Clock = {
|
|||||||
if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) {
|
if (jasmine.Clock.installed != jasmine.Clock.defaultFakeTimer) {
|
||||||
throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
|
throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
installed: null
|
installed: null
|
||||||
};
|
};
|
||||||
jasmine.Clock.installed = jasmine.Clock.real;
|
jasmine.Clock.installed = jasmine.Clock.real;
|
||||||
|
|
||||||
|
//else for IE support
|
||||||
window.setTimeout = function(funcToCall, millis) {
|
window.setTimeout = function(funcToCall, millis) {
|
||||||
return jasmine.Clock.installed.setTimeout.apply(this, arguments);
|
if (jasmine.Clock.installed.setTimeout.apply) {
|
||||||
|
return jasmine.Clock.installed.setTimeout.apply(this, arguments);
|
||||||
|
} else {
|
||||||
|
return jasmine.Clock.installed.setTimeout(funcToCall, millis);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
window.setInterval = function(funcToCall, millis) {
|
window.setInterval = function(funcToCall, millis) {
|
||||||
return jasmine.Clock.installed.setInterval.apply(this, arguments);
|
if (jasmine.Clock.installed.setInterval.apply) {
|
||||||
|
return jasmine.Clock.installed.setInterval.apply(this, arguments);
|
||||||
|
} else {
|
||||||
|
return jasmine.Clock.installed.setInterval(funcToCall, millis);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
window.clearTimeout = function(timeoutKey) {
|
window.clearTimeout = function(timeoutKey) {
|
||||||
return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
|
if (jasmine.Clock.installed.clearTimeout.apply) {
|
||||||
|
return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
|
||||||
|
} else {
|
||||||
|
return jasmine.Clock.installed.clearTimeout(timeoutKey);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
window.clearInterval = function(timeoutKey) {
|
window.clearInterval = function(timeoutKey) {
|
||||||
return jasmine.Clock.installed.clearInterval.apply(this, arguments);
|
if (jasmine.Clock.installed.clearTimeout.apply) {
|
||||||
|
return jasmine.Clock.installed.clearInterval.apply(this, arguments);
|
||||||
|
} else {
|
||||||
|
return jasmine.Clock.installed.clearInterval(timeoutKey);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"major": 0,
|
"major": 0,
|
||||||
"minor": 9,
|
"minor": 10,
|
||||||
"build": 0
|
"build": 0
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user