From 3b788c7abfcfdf08015a06671243af8f671e314d Mon Sep 17 00:00:00 2001 From: Geoff Lankow Date: Wed, 16 Jan 2019 22:46:12 +1300 Subject: [PATCH] Bug 1491269 - Fix failing testTaskView.js; r=Fallen --- calendar/base/content/calendar-task-tree.xml | 38 ++++++++++---------- calendar/test/mozmill/views/testTaskView.js | 17 ++++----- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/calendar/base/content/calendar-task-tree.xml b/calendar/base/content/calendar-task-tree.xml index b90a74709f..604a4966db 100644 --- a/calendar/base/content/calendar-task-tree.xml +++ b/calendar/base/content/calendar-task-tree.xml @@ -212,19 +212,19 @@ [] - true - null - null - null - null - null + true + null + null + null + null + null - - + + @@ -319,6 +319,7 @@ return null; ]]> + -1 && this.binding.mTaskArray[aRow.value]; + if (aRow) { + aRow.value = row; + } + return row > -1 && this.binding.mTaskArray[row]; }, // Helper function to display datetimes diff --git a/calendar/test/mozmill/views/testTaskView.js b/calendar/test/mozmill/views/testTaskView.js index 9b750b22a0..6ce2c8b659 100755 --- a/calendar/test/mozmill/views/testTaskView.js +++ b/calendar/test/mozmill/views/testTaskView.js @@ -37,7 +37,6 @@ function setupModule(module) { // Mozmill doesn't support trees yet, therefore completed checkbox and line-through style are not // checked. -testTaskView.__force_skip__ = true; function testTaskView() { // paths let treeChildren = ` @@ -65,7 +64,7 @@ function testTaskView() { } let taskTreeNode = lookup(taskTree).getNode(); - let countBefore = taskTreeNode.mTaskArray.length; + controller.assert(() => taskTreeNode.mTaskArray.length == 0); // Add task. let taskInput= lookup(` @@ -76,11 +75,7 @@ function testTaskView() { controller.keypress(taskInput, "VK_RETURN", {}); // Verify added. - let countAfter; - controller.waitFor(() => { - countAfter = taskTreeNode.mTaskArray.length; - return countAfter == (countBefore + 1); - }, "Added Task did not appear; countBefore=" + countBefore + ", countAfter=" + countAfter); + controller.waitFor(() => taskTreeNode.mTaskArray.length == 1, "Added Task did not appear"); // Last added task is automatically selected so verify detail window data. controller.assertJSProperty(eid("calendar-task-details-title"), "textContent", TITLE); @@ -106,6 +101,9 @@ function testTaskView() { task.click(taskid("button-saveandclose")); }); + controller.assert(() => taskTreeNode.mTaskArray.length < 2, "Task added but should not have been"); + controller.assert(() => taskTreeNode.mTaskArray.length > 0, "Task removed but should not have been"); + // Verify description and status in details pane. controller.assertValue(lookup(` ${TASK_VIEW}/{"flex":"1"}/id("calendar-task-details-container")/ @@ -158,10 +156,7 @@ function testTaskView() { // Delete task and verify. countBefore = taskTreeNode.mTaskArray.length; controller.click(eid("calendar-delete-task-button")); - controller.waitFor(() => { - countAfter = taskTreeNode.mTaskArray.length; - return countAfter == (countBefore - 1); - }, "Task did not delete; countBefore=" + countBefore + ", countAfter=" + countAfter); + controller.waitFor(() => taskTreeNode.mTaskArray.length == 0, "Task did not delete"); } function teardownTest(module) {