API Docs for:
Show:

ngMidwayTester Class

Creates an instance of the midway tester on the specified module.

Constructor

ngMidwayTester

(
  • moduleName
  • [config]
)
Object

Parameters:

  • moduleName Object

    the AngularJS module that you wish to test

  • [config] Object optional
    • [window=window] Object optional

      The window node of the page

    • [document=document] Object optional

      The document node of the page

    • [templateUrl] Object optional

      The template file for the HTML layout of the tester

    • [template] Object optional

      The template string for the HTML layout of the tester

Returns:

Object:

An instance of the midway tester

Methods

apply

(
  • fn
  • [scope=$rootScope]
)

Performs an apply operation on the given scope

Parameters:

  • fn Function

    The callback function which will be used in the apply digest

  • [scope=$rootScope] Object optional

    scope 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 optional

    The element that will be used as the parent (defaults to document.body)

compile

(
  • html
  • [scope=$rootScope]
)
Element

Compiles and links the given HTML

Parameters:

  • html String | Element

    the html or element node which will be compiled

  • [scope=$rootScope] Object optional

    The scope object which will be linked to the compile

Returns:

Element:

The element node which which is the result of the compilation

controller

(
  • name
  • [locals]
)
Object

Attaches the $rootElement module to the provided body element

Parameters:

  • name String

    The name of the controller

  • [locals] Object optional

    A key/value map of all the injectable services for when the controller is instantiated

Returns:

Object:

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 optional

    The scope object which will be used for the compilation

evalAsync

(
  • fn
  • [scope=$rootScope]
)

Runs $scope.$evalAsync() on the provided scope

Parameters:

  • fn Function

    The function to be provided to evalAsync

  • [scope=$rootScope] Object optional

    The scope object which will be used for the eval call

injector

() Object

Returns:

Object:

Returns the AngularJS $injector service

module

() Object

Returns:

Object:

Returns the module container object acquired from angular.module(moduleName)

path

() String

Returns:

String:

Returns the path of the current route

rootElement

() Object

Returns:

Object:

The $rootElement object of the module

rootScope

() Object

Returns:

Object:

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 Function

    The given function to poll

  • callback Function

    The given callback to fire once the exp function returns a truthy value

viewElement

() Object

Returns:

Object:

The scope of the current view element

viewElement

() Element

Returns:

Element:

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 String

    The given path that the current route will be changed to

  • [callback] Function optional

    The given callback to fire once the view has been fully loaded