Documentation

include MVC MVC.Animate MVC.Class MVC.Controller MVC.Controller.Action MVC.Controller.Action.Drag MVC.Controller.Action.Drop MVC.Controller.Action.EnterLeave MVC.Controller.Action.Event MVC.Controller.Action.Hover MVC.Controller.Action.Lasso MVC.Controller.Action.Selectable MVC.Controller.Action.Subscribe MVC.Controller.Comet MVC.Controller.Params MVC.Controller.Params.Drag MVC.Controller.Params.Drop MVC.Controller.Stateful MVC.Delegator MVC.Doc MVC.Element MVC.Event MVC.File MVC.History MVC.IO MVC.IO.Ajax MVC.IO.Comet MVC.IO.JsonP MVC.IO.WindowName MVC.IO.XDoc MVC.Model MVC.Model.Ajax MVC.Model.Cookie MVC.Model.JsonP MVC.Model.JsonRest MVC.Model.WindowName MVC.Model.XmlRest MVC.Native MVC.Native.Array MVC.Native.Date MVC.Native.Function MVC.Native.Number MVC.Native.Object MVC.Native.String MVC.Options MVC.Store MVC.SyntheticEvent MVC.Test MVC.Test.Assertions MVC.Test.Controller MVC.Test.Functional MVC.Test.Runner MVC.Test.Unit MVC.Timer MVC.Timer.Easings MVC.Vector MVC.View MVC.View.Helpers OpenAjax

MVC.Test

Inherits: MVC.Class
The Test class is the super class of other test classes including: Test.Unit, Test.Functional, and Test.Controller. Typically Test is not used directly but its functions are available in inheriting classes.

Prototype Methods

fail

fail() -> undefined
Adds to the test case's failure count.

helpers

helpers() -> undefined
Returns an object of helper functions that will be used to generate a new Assertion class for the TestCase. The base implementation returns all functions provided to tests in the constructor that do not start with test. Functional and Controller tests overwrite this function.

init

init(name, tests, type) -> undefined
Creates a new test case. A test case is a collection of test functions and helpers.
  test_some_asserts : function(){
    var value = this.my_helper('hello world')
    this.assert(value)      //passes
  },
  my_helper : function(value){
    return value == 'hello world'
  }
}, 'unit')
{Object} - the unique name of the test. Make sure no two tests have the same name.
{Object} - An object with test functions. Functions that begin with test_ will be run as tests. Functions that don't begin with test are converted to helper functions. Do not name helper functions the same name as the test provided helpers and assertions such as assert or assertEqual as your functions will override these functions.
{Object} - The type of test ('unit', 'functional').

pass

pass() -> undefined
Adds to the test case's pass count.

run

run(callback) -> undefined
Runs all the testcase's tests and when complete calls an optional callback if provided.
{Function} - optional callback for when the test is complete

run_helper

run_helper(helper_name) -> undefined
Runs a helper function.
{String} -

run_next

run_next() -> undefined
Runs the next function