Bug 963925: added test for Highlight All mode. r=Unfocused

This commit is contained in:
Mike de Boer 2014-02-17 15:43:04 +01:00
Родитель 729e51e159
Коммит 33dc2a6169
1 изменённых файлов: 49 добавлений и 0 удалений

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

@ -91,6 +91,9 @@
testQuickFindText(); testQuickFindText();
gFindBar.close(); gFindBar.close();
ok(gFindBar.hidden, "Failed to close findbar after testQuickFindText"); ok(gFindBar.hidden, "Failed to close findbar after testQuickFindText");
testFindWithHighlight();
gFindBar.close();
ok(gFindBar.hidden, "Failed to close findbar after testFindWithHighlight");
testFindbarSelection(); testFindbarSelection();
testDrop(); testDrop();
testQuickFindLink(); testQuickFindLink();
@ -304,6 +307,52 @@
"testQuickFindLink: failed to find sample link"); "testQuickFindLink: failed to find sample link");
} }
// See bug 963925 for more details on this test.
function testFindWithHighlight() {
//clearFocus();
gFindBar._findField.value = "";
let findCommand = document.getElementById("cmd_find");
findCommand.doCommand();
let searchStr = "e";
enterStringIntoFindField(searchStr);
let a = gFindBar._findField.value;
let b = gFindBar._browser.finder._fastFind.searchString;
let c = gFindBar._browser.finder.searchString;
ok(a == b && b == c, "testFindWithHighlight: " + a + ", " + b + ", " + c + ".");
let oldGetInitialSelection = gFindBar._getInitialSelection;
let searchStr = "t";
gFindBar._getInitialSelection = () => searchStr;
findCommand.doCommand();
gFindBar._getInitialSelection = oldGetInitialSelection;
a = gFindBar._findField.value;
b = gFindBar._browser.finder._fastFind.searchString;
c = gFindBar._browser.finder.searchString;
ok(a == searchStr && b == c, "testFindWithHighlight: " + a + ", " + b + ", " + c + ".");
let highlightButton = gFindBar.getElement("highlight");
highlightButton.click();
ok(highlightButton.checked, "testFindWithHighlight: Highlight All should be checked.");
a = gFindBar._findField.value;
b = gFindBar._browser.finder._fastFind.searchString;
c = gFindBar._browser.finder.searchString;
ok(a == searchStr && b == c, "testFindWithHighlight: " + a + ", " + b + ", " + c + ".");
gFindBar.onFindAgainCommand();
a = gFindBar._findField.value;
b = gFindBar._browser.finder._fastFind.searchString;
c = gFindBar._browser.finder.searchString;
ok(a == b && b == c, "testFindWithHighlight: " + a + ", " + b + ", " + c + ".");
highlightButton.click();
ok(!highlightButton.checked, "testFindWithHighlight: Highlight All should be unchecked.");
}
function testQuickFindText() { function testQuickFindText() {
clearFocus(); clearFocus();