Built-In Namespace _global_
Method Attributes | Method Name and Description |
---|---|
afterEach(afterEachFunction)
A function that is called after each spec in a suite.
|
|
anticipate(number)
|
|
beforeEach(beforeEachFunction)
A function that is called before each spec in a suite.
|
|
complete()
|
|
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, ignore)
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: base.js.
Defined in: base.js.
- Parameters:
- {Function} afterEachFunction
anticipate(number)
Defined in: base.js.
- Parameters:
- number
beforeEach(beforeEachFunction)
A function that is called before each spec in a suite.
Used for spec setup, including validating assumptions.
Defined in: base.js.
Defined in: base.js.
- Parameters:
- {Function} beforeEachFunction
complete()
Defined in: base.js.
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: base.js.
Defined in: base.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: base.js.
Defined in: base.js.
- Parameters:
- {Object} actual
- Actual value to test against and expected value
incomplete()
Defined in: base.js.
it(desc, func)
Creates a Jasmine spec that will be added to the current suite.
// TODO: pending tests
Defined in: base.js.
Defined in: base.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: base.js.
Defined in: base.js.
- Parameters:
- {Function} func
- Function that defines part of a jasmine spec.
spyOn(obj, methodName, ignore)
Function that installs a spy on an existing object's method name. Used within a Spec to create a spy.
Defined in: base.js.
Defined in: base.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
- ignore
- 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: base.js.
Defined in: base.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: base.js.
Defined in: base.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: base.js.
Defined in: base.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: base.js.
Defined in: base.js.
- Parameters:
- {String} desc
- description of this specification
- {Function} func
- defines the preconditions and expectations of the spec