Another attempt to fix bug 503988: change the way we invoke find, check the Find bar's status afterwards.

This commit is contained in:
Jonathan Griffin 2009-07-28 17:16:51 -07:00
Родитель 22ffa7d3b6
Коммит d0b8cb8bf2
1 изменённых файлов: 18 добавлений и 15 удалений

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

@ -27,19 +27,6 @@
tests.next(); tests.next();
} }
////
// Enter a string in the find bar's search field, by issuing
// a series of key events to it.
//
function enterStringIntoFindField(aString) {
for (var i=0; i < aString.length; i++) {
var event = document.createEvent("KeyEvents");
event.initKeyEvent("keypress", true, true, null, false, false,
false, false, 0, aString.charCodeAt(i));
gFindBar._findField.inputField.dispatchEvent(event);
}
}
//// ////
// Generator function for test steps for bug 298622: // Generator function for test steps for bug 298622:
// Find should work correctly on a page loaded from the // Find should work correctly on a page loaded from the
@ -85,7 +72,15 @@
}; };
document.getElementById("cmd_find").doCommand(); document.getElementById("cmd_find").doCommand();
ok(!gFindBar.hidden, "failed to open findbar"); ok(!gFindBar.hidden, "failed to open findbar");
enterStringIntoFindField("A generic page"); gFindBar._findField.value = "A generic page";
gFindBar._find();
SimpleTest.executeSoon(nextTest);
yield;
// Make sure Find bar's internal status is not 'notfound'
isnot(gFindBar._findField.getAttribute("status"), "notfound",
"Findfield status attribute should not have been 'notfound'" +
" after Find");
// Make sure the key events above have time to be processed // Make sure the key events above have time to be processed
// before continuing // before continuing
@ -122,8 +117,16 @@
gFindBar = document.getElementById("FindToolbar"); gFindBar = document.getElementById("FindToolbar");
document.getElementById("cmd_find").doCommand(); document.getElementById("cmd_find").doCommand();
ok(!gFindBar.hidden, "failed to open findbar"); ok(!gFindBar.hidden, "failed to open findbar");
enterStringIntoFindField("find this"); gFindBar._findField.value = "find this";
gFindBar._find();
SimpleTest.executeSoon(nextTest);
yield;
// Make sure Find bar's internal status is not 'notfound'
isnot(gFindBar._findField.getAttribute("status"), "notfound",
"Findfield status attribute should not have been 'notfound'" +
" after Find");
// Make sure the key events above have time to be processed // Make sure the key events above have time to be processed
// before continuing // before continuing
waitForTrue(function() { waitForTrue(function() {