Merge branch 'master' of git@github.com:pivotal/jasmine
This commit is contained in:
commit
0f610b03d2
@ -8,9 +8,11 @@ Quick Start
|
||||
### Ruby Suite Running
|
||||
|
||||
sudo gem sources -a http://gems.github.com
|
||||
sudo gem install json thin
|
||||
sudo gem install geminstaller
|
||||
git clone git://github.com/pivotal/jasmine.git
|
||||
cd jasmine/examples/ruby
|
||||
cd jasmine
|
||||
sudo geminstaller
|
||||
cd examples/ruby
|
||||
rake jasmine_server
|
||||
|
||||
open `http://localhost:8888/` in your favorite browser.
|
||||
@ -24,9 +26,11 @@ open `examples/test/html/example_suite.html` in your favorite browser.
|
||||
### Automatic Suite Running (w/ Selenium)
|
||||
|
||||
sudo gem sources -a http://gems.github.com
|
||||
sudo gem install json thin pivotal-selenium-rc selenium-client
|
||||
sudo gem install geminstaller
|
||||
git clone git://github.com/pivotal/jasmine.git
|
||||
cd jasmine/examples/ruby
|
||||
cd jasmine
|
||||
sudo geminstaller
|
||||
cd examples/ruby
|
||||
rake test:ci
|
||||
|
||||
Releases
|
||||
@ -42,6 +46,10 @@ Releases
|
||||
|
||||
Please use the latest version unless you have a good reason not to. Some of this documentation may not be applicable to older versions.
|
||||
|
||||
Pull Requests
|
||||
----------
|
||||
We welcome your contributions! Jasmine is currently maintained by Davis Frank ([infews](http://github.com/infews)), Rajan Agaskar ([ragaskar](http://github.com/ragaskar)), and Christian Williams ([Xian](http://github.com/Xian)). You can help us by removing all other recipients from your pull request.
|
||||
|
||||
|
||||
Why Another Frickin' JS TDD/BDD Framework?
|
||||
-----------
|
||||
@ -450,58 +458,10 @@ Spies have some useful properties:
|
||||
|
||||
Spies are automatically removed after each spec. They may be set in the beforeEach function.
|
||||
|
||||
### Runner
|
||||
|
||||
You don't need a DOM to run your tests, but you do need a page on which to load & execute your JS. Include the `jasmine.js` file in a script tag as well as the JS file with your specs. You can also use this page for reporting. More on that in a moment.
|
||||
|
||||
Here's the example HTML file (in `jasmine/example`):
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Jasmine Example</title>
|
||||
<script type="text/javascript" src="../lib/jasmine.js"></script>
|
||||
<script type="text/javascript" src="example.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="../lib/jasmine.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
Running Jasmine Example Specs
|
||||
</h1>
|
||||
<div id="results"></div>
|
||||
<script type="text/javascript">
|
||||
jasmine.execute();
|
||||
setTimeout(function () {
|
||||
document.getElementById('results').innerHTML = 'It\'s alive! :' +
|
||||
(jasmine.currentRunner.results.passedCount === 1);
|
||||
}, 250);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
It's the call to `jasmine.execute()` that runs all of the defined specs, gathering reports of each expectation.
|
||||
|
||||
### Reports
|
||||
|
||||
If a reporter exists on the Jasmine instance (named `jasmine`), it will be called when each spec, suite and the overall runner complete. If you're at the single-spec result level, you'll get a spec description, whether it passed or failed, and what the failure message was. At the suite & runner report level, you'll get the total specs run so far, the passed counts, failed counts, and a description (of the suite or runner).
|
||||
|
||||
There is a `Jasmine.Reporters` namespace for you to see how to handle reporting. See the file `json_reporter.js`, which takes the results objects and turns them into JSON strings, for two examples of how to make the results callbacks work for you.
|
||||
|
||||
|
||||
### Disabling Tests & Suites
|
||||
|
||||
Specs may be disabled by calling `xit()` instead of `it()`. Suites may be disabled by calling `xdescribe()` instead of `describe()`. A simple find/replace in your editor of choice will allow you to run a subset of your specs.
|
||||
|
||||
Contributing and Tests
|
||||
----------------------
|
||||
|
||||
Sometimes it's hard to test a framework with the framework itself. Either the framework isn't mature enough or it just hurts your head. Jasmine is affected by both.
|
||||
|
||||
So we made a little bootstrappy test reporter that lets us test Jasmine's pieces in isolation. See test/bootstrap.js. Feel free to use the bootstrap test suite to test your custom Matchers or extensions/changes to Jasmine.
|
||||
|
||||
Your contributions are welcome. Please submit tests with your pull request.
|
||||
|
||||
## Support
|
||||
We now have a Google Group for support & discussion.
|
||||
|
||||
@ -517,7 +477,3 @@ We now have a Google Group for support & discussion.
|
||||
* A big shout out to the various JavaScript test framework authors, especially TJ for [JSpec](http://github.com/visionmedia/jspec/tree/master) - we played with it a bit before deciding that we really needed to roll our own.
|
||||
* Thanks to Pivot [Jessica Miller](http://www.jessicamillerworks.com/) for our fancy pass/fail/pending icons
|
||||
* Huge contributions have been made by [Christian Williams](mailto:xian@pivotallabs.com) (the master "spy" coder), [Erik Hanson](mailto:erik@pivotallabs.com), [Adam Abrons](mailto:adam@pivotallabs.com) and [Carl Jackson](mailto:carl@pivotallabs.com), and many other Pivots.
|
||||
|
||||
## TODO List
|
||||
|
||||
* Pending & Disabled counts should be included in results
|
||||
|
15
Rakefile
15
Rakefile
@ -19,10 +19,11 @@ def start_jasmine_server(jasmine_includes = nil)
|
||||
puts "your tests are here:"
|
||||
puts " http://localhost:8888/run.html"
|
||||
|
||||
Jasmine::SimpleServer.start(8888,
|
||||
lambda { JasmineHelper.spec_file_urls },
|
||||
JasmineHelper.dir_mappings,
|
||||
jasmine_includes)
|
||||
Jasmine::SimpleServer.start(
|
||||
8888,
|
||||
lambda { JasmineHelper.specs },
|
||||
JasmineHelper.dir_mappings,
|
||||
:jasmine_files => jasmine_includes)
|
||||
end
|
||||
|
||||
namespace :jasmine do
|
||||
@ -67,7 +68,11 @@ jasmine.version_= {
|
||||
|
||||
desc "Run jasmine tests of source via server"
|
||||
task :server do
|
||||
jasmine_includes = lambda { jasmine_sources + ['lib/TrivialReporter.js'] }
|
||||
files = jasmine_sources + ['lib/TrivialReporter.js', 'lib/consolex.js']
|
||||
jasmine_includes = lambda {
|
||||
raw_jasmine_includes = files.collect { |f| File.expand_path(File.join(JasmineHelper.jasmine_root, f)) }
|
||||
Jasmine.cachebust(raw_jasmine_includes).collect {|f| f.sub(JasmineHelper.jasmine_src_dir, "/src").sub(JasmineHelper.jasmine_lib_dir, "/lib") }
|
||||
}
|
||||
start_jasmine_server(jasmine_includes)
|
||||
end
|
||||
|
||||
|
@ -49,6 +49,7 @@ module Jasmine
|
||||
end
|
||||
|
||||
def self.cachebust(files, root_dir="", replace=nil, replace_with=nil)
|
||||
require 'digest/md5'
|
||||
files.collect do |file_name|
|
||||
real_file_name = replace && replace_with ? file_name.sub(replace, replace_with) : file_name
|
||||
begin
|
||||
@ -61,25 +62,33 @@ module Jasmine
|
||||
end
|
||||
|
||||
class RunAdapter
|
||||
def initialize(spec_files_or_proc, jasmine_files = nil, stylesheets = [])
|
||||
@spec_files_or_proc = spec_files_or_proc
|
||||
@jasmine_files = jasmine_files || [
|
||||
def initialize(spec_files_or_proc, options = {})
|
||||
@spec_files_or_proc = Jasmine.files(spec_files_or_proc) || []
|
||||
@jasmine_files = Jasmine.files(options[:jasmine_files]) || [
|
||||
"/__JASMINE_ROOT__/lib/" + File.basename(Dir.glob("#{Jasmine.root}/lib/jasmine*.js").first),
|
||||
"/__JASMINE_ROOT__/lib/TrivialReporter.js",
|
||||
"/__JASMINE_ROOT__/lib/json2.js"
|
||||
"/__JASMINE_ROOT__/lib/json2.js",
|
||||
"/__JASMINE_ROOT__/lib/consolex.js",
|
||||
]
|
||||
@stylesheets = ["/__JASMINE_ROOT__/lib/jasmine.css"] + stylesheets
|
||||
@stylesheets = ["/__JASMINE_ROOT__/lib/jasmine.css"] + (Jasmine.files(options[:stylesheets]) || [])
|
||||
@spec_helpers = Jasmine.files(options[:spec_helpers]) || []
|
||||
end
|
||||
|
||||
def call(env)
|
||||
run
|
||||
end
|
||||
|
||||
def run
|
||||
stylesheets = @stylesheets
|
||||
spec_helpers = @spec_helpers
|
||||
spec_files = @spec_files_or_proc
|
||||
spec_files = spec_files.call if spec_files.respond_to?(:call)
|
||||
|
||||
jasmine_files = @jasmine_files
|
||||
jasmine_files = jasmine_files.call if jasmine_files.respond_to?(:call)
|
||||
|
||||
css_files = @stylesheets
|
||||
|
||||
|
||||
body = ERB.new(File.read(File.join(File.dirname(__FILE__), "run.html"))).result(binding)
|
||||
[
|
||||
200,
|
||||
@ -87,6 +96,8 @@ module Jasmine
|
||||
body
|
||||
]
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
class Redirect
|
||||
@ -113,13 +124,36 @@ module Jasmine
|
||||
end
|
||||
end
|
||||
|
||||
class SimpleServer
|
||||
def self.start(port, spec_files_or_proc, mappings, jasmine_files = nil, stylesheets = [])
|
||||
require 'thin'
|
||||
class FocusedSuite
|
||||
def initialize(spec_files_or_proc, options)
|
||||
@spec_files_or_proc = Jasmine.files(spec_files_or_proc) || []
|
||||
@options = options
|
||||
end
|
||||
|
||||
def call(env)
|
||||
spec_files = @spec_files_or_proc
|
||||
matching_specs = spec_files.select {|spec_file| spec_file =~ /#{Regexp.escape(env["PATH_INFO"])}/ }.compact
|
||||
if !matching_specs.empty?
|
||||
run_adapter = Jasmine::RunAdapter.new(matching_specs, @options)
|
||||
run_adapter.run
|
||||
else
|
||||
[
|
||||
200,
|
||||
{ 'Content-Type' => 'application/javascript' },
|
||||
"document.write('<p>Couldn\\'t find any specs matching #{env["PATH_INFO"]}!</p>');"
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class SimpleServer
|
||||
def self.start(port, spec_files_or_proc, mappings, options = {})
|
||||
require 'thin'
|
||||
config = {
|
||||
'/__suite__' => Jasmine::FocusedSuite.new(spec_files_or_proc, options),
|
||||
'/run.html' => Jasmine::Redirect.new('/'),
|
||||
'/' => Jasmine::RunAdapter.new(spec_files_or_proc, jasmine_files, stylesheets)
|
||||
'/' => Jasmine::RunAdapter.new(spec_files_or_proc, options)
|
||||
}
|
||||
mappings.each do |from, to|
|
||||
config[from] = Rack::File.new(to)
|
||||
@ -132,7 +166,12 @@ module Jasmine
|
||||
JsAlert.new
|
||||
])
|
||||
|
||||
Thin::Server.start('0.0.0.0', port, app)
|
||||
begin
|
||||
Thin::Server.start('0.0.0.0', port, app)
|
||||
rescue RuntimeError => e
|
||||
raise e unless e.message == 'no acceptor'
|
||||
raise RuntimeError.new("A server is already running on port #{port}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -180,15 +219,13 @@ module Jasmine
|
||||
end
|
||||
|
||||
class Runner
|
||||
def initialize(selenium_jar_path, spec_files, dir_mappings, jasmine_files = nil, options={})
|
||||
def initialize(selenium_jar_path, spec_files, dir_mappings, options={})
|
||||
@selenium_jar_path = selenium_jar_path
|
||||
@spec_files = spec_files
|
||||
@dir_mappings = dir_mappings
|
||||
@jasmine_files = jasmine_files
|
||||
@browser = options[:browser] || 'firefox'
|
||||
@stylesheets = options[:stylesheets] || []
|
||||
|
||||
@options = options
|
||||
|
||||
@browser = options[:browser] ? options[:browser].delete(:browser) : 'firefox'
|
||||
@selenium_pid = nil
|
||||
@jasmine_server_pid = nil
|
||||
end
|
||||
@ -216,7 +253,7 @@ module Jasmine
|
||||
|
||||
@jasmine_server_pid = fork do
|
||||
Process.setpgrp
|
||||
Jasmine::SimpleServer.start(@jasmine_server_port, @spec_files, @dir_mappings, @jasmine_files, @stylesheets)
|
||||
Jasmine::SimpleServer.start(@jasmine_server_port, @spec_files, @dir_mappings, @options)
|
||||
exit! 0
|
||||
end
|
||||
puts "jasmine server started. pid is #{@jasmine_server_pid}"
|
||||
@ -246,4 +283,11 @@ module Jasmine
|
||||
@client.eval_js(script)
|
||||
end
|
||||
end
|
||||
|
||||
def self.files(f)
|
||||
result = f
|
||||
result = result.call if result.respond_to?(:call)
|
||||
result
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -11,6 +11,10 @@
|
||||
<script src="<%= jasmine_file %>" type="text/javascript"></script>
|
||||
<% end %>
|
||||
|
||||
<% spec_helpers.each do |spec_helper| %>
|
||||
<script src="<%= spec_helper %>" type="text/javascript"></script>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
var jsApiReporter;
|
||||
(function() {
|
||||
|
@ -1,12 +1,14 @@
|
||||
require 'spec'
|
||||
require 'open-uri'
|
||||
require 'thin'
|
||||
|
||||
require File.dirname(__FILE__) + '/../jasmine_runner'
|
||||
|
||||
describe Jasmine::SimpleServer do
|
||||
before do
|
||||
@port = Jasmine::find_unused_port
|
||||
end
|
||||
|
||||
|
||||
after do
|
||||
Jasmine::kill_process_group(@jasmine_server_pid) if @jasmine_server_pid
|
||||
end
|
||||
@ -25,12 +27,30 @@ describe Jasmine::SimpleServer do
|
||||
run_html.should =~ /<script src="file2"/
|
||||
end
|
||||
|
||||
describe "RuntimeError" do
|
||||
|
||||
it "should throw an Already Running error if there is already a server running" do
|
||||
Thin::Server.should_receive(:start).and_raise(RuntimeError.new('no acceptor'))
|
||||
lambda {
|
||||
Jasmine::SimpleServer.start(@port, ["file1", "file2"], {})
|
||||
}.should raise_error(RuntimeError, "A server is already running on port #{@port}")
|
||||
end
|
||||
|
||||
it "re-raises other RuntimeErrors" do
|
||||
Thin::Server.should_receive(:start).and_raise(RuntimeError.new('some random error'))
|
||||
lambda {
|
||||
Jasmine::SimpleServer.start(@port, ["file1", "file2"], {})
|
||||
}.should raise_error(RuntimeError, "some random error")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
it "should take a proc that returns a list of spec files" do
|
||||
spec_fileses = [["file1", "file2"], ["file1", "file2", "file3"]]
|
||||
spec_files_proc = lambda do
|
||||
spec_fileses.shift
|
||||
end
|
||||
|
||||
|
||||
@jasmine_server_pid = fork do
|
||||
Process.setpgrp
|
||||
Jasmine::SimpleServer.start(@port, spec_files_proc, {})
|
||||
|
@ -194,6 +194,8 @@ ul.inheritsList
|
||||
|
||||
<li><a href="symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||
|
||||
<li><a href="symbols/jasmine.Matchers.html">jasmine.Matchers</a></li>
|
||||
|
||||
<li><a href="symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||
|
||||
<li><a href="symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||
@ -219,7 +221,19 @@ ul.inheritsList
|
||||
|
||||
|
||||
<div>
|
||||
<h2><a href="symbols/src/lib_jasmine-0.9.0.js.html">lib/jasmine-0.9.0.js</a></h2>
|
||||
<h2><a href="symbols/src/lib_consolex.js.html">lib/consolex.js</a></h2>
|
||||
|
||||
<dl>
|
||||
|
||||
|
||||
|
||||
|
||||
</dl>
|
||||
</div>
|
||||
<hr />
|
||||
|
||||
<div>
|
||||
<h2><a href="symbols/src/lib_jasmine-0.10.0.js.html">lib/jasmine-0.10.0.js</a></h2>
|
||||
|
||||
<dl>
|
||||
|
||||
@ -258,7 +272,7 @@ ul.inheritsList
|
||||
</div>
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
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)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Sat Oct 31 2009 21:44:39 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -194,6 +194,8 @@ ul.inheritsList
|
||||
|
||||
<li><a href="symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||
|
||||
<li><a href="symbols/jasmine.Matchers.html">jasmine.Matchers</a></li>
|
||||
|
||||
<li><a href="symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||
|
||||
<li><a href="symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||
@ -248,6 +250,12 @@ ul.inheritsList
|
||||
</div>
|
||||
<hr />
|
||||
|
||||
<div>
|
||||
<h2><a href="symbols/jasmine.Matchers.html">jasmine.Matchers</a></h2>
|
||||
|
||||
</div>
|
||||
<hr />
|
||||
|
||||
<div>
|
||||
<h2><a href="symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></h2>
|
||||
|
||||
@ -300,7 +308,7 @@ ul.inheritsList
|
||||
</div>
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
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)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Sat Oct 31 2009 21:44:39 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -199,6 +199,8 @@ ul.inheritsList
|
||||
|
||||
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Matchers.html">jasmine.Matchers</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||
@ -389,7 +391,7 @@ ul.inheritsList
|
||||
Used for restoring any state that is hijacked during spec execution.
|
||||
|
||||
<br />
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
|
||||
</div>
|
||||
@ -430,7 +432,7 @@ Used for restoring any state that is hijacked during spec execution.
|
||||
Used for spec setup, including validating assumptions.
|
||||
|
||||
<br />
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
|
||||
</div>
|
||||
@ -473,7 +475,7 @@ are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be
|
||||
of setup in some tests.
|
||||
|
||||
<br />
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
|
||||
</div>
|
||||
@ -527,7 +529,7 @@ It is passed an Object that is the actual value and should chain to one of the m
|
||||
jasmine.Matchers functions.
|
||||
|
||||
<br />
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
|
||||
</div>
|
||||
@ -568,7 +570,7 @@ jasmine.Matchers functions.
|
||||
// TODO: pending tests
|
||||
|
||||
<br />
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
|
||||
</div>
|
||||
@ -619,7 +621,7 @@ jasmine.Matchers functions.
|
||||
Defines part of a jasmine spec. Used in cominbination with waits or waitsFor in asynchrnous specs.
|
||||
|
||||
<br />
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
|
||||
</div>
|
||||
@ -658,7 +660,7 @@ jasmine.Matchers functions.
|
||||
Function that installs a spy on an existing object's method name. Used within a Spec to create a spy.
|
||||
|
||||
<br />
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
|
||||
</div>
|
||||
@ -725,7 +727,7 @@ spyOn(foo, 'not'); // actual foo.not will not be called, execution stops</pre>
|
||||
Waits for a timeout before moving to the next runs()-defined block.
|
||||
|
||||
<br />
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
|
||||
</div>
|
||||
@ -764,7 +766,7 @@ spyOn(foo, 'not'); // actual foo.not will not be called, execution stops</pre>
|
||||
Waits for the latchFunction to return true before proceeding to the next runs()-defined block.
|
||||
|
||||
<br />
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
|
||||
</div>
|
||||
@ -815,7 +817,7 @@ spyOn(foo, 'not'); // actual foo.not will not be called, execution stops</pre>
|
||||
Disables a suite of specifications. Used to disable some suites in a file, or files, temporarily during development.
|
||||
|
||||
<br />
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
|
||||
</div>
|
||||
@ -862,7 +864,7 @@ spyOn(foo, 'not'); // actual foo.not will not be called, execution stops</pre>
|
||||
A convenience method that allows existing specs to be disabled temporarily during development.
|
||||
|
||||
<br />
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
|
||||
</div>
|
||||
@ -908,7 +910,7 @@ A convenience method that allows existing specs to be disabled temporarily durin
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
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)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Sat Oct 31 2009 21:44:38 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -199,6 +199,8 @@ ul.inheritsList
|
||||
|
||||
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Matchers.html">jasmine.Matchers</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||
@ -234,7 +236,7 @@ ul.inheritsList
|
||||
|
||||
|
||||
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
</p>
|
||||
|
||||
@ -339,7 +341,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
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)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Sat Oct 31 2009 21:44:38 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -199,6 +199,8 @@ ul.inheritsList
|
||||
|
||||
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Matchers.html">jasmine.Matchers</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||
@ -234,7 +236,7 @@ ul.inheritsList
|
||||
|
||||
|
||||
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
</p>
|
||||
|
||||
@ -507,7 +509,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
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)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Sat Oct 31 2009 21:44:38 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -199,6 +199,8 @@ ul.inheritsList
|
||||
|
||||
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Matchers.html">jasmine.Matchers</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||
@ -234,7 +236,7 @@ ul.inheritsList
|
||||
|
||||
|
||||
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
</p>
|
||||
|
||||
@ -316,7 +318,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
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)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Sat Oct 31 2009 21:44:38 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
883
doc/symbols/jasmine.Matchers.html
Normal file
883
doc/symbols/jasmine.Matchers.html
Normal file
@ -0,0 +1,883 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="JsDoc Toolkit" />
|
||||
|
||||
<title>JsDoc Reference - jasmine.Matchers</title>
|
||||
|
||||
<style type="text/css">
|
||||
/* default.css */
|
||||
body
|
||||
{
|
||||
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||||
width: 800px;
|
||||
}
|
||||
|
||||
.header
|
||||
{
|
||||
clear: both;
|
||||
background-color: #ccc;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
h1
|
||||
{
|
||||
font-size: 150%;
|
||||
font-weight: bold;
|
||||
padding: 0;
|
||||
margin: 1em 0 0 .3em;
|
||||
}
|
||||
|
||||
hr
|
||||
{
|
||||
border: none 0;
|
||||
border-top: 1px solid #7F8FB1;
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
pre.code
|
||||
{
|
||||
display: block;
|
||||
padding: 8px;
|
||||
border: 1px dashed #ccc;
|
||||
}
|
||||
|
||||
#index
|
||||
{
|
||||
margin-top: 24px;
|
||||
float: left;
|
||||
width: 160px;
|
||||
position: absolute;
|
||||
left: 8px;
|
||||
background-color: #F3F3F3;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
#content
|
||||
{
|
||||
margin-left: 190px;
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
.classList
|
||||
{
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin: 0 0 0 8px;
|
||||
font-family: arial, sans-serif;
|
||||
font-size: 1em;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.classList li
|
||||
{
|
||||
padding: 0;
|
||||
margin: 0 0 8px 0;
|
||||
}
|
||||
|
||||
.summaryTable { width: 100%; }
|
||||
|
||||
h1.classTitle
|
||||
{
|
||||
font-size:170%;
|
||||
line-height:130%;
|
||||
}
|
||||
|
||||
h2 { font-size: 110%; }
|
||||
caption, div.sectionTitle
|
||||
{
|
||||
background-color: #7F8FB1;
|
||||
color: #fff;
|
||||
font-size:130%;
|
||||
text-align: left;
|
||||
padding: 2px 6px 2px 6px;
|
||||
border: 1px #7F8FB1 solid;
|
||||
}
|
||||
|
||||
div.sectionTitle { margin-bottom: 8px; }
|
||||
.summaryTable thead { display: none; }
|
||||
|
||||
.summaryTable td
|
||||
{
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
border-bottom: 1px #7F8FB1 solid;
|
||||
border-right: 1px #7F8FB1 solid;
|
||||
}
|
||||
|
||||
/*col#summaryAttributes {}*/
|
||||
.summaryTable td.attributes
|
||||
{
|
||||
border-left: 1px #7F8FB1 solid;
|
||||
width: 140px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
td.attributes, .fixedFont
|
||||
{
|
||||
line-height: 15px;
|
||||
color: #002EBE;
|
||||
font-family: "Courier New",Courier,monospace;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.summaryTable td.nameDescription
|
||||
{
|
||||
text-align: left;
|
||||
font-size: 13px;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
.summaryTable td.nameDescription, .description
|
||||
{
|
||||
line-height: 15px;
|
||||
padding: 4px;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
.summaryTable { margin-bottom: 8px; }
|
||||
|
||||
ul.inheritsList
|
||||
{
|
||||
list-style: square;
|
||||
margin-left: 20px;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.detailList {
|
||||
margin-left: 20px;
|
||||
line-height: 15px;
|
||||
}
|
||||
.detailList dt { margin-left: 20px; }
|
||||
|
||||
.detailList .heading
|
||||
{
|
||||
font-weight: bold;
|
||||
padding-bottom: 6px;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.light, td.attributes, .light a:link, .light a:visited
|
||||
{
|
||||
color: #777;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.fineprint
|
||||
{
|
||||
text-align: right;
|
||||
font-size: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- ============================== header ================================= -->
|
||||
<!-- begin static/header.html -->
|
||||
<div id="header">
|
||||
</div>
|
||||
<!-- end static/header.html -->
|
||||
|
||||
<!-- ============================== classes index ============================ -->
|
||||
<div id="index">
|
||||
<!-- begin publish.classesIndex -->
|
||||
<div align="center"><a href="../index.html">Class Index</a>
|
||||
| <a href="../files.html">File Index</a></div>
|
||||
<hr />
|
||||
<h2>Classes</h2>
|
||||
<ul class="classList">
|
||||
|
||||
<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.html">jasmine</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Block.html">jasmine.Block</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Env.html">jasmine.Env</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Matchers.html">jasmine.Matchers</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Reporter.html">jasmine.Reporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Runner.html">jasmine.Runner</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Spec.html">jasmine.Spec</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Spy.html">jasmine.Spy</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Suite.html">jasmine.Suite</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.util.html">jasmine.util</a></li>
|
||||
|
||||
</ul>
|
||||
<hr />
|
||||
<!-- end publish.classesIndex -->
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<!-- ============================== class title ============================ -->
|
||||
<h1 class="classTitle">
|
||||
|
||||
Class jasmine.Matchers
|
||||
</h1>
|
||||
|
||||
<!-- ============================== class summary ========================== -->
|
||||
<p class="description">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
</p>
|
||||
|
||||
<!-- ============================== constructor summary ==================== -->
|
||||
|
||||
<table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class jasmine.Matchers.">
|
||||
<caption>Class Summary</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Constructor Attributes</th>
|
||||
<th scope="col">Constructor Name and Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription" >
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html">jasmine.Matchers</a></b>(env, actual, results)
|
||||
</div>
|
||||
<div class="description"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<!-- ============================== properties summary ===================== -->
|
||||
|
||||
|
||||
|
||||
<table class="summaryTable" cellspacing="0" summary="A summary of the fields documented in the class jasmine.Matchers.">
|
||||
<caption>Field Summary</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Field Attributes</th>
|
||||
<th scope="col">Field Name and Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html#toBe">toBe</a></b>
|
||||
</div>
|
||||
<div class="description">toBe: compares the actual to the expected using ===</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html#toBeDefined">toBeDefined</a></b>
|
||||
</div>
|
||||
<div class="description">Matcher that compares the acutal to undefined.</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html#toBeFalsy">toBeFalsy</a></b>
|
||||
</div>
|
||||
<div class="description">Matcher that boolean nots the actual.</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html#toBeNull">toBeNull</a></b>
|
||||
</div>
|
||||
<div class="description">Matcher that compares the actual to null.</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html#toBeTruthy">toBeTruthy</a></b>
|
||||
</div>
|
||||
<div class="description">Matcher that boolean not-nots the actual.</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html#toBeUndefined">toBeUndefined</a></b>
|
||||
</div>
|
||||
<div class="description">Matcher that compares the acutal to undefined.</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html#toContain">toContain</a></b>
|
||||
</div>
|
||||
<div class="description">Matcher that checks that the expected item is an element in the actual Array.</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html#toEqual">toEqual</a></b>
|
||||
</div>
|
||||
<div class="description">toEqual: compares the actual to the expected using common sense equality.</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html#toMatch">toMatch</a></b>
|
||||
</div>
|
||||
<div class="description">Matcher that compares the actual to the expected using a regular expression.</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html#toNotBe">toNotBe</a></b>
|
||||
</div>
|
||||
<div class="description">toNotBe: compares the actual to the expected using !==</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html#toNotContain">toNotContain</a></b>
|
||||
</div>
|
||||
<div class="description">Matcher that checks that the expected item is NOT an element in the actual Array.</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html#toNotEqual">toNotEqual</a></b>
|
||||
</div>
|
||||
<div class="description">toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html#toNotMatch">toNotMatch</a></b>
|
||||
</div>
|
||||
<div class="description">Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html#toThrow">toThrow</a></b>
|
||||
</div>
|
||||
<div class="description">Matcher that checks that the expected exception was thrown by the actual.</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html#wasCalled">wasCalled</a></b>
|
||||
</div>
|
||||
<div class="description">Matcher that checks to see if the acutal, a Jasmine spy, was called.</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
<b><a href="../symbols/jasmine.Matchers.html#wasNotCalled">wasNotCalled</a></b>
|
||||
</div>
|
||||
<div class="description">Matcher that checks to see if the acutal, a Jasmine spy, was not called.</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ============================== methods summary ======================== -->
|
||||
|
||||
<!-- ============================== events summary ======================== -->
|
||||
|
||||
|
||||
<!-- ============================== constructor details ==================== -->
|
||||
|
||||
<div class="details"><a name="constructor"> </a>
|
||||
<div class="sectionTitle">
|
||||
Class Detail
|
||||
</div>
|
||||
|
||||
<div class="fixedFont">
|
||||
<b>jasmine.Matchers</b>(env, actual, results)
|
||||
</div>
|
||||
|
||||
<div class="description">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dl class="detailList">
|
||||
<dt class="heading">Parameters:</dt>
|
||||
|
||||
<dt>
|
||||
<span class="light fixedFont">{<a href="../symbols/jasmine.Env.html">jasmine.Env</a>}</span> <b>env</b>
|
||||
|
||||
</dt>
|
||||
<dd></dd>
|
||||
|
||||
<dt>
|
||||
<b>actual</b>
|
||||
|
||||
</dt>
|
||||
<dd></dd>
|
||||
|
||||
<dt>
|
||||
<span class="light fixedFont">{<a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a>}</span> <b>results</b>
|
||||
|
||||
</dt>
|
||||
<dd></dd>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ============================== field details ========================== -->
|
||||
|
||||
<div class="sectionTitle">
|
||||
Field Detail
|
||||
</div>
|
||||
|
||||
<a name="toBe"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>toBe</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
toBe: compares the actual to the expected using ===
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="toBeDefined"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>toBeDefined</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
Matcher that compares the acutal to undefined.
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="toBeFalsy"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>toBeFalsy</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
Matcher that boolean nots the actual.
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="toBeNull"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>toBeNull</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
Matcher that compares the actual to null.
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="toBeTruthy"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>toBeTruthy</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
Matcher that boolean not-nots the actual.
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="toBeUndefined"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>toBeUndefined</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
Matcher that compares the acutal to undefined.
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="toContain"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>toContain</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
Matcher that checks that the expected item is an element in the actual Array.
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="toEqual"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>toEqual</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
toEqual: compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc.
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="toMatch"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>toMatch</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes
|
||||
a pattern or a String.
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="toNotBe"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>toNotBe</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
toNotBe: compares the actual to the expected using !==
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="toNotContain"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>toNotContain</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
Matcher that checks that the expected item is NOT an element in the actual Array.
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="toNotEqual"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>toNotEqual</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="toNotMatch"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>toNotMatch</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="toThrow"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>toThrow</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
Matcher that checks that the expected exception was thrown by the actual.
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="wasCalled"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>wasCalled</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
Matcher that checks to see if the acutal, a Jasmine spy, was called.
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="wasNotCalled"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>wasNotCalled</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
Matcher that checks to see if the acutal, a Jasmine spy, was not called.
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ============================== method details ========================= -->
|
||||
|
||||
|
||||
<!-- ============================== event details ========================= -->
|
||||
|
||||
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Sat Oct 31 2009 21:44:38 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -199,6 +199,8 @@ ul.inheritsList
|
||||
|
||||
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Matchers.html">jasmine.Matchers</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||
@ -234,7 +236,7 @@ ul.inheritsList
|
||||
|
||||
|
||||
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
</p>
|
||||
|
||||
@ -316,7 +318,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
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)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Sat Oct 31 2009 21:44:38 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -199,6 +199,8 @@ ul.inheritsList
|
||||
|
||||
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Matchers.html">jasmine.Matchers</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||
@ -234,7 +236,7 @@ ul.inheritsList
|
||||
|
||||
|
||||
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
</p>
|
||||
|
||||
@ -700,7 +702,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
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)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Sat Oct 31 2009 21:44:38 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -199,6 +199,8 @@ ul.inheritsList
|
||||
|
||||
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Matchers.html">jasmine.Matchers</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||
@ -234,7 +236,7 @@ ul.inheritsList
|
||||
|
||||
|
||||
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
</p>
|
||||
|
||||
@ -316,7 +318,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
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)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Sat Oct 31 2009 21:44:38 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -199,6 +199,8 @@ ul.inheritsList
|
||||
|
||||
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Matchers.html">jasmine.Matchers</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||
@ -234,7 +236,7 @@ ul.inheritsList
|
||||
|
||||
|
||||
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
</p>
|
||||
|
||||
@ -267,42 +269,6 @@ ul.inheritsList
|
||||
|
||||
<!-- ============================== methods summary ======================== -->
|
||||
|
||||
|
||||
|
||||
<table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class jasmine.Runner.">
|
||||
<caption>Method Summary</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Method Attributes</th>
|
||||
<th scope="col">Method Name and Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont"><b><a href="../symbols/jasmine.Runner.html#getAllSuites">getAllSuites</a></b>()
|
||||
</div>
|
||||
<div class="description"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont"><b><a href="../symbols/jasmine.Runner.html#getResults">getResults</a></b>()
|
||||
</div>
|
||||
<div class="description"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ============================== events summary ======================== -->
|
||||
|
||||
|
||||
@ -352,61 +318,6 @@ ul.inheritsList
|
||||
|
||||
<!-- ============================== method details ========================= -->
|
||||
|
||||
<div class="sectionTitle">
|
||||
Method Detail
|
||||
</div>
|
||||
|
||||
<a name="getAllSuites"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>getAllSuites</b>()
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="getResults"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>getResults</b>()
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ============================== event details ========================= -->
|
||||
|
||||
@ -418,7 +329,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
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)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Sat Oct 31 2009 21:44:39 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -199,6 +199,8 @@ ul.inheritsList
|
||||
|
||||
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Matchers.html">jasmine.Matchers</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||
@ -234,7 +236,7 @@ ul.inheritsList
|
||||
|
||||
|
||||
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
</p>
|
||||
|
||||
@ -396,7 +398,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
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)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Sat Oct 31 2009 21:44:39 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -199,6 +199,8 @@ ul.inheritsList
|
||||
|
||||
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Matchers.html">jasmine.Matchers</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||
@ -234,7 +236,7 @@ ul.inheritsList
|
||||
|
||||
|
||||
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
</p>
|
||||
|
||||
@ -845,7 +847,7 @@ expect(foo.bar.callCount).toEqual(0);</pre>
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
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)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Sat Oct 31 2009 21:44:39 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -199,6 +199,8 @@ ul.inheritsList
|
||||
|
||||
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Matchers.html">jasmine.Matchers</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||
@ -234,7 +236,7 @@ ul.inheritsList
|
||||
|
||||
|
||||
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
</p>
|
||||
|
||||
@ -267,42 +269,6 @@ ul.inheritsList
|
||||
|
||||
<!-- ============================== methods summary ======================== -->
|
||||
|
||||
|
||||
|
||||
<table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class jasmine.Suite.">
|
||||
<caption>Method Summary</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Method Attributes</th>
|
||||
<th scope="col">Method Name and Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont"><b><a href="../symbols/jasmine.Suite.html#getResults">getResults</a></b>()
|
||||
</div>
|
||||
<div class="description"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont"><b><a href="../symbols/jasmine.Suite.html#specCount">specCount</a></b>()
|
||||
</div>
|
||||
<div class="description"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ============================== events summary ======================== -->
|
||||
|
||||
|
||||
@ -370,61 +336,6 @@ ul.inheritsList
|
||||
|
||||
<!-- ============================== method details ========================= -->
|
||||
|
||||
<div class="sectionTitle">
|
||||
Method Detail
|
||||
</div>
|
||||
|
||||
<a name="getResults"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>getResults</b>()
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name="specCount"> </a>
|
||||
<div class="fixedFont">
|
||||
|
||||
|
||||
<b>specCount</b>()
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ============================== event details ========================= -->
|
||||
|
||||
@ -436,7 +347,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
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)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Sat Oct 31 2009 21:44:39 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -199,6 +199,8 @@ ul.inheritsList
|
||||
|
||||
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Matchers.html">jasmine.Matchers</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||
@ -234,7 +236,7 @@ ul.inheritsList
|
||||
|
||||
|
||||
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
</p>
|
||||
|
||||
@ -276,6 +278,16 @@ ul.inheritsList
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"><static> </td>
|
||||
<td class="nameDescription">
|
||||
<div class="fixedFont">
|
||||
jasmine.<b><a href="../symbols/jasmine.html#.details">details</a></b>
|
||||
</div>
|
||||
<div class="description"></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="attributes"><static> </td>
|
||||
<td class="nameDescription">
|
||||
@ -416,6 +428,28 @@ Jasmine environment.</div>
|
||||
Field Detail
|
||||
</div>
|
||||
|
||||
<a name=".details"> </a>
|
||||
<div class="fixedFont"><static>
|
||||
|
||||
|
||||
<span class="light">jasmine.</span><b>details</b>
|
||||
|
||||
</div>
|
||||
<div class="description">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<a name=".UPDATE_INTERVAL"> </a>
|
||||
<div class="fixedFont"><static>
|
||||
|
||||
@ -728,7 +762,7 @@ Jasmine environment.
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
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)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Sat Oct 31 2009 21:44:38 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -199,6 +199,8 @@ ul.inheritsList
|
||||
|
||||
<li><a href="../symbols/jasmine.JsApiReporter.html">jasmine.JsApiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.Matchers.html">jasmine.Matchers</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.MultiReporter.html">jasmine.MultiReporter</a></li>
|
||||
|
||||
<li><a href="../symbols/jasmine.NestedResults.html">jasmine.NestedResults</a></li>
|
||||
@ -234,7 +236,7 @@ ul.inheritsList
|
||||
|
||||
|
||||
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.9.0.js.html">jasmine-0.9.0.js</a>.
|
||||
<br /><i>Defined in: </i> <a href="../symbols/src/lib_jasmine-0.10.0.js.html">jasmine-0.10.0.js</a>.
|
||||
|
||||
</p>
|
||||
|
||||
@ -316,7 +318,7 @@ ul.inheritsList
|
||||
<!-- ============================== footer ================================= -->
|
||||
<div class="fineprint" style="clear:both">
|
||||
|
||||
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)
|
||||
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Sat Oct 31 2009 21:44:39 GMT-0700 (PDT)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -24,121 +24,103 @@
|
||||
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 18</span>
|
||||
<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'> 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="COMM">//twice for ie</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><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="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><span class="WHIT"> </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'> 20</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'> 21</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 22</span>
|
||||
<span class='line'> 23</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'> 24</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 25</span>
|
||||
<span class='line'> 26</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'> 27</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'> 28</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="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 31</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="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 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.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><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="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 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="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="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.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="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="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="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="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</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'> 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="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 52</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="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 55</span>
|
||||
<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="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">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">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="COMM">//do it twice for IE</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><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="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">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">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="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="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="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="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><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="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 73</span>
|
||||
<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">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="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="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="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="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><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 82</span>
|
||||
<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">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">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">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="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="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">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="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 class='line'> 93</span>
|
||||
<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="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><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="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="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="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><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="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="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'> 29</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'> 30</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'> 31</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'> 32</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'> 33</span>
|
||||
<span class='line'> 34</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'> 35</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'> 36</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'> 37</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'> 38</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'> 39</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'> 40</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'> 41</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'> 42</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'> 43</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 44</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'> 45</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 46</span>
|
||||
<span class='line'> 47</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'> 48</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 49</span>
|
||||
<span class='line'> 50</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'> 51</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'> 52</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'> 53</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'> 54</span> </span><span class="WHIT"> </span><span class="COMM">//do it twice for IE</span><span class="WHIT">
|
||||
<span class='line'> 55</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'> 56</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'> 57</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'> 58</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'> 59</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'> 60</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'> 61</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 62</span> </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">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'> 64</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'> 65</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'> 66</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 67</span>
|
||||
<span class='line'> 68</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'> 69</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'> 70</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'> 71</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'> 72</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'> 73</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 74</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'> 75</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 76</span>
|
||||
<span class='line'> 77</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'> 78</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'> 79</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'> 80</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'> 81</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'> 82</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 83</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'> 84</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'> 85</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'> 86</span>
|
||||
<span class='line'> 87</span>
|
||||
<span class='line'> 88</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'> 89</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'> 90</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'> 91</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'> 92</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'> 93</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'> 94</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'> 95</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'> 96</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 97</span> </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">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'> 99</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>100</span>
|
||||
<span class='line'>101</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'>102</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'>103</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>104</span>
|
||||
<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="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>107</span>
|
||||
<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="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="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>111</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">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="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>115</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="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="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">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="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="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="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>123</span>
|
||||
<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="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><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>
|
||||
<span class='line'>105</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'>106</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'>107</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>108</span>
|
||||
<span class='line'>109</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'>110</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'>111</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'>112</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'>113</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'>114</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'>115</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>116</span>
|
||||
<span class='line'>117</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'>118</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'>119</span> </span><span class="PUNC">}</span><span class="PUNC">;</span></pre></body></html>
|
35
doc/symbols/src/lib_consolex.js.html
Normal file
35
doc/symbols/src/lib_consolex.js.html
Normal file
@ -0,0 +1,35 @@
|
||||
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
|
||||
.KEYW {color: #933;}
|
||||
.COMM {color: #bbb; font-style: italic;}
|
||||
.NUMB {color: #393;}
|
||||
.STRN {color: #393;}
|
||||
.REGX {color: #339;}
|
||||
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
|
||||
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">/** Console X
|
||||
<span class='line'> 2</span> * http://github.com/deadlyicon/consolex.js
|
||||
<span class='line'> 3</span> *
|
||||
<span class='line'> 4</span> * By Jared Grippe <jared@jaredgrippe.com>
|
||||
<span class='line'> 5</span> *
|
||||
<span class='line'> 6</span> * Copyright (c) 2009 Jared Grippe
|
||||
<span class='line'> 7</span> * Licensed under the MIT license.
|
||||
<span class='line'> 8</span> *
|
||||
<span class='line'> 9</span> * consolex avoids ever having to see javascript bugs in browsers that do not implement the entire
|
||||
<span class='line'> 10</span> * firebug console suit
|
||||
<span class='line'> 11</span> *
|
||||
<span class='line'> 12</span> */</span><span class="WHIT">
|
||||
<span class='line'> 13</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">window</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 14</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="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="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 15</span>
|
||||
<span class='line'> 16</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 class='line'> 17</span> </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'> 18</span>
|
||||
<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">emptyFunction</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 20</span>
|
||||
<span class='line'> 21</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">names.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">++</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 22</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="PUNC">(</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="NAME">emptyFunction</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</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="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 24</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="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">method</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">Function.prototype.apply.apply</span><span class="PUNC">(</span><span class="NAME">method</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">console</span><span class="PUNC">,</span><span class="NAME">arguments</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 class='line'> 26</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</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="PUNC">)</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="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>
|
2302
doc/symbols/src/lib_jasmine-0.10.0.js.html
Normal file
2302
doc/symbols/src/lib_jasmine-0.10.0.js.html
Normal file
File diff suppressed because it is too large
Load Diff
@ -6,6 +6,7 @@
|
||||
</head>
|
||||
<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/consolex.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../lib/jasmine.css">
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -19,6 +19,6 @@ task :jasmine_server do
|
||||
puts " http://localhost:8888/run.html"
|
||||
|
||||
Jasmine::SimpleServer.start(8888,
|
||||
lambda { JasmineHelper.spec_file_urls },
|
||||
lambda { JasmineHelper.specs },
|
||||
JasmineHelper.dir_mappings)
|
||||
end
|
||||
|
@ -10,7 +10,9 @@ class JasmineHelper
|
||||
def self.jasmine
|
||||
['/lib/' + File.basename(Dir.glob("#{JasmineHelper.jasmine_lib_dir}/jasmine*.js").first)] +
|
||||
['/lib/json2.js',
|
||||
'/lib/TrivialReporter.js']
|
||||
'/lib/TrivialReporter.js',
|
||||
'/lib/consolex.js'
|
||||
]
|
||||
end
|
||||
|
||||
def self.jasmine_src_dir
|
||||
@ -25,7 +27,7 @@ class JasmineHelper
|
||||
Dir.glob(File.join(jasmine_spec_dir, "**/*[Ss]pec.js"))
|
||||
end
|
||||
|
||||
def self.spec_file_urls
|
||||
def self.specs
|
||||
raw_spec_files.collect {|f| f.sub(jasmine_spec_dir, "/spec")}
|
||||
end
|
||||
|
||||
|
@ -4,7 +4,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), "jasmine_helper.rb"))
|
||||
require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder"))
|
||||
|
||||
jasmine_runner = Jasmine::Runner.new(SeleniumRC::Server.new.jar_path,
|
||||
JasmineHelper.spec_file_urls,
|
||||
JasmineHelper.specs,
|
||||
JasmineHelper.dir_mappings)
|
||||
|
||||
spec_builder = Jasmine::SpecBuilder.new(JasmineHelper.raw_spec_files, jasmine_runner)
|
||||
|
20
geminstaller.yml
Normal file
20
geminstaller.yml
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
gems:
|
||||
- name: rake
|
||||
version: 0.8.7
|
||||
- name: ragaskar-jsdoc_helper
|
||||
version: 0.0.2.1
|
||||
- name: json
|
||||
version: 1.1.9
|
||||
- name: pivotal-selenium-rc
|
||||
version: 1.11.20090610
|
||||
- name: rack
|
||||
version: 1.0.0
|
||||
- name: thin
|
||||
version: 1.2.4
|
||||
- name: eventmachine
|
||||
version: 0.12.8
|
||||
- name: rspec
|
||||
version: 1.2.9
|
||||
- name: selenium-client
|
||||
version: 1.2.17
|
@ -17,13 +17,7 @@ jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarA
|
||||
}
|
||||
|
||||
for (var attr in attrs) {
|
||||
if (attr == 'className') {
|
||||
el.setAttribute('class', attrs[attr]);
|
||||
//twice for ie
|
||||
el.setAttribute('className', attrs[attr]);
|
||||
} else {
|
||||
el[attr] = attrs[attr];
|
||||
}
|
||||
}
|
||||
|
||||
return el;
|
||||
@ -101,7 +95,6 @@ jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
|
||||
specDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
|
||||
}
|
||||
}
|
||||
|
||||
this.suiteDivs[spec.suite.getFullName()].appendChild(specDiv);
|
||||
};
|
||||
|
||||
@ -123,14 +116,4 @@ jasmine.TrivialReporter.prototype.specFilter = function(spec) {
|
||||
|
||||
if (!paramMap["spec"]) return true;
|
||||
return spec.getFullName().indexOf(paramMap["spec"]) == 0;
|
||||
};
|
||||
|
||||
//protect against console.log incidents
|
||||
if (!("console" in window) || !("firebug" in console)) {
|
||||
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
|
||||
window.console = {};
|
||||
for (var i = 0, len = names.length; i < len; ++i) {
|
||||
window.console[names[i]] = function() {
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
28
lib/consolex.js
Normal file
28
lib/consolex.js
Normal file
@ -0,0 +1,28 @@
|
||||
/** Console X
|
||||
* http://github.com/deadlyicon/consolex.js
|
||||
*
|
||||
* By Jared Grippe <jared@jaredgrippe.com>
|
||||
*
|
||||
* Copyright (c) 2009 Jared Grippe
|
||||
* Licensed under the MIT license.
|
||||
*
|
||||
* consolex avoids ever having to see javascript bugs in browsers that do not implement the entire
|
||||
* firebug console suit
|
||||
*
|
||||
*/
|
||||
(function(window) {
|
||||
window.console || (window.console = {});
|
||||
|
||||
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
|
||||
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
|
||||
|
||||
function emptyFunction(){}
|
||||
|
||||
for (var i = 0; i < names.length; ++i){
|
||||
window.console[names[i]] || (window.console[names[i]] = emptyFunction);
|
||||
if (typeof window.console[names[i]] !== 'function')
|
||||
window.console[names[i]] = (function(method) {
|
||||
return function(){ return Function.prototype.apply.apply(method, [console,arguments]); };
|
||||
})(window.console[names[i]]);
|
||||
}
|
||||
})(this);
|
@ -28,16 +28,14 @@ jasmine.UPDATE_INTERVAL = 250;
|
||||
*/
|
||||
jasmine.bindOriginal_ = function(base, name) {
|
||||
var original = base[name];
|
||||
return function() {
|
||||
if (original.apply) {
|
||||
if (original.apply) {
|
||||
return function() {
|
||||
return original.apply(base, arguments);
|
||||
} else {
|
||||
//IE support
|
||||
if (base == window) {
|
||||
return window[name].apply(window, arguments);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
} else {
|
||||
// IE support
|
||||
return window[name];
|
||||
}
|
||||
};
|
||||
|
||||
jasmine.setTimeout = jasmine.bindOriginal_(window, 'setTimeout');
|
||||
@ -51,12 +49,18 @@ jasmine.MessageResult = function(text) {
|
||||
this.trace = new Error(); // todo: test better
|
||||
};
|
||||
|
||||
jasmine.ExpectationResult = function(passed, message, details) {
|
||||
jasmine.ExpectationResult = function(params) {
|
||||
this.type = 'ExpectationResult';
|
||||
this.passed_ = passed;
|
||||
this.message = message;
|
||||
this.details = details;
|
||||
this.trace = new Error(message); // todo: test better
|
||||
this.matcherName = params.matcherName;
|
||||
this.passed_ = params.passed;
|
||||
this.expected = params.expected;
|
||||
this.actual = params.actual;
|
||||
|
||||
/** @deprecated */
|
||||
this.details = params.details;
|
||||
|
||||
this.message = this.passed_ ? 'Passed.' : params.message;
|
||||
this.trace = this.passed_ ? '' : new Error(this.message);
|
||||
};
|
||||
|
||||
jasmine.ExpectationResult.prototype.passed = function () {
|
||||
@ -530,7 +534,7 @@ jasmine.version_= {
|
||||
"major": 0,
|
||||
"minor": 10,
|
||||
"build": 0,
|
||||
"revision": 1255748957
|
||||
"revision": 1257050679
|
||||
};
|
||||
/**
|
||||
* @namespace
|
||||
@ -591,6 +595,11 @@ jasmine.util.argsToArray = function(args) {
|
||||
return arrayOfArgs;
|
||||
};
|
||||
|
||||
jasmine.util.extend = function(destination, source) {
|
||||
for (var property in source) destination[property] = source[property];
|
||||
return destination;
|
||||
};
|
||||
|
||||
/**
|
||||
* Environment for Jasmine
|
||||
*
|
||||
@ -600,7 +609,6 @@ jasmine.Env = function() {
|
||||
this.currentSpec = null;
|
||||
this.currentSuite = null;
|
||||
this.currentRunner_ = new jasmine.Runner(this);
|
||||
this.currentlyRunningTests = false;
|
||||
|
||||
this.reporter = new jasmine.MultiReporter();
|
||||
|
||||
@ -739,18 +747,18 @@ jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchVal
|
||||
|
||||
for (var property in b) {
|
||||
if (!hasKey(a, property) && hasKey(b, property)) {
|
||||
mismatchKeys.push("expected has key '" + property + "', but missing from <b>actual</b>.");
|
||||
mismatchKeys.push("expected has key '" + property + "', but missing from actual.");
|
||||
}
|
||||
}
|
||||
for (property in a) {
|
||||
if (!hasKey(b, property) && hasKey(a, property)) {
|
||||
mismatchKeys.push("<b>expected</b> missing key '" + property + "', but present in actual.");
|
||||
mismatchKeys.push("expected missing key '" + property + "', but present in actual.");
|
||||
}
|
||||
}
|
||||
for (property in b) {
|
||||
if (property == '__Jasmine_been_here_before__') continue;
|
||||
if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) {
|
||||
mismatchValues.push("'" + property + "' was<br /><br />'" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "'<br /><br />in expected, but was<br /><br />'" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "'<br /><br />in actual.<br />");
|
||||
mismatchValues.push("'" + property + "' was '" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "' in expected, but was '" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "' in actual.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -967,91 +975,111 @@ jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
|
||||
return summaryResult;
|
||||
};
|
||||
|
||||
jasmine.Matchers = function(env, actual, results) {
|
||||
/**
|
||||
* @constructor
|
||||
* @param {jasmine.Env} env
|
||||
* @param actual
|
||||
* @param {jasmine.NestedResults} results
|
||||
*/
|
||||
jasmine.Matchers = function(env, actual, spec) {
|
||||
this.env = env;
|
||||
this.actual = actual;
|
||||
this.passing_message = 'Passed.';
|
||||
this.results_ = results || new jasmine.NestedResults();
|
||||
this.spec = spec;
|
||||
};
|
||||
|
||||
jasmine.Matchers.pp = function(str) {
|
||||
return jasmine.util.htmlEscape(jasmine.pp(str));
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
jasmine.Matchers.prototype.getResults = function() {
|
||||
return this.results_;
|
||||
};
|
||||
|
||||
jasmine.Matchers.prototype.results = function() {
|
||||
return this.results_;
|
||||
};
|
||||
|
||||
jasmine.Matchers.prototype.report = function(result, failing_message, details) {
|
||||
this.results_.addResult(new jasmine.ExpectationResult(result, result ? this.passing_message : failing_message, details));
|
||||
var expectationResult = new jasmine.ExpectationResult({
|
||||
passed: result,
|
||||
message: failing_message,
|
||||
details: details
|
||||
});
|
||||
this.spec.addMatcherResult(expectationResult);
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Matcher that compares the actual to the expected using ===.
|
||||
*
|
||||
* @param expected
|
||||
*/
|
||||
jasmine.Matchers.prototype.toBe = function(expected) {
|
||||
return this.report(this.actual === expected, 'Expected<br /><br />' + jasmine.Matchers.pp(expected)
|
||||
+ '<br /><br />to be the same object as<br /><br />' + jasmine.Matchers.pp(this.actual)
|
||||
+ '<br />');
|
||||
};
|
||||
|
||||
/**
|
||||
* Matcher that compares the actual to the expected using !==
|
||||
* @param expected
|
||||
*/
|
||||
jasmine.Matchers.prototype.toNotBe = function(expected) {
|
||||
return this.report(this.actual !== expected, 'Expected<br /><br />' + jasmine.Matchers.pp(expected)
|
||||
+ '<br /><br />to be a different object from actual, but they were the same.');
|
||||
};
|
||||
|
||||
/**
|
||||
* Matcher that compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc.
|
||||
*
|
||||
* @param expected
|
||||
*/
|
||||
jasmine.Matchers.prototype.toEqual = function(expected) {
|
||||
var mismatchKeys = [];
|
||||
var mismatchValues = [];
|
||||
|
||||
var formatMismatches = function(name, array) {
|
||||
if (array.length == 0) return '';
|
||||
var errorOutput = '<br /><br />Different ' + name + ':<br />';
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
errorOutput += array[i] + '<br />';
|
||||
jasmine.Matchers.matcherFn_ = function(matcherName, options) {
|
||||
return function () {
|
||||
jasmine.util.extend(this, options);
|
||||
var matcherArgs = jasmine.util.argsToArray(arguments);
|
||||
var args = [this.actual].concat(matcherArgs);
|
||||
var result = options.test.apply(this, args);
|
||||
var message;
|
||||
if (!result) {
|
||||
message = options.message.apply(this, args);
|
||||
}
|
||||
return errorOutput;
|
||||
var expectationResult = new jasmine.ExpectationResult({
|
||||
matcherName: matcherName,
|
||||
passed: result,
|
||||
expected: matcherArgs.length > 1 ? matcherArgs : matcherArgs[0],
|
||||
actual: this.actual,
|
||||
message: message
|
||||
});
|
||||
this.spec.addMatcherResult(expectationResult);
|
||||
return result;
|
||||
};
|
||||
|
||||
return this.report(this.env.equals_(this.actual, expected, mismatchKeys, mismatchValues),
|
||||
'Expected<br /><br />' + jasmine.Matchers.pp(expected)
|
||||
+ '<br /><br />but got<br /><br />' + jasmine.Matchers.pp(this.actual)
|
||||
+ '<br />'
|
||||
+ formatMismatches('Keys', mismatchKeys)
|
||||
+ formatMismatches('Values', mismatchValues), {
|
||||
matcherName: 'toEqual', expected: expected, actual: this.actual
|
||||
});
|
||||
};
|
||||
/** @deprecated */
|
||||
jasmine.Matchers.prototype.should_equal = jasmine.Matchers.prototype.toEqual;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Matcher that compares the actual to the expected using the ! of jasmine.Matchers.toEqual
|
||||
* toBe: compares the actual to the expected using ===
|
||||
* @param expected
|
||||
*/
|
||||
jasmine.Matchers.prototype.toNotEqual = function(expected) {
|
||||
return this.report(!this.env.equals_(this.actual, expected),
|
||||
'Expected ' + jasmine.Matchers.pp(expected) + ' to not equal ' + jasmine.Matchers.pp(this.actual) + ', but it does.');
|
||||
};
|
||||
/** @deprecated */
|
||||
jasmine.Matchers.prototype.should_not_equal = jasmine.Matchers.prototype.toNotEqual;
|
||||
|
||||
jasmine.Matchers.prototype.toBe = jasmine.Matchers.matcherFn_('toBe', {
|
||||
test: function (actual, expected) {
|
||||
return actual === expected;
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return "Expected " + jasmine.pp(actual) + " to be " + jasmine.pp(expected);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* toNotBe: compares the actual to the expected using !==
|
||||
* @param expected
|
||||
*/
|
||||
jasmine.Matchers.prototype.toNotBe = jasmine.Matchers.matcherFn_('toNotBe', {
|
||||
test: function (actual, expected) {
|
||||
return actual !== expected;
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return "Expected " + jasmine.pp(actual) + " to not be " + jasmine.pp(expected);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* toEqual: compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc.
|
||||
*
|
||||
* @param expected
|
||||
*/
|
||||
|
||||
jasmine.Matchers.prototype.toEqual = jasmine.Matchers.matcherFn_('toEqual', {
|
||||
test: function (actual, expected) {
|
||||
return this.env.equals_(actual, expected);
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return "Expected " + jasmine.pp(actual) + " to equal " + jasmine.pp(expected);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual
|
||||
* @param expected
|
||||
*/
|
||||
jasmine.Matchers.prototype.toNotEqual = jasmine.Matchers.matcherFn_('toNotEqual', {
|
||||
test: function (actual, expected) {
|
||||
return !this.env.equals_(actual, expected);
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return "Expected " + jasmine.pp(actual) + " to not equal " + jasmine.pp(expected);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes
|
||||
@ -1059,93 +1087,166 @@ jasmine.Matchers.prototype.should_not_equal = jasmine.Matchers.prototype.toNotEq
|
||||
*
|
||||
* @param reg_exp
|
||||
*/
|
||||
jasmine.Matchers.prototype.toMatch = function(reg_exp) {
|
||||
return this.report((new RegExp(reg_exp).test(this.actual)),
|
||||
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to match ' + reg_exp + '.');
|
||||
};
|
||||
/** @deprecated */
|
||||
jasmine.Matchers.prototype.should_match = jasmine.Matchers.prototype.toMatch;
|
||||
jasmine.Matchers.prototype.toMatch = jasmine.Matchers.matcherFn_('toMatch', {
|
||||
test: function(actual, expected) {
|
||||
return new RegExp(expected).test(actual);
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return jasmine.pp(actual) + " does not match the regular expression " + new RegExp(expected).toString();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch
|
||||
* @param reg_exp
|
||||
*/
|
||||
jasmine.Matchers.prototype.toNotMatch = function(reg_exp) {
|
||||
return this.report((!new RegExp(reg_exp).test(this.actual)),
|
||||
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to not match ' + reg_exp + '.');
|
||||
};
|
||||
/** @deprecated */
|
||||
jasmine.Matchers.prototype.should_not_match = jasmine.Matchers.prototype.toNotMatch;
|
||||
|
||||
jasmine.Matchers.prototype.toNotMatch = jasmine.Matchers.matcherFn_('toNotMatch', {
|
||||
test: function(actual, expected) {
|
||||
return !(new RegExp(expected).test(actual));
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return jasmine.pp(actual) + " should not match " + new RegExp(expected).toString();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that compares the acutal to undefined.
|
||||
*/
|
||||
jasmine.Matchers.prototype.toBeDefined = function() {
|
||||
return this.report((this.actual !== undefined),
|
||||
'Expected a value to be defined but it was undefined.');
|
||||
};
|
||||
/** @deprecated */
|
||||
jasmine.Matchers.prototype.should_be_defined = jasmine.Matchers.prototype.toBeDefined;
|
||||
|
||||
jasmine.Matchers.prototype.toBeDefined = jasmine.Matchers.matcherFn_('toBeDefined', {
|
||||
test: function(actual) {
|
||||
return (actual !== undefined);
|
||||
},
|
||||
message: function() {
|
||||
return 'Expected actual to not be undefined.';
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that compares the acutal to undefined.
|
||||
*/
|
||||
|
||||
jasmine.Matchers.prototype.toBeUndefined = jasmine.Matchers.matcherFn_('toBeUndefined', {
|
||||
test: function(actual) {
|
||||
return (actual === undefined);
|
||||
},
|
||||
message: function(actual) {
|
||||
return 'Expected ' + jasmine.pp(actual) + ' to be undefined.';
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that compares the actual to null.
|
||||
*
|
||||
*/
|
||||
jasmine.Matchers.prototype.toBeNull = function() {
|
||||
return this.report((this.actual === null),
|
||||
'Expected a value to be null but it was ' + jasmine.Matchers.pp(this.actual) + '.');
|
||||
};
|
||||
/** @deprecated */
|
||||
jasmine.Matchers.prototype.should_be_null = jasmine.Matchers.prototype.toBeNull;
|
||||
jasmine.Matchers.prototype.toBeNull = jasmine.Matchers.matcherFn_('toBeNull', {
|
||||
test: function(actual) {
|
||||
return (actual === null);
|
||||
},
|
||||
message: function(actual) {
|
||||
return 'Expected ' + jasmine.pp(actual) + ' to be null.';
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that boolean not-nots the actual.
|
||||
*/
|
||||
jasmine.Matchers.prototype.toBeTruthy = function() {
|
||||
return this.report(!!this.actual,
|
||||
'Expected a value to be truthy but it was ' + jasmine.Matchers.pp(this.actual) + '.');
|
||||
};
|
||||
/** @deprecated */
|
||||
jasmine.Matchers.prototype.should_be_truthy = jasmine.Matchers.prototype.toBeTruthy;
|
||||
jasmine.Matchers.prototype.toBeTruthy = jasmine.Matchers.matcherFn_('toBeTruthy', {
|
||||
test: function(actual) {
|
||||
return !!actual;
|
||||
},
|
||||
message: function() {
|
||||
return 'Expected actual to be truthy';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Matcher that boolean nots the actual.
|
||||
*/
|
||||
jasmine.Matchers.prototype.toBeFalsy = function() {
|
||||
return this.report(!this.actual,
|
||||
'Expected a value to be falsy but it was ' + jasmine.Matchers.pp(this.actual) + '.');
|
||||
};
|
||||
/** @deprecated */
|
||||
jasmine.Matchers.prototype.should_be_falsy = jasmine.Matchers.prototype.toBeFalsy;
|
||||
jasmine.Matchers.prototype.toBeFalsy = jasmine.Matchers.matcherFn_('toBeFalsy', {
|
||||
test: function(actual) {
|
||||
return !actual;
|
||||
},
|
||||
message: function(actual) {
|
||||
return 'Expected ' + jasmine.pp(actual) + ' to be falsy';
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that checks to see if the acutal, a Jasmine spy, was called.
|
||||
*/
|
||||
jasmine.Matchers.prototype.wasCalled = function() {
|
||||
if (!this.actual || !this.actual.isSpy) {
|
||||
return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
|
||||
|
||||
jasmine.Matchers.prototype.wasCalled = jasmine.Matchers.matcherFn_('wasCalled', {
|
||||
getActual_: function() {
|
||||
var args = jasmine.util.argsToArray(arguments);
|
||||
if (args.length > 1) {
|
||||
throw(new Error('wasCalled does not take arguments, use wasCalledWith'));
|
||||
}
|
||||
return args.splice(0, 1)[0];
|
||||
},
|
||||
test: function() {
|
||||
var actual = this.getActual_.apply(this, arguments);
|
||||
if (!actual || !actual.isSpy) {
|
||||
return false;
|
||||
}
|
||||
return actual.wasCalled;
|
||||
},
|
||||
message: function() {
|
||||
var actual = this.getActual_.apply(this, arguments);
|
||||
if (!actual || !actual.isSpy) {
|
||||
return 'Actual is not a spy.';
|
||||
}
|
||||
return "Expected spy " + actual.identity + " to have been called.";
|
||||
}
|
||||
if (arguments.length > 0) {
|
||||
return this.report(false, 'wasCalled matcher does not take arguments');
|
||||
}
|
||||
return this.report((this.actual.wasCalled),
|
||||
'Expected spy "' + this.actual.identity + '" to have been called, but it was not.');
|
||||
};
|
||||
/** @deprecated */
|
||||
jasmine.Matchers.prototype.was_called = jasmine.Matchers.prototype.wasCalled;
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that checks to see if the acutal, a Jasmine spy, was not called.
|
||||
*/
|
||||
jasmine.Matchers.prototype.wasNotCalled = function() {
|
||||
if (!this.actual || !this.actual.isSpy) {
|
||||
return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
|
||||
jasmine.Matchers.prototype.wasNotCalled = jasmine.Matchers.matcherFn_('wasNotCalled', {
|
||||
getActual_: function() {
|
||||
var args = jasmine.util.argsToArray(arguments);
|
||||
return args.splice(0, 1)[0];
|
||||
},
|
||||
test: function() {
|
||||
var actual = this.getActual_.apply(this, arguments);
|
||||
if (!actual || !actual.isSpy) {
|
||||
return false;
|
||||
}
|
||||
return !actual.wasCalled;
|
||||
},
|
||||
message: function() {
|
||||
var actual = this.getActual_.apply(this, arguments);
|
||||
if (!actual || !actual.isSpy) {
|
||||
return 'Actual is not a spy.';
|
||||
}
|
||||
return "Expected spy " + actual.identity + " to not have been called.";
|
||||
}
|
||||
return this.report((!this.actual.wasCalled),
|
||||
'Expected spy "' + this.actual.identity + '" to not have been called, but it was.');
|
||||
};
|
||||
/** @deprecated */
|
||||
jasmine.Matchers.prototype.was_not_called = jasmine.Matchers.prototype.wasNotCalled;
|
||||
});
|
||||
|
||||
jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.matcherFn_('wasCalledWith', {
|
||||
test: function() {
|
||||
var args = jasmine.util.argsToArray(arguments);
|
||||
var actual = args.splice(0, 1)[0];
|
||||
if (!actual || !actual.isSpy) {
|
||||
return false;
|
||||
}
|
||||
return this.env.contains_(actual.argsForCall, args);
|
||||
},
|
||||
message: function() {
|
||||
var args = jasmine.util.argsToArray(arguments);
|
||||
var actual = args.splice(0, 1)[0];
|
||||
var message;
|
||||
if (!actual || !actual.isSpy) {
|
||||
message = 'Actual is not a spy';
|
||||
} else {
|
||||
message = "Expected spy to have been called with " + jasmine.pp(args) + " but was called with " + actual.argsForCall;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that checks to see if the acutal, a Jasmine spy, was called with a set of parameters.
|
||||
@ -1153,78 +1254,89 @@ jasmine.Matchers.prototype.was_not_called = jasmine.Matchers.prototype.wasNotCal
|
||||
* @example
|
||||
*
|
||||
*/
|
||||
jasmine.Matchers.prototype.wasCalledWith = function() {
|
||||
if (!this.actual || !this.actual.isSpy) {
|
||||
return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.', {
|
||||
matcherName: 'wasCalledWith'
|
||||
});
|
||||
}
|
||||
|
||||
var args = jasmine.util.argsToArray(arguments);
|
||||
|
||||
return this.report(this.env.contains_(this.actual.argsForCall, args),
|
||||
'Expected ' + jasmine.Matchers.pp(this.actual.argsForCall) + ' to contain ' + jasmine.Matchers.pp(args) + ', but it does not.', {
|
||||
matcherName: 'wasCalledWith', expected: args, actual: this.actual.argsForCall
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Matcher that checks that the expected item is an element in the actual Array.
|
||||
*
|
||||
* @param {Object} item
|
||||
*/
|
||||
jasmine.Matchers.prototype.toContain = function(item) {
|
||||
return this.report(this.env.contains_(this.actual, item),
|
||||
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to contain ' + jasmine.Matchers.pp(item) + ', but it does not.', {
|
||||
matcherName: 'toContain', expected: item, actual: this.actual
|
||||
});
|
||||
};
|
||||
|
||||
jasmine.Matchers.prototype.toContain = jasmine.Matchers.matcherFn_('toContain', {
|
||||
test: function(actual, expected) {
|
||||
return this.env.contains_(actual, expected);
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return 'Expected ' + jasmine.pp(actual) + ' to contain ' + jasmine.pp(expected);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that checks that the expected item is NOT an element in the actual Array.
|
||||
*
|
||||
* @param {Object} item
|
||||
*/
|
||||
jasmine.Matchers.prototype.toNotContain = function(item) {
|
||||
return this.report(!this.env.contains_(this.actual, item),
|
||||
'Expected ' + jasmine.Matchers.pp(this.actual) + ' not to contain ' + jasmine.Matchers.pp(item) + ', but it does.');
|
||||
};
|
||||
jasmine.Matchers.prototype.toNotContain = jasmine.Matchers.matcherFn_('toNotContain', {
|
||||
test: function(actual, expected) {
|
||||
return !this.env.contains_(actual, expected);
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return 'Expected ' + jasmine.pp(actual) + ' to not contain ' + jasmine.pp(expected);
|
||||
}
|
||||
});
|
||||
|
||||
jasmine.Matchers.prototype.toBeLessThan = function(expected) {
|
||||
return this.report(this.actual < expected,
|
||||
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be less than ' + jasmine.Matchers.pp(expected) + ', but it was not.');
|
||||
};
|
||||
jasmine.Matchers.prototype.toBeLessThan = jasmine.Matchers.matcherFn_('toBeLessThan', {
|
||||
test: function(actual, expected) {
|
||||
return actual < expected;
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return 'Expected ' + jasmine.pp(actual) + ' to be less than ' + jasmine.pp(expected);
|
||||
}
|
||||
});
|
||||
|
||||
jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
|
||||
return this.report(this.actual > expected,
|
||||
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be greater than ' + jasmine.Matchers.pp(expected) + ', but it was not.');
|
||||
};
|
||||
jasmine.Matchers.prototype.toBeGreaterThan = jasmine.Matchers.matcherFn_('toBeGreaterThan', {
|
||||
test: function(actual, expected) {
|
||||
return actual > expected;
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return 'Expected ' + jasmine.pp(actual) + ' to be greater than ' + jasmine.pp(expected);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that checks that the expected exception was thrown by the actual.
|
||||
*
|
||||
* @param {String} expectedException
|
||||
*/
|
||||
jasmine.Matchers.prototype.toThrow = function(expectedException) {
|
||||
var exception = null;
|
||||
try {
|
||||
this.actual();
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
if (expectedException !== undefined) {
|
||||
if (exception == null) {
|
||||
return this.report(false, "Expected function to throw " + jasmine.Matchers.pp(expectedException) + ", but it did not.");
|
||||
jasmine.Matchers.prototype.toThrow = jasmine.Matchers.matcherFn_('toThrow', {
|
||||
getException_: function(actual, expected) {
|
||||
var exception;
|
||||
if (typeof actual != 'function') {
|
||||
throw new Error('Actual is not a function');
|
||||
}
|
||||
try {
|
||||
actual();
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
return exception;
|
||||
},
|
||||
test: function(actual, expected) {
|
||||
var result = false;
|
||||
var exception = this.getException_(actual, expected);
|
||||
if (exception) {
|
||||
result = (expected === undefined || this.env.equals_(exception.message || exception, expected.message || expected));
|
||||
}
|
||||
return result;
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
var exception = this.getException_(actual, expected);
|
||||
if (exception && (expected === undefined || !this.env.equals_(exception.message || exception, expected.message || expected))) {
|
||||
return ["Expected function to throw", expected.message || expected, ", but it threw", exception.message || exception ].join(' ');
|
||||
} else {
|
||||
return "Expected function to throw an exception.";
|
||||
}
|
||||
return this.report(
|
||||
this.env.equals_(
|
||||
exception.message || exception,
|
||||
expectedException.message || expectedException),
|
||||
"Expected function to throw " + jasmine.Matchers.pp(expectedException) + ", but it threw " + jasmine.Matchers.pp(exception) + ".");
|
||||
} else {
|
||||
return this.report(exception != null, "Expected function to throw an exception, but it did not.");
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
jasmine.Matchers.Any = function(expectedClass) {
|
||||
this.expectedClass = expectedClass;
|
||||
@ -1660,11 +1772,6 @@ jasmine.Runner.prototype.add = function(block) {
|
||||
this.queue.add(block);
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
jasmine.Runner.prototype.getAllSuites = function() {
|
||||
return this.suites_;
|
||||
};
|
||||
|
||||
jasmine.Runner.prototype.specs = function () {
|
||||
var suites = this.suites();
|
||||
var specs = [];
|
||||
@ -1682,11 +1789,6 @@ jasmine.Runner.prototype.suites = function() {
|
||||
jasmine.Runner.prototype.results = function() {
|
||||
return this.queue.results();
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
jasmine.Runner.prototype.getResults = function() {
|
||||
return this.queue.results();
|
||||
};
|
||||
/**
|
||||
* Internal representation of a Jasmine specification, or test.
|
||||
*
|
||||
@ -1751,16 +1853,12 @@ jasmine.Spec.prototype.addToQueue = function (block) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @deprecated
|
||||
*/
|
||||
jasmine.Spec.prototype.expects_that = function(actual) {
|
||||
return this.expect(actual);
|
||||
jasmine.Spec.prototype.addMatcherResult = function(result) {
|
||||
this.results_.addResult(result);
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.expect = function(actual) {
|
||||
return new (this.getMatchersClass_())(this.env, actual, this.results_);
|
||||
return new (this.getMatchersClass_())(this.env, actual, this);
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.waits = function(timeout) {
|
||||
@ -1776,7 +1874,11 @@ jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessag
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.fail = function (e) {
|
||||
this.results_.addResult(new jasmine.ExpectationResult(false, e ? jasmine.util.formatException(e) : null, null));
|
||||
var expectationResult = new jasmine.ExpectationResult({
|
||||
passed: false,
|
||||
message: e ? jasmine.util.formatException(e) : 'Exception'
|
||||
});
|
||||
this.results_.addResult(expectationResult);
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.getMatchersClass_ = function() {
|
||||
@ -1826,14 +1928,12 @@ jasmine.Spec.prototype.execute = function(onComplete) {
|
||||
this.env.reporter.log('>> Jasmine Running ' + this.suite.description + ' ' + this.description + '...');
|
||||
|
||||
spec.env.currentSpec = spec;
|
||||
spec.env.currentlyRunningTests = true;
|
||||
|
||||
spec.addBeforesAndAftersToQueue();
|
||||
|
||||
spec.queue.start(function () {
|
||||
spec.finish(onComplete);
|
||||
});
|
||||
spec.env.currentlyRunningTests = false;
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
|
||||
@ -1943,11 +2043,6 @@ jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
|
||||
this.after_.push(afterEachFunction);
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
jasmine.Suite.prototype.getResults = function() {
|
||||
return this.queue.results();
|
||||
};
|
||||
|
||||
jasmine.Suite.prototype.results = function() {
|
||||
return this.queue.results();
|
||||
};
|
||||
@ -1961,11 +2056,6 @@ jasmine.Suite.prototype.add = function(block) {
|
||||
this.queue.add(block);
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
jasmine.Suite.prototype.specCount = function() {
|
||||
return this.specs_.length;
|
||||
};
|
||||
|
||||
jasmine.Suite.prototype.specs = function() {
|
||||
return this.specs_;
|
||||
};
|
||||
|
@ -58,6 +58,16 @@ body .run_spec {
|
||||
/*white-space: pre;*/
|
||||
/*}*/
|
||||
|
||||
.resultMessage span.result {
|
||||
display: block;
|
||||
line-height: 2em;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.resultMessage .mismatch {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.stackTrace {
|
||||
white-space: pre;
|
||||
font-size: .8em;
|
||||
@ -73,4 +83,4 @@ body .run_spec {
|
||||
#jasmine_content {
|
||||
position:fixed;
|
||||
left: 100%;
|
||||
}
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ class JasmineHelper
|
||||
def self.jasmine
|
||||
['/lib/' + File.basename(Dir.glob("#{JasmineHelper.jasmine_lib_dir}/jasmine*.js").first)] +
|
||||
['/lib/json2.js',
|
||||
'/lib/TrivialReporter.js']
|
||||
'/lib/TrivialReporter.js']
|
||||
end
|
||||
|
||||
def self.jasmine_root
|
||||
def self.jasmine_root
|
||||
File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
||||
end
|
||||
|
||||
@ -18,6 +18,10 @@ def self.jasmine_root
|
||||
File.expand_path(File.join(jasmine_root, 'src'))
|
||||
end
|
||||
|
||||
def self.jasmine_lib_dir
|
||||
File.expand_path(File.join(jasmine_root, 'lib'))
|
||||
end
|
||||
|
||||
def self.jasmine_spec_dir
|
||||
File.expand_path(File.join(jasmine_root, 'spec'))
|
||||
end
|
||||
@ -26,15 +30,15 @@ def self.jasmine_root
|
||||
Dir.glob(File.join(jasmine_spec_dir, "**/*[Ss]pec.js"))
|
||||
end
|
||||
|
||||
def self.spec_file_urls
|
||||
raw_spec_files.collect {|f| f.sub(jasmine_spec_dir, "/spec")}
|
||||
def self.specs
|
||||
Jasmine.cachebust(raw_spec_files).collect {|f| f.sub(jasmine_spec_dir, "/spec")}
|
||||
end
|
||||
|
||||
def self.dir_mappings
|
||||
{
|
||||
"/src" => jasmine_src_dir,
|
||||
"/spec" => jasmine_spec_dir,
|
||||
"/lib" => jasmine_lib_dir
|
||||
"/src" => jasmine_src_dir,
|
||||
"/spec" => jasmine_spec_dir,
|
||||
"/lib" => jasmine_lib_dir
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -4,7 +4,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), "jasmine_helper.rb"))
|
||||
require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder"))
|
||||
|
||||
jasmine_runner = Jasmine::Runner.new(SeleniumRC::Server.new.jar_path,
|
||||
JasmineHelper.spec_file_urls,
|
||||
JasmineHelper.specs,
|
||||
JasmineHelper.dir_mappings)
|
||||
|
||||
spec_builder = Jasmine::SpecBuilder.new(JasmineHelper.raw_spec_files, jasmine_runner)
|
||||
|
@ -25,6 +25,7 @@
|
||||
<script type="text/javascript" src="../src/WaitsForBlock.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../lib/TrivialReporter.js"></script>
|
||||
<script type="text/javascript" src="../lib/consolex.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -6,7 +6,7 @@ describe('Exceptions:', function() {
|
||||
env.updateInterval = 0;
|
||||
});
|
||||
|
||||
it('jasmine.formatException formats Firefox exception maessages as expected', function() {
|
||||
it('jasmine.formatException formats Firefox exception messages as expected', function() {
|
||||
var sampleFirefoxException = {
|
||||
fileName: 'foo.js',
|
||||
line: '1978',
|
||||
@ -19,7 +19,7 @@ describe('Exceptions:', function() {
|
||||
expect(jasmine.util.formatException(sampleFirefoxException)).toEqual(expected);
|
||||
});
|
||||
|
||||
it('jasmine.formatException formats Webkit exception maessages as expected', function() {
|
||||
it('jasmine.formatException formats Webkit exception messages as expected', function() {
|
||||
var sampleWebkitException = {
|
||||
sourceURL: 'foo.js',
|
||||
lineNumber: '1978',
|
||||
@ -81,7 +81,7 @@ describe('Exceptions:', function() {
|
||||
var specResults = suiteResults.getItems();
|
||||
|
||||
expect(suiteResults.passed()).toEqual(false);
|
||||
|
||||
//
|
||||
expect(specResults.length).toEqual(5);
|
||||
expect(specResults[0].passed()).toMatch(false);
|
||||
var blockResults = specResults[0].getItems();
|
||||
|
@ -1,20 +1,14 @@
|
||||
describe("jasmine.Matchers", function() {
|
||||
var env;
|
||||
|
||||
var env, mockSpec;
|
||||
|
||||
beforeEach(function() {
|
||||
env = new jasmine.Env();
|
||||
env.updateInterval = 0;
|
||||
mockSpec = jasmine.createSpyObj('spec', ['addMatcherResult']);
|
||||
});
|
||||
|
||||
function match(value) {
|
||||
return new jasmine.Matchers(env, value);
|
||||
}
|
||||
|
||||
function detailsFor(actual, matcherName, matcherArgs) {
|
||||
var matcher = match(actual);
|
||||
matcher[matcherName].apply(matcher, matcherArgs);
|
||||
expect(matcher.results().getItems().length).toEqual(1);
|
||||
return matcher.results().getItems()[0].details;
|
||||
function match(value) {
|
||||
return new jasmine.Matchers(env, value, mockSpec);
|
||||
}
|
||||
|
||||
it("toEqual with primitives, objects, dates, html nodes, etc.", function() {
|
||||
@ -22,8 +16,12 @@ describe("jasmine.Matchers", function() {
|
||||
|
||||
expect(match({foo:'bar'}).toEqual(null)).toEqual(false);
|
||||
|
||||
var functionA = function() { return 'hi'; };
|
||||
var functionB = function() { return 'hi'; };
|
||||
var functionA = function() {
|
||||
return 'hi';
|
||||
};
|
||||
var functionB = function() {
|
||||
return 'hi';
|
||||
};
|
||||
expect(match({foo:functionA}).toEqual({foo:functionB})).toEqual(false);
|
||||
expect(match({foo:functionA}).toEqual({foo:functionA})).toEqual(true);
|
||||
|
||||
@ -49,6 +47,37 @@ describe("jasmine.Matchers", function() {
|
||||
expect((match(['a', 'b']).toEqual(['a', 'b', undefined]))).toEqual(false);
|
||||
});
|
||||
|
||||
it("toEqual to build an Expectation Result", function() {
|
||||
var actual = 'a';
|
||||
var matcher = match(actual);
|
||||
var expected = 'b';
|
||||
matcher.toEqual(expected);
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toEqual");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch(jasmine.pp(actual));
|
||||
expect(result.message).toMatch(jasmine.pp(expected));
|
||||
expect(result.expected).toEqual(expected);
|
||||
expect(result.actual).toEqual(actual);
|
||||
});
|
||||
|
||||
it("toNotEqual to build an Expectation Result", function() {
|
||||
var str = 'a';
|
||||
var matcher = match(str);
|
||||
matcher.toNotEqual(str);
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toNotEqual");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch(jasmine.pp(str));
|
||||
expect(result.message).toMatch('not');
|
||||
expect(result.expected).toEqual(str);
|
||||
expect(result.actual).toEqual(str);
|
||||
});
|
||||
|
||||
it('toBe should return true only if the expected and actual items === each other', function() {
|
||||
var a = {};
|
||||
var b = {};
|
||||
@ -62,6 +91,35 @@ describe("jasmine.Matchers", function() {
|
||||
expect((match(a).toNotBe(c))).toEqual(false);
|
||||
});
|
||||
|
||||
it("toBe to build an ExpectationResult", function() {
|
||||
var expected = 'b';
|
||||
var actual = 'a';
|
||||
var matcher = match(actual);
|
||||
matcher.toBe(expected);
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toBe");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch(jasmine.pp(actual));
|
||||
expect(result.message).toMatch(jasmine.pp(expected));
|
||||
expect(result.expected).toEqual(expected);
|
||||
expect(result.actual).toEqual(actual);
|
||||
});
|
||||
|
||||
it("toNotBe to build an ExpectationResult", function() {
|
||||
var str = 'a';
|
||||
var matcher = match(str);
|
||||
matcher.toNotBe(str);
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toNotBe");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch(str);
|
||||
expect(result.expected).toEqual(str);
|
||||
expect(result.actual).toEqual(str);
|
||||
});
|
||||
|
||||
it("toMatch and #toNotMatch should perform regular expression matching on strings", function() {
|
||||
expect((match('foobarbel').toMatch(/bar/))).toEqual(true);
|
||||
@ -77,17 +135,127 @@ describe("jasmine.Matchers", function() {
|
||||
expect((match('foobazbel').toNotMatch("bar"))).toEqual(true);
|
||||
});
|
||||
|
||||
it("toMatch w/ RegExp to build an ExpectationResult", function() {
|
||||
var actual = 'a';
|
||||
var matcher = match(actual);
|
||||
var expected = /b/;
|
||||
matcher.toMatch(expected);
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toMatch");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch(jasmine.pp(actual));
|
||||
expect(result.message).toMatch(expected.toString());
|
||||
expect(result.expected).toEqual(expected);
|
||||
expect(result.actual).toEqual(actual);
|
||||
});
|
||||
|
||||
it("toMatch w/ String to build an ExpectationResult", function() {
|
||||
var actual = 'a';
|
||||
var matcher = match(actual);
|
||||
var expected = 'b';
|
||||
matcher.toMatch(expected);
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toMatch");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch(jasmine.pp(actual));
|
||||
expect(result.message).toMatch(new RegExp(expected).toString());
|
||||
expect(result.expected).toEqual(expected);
|
||||
expect(result.actual).toEqual(actual);
|
||||
});
|
||||
|
||||
it("toNotMatch w/ RegExp to build an ExpectationResult", function() {
|
||||
var actual = 'a';
|
||||
var matcher = match(actual);
|
||||
var expected = /a/;
|
||||
matcher.toNotMatch(expected);
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toNotMatch");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch(expected.toString());
|
||||
expect(result.message).toMatch(jasmine.pp(actual));
|
||||
expect(result.message).toMatch("not");
|
||||
expect(result.expected).toEqual(expected);
|
||||
expect(result.actual).toEqual(actual);
|
||||
});
|
||||
|
||||
it("toNotMatch w/ String to build an ExpectationResult", function() {
|
||||
var str = 'a';
|
||||
var matcher = match(str);
|
||||
matcher.toNotMatch(str);
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toNotMatch");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch(jasmine.pp(str));
|
||||
expect(result.message).toMatch(new RegExp(str).toString());
|
||||
expect(result.message).toMatch("not");
|
||||
expect(result.expected).toEqual(str);
|
||||
expect(result.actual).toEqual(str);
|
||||
});
|
||||
|
||||
it("toBeDefined", function() {
|
||||
expect(match('foo').toBeDefined()).toEqual(true);
|
||||
expect(match(undefined).toBeDefined()).toEqual(false);
|
||||
});
|
||||
|
||||
it("toBeDefined to build an ExpectationResult", function() {
|
||||
var matcher = match(undefined);
|
||||
matcher.toBeDefined();
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toBeDefined");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toEqual('Expected actual to not be undefined.');
|
||||
expect(result.actual).toEqual(undefined);
|
||||
});
|
||||
|
||||
it("toBeUndefined", function() {
|
||||
expect(match('foo').toBeUndefined()).toEqual(false);
|
||||
expect(match(undefined).toBeUndefined()).toEqual(true);
|
||||
});
|
||||
|
||||
it("toBeNull", function() {
|
||||
expect(match(null).toBeNull()).toEqual(true);
|
||||
expect(match(undefined).toBeNull()).toEqual(false);
|
||||
expect(match("foo").toBeNull()).toEqual(false);
|
||||
});
|
||||
|
||||
it("toBeNull w/ String to build an ExpectationResult", function() {
|
||||
var actual = 'a';
|
||||
var matcher = match(actual);
|
||||
matcher.toBeNull();
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toBeNull");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch(jasmine.pp(actual));
|
||||
expect(result.message).toMatch('null');
|
||||
expect(result.actual).toEqual(actual);
|
||||
});
|
||||
|
||||
it("toBeNull w/ Object to build an ExpectationResult", function() {
|
||||
var actual = {a: 'b'};
|
||||
var matcher = match(actual);
|
||||
matcher.toBeNull();
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toBeNull");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch(jasmine.pp(actual));
|
||||
expect(result.message).toMatch('null');
|
||||
expect(result.actual).toEqual(actual);
|
||||
});
|
||||
|
||||
it("toBeFalsy", function() {
|
||||
expect(match(false).toBeFalsy()).toEqual(true);
|
||||
expect(match(true).toBeFalsy()).toEqual(false);
|
||||
@ -96,6 +264,20 @@ describe("jasmine.Matchers", function() {
|
||||
expect(match("").toBeFalsy()).toEqual(true);
|
||||
});
|
||||
|
||||
it("toBeFalsy to build an ExpectationResult", function() {
|
||||
var actual = 'a';
|
||||
var matcher = match(actual);
|
||||
matcher.toBeFalsy();
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toBeFalsy");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch(jasmine.pp(actual));
|
||||
expect(result.message).toMatch('falsy');
|
||||
expect(result.actual).toEqual(actual);
|
||||
});
|
||||
|
||||
it("toBeTruthy", function() {
|
||||
expect(match(false).toBeTruthy()).toEqual(false);
|
||||
expect(match(true).toBeTruthy()).toEqual(true);
|
||||
@ -107,6 +289,18 @@ describe("jasmine.Matchers", function() {
|
||||
expect(match({foo: 1}).toBeTruthy()).toEqual(true);
|
||||
});
|
||||
|
||||
it("toBeTruthy to build an ExpectationResult", function() {
|
||||
var matcher = match(false);
|
||||
matcher.toBeTruthy();
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toBeTruthy");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toEqual("Expected actual to be truthy");
|
||||
expect(result.actual).toEqual(false);
|
||||
});
|
||||
|
||||
it("toEqual", function() {
|
||||
expect(match(undefined).toEqual(undefined)).toEqual(true);
|
||||
expect(match({foo:'bar'}).toEqual({foo:'bar'})).toEqual(true);
|
||||
@ -122,10 +316,13 @@ describe("jasmine.Matchers", function() {
|
||||
expect(match("foo").toEqual(jasmine.any(Object))).toEqual(false);
|
||||
expect(match({someObj:'foo'}).toEqual(jasmine.any(Object))).toEqual(true);
|
||||
expect(match({someObj:'foo'}).toEqual(jasmine.any(Function))).toEqual(false);
|
||||
expect(match(function() {}).toEqual(jasmine.any(Object))).toEqual(false);
|
||||
expect(match(function() {
|
||||
}).toEqual(jasmine.any(Object))).toEqual(false);
|
||||
expect(match(["foo", "goo"]).toEqual(["foo", jasmine.any(String)])).toEqual(true);
|
||||
expect(match(function() {}).toEqual(jasmine.any(Function))).toEqual(true);
|
||||
expect(match(["a", function() {}]).toEqual(["a", jasmine.any(Function)])).toEqual(true);
|
||||
expect(match(function() {
|
||||
}).toEqual(jasmine.any(Function))).toEqual(true);
|
||||
expect(match(["a", function() {
|
||||
}]).toEqual(["a", jasmine.any(Function)])).toEqual(true);
|
||||
});
|
||||
|
||||
it("toEqual handles circular objects ok", function() {
|
||||
@ -154,7 +351,7 @@ describe("jasmine.Matchers", function() {
|
||||
it("toContain and toNotContain", function() {
|
||||
expect(match('ABC').toContain('A')).toEqual(true);
|
||||
expect(match('ABC').toContain('X')).toEqual(false);
|
||||
|
||||
|
||||
expect(match(['A', 'B', 'C']).toContain('A')).toEqual(true);
|
||||
expect(match(['A', 'B', 'C']).toContain('F')).toEqual(false);
|
||||
expect(match(['A', 'B', 'C']).toNotContain('F')).toEqual(true);
|
||||
@ -162,10 +359,40 @@ describe("jasmine.Matchers", function() {
|
||||
|
||||
expect(match(['A', {some:'object'}, 'C']).toContain({some:'object'})).toEqual(true);
|
||||
expect(match(['A', {some:'object'}, 'C']).toContain({some:'other object'})).toEqual(false);
|
||||
});
|
||||
|
||||
expect(detailsFor('abc', 'toContain', ['x'])).toEqual({
|
||||
matcherName: 'toContain', expected: 'x', actual: 'abc'
|
||||
});
|
||||
it("toContain to build an ExpectationResult", function() {
|
||||
var actual = ['a','b','c'];
|
||||
var matcher = match(actual);
|
||||
var expected = 'x';
|
||||
matcher.toContain(expected);
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toContain");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch(jasmine.pp(actual));
|
||||
expect(result.message).toMatch('contain');
|
||||
expect(result.message).toMatch(jasmine.pp(expected));
|
||||
expect(result.actual).toEqual(actual);
|
||||
expect(result.expected).toEqual(expected);
|
||||
});
|
||||
|
||||
it("toNotContain to build an ExpectationResult", function() {
|
||||
var actual = ['a','b','c'];
|
||||
var matcher = match(actual);
|
||||
var expected = 'b';
|
||||
matcher.toNotContain(expected);
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toNotContain");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch(jasmine.pp(actual));
|
||||
expect(result.message).toMatch('not contain');
|
||||
expect(result.message).toMatch(jasmine.pp(expected));
|
||||
expect(result.actual).toEqual(actual);
|
||||
expect(result.expected).toEqual(expected);
|
||||
});
|
||||
|
||||
it("toBeLessThan should pass if actual is less than expected", function() {
|
||||
@ -174,141 +401,194 @@ describe("jasmine.Matchers", function() {
|
||||
expect(match(37).toBeLessThan(37)).toEqual(false);
|
||||
});
|
||||
|
||||
it("toBeLessThan to build an ExpectationResult", function() {
|
||||
var actual = 3;
|
||||
var matcher = match(actual);
|
||||
var expected = 1;
|
||||
matcher.toBeLessThan(expected);
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toBeLessThan");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch(jasmine.pp(actual) + ' to be less than');
|
||||
expect(result.message).toMatch(jasmine.pp(expected));
|
||||
expect(result.actual).toEqual(actual);
|
||||
expect(result.expected).toEqual(expected);
|
||||
});
|
||||
|
||||
it("toBeGreaterThan should pass if actual is greater than expected", function() {
|
||||
expect(match(37).toBeGreaterThan(42)).toEqual(false);
|
||||
expect(match(37).toBeGreaterThan(-42)).toEqual(true);
|
||||
expect(match(37).toBeGreaterThan(37)).toEqual(false);
|
||||
});
|
||||
|
||||
it("toBeGreaterThan to build an ExpectationResult", function() {
|
||||
var actual = 1;
|
||||
var matcher = match(actual);
|
||||
var expected = 3;
|
||||
matcher.toBeGreaterThan(expected);
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("toBeGreaterThan");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch(jasmine.pp(actual) + ' to be greater than');
|
||||
expect(result.message).toMatch(jasmine.pp(expected));
|
||||
expect(result.actual).toEqual(actual);
|
||||
expect(result.expected).toEqual(expected);
|
||||
});
|
||||
|
||||
it("toThrow", function() {
|
||||
var expected = new jasmine.Matchers(env, function() {
|
||||
throw new Error("Fake Error");
|
||||
});
|
||||
}, mockSpec);
|
||||
expect(expected.toThrow()).toEqual(true);
|
||||
expect(expected.toThrow("Fake Error")).toEqual(true);
|
||||
expect(expected.toThrow(new Error("Fake Error"))).toEqual(true);
|
||||
|
||||
expect(expected.toThrow("Other Error")).toEqual(false);
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
expect(result.message).toMatch("Other Error");
|
||||
|
||||
expect(expected.toThrow(new Error("Other Error"))).toEqual(false);
|
||||
result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
expect(result.message).toMatch("Other Error");
|
||||
|
||||
var exception;
|
||||
try {
|
||||
(function () {
|
||||
new jasmine.Matchers(env, 'not-a-function', mockSpec).toThrow();
|
||||
})();
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
;
|
||||
expect(exception).toBeDefined();
|
||||
expect(exception.message).toEqual('Actual is not a function');
|
||||
|
||||
|
||||
expect(match(function() {
|
||||
}).toThrow()).toEqual(false);
|
||||
result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
expect(result.message).toEqual('Expected function to throw an exception.');
|
||||
|
||||
|
||||
expect(match(function() {}).toThrow()).toEqual(false);
|
||||
});
|
||||
|
||||
it("wasCalled, wasNotCalled, wasCalledWith", function() {
|
||||
var currentSuite;
|
||||
var spec;
|
||||
currentSuite = env.describe('default current suite', function() {
|
||||
spec = env.it();
|
||||
describe("wasCalled, wasNotCalled, wasCalledWith", function() {
|
||||
var TestClass;
|
||||
beforeEach(function() {
|
||||
TestClass = { someFunction: function() {
|
||||
} };
|
||||
});
|
||||
describe('without spies', function() {
|
||||
it('should always show an error', function () {
|
||||
expect(match(TestClass.someFunction).wasCalled()).toEqual(false);
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
expect(result.message).toEqual("Actual is not a spy.");
|
||||
|
||||
expect(match(TestClass.someFunction).wasNotCalled()).toEqual(false);
|
||||
result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
expect(result.message).toEqual("Actual is not a spy.");
|
||||
});
|
||||
});
|
||||
|
||||
var TestClass = { someFunction: function() {
|
||||
} };
|
||||
describe('with spies', function () {
|
||||
|
||||
var expected;
|
||||
expect(match(TestClass.someFunction).wasCalled()).toEqual(false);
|
||||
expect(match(TestClass.someFunction).wasNotCalled()).toEqual(false);
|
||||
beforeEach(function () {
|
||||
TestClass.someFunction = jasmine.createSpy("My spy");
|
||||
});
|
||||
|
||||
spec.spyOn(TestClass, 'someFunction');
|
||||
it("should track if it was called", function() {
|
||||
expect(match(TestClass.someFunction).wasCalled()).toEqual(false);
|
||||
expect(match(TestClass.someFunction).wasNotCalled()).toEqual(true);
|
||||
|
||||
expect(match(TestClass.someFunction).wasCalled()).toEqual(false);
|
||||
expect(match(TestClass.someFunction).wasNotCalled()).toEqual(true);
|
||||
TestClass.someFunction();
|
||||
expect(match(TestClass.someFunction).wasCalled()).toEqual(true);
|
||||
expect(function () {
|
||||
match(TestClass.someFunction).wasCalled('some arg');
|
||||
}).toThrow('wasCalled does not take arguments, use wasCalledWith');
|
||||
expect(match(TestClass.someFunction).wasNotCalled()).toEqual(false);
|
||||
});
|
||||
|
||||
it('should return true if it was called with the expected args', function() {
|
||||
TestClass.someFunction('a', 'b', 'c');
|
||||
expect(match(TestClass.someFunction).wasCalledWith('a', 'b', 'c')).toEqual(true);
|
||||
});
|
||||
|
||||
it('should return false if it was not called with the expected args', function() {
|
||||
TestClass.someFunction('a', 'b', 'c');
|
||||
var expected = match(TestClass.someFunction);
|
||||
expect(expected.wasCalledWith('c', 'b', 'a')).toEqual(false);
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.expected).toEqual(['c', 'b', 'a']);
|
||||
expect(result.actual.mostRecentCall.args).toEqual(['a', 'b', 'c']);
|
||||
});
|
||||
|
||||
it('should allow matches across multiple calls', function() {
|
||||
var expected = match(TestClass.someFunction);
|
||||
TestClass.someFunction('a', 'b', 'c');
|
||||
TestClass.someFunction('d', 'e', 'f');
|
||||
expect(expected.wasCalledWith('a', 'b', 'c')).toEqual(true);
|
||||
expect(expected.wasCalledWith('d', 'e', 'f')).toEqual(true);
|
||||
expect(expected.wasCalledWith('x', 'y', 'z')).toEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
TestClass.someFunction();
|
||||
expect(match(TestClass.someFunction).wasCalled()).toEqual(true);
|
||||
expect(match(TestClass.someFunction).wasCalled('some arg')).toEqual(false);
|
||||
expect(match(TestClass.someFunction).wasNotCalled()).toEqual(false);
|
||||
|
||||
TestClass.someFunction('a', 'b', 'c');
|
||||
expect(match(TestClass.someFunction).wasCalledWith('a', 'b', 'c')).toEqual(true);
|
||||
|
||||
expected = match(TestClass.someFunction);
|
||||
expect(expected.wasCalledWith('c', 'b', 'a')).toEqual(false);
|
||||
expect(expected.results().getItems()[0].passed()).toEqual(false);
|
||||
|
||||
TestClass.someFunction.reset();
|
||||
TestClass.someFunction('a', 'b', 'c');
|
||||
TestClass.someFunction('d', 'e', 'f');
|
||||
expect(expected.wasCalledWith('a', 'b', 'c')).toEqual(true);
|
||||
expect(expected.wasCalledWith('d', 'e', 'f')).toEqual(true);
|
||||
expect(expected.wasCalledWith('x', 'y', 'z')).toEqual(false);
|
||||
|
||||
expect(detailsFor(TestClass.someFunction, 'wasCalledWith', ['x', 'y', 'z'])).toEqual({
|
||||
matcherName: 'wasCalledWith', expected: ['x', 'y', 'z'], actual: TestClass.someFunction.argsForCall
|
||||
describe("wasCalledWith to build an ExpectationResult", function () {
|
||||
var TestClass;
|
||||
beforeEach(function() {
|
||||
var currentSuite;
|
||||
var spec;
|
||||
currentSuite = env.describe('default current suite', function() {
|
||||
spec = env.it();
|
||||
}, spec);
|
||||
TestClass = { someFunction: function(a, b) {
|
||||
} };
|
||||
spec.spyOn(TestClass, 'someFunction');
|
||||
});
|
||||
|
||||
it("should handle case of actual not being a spy", function() {
|
||||
var matcher = match();
|
||||
matcher.wasCalledWith('a', 'b');
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("wasCalledWith");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toEqual("Actual is not a spy");
|
||||
expect(result.actual).toEqual(undefined);
|
||||
expect(result.expected).toEqual(['a','b']);
|
||||
|
||||
matcher = match('foo');
|
||||
matcher.wasCalledWith('a', 'b');
|
||||
|
||||
result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
|
||||
expect(result.matcherName).toEqual("wasCalledWith");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toEqual("Actual is not a spy");
|
||||
expect(result.actual).toEqual('foo');
|
||||
expect(result.expected).toEqual(['a','b']);
|
||||
});
|
||||
|
||||
it("should should handle the case of a spy", function() {
|
||||
TestClass.someFunction('a', 'c');
|
||||
var matcher = match(TestClass.someFunction);
|
||||
matcher.wasCalledWith('a', 'b');
|
||||
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
expect(result.matcherName).toEqual("wasCalledWith");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch("['a', 'b']");
|
||||
expect(result.message).toMatch("['a', 'c']");
|
||||
expect(result.actual).toEqual(TestClass.someFunction);
|
||||
expect(result.expected).toEqual(['a','b']);
|
||||
});
|
||||
});
|
||||
|
||||
it("should report mismatches in some nice way", function() {
|
||||
var results = new jasmine.NestedResults();
|
||||
var expected = new jasmine.Matchers(env, true, results);
|
||||
expected.toEqual(true);
|
||||
expected.toEqual(false);
|
||||
|
||||
expect(results.getItems().length).toEqual(2);
|
||||
|
||||
expect(results.getItems()[0].passed()).toEqual(true);
|
||||
|
||||
expect(results.getItems()[1].passed()).toEqual(false);
|
||||
|
||||
results = new jasmine.NestedResults();
|
||||
expected = new jasmine.Matchers(env, false, results);
|
||||
expected.toEqual(true);
|
||||
|
||||
var expectedMessage = 'Expected<br /><br />true<br /><br />but got<br /><br />false<br />';
|
||||
expect(results.getItems()[0].message).toEqual(expectedMessage);
|
||||
|
||||
results = new jasmine.NestedResults();
|
||||
expected = new jasmine.Matchers(env, null, results);
|
||||
expected.toEqual('not null');
|
||||
|
||||
expectedMessage = 'Expected<br /><br />\'not null\'<br /><br />but got<br /><br />null<br />';
|
||||
expect(results.getItems()[0].message).toEqual(expectedMessage);
|
||||
|
||||
results = new jasmine.NestedResults();
|
||||
expected = new jasmine.Matchers(env, undefined, results);
|
||||
expected.toEqual('not undefined');
|
||||
|
||||
expectedMessage = 'Expected<br /><br />\'not undefined\'<br /><br />but got<br /><br />undefined<br />';
|
||||
expect(results.getItems()[0].message).toEqual(expectedMessage);
|
||||
|
||||
|
||||
results = new jasmine.NestedResults();
|
||||
expected = new jasmine.Matchers(env, {foo:'one',baz:'two', more: 'blah'}, results);
|
||||
expected.toEqual({foo:'one', bar: '<b>three</b> &', baz: '2'});
|
||||
|
||||
expectedMessage =
|
||||
"Expected<br /><br />{ foo : 'one', bar : '<b>three</b> &', baz : '2' }<br /><br />but got<br /><br />{ foo : 'one', baz : 'two', more : 'blah' }<br />" +
|
||||
"<br /><br />Different Keys:<br />" +
|
||||
"expected has key 'bar', but missing from <b>actual</b>.<br />" +
|
||||
"<b>expected</b> missing key 'more', but present in actual.<br />" +
|
||||
"<br /><br />Different Values:<br />" +
|
||||
"'bar' was<br /><br />'<b>three</b> &'<br /><br />in expected, but was<br /><br />'undefined'<br /><br />in actual.<br /><br />" +
|
||||
"'baz' was<br /><br />'2'<br /><br />in expected, but was<br /><br />'two'<br /><br />in actual.<br /><br />";
|
||||
var actualMessage = results.getItems()[0].message;
|
||||
expect(actualMessage).toEqual(expectedMessage);
|
||||
|
||||
|
||||
results = new jasmine.NestedResults();
|
||||
expected = new jasmine.Matchers(env, true, results);
|
||||
expected.toEqual(true);
|
||||
|
||||
expect(results.getItems()[0].message).toEqual('Passed.');
|
||||
|
||||
|
||||
expected = new jasmine.Matchers(env, [1, 2, 3], results);
|
||||
results.getItems().length = 0;
|
||||
expected.toEqual([1, 2, 3]);
|
||||
expect(results.getItems()[0].passed()).toEqual(true);
|
||||
|
||||
expected = new jasmine.Matchers(env, [1, 2, 3], results);
|
||||
results.getItems().length = 0;
|
||||
expected.toEqual([{}, {}, {}]);
|
||||
expect(results.getItems()[0].passed()).toEqual(false);
|
||||
|
||||
expected = new jasmine.Matchers(env, [{}, {}, {}], results);
|
||||
results.getItems().length = 0;
|
||||
expected.toEqual([1, 2, 3]);
|
||||
expect(results.getItems()[0].passed()).toEqual(false);
|
||||
});
|
||||
|
||||
});
|
||||
})
|
||||
;
|
||||
|
34
spec/suites/MockClockSpec.js
Normal file
34
spec/suites/MockClockSpec.js
Normal file
@ -0,0 +1,34 @@
|
||||
describe("MockClock", function () {
|
||||
|
||||
beforeEach(function() {
|
||||
jasmine.Clock.useMock();
|
||||
});
|
||||
|
||||
describe("setTimeout", function () {
|
||||
it("should mock the clock when useMock is in a beforeEach", function() {
|
||||
var expected = false;
|
||||
setTimeout(function() {
|
||||
expected = true;
|
||||
}, 30000);
|
||||
expect(expected).toBe(false);
|
||||
jasmine.Clock.tick(30001);
|
||||
expect(expected).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("setInterval", function () {
|
||||
it("should mock the clock when useMock is in a beforeEach", function() {
|
||||
var interval = 0;
|
||||
setInterval(function() {
|
||||
interval++;
|
||||
}, 30000);
|
||||
expect(interval).toEqual(0);
|
||||
jasmine.Clock.tick(30001);
|
||||
expect(interval).toEqual(1);
|
||||
jasmine.Clock.tick(30001);
|
||||
expect(interval).toEqual(2);
|
||||
jasmine.Clock.tick(1);
|
||||
expect(interval).toEqual(2);
|
||||
});
|
||||
});
|
||||
});
|
@ -3,14 +3,18 @@ describe('jasmine.NestedResults', function() {
|
||||
// Leaf case
|
||||
var results = new jasmine.NestedResults();
|
||||
|
||||
results.addResult(new jasmine.ExpectationResult(true,'Passed.'));
|
||||
results.addResult(new jasmine.ExpectationResult({
|
||||
matcherName: "foo", passed: true, message: 'Passed.', actual: 'bar', expected: 'bar'}
|
||||
));
|
||||
|
||||
expect(results.getItems().length).toEqual(1);
|
||||
expect(results.totalCount).toEqual(1);
|
||||
expect(results.passedCount).toEqual(1);
|
||||
expect(results.failedCount).toEqual(0);
|
||||
|
||||
results.addResult(new jasmine.ExpectationResult(false, 'FAIL.'));
|
||||
results.addResult(new jasmine.ExpectationResult({
|
||||
matcherName: "baz", passed: false, message: 'FAIL.', actual: "corge", expected: "quux"
|
||||
}));
|
||||
|
||||
expect(results.getItems().length).toEqual(2);
|
||||
expect(results.totalCount).toEqual(2);
|
||||
@ -21,12 +25,21 @@ describe('jasmine.NestedResults', function() {
|
||||
it('should roll up counts for nested results', function() {
|
||||
// Branch case
|
||||
var leafResultsOne = new jasmine.NestedResults();
|
||||
leafResultsOne.addResult(new jasmine.ExpectationResult( true, ''));
|
||||
leafResultsOne.addResult(new jasmine.ExpectationResult( false, ''));
|
||||
leafResultsOne.addResult(new jasmine.ExpectationResult({
|
||||
matcherName: "toSomething", passed: true, message: 'message', actual: '', expected:''
|
||||
}));
|
||||
|
||||
leafResultsOne.addResult(new jasmine.ExpectationResult({
|
||||
matcherName: "toSomethingElse", passed: false, message: 'message', actual: 'a', expected: 'b'
|
||||
}));
|
||||
|
||||
var leafResultsTwo = new jasmine.NestedResults();
|
||||
leafResultsTwo.addResult(new jasmine.ExpectationResult( true, ''));
|
||||
leafResultsTwo.addResult(new jasmine.ExpectationResult( false, ''));
|
||||
leafResultsTwo.addResult(new jasmine.ExpectationResult({
|
||||
matcherName: "toSomething", passed: true, message: 'message', actual: '', expected: ''
|
||||
}));
|
||||
leafResultsTwo.addResult(new jasmine.ExpectationResult({
|
||||
matcherName: "toSomethineElse", passed: false, message: 'message', actual: 'c', expected: 'd'
|
||||
}));
|
||||
|
||||
var branchResults = new jasmine.NestedResults();
|
||||
branchResults.addResult(leafResultsOne);
|
||||
@ -38,4 +51,4 @@ describe('jasmine.NestedResults', function() {
|
||||
expect(branchResults.failedCount).toEqual(2);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -37,7 +37,6 @@ describe("jasmine spec running", function () {
|
||||
expect(it4.id).toEqual(4);
|
||||
});
|
||||
|
||||
|
||||
it("should build up some objects with results we can inspect", function() {
|
||||
|
||||
var specWithNoBody, specWithExpectation, specWithFailingExpectations, specWithMultipleExpectations;
|
||||
|
@ -8,19 +8,21 @@ describe("TrivialReporter", function() {
|
||||
|
||||
function fakeSpec(name) {
|
||||
return {
|
||||
getFullName: function() { return name; }
|
||||
getFullName: function() {
|
||||
return name;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
it("should run only specs beginning with spec parameter", function() {
|
||||
trivialReporter = new jasmine.TrivialReporter({ location: {search: "?spec=run%20this"} });
|
||||
var trivialReporter = new jasmine.TrivialReporter({ location: {search: "?spec=run%20this"} });
|
||||
expect(trivialReporter.specFilter(fakeSpec("run this"))).toBeTruthy();
|
||||
expect(trivialReporter.specFilter(fakeSpec("not the right spec"))).toBeFalsy();
|
||||
expect(trivialReporter.specFilter(fakeSpec("not run this"))).toBeFalsy();
|
||||
});
|
||||
|
||||
it("should display empty divs for every suite when the runner is starting", function() {
|
||||
trivialReporter = new jasmine.TrivialReporter({ body: body });
|
||||
var trivialReporter = new jasmine.TrivialReporter({ body: body });
|
||||
trivialReporter.reportRunnerStarting({
|
||||
suites: function() {
|
||||
return [ new jasmine.Suite({}, "suite 1", null, null) ];
|
||||
@ -31,5 +33,95 @@ describe("TrivialReporter", function() {
|
||||
expect(divs.length).toEqual(2);
|
||||
expect(divs[1].innerHTML).toContain("suite 1");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('Matcher reporting', function () {
|
||||
var getResultMessageDiv = function (body) {
|
||||
var divs = body.getElementsByTagName("div");
|
||||
for (var i = 0; i < divs.length; i++) {
|
||||
if (divs[i].className.match(/resultMessage/)) {
|
||||
return divs[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var runner, spec, fakeTimer;
|
||||
beforeEach(function () {
|
||||
var env = new jasmine.Env();
|
||||
fakeTimer = new jasmine.FakeTimer();
|
||||
env.setTimeout = fakeTimer.setTimeout;
|
||||
env.clearTimeout = fakeTimer.clearTimeout;
|
||||
env.setInterval = fakeTimer.setInterval;
|
||||
env.clearInterval = fakeTimer.clearInterval;
|
||||
runner = env.currentRunner();
|
||||
var suite = new jasmine.Suite(env, 'some suite');
|
||||
runner.add(suite);
|
||||
spec = new jasmine.Spec(env, suite, 'some spec');
|
||||
suite.add(spec);
|
||||
var trivialReporter = new jasmine.TrivialReporter({ body: body, location: {search: "?"} });
|
||||
env.addReporter(trivialReporter);
|
||||
});
|
||||
|
||||
describe('toContain', function () {
|
||||
it('should show actual and expected', function () {
|
||||
spec.runs(function () {
|
||||
this.expect('foo').toContain('bar');
|
||||
});
|
||||
runner.execute();
|
||||
fakeTimer.tick(0);
|
||||
|
||||
var resultEl = getResultMessageDiv(body);
|
||||
expect(resultEl.innerHTML).toMatch(/foo/);
|
||||
expect(resultEl.innerHTML).toMatch(/bar/);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("failure messages (integration)", function () {
|
||||
var spec, results, expectationResult;
|
||||
|
||||
beforeEach(function() {
|
||||
results = {
|
||||
passed: function() {
|
||||
return false;
|
||||
},
|
||||
getItems: function() {
|
||||
}};
|
||||
|
||||
spec = {
|
||||
suite: {
|
||||
getFullName: function() {
|
||||
return "suite 1";
|
||||
}
|
||||
},
|
||||
getFullName: function() {
|
||||
return "foo";
|
||||
},
|
||||
results: function() {
|
||||
return results;
|
||||
}
|
||||
};
|
||||
|
||||
trivialReporter = new jasmine.TrivialReporter({ body: body });
|
||||
trivialReporter.reportRunnerStarting({
|
||||
suites: function() {
|
||||
return [ new jasmine.Suite({}, "suite 1", null, null) ];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("should add the failure message to the DOM (non-toEquals matchers)", function() {
|
||||
expectationResult = new jasmine.ExpectationResult({
|
||||
matcherName: "toBeNull", passed: false, message: "Expected 'a' to be null, but it was not"
|
||||
});
|
||||
|
||||
spyOn(results, 'getItems').andReturn([expectationResult]);
|
||||
|
||||
trivialReporter.reportSpecResults(spec);
|
||||
|
||||
var divs = body.getElementsByTagName("div");
|
||||
expect(divs[3].innerHTML).toEqual("Expected 'a' to be null, but it was not");
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
23
spec/suites/UtilSpec.js
Normal file
23
spec/suites/UtilSpec.js
Normal file
@ -0,0 +1,23 @@
|
||||
describe("jasmine.util", function() {
|
||||
describe("extend", function () {
|
||||
it("should add properies to a destination object ", function() {
|
||||
var destination = {baz: 'baz'};
|
||||
jasmine.util.extend(destination, {
|
||||
foo: 'foo', bar: 'bar'
|
||||
});
|
||||
expect(destination).toEqual({foo: 'foo', bar: 'bar', baz: 'baz'});
|
||||
});
|
||||
|
||||
it("should replace properies that already exist on a destination object", function() {
|
||||
var destination = {foo: 'foo'};
|
||||
jasmine.util.extend(destination, {
|
||||
foo: 'bar'
|
||||
});
|
||||
expect(destination).toEqual({foo: 'bar'});
|
||||
jasmine.util.extend(destination, {
|
||||
foo: null
|
||||
});
|
||||
expect(destination).toEqual({foo: null});
|
||||
});
|
||||
});
|
||||
});
|
@ -7,7 +7,6 @@ jasmine.Env = function() {
|
||||
this.currentSpec = null;
|
||||
this.currentSuite = null;
|
||||
this.currentRunner_ = new jasmine.Runner(this);
|
||||
this.currentlyRunningTests = false;
|
||||
|
||||
this.reporter = new jasmine.MultiReporter();
|
||||
|
||||
@ -146,18 +145,18 @@ jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchVal
|
||||
|
||||
for (var property in b) {
|
||||
if (!hasKey(a, property) && hasKey(b, property)) {
|
||||
mismatchKeys.push("expected has key '" + property + "', but missing from <b>actual</b>.");
|
||||
mismatchKeys.push("expected has key '" + property + "', but missing from actual.");
|
||||
}
|
||||
}
|
||||
for (property in a) {
|
||||
if (!hasKey(b, property) && hasKey(a, property)) {
|
||||
mismatchKeys.push("<b>expected</b> missing key '" + property + "', but present in actual.");
|
||||
mismatchKeys.push("expected missing key '" + property + "', but present in actual.");
|
||||
}
|
||||
}
|
||||
for (property in b) {
|
||||
if (property == '__Jasmine_been_here_before__') continue;
|
||||
if (!this.equals_(a[property], b[property], mismatchKeys, mismatchValues)) {
|
||||
mismatchValues.push("'" + property + "' was<br /><br />'" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "'<br /><br />in expected, but was<br /><br />'" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "'<br /><br />in actual.<br />");
|
||||
mismatchValues.push("'" + property + "' was '" + (b[property] ? jasmine.util.htmlEscape(b[property].toString()) : b[property]) + "' in expected, but was '" + (a[property] ? jasmine.util.htmlEscape(a[property].toString()) : a[property]) + "' in actual.");
|
||||
}
|
||||
}
|
||||
|
||||
|
421
src/Matchers.js
421
src/Matchers.js
@ -1,79 +1,108 @@
|
||||
jasmine.Matchers = function(env, actual, results) {
|
||||
/**
|
||||
* @constructor
|
||||
* @param {jasmine.Env} env
|
||||
* @param actual
|
||||
* @param {jasmine.NestedResults} results
|
||||
*/
|
||||
jasmine.Matchers = function(env, actual, spec) {
|
||||
this.env = env;
|
||||
this.actual = actual;
|
||||
this.passing_message = 'Passed.';
|
||||
this.results_ = results || new jasmine.NestedResults();
|
||||
this.spec = spec;
|
||||
};
|
||||
|
||||
jasmine.Matchers.pp = function(str) {
|
||||
return jasmine.util.htmlEscape(jasmine.pp(str));
|
||||
};
|
||||
|
||||
jasmine.Matchers.prototype.results = function() {
|
||||
return this.results_;
|
||||
};
|
||||
|
||||
jasmine.Matchers.prototype.report = function(result, failing_message, details) {
|
||||
this.results_.addResult(new jasmine.ExpectationResult(result, result ? this.passing_message : failing_message, details));
|
||||
var expectationResult = new jasmine.ExpectationResult({
|
||||
passed: result,
|
||||
message: failing_message,
|
||||
details: details
|
||||
});
|
||||
this.spec.addMatcherResult(expectationResult);
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Matcher that compares the actual to the expected using ===.
|
||||
*
|
||||
* @param expected
|
||||
*/
|
||||
jasmine.Matchers.prototype.toBe = function(expected) {
|
||||
return this.report(this.actual === expected, 'Expected<br /><br />' + jasmine.Matchers.pp(expected)
|
||||
+ '<br /><br />to be the same object as<br /><br />' + jasmine.Matchers.pp(this.actual)
|
||||
+ '<br />');
|
||||
};
|
||||
|
||||
/**
|
||||
* Matcher that compares the actual to the expected using !==
|
||||
* @param expected
|
||||
*/
|
||||
jasmine.Matchers.prototype.toNotBe = function(expected) {
|
||||
return this.report(this.actual !== expected, 'Expected<br /><br />' + jasmine.Matchers.pp(expected)
|
||||
+ '<br /><br />to be a different object from actual, but they were the same.');
|
||||
};
|
||||
|
||||
/**
|
||||
* Matcher that compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc.
|
||||
*
|
||||
* @param expected
|
||||
*/
|
||||
jasmine.Matchers.prototype.toEqual = function(expected) {
|
||||
var mismatchKeys = [];
|
||||
var mismatchValues = [];
|
||||
|
||||
var formatMismatches = function(name, array) {
|
||||
if (array.length == 0) return '';
|
||||
var errorOutput = '<br /><br />Different ' + name + ':<br />';
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
errorOutput += array[i] + '<br />';
|
||||
jasmine.Matchers.matcherFn_ = function(matcherName, options) {
|
||||
return function () {
|
||||
jasmine.util.extend(this, options);
|
||||
var matcherArgs = jasmine.util.argsToArray(arguments);
|
||||
var args = [this.actual].concat(matcherArgs);
|
||||
var result = options.test.apply(this, args);
|
||||
var message;
|
||||
if (!result) {
|
||||
message = options.message.apply(this, args);
|
||||
}
|
||||
return errorOutput;
|
||||
var expectationResult = new jasmine.ExpectationResult({
|
||||
matcherName: matcherName,
|
||||
passed: result,
|
||||
expected: matcherArgs.length > 1 ? matcherArgs : matcherArgs[0],
|
||||
actual: this.actual,
|
||||
message: message
|
||||
});
|
||||
this.spec.addMatcherResult(expectationResult);
|
||||
return result;
|
||||
};
|
||||
|
||||
return this.report(this.env.equals_(this.actual, expected, mismatchKeys, mismatchValues),
|
||||
'Expected<br /><br />' + jasmine.Matchers.pp(expected)
|
||||
+ '<br /><br />but got<br /><br />' + jasmine.Matchers.pp(this.actual)
|
||||
+ '<br />'
|
||||
+ formatMismatches('Keys', mismatchKeys)
|
||||
+ formatMismatches('Values', mismatchValues), {
|
||||
matcherName: 'toEqual', expected: expected, actual: this.actual
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Matcher that compares the actual to the expected using the ! of jasmine.Matchers.toEqual
|
||||
* toBe: compares the actual to the expected using ===
|
||||
* @param expected
|
||||
*/
|
||||
jasmine.Matchers.prototype.toNotEqual = function(expected) {
|
||||
return this.report(!this.env.equals_(this.actual, expected),
|
||||
'Expected ' + jasmine.Matchers.pp(expected) + ' to not equal ' + jasmine.Matchers.pp(this.actual) + ', but it does.');
|
||||
};
|
||||
|
||||
jasmine.Matchers.prototype.toBe = jasmine.Matchers.matcherFn_('toBe', {
|
||||
test: function (actual, expected) {
|
||||
return actual === expected;
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return "Expected " + jasmine.pp(actual) + " to be " + jasmine.pp(expected);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* toNotBe: compares the actual to the expected using !==
|
||||
* @param expected
|
||||
*/
|
||||
jasmine.Matchers.prototype.toNotBe = jasmine.Matchers.matcherFn_('toNotBe', {
|
||||
test: function (actual, expected) {
|
||||
return actual !== expected;
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return "Expected " + jasmine.pp(actual) + " to not be " + jasmine.pp(expected);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* toEqual: compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc.
|
||||
*
|
||||
* @param expected
|
||||
*/
|
||||
|
||||
jasmine.Matchers.prototype.toEqual = jasmine.Matchers.matcherFn_('toEqual', {
|
||||
test: function (actual, expected) {
|
||||
return this.env.equals_(actual, expected);
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return "Expected " + jasmine.pp(actual) + " to equal " + jasmine.pp(expected);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual
|
||||
* @param expected
|
||||
*/
|
||||
jasmine.Matchers.prototype.toNotEqual = jasmine.Matchers.matcherFn_('toNotEqual', {
|
||||
test: function (actual, expected) {
|
||||
return !this.env.equals_(actual, expected);
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return "Expected " + jasmine.pp(actual) + " to not equal " + jasmine.pp(expected);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes
|
||||
@ -81,77 +110,166 @@ jasmine.Matchers.prototype.toNotEqual = function(expected) {
|
||||
*
|
||||
* @param reg_exp
|
||||
*/
|
||||
jasmine.Matchers.prototype.toMatch = function(reg_exp) {
|
||||
return this.report((new RegExp(reg_exp).test(this.actual)),
|
||||
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to match ' + reg_exp + '.');
|
||||
};
|
||||
jasmine.Matchers.prototype.toMatch = jasmine.Matchers.matcherFn_('toMatch', {
|
||||
test: function(actual, expected) {
|
||||
return new RegExp(expected).test(actual);
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return jasmine.pp(actual) + " does not match the regular expression " + new RegExp(expected).toString();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch
|
||||
* @param reg_exp
|
||||
*/
|
||||
jasmine.Matchers.prototype.toNotMatch = function(reg_exp) {
|
||||
return this.report((!new RegExp(reg_exp).test(this.actual)),
|
||||
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to not match ' + reg_exp + '.');
|
||||
};
|
||||
|
||||
jasmine.Matchers.prototype.toNotMatch = jasmine.Matchers.matcherFn_('toNotMatch', {
|
||||
test: function(actual, expected) {
|
||||
return !(new RegExp(expected).test(actual));
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return jasmine.pp(actual) + " should not match " + new RegExp(expected).toString();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that compares the acutal to undefined.
|
||||
*/
|
||||
jasmine.Matchers.prototype.toBeDefined = function() {
|
||||
return this.report((this.actual !== undefined),
|
||||
'Expected a value to be defined but it was undefined.');
|
||||
};
|
||||
|
||||
jasmine.Matchers.prototype.toBeDefined = jasmine.Matchers.matcherFn_('toBeDefined', {
|
||||
test: function(actual) {
|
||||
return (actual !== undefined);
|
||||
},
|
||||
message: function() {
|
||||
return 'Expected actual to not be undefined.';
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that compares the acutal to undefined.
|
||||
*/
|
||||
|
||||
jasmine.Matchers.prototype.toBeUndefined = jasmine.Matchers.matcherFn_('toBeUndefined', {
|
||||
test: function(actual) {
|
||||
return (actual === undefined);
|
||||
},
|
||||
message: function(actual) {
|
||||
return 'Expected ' + jasmine.pp(actual) + ' to be undefined.';
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that compares the actual to null.
|
||||
*
|
||||
*/
|
||||
jasmine.Matchers.prototype.toBeNull = function() {
|
||||
return this.report((this.actual === null),
|
||||
'Expected a value to be null but it was ' + jasmine.Matchers.pp(this.actual) + '.');
|
||||
};
|
||||
jasmine.Matchers.prototype.toBeNull = jasmine.Matchers.matcherFn_('toBeNull', {
|
||||
test: function(actual) {
|
||||
return (actual === null);
|
||||
},
|
||||
message: function(actual) {
|
||||
return 'Expected ' + jasmine.pp(actual) + ' to be null.';
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that boolean not-nots the actual.
|
||||
*/
|
||||
jasmine.Matchers.prototype.toBeTruthy = function() {
|
||||
return this.report(!!this.actual,
|
||||
'Expected a value to be truthy but it was ' + jasmine.Matchers.pp(this.actual) + '.');
|
||||
};
|
||||
jasmine.Matchers.prototype.toBeTruthy = jasmine.Matchers.matcherFn_('toBeTruthy', {
|
||||
test: function(actual) {
|
||||
return !!actual;
|
||||
},
|
||||
message: function() {
|
||||
return 'Expected actual to be truthy';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Matcher that boolean nots the actual.
|
||||
*/
|
||||
jasmine.Matchers.prototype.toBeFalsy = function() {
|
||||
return this.report(!this.actual,
|
||||
'Expected a value to be falsy but it was ' + jasmine.Matchers.pp(this.actual) + '.');
|
||||
};
|
||||
jasmine.Matchers.prototype.toBeFalsy = jasmine.Matchers.matcherFn_('toBeFalsy', {
|
||||
test: function(actual) {
|
||||
return !actual;
|
||||
},
|
||||
message: function(actual) {
|
||||
return 'Expected ' + jasmine.pp(actual) + ' to be falsy';
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that checks to see if the acutal, a Jasmine spy, was called.
|
||||
*/
|
||||
jasmine.Matchers.prototype.wasCalled = function() {
|
||||
if (!this.actual || !this.actual.isSpy) {
|
||||
return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
|
||||
|
||||
jasmine.Matchers.prototype.wasCalled = jasmine.Matchers.matcherFn_('wasCalled', {
|
||||
getActual_: function() {
|
||||
var args = jasmine.util.argsToArray(arguments);
|
||||
if (args.length > 1) {
|
||||
throw(new Error('wasCalled does not take arguments, use wasCalledWith'));
|
||||
}
|
||||
return args.splice(0, 1)[0];
|
||||
},
|
||||
test: function() {
|
||||
var actual = this.getActual_.apply(this, arguments);
|
||||
if (!actual || !actual.isSpy) {
|
||||
return false;
|
||||
}
|
||||
return actual.wasCalled;
|
||||
},
|
||||
message: function() {
|
||||
var actual = this.getActual_.apply(this, arguments);
|
||||
if (!actual || !actual.isSpy) {
|
||||
return 'Actual is not a spy.';
|
||||
}
|
||||
return "Expected spy " + actual.identity + " to have been called.";
|
||||
}
|
||||
if (arguments.length > 0) {
|
||||
return this.report(false, 'wasCalled matcher does not take arguments');
|
||||
}
|
||||
return this.report((this.actual.wasCalled),
|
||||
'Expected spy "' + this.actual.identity + '" to have been called, but it was not.');
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that checks to see if the acutal, a Jasmine spy, was not called.
|
||||
*/
|
||||
jasmine.Matchers.prototype.wasNotCalled = function() {
|
||||
if (!this.actual || !this.actual.isSpy) {
|
||||
return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
|
||||
jasmine.Matchers.prototype.wasNotCalled = jasmine.Matchers.matcherFn_('wasNotCalled', {
|
||||
getActual_: function() {
|
||||
var args = jasmine.util.argsToArray(arguments);
|
||||
return args.splice(0, 1)[0];
|
||||
},
|
||||
test: function() {
|
||||
var actual = this.getActual_.apply(this, arguments);
|
||||
if (!actual || !actual.isSpy) {
|
||||
return false;
|
||||
}
|
||||
return !actual.wasCalled;
|
||||
},
|
||||
message: function() {
|
||||
var actual = this.getActual_.apply(this, arguments);
|
||||
if (!actual || !actual.isSpy) {
|
||||
return 'Actual is not a spy.';
|
||||
}
|
||||
return "Expected spy " + actual.identity + " to not have been called.";
|
||||
}
|
||||
return this.report((!this.actual.wasCalled),
|
||||
'Expected spy "' + this.actual.identity + '" to not have been called, but it was.');
|
||||
};
|
||||
});
|
||||
|
||||
jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.matcherFn_('wasCalledWith', {
|
||||
test: function() {
|
||||
var args = jasmine.util.argsToArray(arguments);
|
||||
var actual = args.splice(0, 1)[0];
|
||||
if (!actual || !actual.isSpy) {
|
||||
return false;
|
||||
}
|
||||
return this.env.contains_(actual.argsForCall, args);
|
||||
},
|
||||
message: function() {
|
||||
var args = jasmine.util.argsToArray(arguments);
|
||||
var actual = args.splice(0, 1)[0];
|
||||
var message;
|
||||
if (!actual || !actual.isSpy) {
|
||||
message = 'Actual is not a spy';
|
||||
} else {
|
||||
message = "Expected spy to have been called with " + jasmine.pp(args) + " but was called with " + actual.argsForCall;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that checks to see if the acutal, a Jasmine spy, was called with a set of parameters.
|
||||
@ -159,78 +277,89 @@ jasmine.Matchers.prototype.wasNotCalled = function() {
|
||||
* @example
|
||||
*
|
||||
*/
|
||||
jasmine.Matchers.prototype.wasCalledWith = function() {
|
||||
if (!this.actual || !this.actual.isSpy) {
|
||||
return this.report(false, 'Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.', {
|
||||
matcherName: 'wasCalledWith'
|
||||
});
|
||||
}
|
||||
|
||||
var args = jasmine.util.argsToArray(arguments);
|
||||
|
||||
return this.report(this.env.contains_(this.actual.argsForCall, args),
|
||||
'Expected ' + jasmine.Matchers.pp(this.actual.argsForCall) + ' to contain ' + jasmine.Matchers.pp(args) + ', but it does not.', {
|
||||
matcherName: 'wasCalledWith', expected: args, actual: this.actual.argsForCall
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Matcher that checks that the expected item is an element in the actual Array.
|
||||
*
|
||||
* @param {Object} item
|
||||
*/
|
||||
jasmine.Matchers.prototype.toContain = function(item) {
|
||||
return this.report(this.env.contains_(this.actual, item),
|
||||
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to contain ' + jasmine.Matchers.pp(item) + ', but it does not.', {
|
||||
matcherName: 'toContain', expected: item, actual: this.actual
|
||||
});
|
||||
};
|
||||
|
||||
jasmine.Matchers.prototype.toContain = jasmine.Matchers.matcherFn_('toContain', {
|
||||
test: function(actual, expected) {
|
||||
return this.env.contains_(actual, expected);
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return 'Expected ' + jasmine.pp(actual) + ' to contain ' + jasmine.pp(expected);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that checks that the expected item is NOT an element in the actual Array.
|
||||
*
|
||||
* @param {Object} item
|
||||
*/
|
||||
jasmine.Matchers.prototype.toNotContain = function(item) {
|
||||
return this.report(!this.env.contains_(this.actual, item),
|
||||
'Expected ' + jasmine.Matchers.pp(this.actual) + ' not to contain ' + jasmine.Matchers.pp(item) + ', but it does.');
|
||||
};
|
||||
jasmine.Matchers.prototype.toNotContain = jasmine.Matchers.matcherFn_('toNotContain', {
|
||||
test: function(actual, expected) {
|
||||
return !this.env.contains_(actual, expected);
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return 'Expected ' + jasmine.pp(actual) + ' to not contain ' + jasmine.pp(expected);
|
||||
}
|
||||
});
|
||||
|
||||
jasmine.Matchers.prototype.toBeLessThan = function(expected) {
|
||||
return this.report(this.actual < expected,
|
||||
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be less than ' + jasmine.Matchers.pp(expected) + ', but it was not.');
|
||||
};
|
||||
jasmine.Matchers.prototype.toBeLessThan = jasmine.Matchers.matcherFn_('toBeLessThan', {
|
||||
test: function(actual, expected) {
|
||||
return actual < expected;
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return 'Expected ' + jasmine.pp(actual) + ' to be less than ' + jasmine.pp(expected);
|
||||
}
|
||||
});
|
||||
|
||||
jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
|
||||
return this.report(this.actual > expected,
|
||||
'Expected ' + jasmine.Matchers.pp(this.actual) + ' to be greater than ' + jasmine.Matchers.pp(expected) + ', but it was not.');
|
||||
};
|
||||
jasmine.Matchers.prototype.toBeGreaterThan = jasmine.Matchers.matcherFn_('toBeGreaterThan', {
|
||||
test: function(actual, expected) {
|
||||
return actual > expected;
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
return 'Expected ' + jasmine.pp(actual) + ' to be greater than ' + jasmine.pp(expected);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Matcher that checks that the expected exception was thrown by the actual.
|
||||
*
|
||||
* @param {String} expectedException
|
||||
*/
|
||||
jasmine.Matchers.prototype.toThrow = function(expectedException) {
|
||||
var exception = null;
|
||||
try {
|
||||
this.actual();
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
if (expectedException !== undefined) {
|
||||
if (exception == null) {
|
||||
return this.report(false, "Expected function to throw " + jasmine.Matchers.pp(expectedException) + ", but it did not.");
|
||||
jasmine.Matchers.prototype.toThrow = jasmine.Matchers.matcherFn_('toThrow', {
|
||||
getException_: function(actual, expected) {
|
||||
var exception;
|
||||
if (typeof actual != 'function') {
|
||||
throw new Error('Actual is not a function');
|
||||
}
|
||||
try {
|
||||
actual();
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
return exception;
|
||||
},
|
||||
test: function(actual, expected) {
|
||||
var result = false;
|
||||
var exception = this.getException_(actual, expected);
|
||||
if (exception) {
|
||||
result = (expected === undefined || this.env.equals_(exception.message || exception, expected.message || expected));
|
||||
}
|
||||
return result;
|
||||
},
|
||||
message: function(actual, expected) {
|
||||
var exception = this.getException_(actual, expected);
|
||||
if (exception && (expected === undefined || !this.env.equals_(exception.message || exception, expected.message || expected))) {
|
||||
return ["Expected function to throw", expected.message || expected, ", but it threw", exception.message || exception ].join(' ');
|
||||
} else {
|
||||
return "Expected function to throw an exception.";
|
||||
}
|
||||
return this.report(
|
||||
this.env.equals_(
|
||||
exception.message || exception,
|
||||
expectedException.message || expectedException),
|
||||
"Expected function to throw " + jasmine.Matchers.pp(expectedException) + ", but it threw " + jasmine.Matchers.pp(exception) + ".");
|
||||
} else {
|
||||
return this.report(exception != null, "Expected function to throw an exception, but it did not.");
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
jasmine.Matchers.Any = function(expectedClass) {
|
||||
this.expectedClass = expectedClass;
|
||||
|
19
src/Spec.js
19
src/Spec.js
@ -43,6 +43,11 @@ jasmine.Spec.prototype.log = function(message) {
|
||||
return this.results_.log(message);
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
jasmine.Spec.prototype.getResults = function() {
|
||||
return this.results_;
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.runs = function (func) {
|
||||
var block = new jasmine.Block(this.env, func, this);
|
||||
this.addToQueue(block);
|
||||
@ -57,8 +62,12 @@ jasmine.Spec.prototype.addToQueue = function (block) {
|
||||
}
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.addMatcherResult = function(result) {
|
||||
this.results_.addResult(result);
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.expect = function(actual) {
|
||||
return new (this.getMatchersClass_())(this.env, actual, this.results_);
|
||||
return new (this.getMatchersClass_())(this.env, actual, this);
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.waits = function(timeout) {
|
||||
@ -74,7 +83,11 @@ jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessag
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.fail = function (e) {
|
||||
this.results_.addResult(new jasmine.ExpectationResult(false, e ? jasmine.util.formatException(e) : null, null));
|
||||
var expectationResult = new jasmine.ExpectationResult({
|
||||
passed: false,
|
||||
message: e ? jasmine.util.formatException(e) : 'Exception'
|
||||
});
|
||||
this.results_.addResult(expectationResult);
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.getMatchersClass_ = function() {
|
||||
@ -124,14 +137,12 @@ jasmine.Spec.prototype.execute = function(onComplete) {
|
||||
this.env.reporter.log('>> Jasmine Running ' + this.suite.description + ' ' + this.description + '...');
|
||||
|
||||
spec.env.currentSpec = spec;
|
||||
spec.env.currentlyRunningTests = true;
|
||||
|
||||
spec.addBeforesAndAftersToQueue();
|
||||
|
||||
spec.queue.start(function () {
|
||||
spec.finish(onComplete);
|
||||
});
|
||||
spec.env.currentlyRunningTests = false;
|
||||
};
|
||||
|
||||
jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
|
||||
|
34
src/base.js
34
src/base.js
@ -28,16 +28,14 @@ jasmine.UPDATE_INTERVAL = 250;
|
||||
*/
|
||||
jasmine.bindOriginal_ = function(base, name) {
|
||||
var original = base[name];
|
||||
return function() {
|
||||
if (original.apply) {
|
||||
if (original.apply) {
|
||||
return function() {
|
||||
return original.apply(base, arguments);
|
||||
} else {
|
||||
//IE support
|
||||
if (base == window) {
|
||||
return window[name].apply(window, arguments);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
} else {
|
||||
// IE support
|
||||
return window[name];
|
||||
}
|
||||
};
|
||||
|
||||
jasmine.setTimeout = jasmine.bindOriginal_(window, 'setTimeout');
|
||||
@ -51,12 +49,18 @@ jasmine.MessageResult = function(text) {
|
||||
this.trace = new Error(); // todo: test better
|
||||
};
|
||||
|
||||
jasmine.ExpectationResult = function(passed, message, details) {
|
||||
jasmine.ExpectationResult = function(params) {
|
||||
this.type = 'ExpectationResult';
|
||||
this.passed_ = passed;
|
||||
this.message = message;
|
||||
this.details = details;
|
||||
this.trace = new Error(message); // todo: test better
|
||||
this.matcherName = params.matcherName;
|
||||
this.passed_ = params.passed;
|
||||
this.expected = params.expected;
|
||||
this.actual = params.actual;
|
||||
|
||||
/** @deprecated */
|
||||
this.details = params.details;
|
||||
|
||||
this.message = this.passed_ ? 'Passed.' : params.message;
|
||||
this.trace = this.passed_ ? '' : new Error(this.message);
|
||||
};
|
||||
|
||||
jasmine.ExpectationResult.prototype.passed = function () {
|
||||
@ -524,4 +528,4 @@ jasmine.include = function(url, opt_global) {
|
||||
|
||||
return eval(xhr.responseText);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -57,3 +57,8 @@ jasmine.util.argsToArray = function(args) {
|
||||
return arrayOfArgs;
|
||||
};
|
||||
|
||||
jasmine.util.extend = function(destination, source) {
|
||||
for (var property in source) destination[property] = source[property];
|
||||
return destination;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user