From 6a4fc40d5335018db58607a4cae22c8c60231ec1 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 22 Mar 2011 20:22:08 +0100 Subject: [PATCH] [ADD] finish documenting QUnit functions (for IDEs) bzr revid: xmo@openerp.com-20110322192208-8usouja1b665s1mm --- addons/base/static/openerp/js/tests.js | 51 +++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/addons/base/static/openerp/js/tests.js b/addons/base/static/openerp/js/tests.js index 46d08ff8691..62d1dcda40b 100644 --- a/addons/base/static/openerp/js/tests.js +++ b/addons/base/static/openerp/js/tests.js @@ -75,7 +75,56 @@ var notEqual; * @param {String} [message] message output with the assertion result */ var deepEqual; -var notDeepEqual, strictEqual, notStrictEqual, raises; +/** + * @function + * Recursive inequality assertion. + * + * Works on primitive types using !== and traversing through + * Objects and Arrays as well checking their components + * + * @param {Object} actual the object to check for correctness (processing result) + * @param {Object} expected the object to check against + * @param {String} [message] message output with the assertion result + */ +var notDeepEqual; +/** + * @function + * Strict equality assertion (~assertEqual) + * + * Passes if both arguments are identical (via ===) + * + * @param {Object} actual the object to check for correctness (processing result) + * @param {Object} expected the object to check against + * @param {String} [message] message output with the assertion result + */ +var strictEqual; +/** + * @function + * Strict inequality assertion (~assertNotEqual) + * + * Passes if both arguments are identical (via !==) + * + * @param {Object} actual the object to check for correctness (processing result) + * @param {Object} expected the object to check against + * @param {String} [message] message output with the assertion result + */ +var notStrictEqual; +/** + * @function + * Passes if the provided block raised an exception. + * + * The expect argument can be provided to perform further assertion checks on the exception itself: + * * If it's a RegExp test the exception against the regexp (message?) + * * If it's a constructor, check if the exception is an instance of it + * * If it's an other type of function, call it with the exception as first parameter + * - If the function returns true, the assertion validates + * - Otherwise it fails + * + * @param {Function} block function which should raise an exception when called + * @param {Object} [expect] a RegExp, a constructor or a Function + * @param {String} [message] message output with the assertion result + */ +var raises; /** * @function * Starts running the test runner again from the point where it was