Author: ygrego Date: 2015-02-18 17:28:54 +0000 (Wed, 18 Feb 2015) New Revision: 825 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/825 Log: Into method "runAll" call another method "updateTestResult" to avoid the closure issue about object currentTest used in call "promise.then" and "promise.catch". Modified: oipf/js/test/Test.js Modified: oipf/js/test/Test.js =================================================================== --- oipf/js/test/Test.js 2015-02-18 17:18:18 UTC (rev 824) +++ oipf/js/test/Test.js 2015-02-18 17:28:54 UTC (rev 825) @@ -66,14 +66,7 @@ for (var j = 0; j < tests.length; j++) { var currentTest = tests[j]; if (currentTest["impl"] === "Yes") { - //this.updateTestResult(currentTest, object); - var promise = new Promise(object[currentTest["method"]].bind(object)); - promise.then(function (val) { - document.getElementById(currentTest["id"] + "Res").textContent = "Result: " + val; - }); - promise.catch(function (val) { - document.getElementById(currentTest["id"] + "Res").textContent = "Result: " + val; - }); + this.updateTestResult(currentTest, object); } } }
participants (1)
-
ygregoï¼ users.nuiton.org