Bug 1491269 - Fix failing testTaskView.js; r=Fallen

This commit is contained in:
Geoff Lankow 2019-01-16 22:46:12 +13:00
Родитель ee7cfe2e09
Коммит 3b788c7abf
2 изменённых файлов: 26 добавлений и 29 удалений

Просмотреть файл

@ -319,6 +319,7 @@
return null; return null;
]]></body> ]]></body>
</method> </method>
<method name="getTaskAtRow"> <method name="getTaskAtRow">
<parameter name="aRow"/> <parameter name="aRow"/>
<body><![CDATA[ <body><![CDATA[
@ -773,13 +774,14 @@
*/ */
_getItemFromEvent: function(event, aCol, aRow) { _getItemFromEvent: function(event, aCol, aRow) {
aRow = aRow || {}; let { col, row } = this.treebox.getCellAt(event.clientX, event.clientY);
let childElt = {}; if (aCol) {
this.treebox.getCellAt(event.clientX, event.clientY, aRow, aCol || {}, childElt); aCol.value = col;
if (!childElt.value) {
return false;
} }
return aRow && aRow.value > -1 && this.binding.mTaskArray[aRow.value]; if (aRow) {
aRow.value = row;
}
return row > -1 && this.binding.mTaskArray[row];
}, },
// Helper function to display datetimes // Helper function to display datetimes

Просмотреть файл

@ -37,7 +37,6 @@ function setupModule(module) {
// Mozmill doesn't support trees yet, therefore completed checkbox and line-through style are not // Mozmill doesn't support trees yet, therefore completed checkbox and line-through style are not
// checked. // checked.
testTaskView.__force_skip__ = true;
function testTaskView() { function testTaskView() {
// paths // paths
let treeChildren = ` let treeChildren = `
@ -65,7 +64,7 @@ function testTaskView() {
} }
let taskTreeNode = lookup(taskTree).getNode(); let taskTreeNode = lookup(taskTree).getNode();
let countBefore = taskTreeNode.mTaskArray.length; controller.assert(() => taskTreeNode.mTaskArray.length == 0);
// Add task. // Add task.
let taskInput= lookup(` let taskInput= lookup(`
@ -76,11 +75,7 @@ function testTaskView() {
controller.keypress(taskInput, "VK_RETURN", {}); controller.keypress(taskInput, "VK_RETURN", {});
// Verify added. // Verify added.
let countAfter; controller.waitFor(() => taskTreeNode.mTaskArray.length == 1, "Added Task did not appear");
controller.waitFor(() => {
countAfter = taskTreeNode.mTaskArray.length;
return countAfter == (countBefore + 1);
}, "Added Task did not appear; countBefore=" + countBefore + ", countAfter=" + countAfter);
// Last added task is automatically selected so verify detail window data. // Last added task is automatically selected so verify detail window data.
controller.assertJSProperty(eid("calendar-task-details-title"), "textContent", TITLE); controller.assertJSProperty(eid("calendar-task-details-title"), "textContent", TITLE);
@ -106,6 +101,9 @@ function testTaskView() {
task.click(taskid("button-saveandclose")); 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. // Verify description and status in details pane.
controller.assertValue(lookup(` controller.assertValue(lookup(`
${TASK_VIEW}/{"flex":"1"}/id("calendar-task-details-container")/ ${TASK_VIEW}/{"flex":"1"}/id("calendar-task-details-container")/
@ -158,10 +156,7 @@ function testTaskView() {
// Delete task and verify. // Delete task and verify.
countBefore = taskTreeNode.mTaskArray.length; countBefore = taskTreeNode.mTaskArray.length;
controller.click(eid("calendar-delete-task-button")); controller.click(eid("calendar-delete-task-button"));
controller.waitFor(() => { controller.waitFor(() => taskTreeNode.mTaskArray.length == 0, "Task did not delete");
countAfter = taskTreeNode.mTaskArray.length;
return countAfter == (countBefore - 1);
}, "Task did not delete; countBefore=" + countBefore + ", countAfter=" + countAfter);
} }
function teardownTest(module) { function teardownTest(module) {