testing.editor.FieldMock Extends goog.testing.LooseMock
Mock of goog.editor.Field.

Inheritance

Constructor

goog.testing.editor.FieldMock(opt_windowopt_appWindowopt_range)

Parameters

opt_window : Window=
Window the field would edit. Defaults to window.
opt_appWindow : Window=
"AppWindow" of the field, which can be different from opt_window when mocking a field that uses an iframe. Defaults to opt_window.
opt_range : goog.dom.AbstractRange=
An object (mock or real) to be returned by getRange(). If ommitted, a new goog.dom.Range is created from the window every time getRange() is called.

Instance Methods

Public Protected Private
inModalMode() boolean
No description.
Returns: boolean  Whether we're in modal interaction mode.
code »
setModalMode(mode)
No description.
Arguments:
mode : boolean
Sets whether we're in modal interaction mode.
code »
$recordCall()
No description.
code »
$recordExpectation()
No description.
code »
$replay()
No description.
code »
$reset()
No description.
code »
$setIgnoreUnexpectedCalls(ignoreUnexpectedCalls) !goog.testing.LooseMock
A setter for the ignoreUnexpectedCalls field.
Arguments:
ignoreUnexpectedCalls : boolean
Whether to ignore unexpected calls.
Returns: !goog.testing.LooseMock  This mock object.
code »
$verify()
No description.
code »
$anyTimes() !goog.testing.Mock
Allows the expectation to be called any number of times.
Returns: !goog.testing.Mock  This mock object.
code »
$argumentsAsString(args) string
Render the provided argument array to a string to help clients with debugging tests.
Arguments:
args : ?Array.<*>
The arguments passed to the mock.
Returns: string  Human-readable string.
code »
$atLeastOnce() !goog.testing.Mock
Allows the expectation to be called any number of times, as long as it's called once.
Returns: !goog.testing.Mock  This mock object.
code »
$atMostOnce() !goog.testing.Mock
Allows the expectation to be called 0 or 1 times.
Returns: !goog.testing.Mock  This mock object.
code »
$do(expectationargs) *
If this expectation defines a function to be called, it will be called and its result will be returned. Otherwise, if the expectation expects to throw, it will throw. Otherwise, this method will return defined value.
Arguments:
expectation : goog.testing.MockExpectation
The expectation.
args : Array
The arguments to the method.
Returns: *  The return value expected by the mock.
code »
$does(func) !goog.testing.Mock
Specifies a function to call for currently pending expectation. Note, that using this method overrides declarations made using $returns() and $throws() methods.
Arguments:
func : Function
The function to call.
Returns: !goog.testing.Mock  This mock object.
code »
$initializeFunctions_(objectToMock)
Initializes the functions on the mock object.
Arguments:
objectToMock : Object
The object being mocked.
code »
$maybeThrow(expectation)
If the expectation expects to throw, this method will throw.
Arguments:
expectation : goog.testing.MockExpectation
The expectation.
code »
$mockMethod(name) *
The function that replaces all methods on the mock object.
Arguments:
name : string
The name of the method being mocked.
Returns: *  In record mode, returns the mock object. In replay mode, returns whatever the creator of the mock set as the return value.
code »
$never() !goog.testing.Mock
Disallows the expectation from being called.
Returns: !goog.testing.Mock  This mock object.
code »
$once() !goog.testing.Mock
Allows the expectation to be called exactly once.
Returns: !goog.testing.Mock  This mock object.
code »
$recordAndThrow(ex)
Throws an exception and records that an exception was thrown.
Arguments:
ex : Object
Exception.
code »
$recordCall(nameargs) *
Records an actual method call, intended to be overridden by a subclass. The subclass must find the pending expectation and return the correct value.
Arguments:
name : string
The name of the method being called.
args : Array
The arguments to the method.
Returns: *  The return expected by the mock.
code »
$recordExpectation()
Records the currently pending expectation, intended to be overridden by a subclass.
code »
$registerArgumentListVerifier(methodNamefn) !goog.testing.Mock
Registers a verfifier function to use when verifying method argument lists.
Arguments:
methodName : string
The name of the method for which the verifierFn should be used.
fn : Function
Argument list verifier function. Should take 2 argument arrays as arguments, and return true if they are considered equivalent.
Returns: !goog.testing.Mock  This mock object.
code »
$replay()
Switches from recording to replay mode.
code »
$reset()
Resets the state of this mock object. This clears all pending expectations without verifying, and puts the mock in recording mode.
code »
$returns(val) !goog.testing.Mock
Specifies a return value for the currently pending expectation.
Arguments:
val : *
The return value.
Returns: !goog.testing.Mock  This mock object.
code »
$throwCallException(nameargsopt_expectation)
Throw an exception based on an incorrect method call.
Arguments:
name : string
Name of method called.
args : ?Array.<*>
Arguments passed to the mock.
opt_expectation : goog.testing.MockExpectation=
Expected next call, if any.
code »
$throwException(commentopt_message)
Throws an exception and records that an exception was thrown.
Arguments:
comment : string
A short comment about the exception.
opt_message : ?string=
A longer message about the exception.
code »
$throws(val) !goog.testing.Mock
Specifies a value for the currently pending expectation to throw.
Arguments:
val : *
The value to throw.
Returns: !goog.testing.Mock  This mock object.
code »
$times(times) !goog.testing.Mock
Specifies the number of times the expectation should be called.
Arguments:
times : number
The number of times this method will be called.
Returns: !goog.testing.Mock  This mock object.
code »
$verify()
Verify that all of the expectations were met. Should be overridden by subclasses.
code »
$verifyCall(expectationnameargs) boolean
Verifies that a method call matches an expectation.
Arguments:
expectation : goog.testing.MockExpectation
The expectation to check.
name : string
The name of the called method.
args : ?Array.<*>
The arguments passed to the mock.
Returns: boolean  Whether the call matches the expectation.
code »

Instance Properties

constructor :
No description.
Code »
$calls_ :
The calls that have been made; we cache them to verify at the end. Each element is an array where the first element is the name, and the second element is the arguments.
Code »
$expectations_ : goog.structs.Map
A map of method names to a LooseExpectationCollection for that method.
Code »
$ignoreUnexpectedCalls_ :
Whether to ignore unexpected calls.
Code »
constructor :
No description.
Code »
$argumentListVerifiers_ :
Map of argument name to optional argument list verifier function.
Code »
$pendingExpectation : goog.testing.MockExpectation
The expectation currently being created. All methods that modify the current expectation return the Mock object for easy chaining, so this is where we keep track of the expectation that's currently being modified.
Code »
$proxy :
A proxy for the mock. This can be used for dependency injection in lieu of the mock if the test requires a strict instanceof check.
Code »
$recording_ :
Whether or not we are in recording mode.
Code »
$threwException_ :
First exception thrown by this mock; used in $verify.
Code »

Static Properties

goog.testing.editor.FieldMock.superClass_ :
No description.
Code »

Package testing.editor

Package Reference