henningn commented on a change in pull request #72: migrate QUnit tests to 
Jasmine
URL: https://github.com/apache/myfaces-tobago/pull/72#discussion_r410347406
 
 

 ##########
 File path: 
tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/10-sort/Sheet_Sorting.test.js
 ##########
 @@ -15,67 +15,52 @@
  * limitations under the License.
  */
 
-import {testFrameQuerySelectorAllFn, testFrameQuerySelectorFn} from 
"/script/tobago-test.js";
-import {TobagoTestTool} from "/tobago/test/tobago-test-tool.js";
+import {querySelectorAllFn, querySelectorFn} from "/script/tobago-test.js";
+import {JasmineTestTool, TobagoTestTool} from 
"/tobago/test/tobago-test-tool.js";
 
-QUnit.test("Basics: Name", function (assert) {
-  let colNameFn = 
testFrameQuerySelectorFn("#page\\:mainForm\\:s1\\:columnName_sorter");
-  let rowsFn = testFrameQuerySelectorAllFn("#page\\:mainForm\\:s1 
.tobago-sheet-bodyTable tbody .tobago-sheet-row");
-  let leftPagingFn = testFrameQuerySelectorFn("#page\\:mainForm\\:s1 
.tobago-sheet-paging-markup-left input");
+it("Basics: Name", function (done) {
+  let colNameFn = querySelectorFn("#page\\:mainForm\\:s1\\:columnName_sorter");
+  let rowsFn = querySelectorAllFn("#page\\:mainForm\\:s1 
.tobago-sheet-bodyTable tbody .tobago-sheet-row");
+  let leftPagingFn = querySelectorFn("#page\\:mainForm\\:s1 
.tobago-sheet-paging-markup-left input");
 
-  let TTT = new TobagoTestTool(assert);
+  let test = new JasmineTestTool(done);
   if (!colNameFn().classList.contains("tobago-sheet-header-markup-ascending")) 
{
-    TTT.action(function () {
-      colNameFn().dispatchEvent(new Event("click", {bubbles: true}));
-    });
-    TTT.waitForResponse();
-  }
-  TTT.asserts(3, function () {
-    
assert.ok(colNameFn().classList.contains("tobago-sheet-header-markup-sortable"));
-    
assert.ok(colNameFn().classList.contains("tobago-sheet-header-markup-ascending"));
-    
assert.notOk(colNameFn().classList.contains("tobago-sheet-header-markup-descending"));
-  });
-  TTT.action(function () {
-    leftPagingFn().value = "22";
-    leftPagingFn().dispatchEvent(new Event("blur", {bubbles: true}));
-  });
-  TTT.waitForResponse();
-  TTT.asserts(12, function () {
-    ajaxExecuteBodyTableCheck(assert, rowsFn,
-        "Earth", "365.26", "",
-        "Elara", "259.65", "1905",
-        "Enceladus", "1.37", "1789",
-        "Epimetheus", "0.69", "1980");
-  });
-  TTT.action(function () {
-    colNameFn().dispatchEvent(new Event("click", {bubbles: true}));
-  });
-  TTT.waitForResponse();
-  TTT.asserts(12, function () {
-    ajaxExecuteBodyTableCheck(assert, rowsFn,
+    test.do(() => colNameFn().dispatchEvent(new Event("click", {bubbles: 
true})));
+    test.wait(() => ajaxExecuteBodyTableCheck(rowsFn,
 
 Review comment:
   The wait() method needs a function with a boolean return value. 
ajaxExecuteBodyTableCheck() have no return value.
   
   This code is used in several lines and should be also fixed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to