goog.testing.MockRange
Classgoog.testing.MockRange
> goog.testing.LooseMock
> goog.testing.Mock
goog.testing.MockRange()
LooseMock of goog.dom.AbstractRange. Useful because the mock framework cannot simply create a mock out of an abstract class, and cannot create a mock out of classes that implements __iterator__ because it relies on the default behavior of iterating through all of an object's properties.
.$anyTimes()
Inherited from goog.testing.Mock
.
Allows the expectation to be called any number of times.
goog.testing.Mock
}
.$argumentListVerifiers_
{Object
}Inherited from goog.testing.Mock
.
Map of argument name to optional argument list verifier function.
.$argumentsAsString(args)
Inherited from goog.testing.Mock
.
Render the provided argument array to a string to help clients with debugging tests.
args
{Array
.<*>?}
string
}
.$atLeastOnce()
Inherited from goog.testing.Mock
.
Allows the expectation to be called any number of times, as long as it's called once.
goog.testing.Mock
}
.$atMostOnce()
Inherited from goog.testing.Mock
.
Allows the expectation to be called 0 or 1 times.
goog.testing.Mock
}
.$do(expectation, args)
Inherited from goog.testing.Mock
.
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.
expectation
{goog.testing.MockExpectation
}
args
{Array
}
.$does(func)
Inherited from 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.
func
{Function
}
goog.testing.Mock
}
.$maybeThrow(expectation)
Inherited from goog.testing.Mock
.
If the expectation expects to throw, this method will throw.
expectation
{goog.testing.MockExpectation
}
.$mockMethod(name)
Inherited from goog.testing.Mock
.
The function that replaces all methods on the mock object.
name
{string
}
.$pendingExpectation
[protected] {goog.testing.MockExpectation
}Inherited from goog.testing.Mock
.
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.
.$proxy
{Object
}Inherited from goog.testing.Mock
.
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.
.$recordAndThrow(ex)
[protected]Inherited from goog.testing.Mock
.
Throws an exception and records that an exception was thrown.
ex
{Object
}
.$recordCall(name, args)
[protected]Inherited from goog.testing.LooseMock
.
Records an actual method call, intended to be overridden by a subclass. The subclass must find the pending expectation and return the correct value.
name
{string
}
args
{Array
}
.$recordExpectation()
[protected]Inherited from goog.testing.LooseMock
.
Records the currently pending expectation, intended to be overridden by a subclass.
.$registerArgumentListVerifier(methodName, fn)
Inherited from goog.testing.Mock
.
Registers a verfifier function to use when verifying method argument lists.
methodName
{string
}
fn
{Function
}
goog.testing.Mock
}
.$replay()
Inherited from goog.testing.LooseMock
.
Switches from recording to replay mode.
.$reset()
Inherited from goog.testing.LooseMock
.
Resets the state of this mock object. This clears all pending expectations without verifying, and puts the mock in recording mode.
.$returns(val)
Inherited from goog.testing.Mock
.
Specifies a return value for the currently pending expectation.
val
{*}
goog.testing.Mock
}
.$setIgnoreUnexpectedCalls(ignoreUnexpectedCalls)
Inherited from goog.testing.LooseMock
.
A setter for the ignoreUnexpectedCalls field.
ignoreUnexpectedCalls
{boolean
}
goog.testing.LooseMock
}
.$throwCallException(name, args, opt_expectation)
Inherited from goog.testing.Mock
.
Throw an exception based on an incorrect method call.
name
{string
}
args
{Array
.<*>?}
opt_expectation
{goog.testing.MockExpectation
=}
.$throwException(comment, opt_message)
[protected]Inherited from goog.testing.Mock
.
Throws an exception and records that an exception was thrown.
comment
{string
}
opt_message
{?string
=}
.$throws(val)
Inherited from goog.testing.Mock
.
Specifies a value for the currently pending expectation to throw.
val
{*}
goog.testing.Mock
}
.$times(times)
Inherited from goog.testing.Mock
.
Specifies the number of times the expectation should be called.
times
{number
}
goog.testing.Mock
}
.$verify()
Inherited from goog.testing.LooseMock
.
Verify that all of the expectations were met. Should be overridden by subclasses.
.$verifyCall(expectation, name, args)
Inherited from goog.testing.Mock
.
Verifies that a method call matches an expectation.
expectation
{goog.testing.MockExpectation
}
name
{string
}
args
{Array
.<*>?}
boolean
}