Class Index | File Index

Classes


Built-In Namespace _global_

Method Summary
Method Attributes Method Name and Description
 
afterEach(afterEachFunction)
A function that is called after each spec in a suite.
 
beforeEach(beforeEachFunction)
A function that is called before each spec in a suite.
 
describe(description, specDefinitions)
Defines a suite of specifications.
 
expect(actual)
Starts a chain for a Jasmine expectation.
 
it(desc, func)
Creates a Jasmine spec that will be added to the current suite.
 
runs(func)
Defines part of a jasmine spec.
 
spyOn(obj, methodName)
Function that installs a spy on an existing object's method name.
 
waits(timeout)
Waits for a timeout before moving to the next runs()-defined block.
 
waitsFor(timeout, latchFunction, message)
Waits for the latchFunction to return true before proceeding to the next runs()-defined block.
 
xdescribe(description, specDefinitions)
Disables a suite of specifications.
 
xit(desc, func)
Creates a disabled Jasmine spec.
Method Detail
afterEach(afterEachFunction)
A function that is called after each spec in a suite. Used for restoring any state that is hijacked during spec execution.
Defined in: jasmine-0.10.0.js.
Parameters:
{Function} afterEachFunction

beforeEach(beforeEachFunction)
A function that is called before each spec in a suite. Used for spec setup, including validating assumptions.
Defined in: jasmine-0.10.0.js.
Parameters:
{Function} beforeEachFunction

describe(description, specDefinitions)
Defines a suite of specifications. Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization of setup in some tests.
Defined in: jasmine-0.10.0.js.
// TODO: a simple suite

// TODO: a simple suite with a nested describe block
Parameters:
{String} description
A string, usually the class under test.
{Function} specDefinitions
function that defines several specs.

expect(actual)
Starts a chain for a Jasmine expectation. It is passed an Object that is the actual value and should chain to one of the many jasmine.Matchers functions.
Defined in: jasmine-0.10.0.js.
Parameters:
{Object} actual
Actual value to test against and expected value

it(desc, func)
Creates a Jasmine spec that will be added to the current suite. // TODO: pending tests
Defined in: jasmine-0.10.0.js.
it('should be true', function() {
  expect(true).toEqual(true);
});
Parameters:
{String} desc
description of this specification
{Function} func
defines the preconditions and expectations of the spec

runs(func)
Defines part of a jasmine spec. Used in cominbination with waits or waitsFor in asynchrnous specs.
Defined in: jasmine-0.10.0.js.
Parameters:
{Function} func
Function that defines part of a jasmine spec.

spyOn(obj, methodName)
Function that installs a spy on an existing object's method name. Used within a Spec to create a spy.
Defined in: jasmine-0.10.0.js.
// spy example
var foo = {
  not: function(bool) { return !bool; }
}
spyOn(foo, 'not'); // actual foo.not will not be called, execution stops
Parameters:
obj
methodName
Returns:
a Jasmine spy that can be chained with all spy methods
See:
jasmine.createSpy

waits(timeout)
Waits for a timeout before moving to the next runs()-defined block.
Defined in: jasmine-0.10.0.js.
Parameters:
{Number} timeout

waitsFor(timeout, latchFunction, message)
Waits for the latchFunction to return true before proceeding to the next runs()-defined block.
Defined in: jasmine-0.10.0.js.
Parameters:
{Number} timeout
{Function} latchFunction
{String} message

xdescribe(description, specDefinitions)
Disables a suite of specifications. Used to disable some suites in a file, or files, temporarily during development.
Defined in: jasmine-0.10.0.js.
Parameters:
{String} description
A string, usually the class under test.
{Function} specDefinitions
function that defines several specs.

xit(desc, func)
Creates a disabled Jasmine spec. A convenience method that allows existing specs to be disabled temporarily during development.
Defined in: jasmine-0.10.0.js.
Parameters:
{String} desc
description of this specification
{Function} func
defines the preconditions and expectations of the spec

Documentation generated by JsDoc Toolkit 2.1.0 on Wed Oct 21 2009 09:32:57 GMT-0700 (PDT)