ngMidwayTester Class
Creates an instance of the midway tester on the specified module.
Constructor
ngMidwayTester
-
moduleName
-
[config]
Parameters:
-
moduleName
Objectthe AngularJS module that you wish to test
-
[config]
Object optional-
[window=window]
Object optionalThe window node of the page
-
[document=document]
Object optionalThe document node of the page
-
[templateUrl]
Object optionalThe template file for the HTML layout of the tester
-
[template]
Object optionalThe template string for the HTML layout of the tester
-
Returns:
An instance of the midway tester
Item Index
Methods
apply
-
fn
-
[scope=$rootScope]
Performs an apply operation on the given scope
Parameters:
-
fn
FunctionThe callback function which will be used in the apply digest
-
[scope=$rootScope]
Object optionalscope The scope object which the apply process will be run on
attach
-
[body=document.body]
Attaches the $rootElement module to the provided body element
Parameters:
-
[body=document.body]
Element optionalThe element that will be used as the parent (defaults to document.body)
compile
-
html
-
[scope=$rootScope]
Compiles and links the given HTML
Parameters:
-
html
String | Elementthe html or element node which will be compiled
-
[scope=$rootScope]
Object optionalThe scope object which will be linked to the compile
Returns:
The element node which which is the result of the compilation
controller
-
name
-
[locals]
Attaches the $rootElement module to the provided body element
Parameters:
-
name
StringThe name of the controller
-
[locals]
Object optionalA key/value map of all the injectable services for when the controller is instantiated
Returns:
The instance of the controller
destroy
()
Removes the $rootElement and clears the module from the page
digest
-
[scope=$rootScope]
Performs a digest operation on the given scope
Parameters:
-
[scope=$rootScope]
Object optionalThe scope object which will be used for the compilation
evalAsync
-
fn
-
[scope=$rootScope]
Runs $scope.$evalAsync() on the provided scope
Parameters:
-
fn
FunctionThe function to be provided to evalAsync
-
[scope=$rootScope]
Object optionalThe scope object which will be used for the eval call
injector
()
Object
Returns:
Returns the AngularJS $injector service
module
()
Object
Returns:
Returns the module container object acquired from angular.module(moduleName)
path
()
String
Returns:
Returns the path of the current route
rootElement
()
Object
Returns:
The $rootElement object of the module
rootScope
()
Object
Returns:
The $rootScope object of the module
until
-
exp
-
callback
Keeps checking an expression until it returns a truthy value and then runs the provided callback
Parameters:
-
exp
FunctionThe given function to poll
-
callback
FunctionThe given callback to fire once the exp function returns a truthy value
viewElement
()
Object
Returns:
The scope of the current view element
viewElement
()
Element
Returns:
The current element that has ng-view attached to it
visit
-
path
-
[callback]
Changes the current route of the page and then fires the callback when the page has loaded
Parameters:
-
path
StringThe given path that the current route will be changed to
-
[callback]
Function optionalThe given callback to fire once the view has been fully loaded