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;
]]></body>
</method>
<method name="getTaskAtRow">
<parameter name="aRow"/>
<body><![CDATA[
@ -773,13 +774,14 @@
*/
_getItemFromEvent: function(event, aCol, aRow) {
aRow = aRow || {};
let childElt = {};
this.treebox.getCellAt(event.clientX, event.clientY, aRow, aCol || {}, childElt);
if (!childElt.value) {
return false;
let { col, row } = this.treebox.getCellAt(event.clientX, event.clientY);
if (aCol) {
aCol.value = col;
}
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

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

@ -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) {