Bug 464710 - Add simple test to check if trees in msgSelectOfflineFolders.xul and virtualFolderListEdit.xul work. r=mkmelin
This commit is contained in:
Родитель
6f21fe466e
Коммит
5d29dad49d
|
@ -0,0 +1,94 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
* Tests for other dialogs using the tree view implementation in folderPane.js.
|
||||
*/
|
||||
|
||||
var MODULE_NAME = 'test-folder-pane';
|
||||
|
||||
var RELATIVE_ROOT = '../shared-modules';
|
||||
var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers",
|
||||
"nntp-helpers"];
|
||||
|
||||
Cu.import("resource:///modules/mailServices.js");
|
||||
|
||||
var nntpAccount;
|
||||
|
||||
function setupModule(module) {
|
||||
for (let lib of MODULE_REQUIRES) {
|
||||
collector.getModule(lib).installInto(module);
|
||||
}
|
||||
|
||||
let server = setupLocalServer(NNTP_PORT);
|
||||
nntpAccount = MailServices.accounts.FindAccountForServer(server);
|
||||
}
|
||||
|
||||
function test_virtual_folder_selection_tree() {
|
||||
plan_for_modal_dialog("mailnews:virtualFolderProperties",
|
||||
subtest_create_virtual_folder);
|
||||
mc.click(mc.eid("button-appmenu"));
|
||||
mc.click_menus_in_sequence(mc.e("appmenu-popup"),
|
||||
[ { id: "appmenu_newMessage" },
|
||||
{ id: "appmenu_newVirtualFolder" } ]);
|
||||
wait_for_modal_dialog("mailnews:virtualFolderProperties");
|
||||
}
|
||||
|
||||
function subtest_create_virtual_folder(vfc) {
|
||||
// Open the folder chooser.
|
||||
plan_for_modal_dialog("mailnews:virtualFolderList",
|
||||
subtest_check_virtual_folder_list);
|
||||
vfc.click(vfc.eid("folderListPicker"));
|
||||
wait_for_modal_dialog("mailnews:virtualFolderList");
|
||||
|
||||
vfc.window.document.documentElement.cancelDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Bug 464710
|
||||
* Check the folder list picker is not empty.
|
||||
*/
|
||||
function subtest_check_virtual_folder_list(listc) {
|
||||
let tree = listc.e("folderPickerTree");
|
||||
// We should see the folders from the 2 base local accounts here.
|
||||
assert_true(tree.view.rowCount > 0, "Folder tree was empty in virtual folder selection!");
|
||||
listc.window.document.documentElement.cancelDialog();
|
||||
}
|
||||
|
||||
function test_offline_sync_folder_selection_tree() {
|
||||
plan_for_modal_dialog("mailnews:synchronizeOffline",
|
||||
subtest_offline_sync);
|
||||
mc.click(mc.eid("button-appmenu"));
|
||||
mc.click_menus_in_sequence(mc.e("appmenu-popup"),
|
||||
[ { id: "appmenu_File" },
|
||||
{ id: "appmenu_offline" },
|
||||
{ id: "appmenu_synchronizeOffline" } ]);
|
||||
wait_for_modal_dialog("mailnews:synchronizeOffline");
|
||||
|
||||
}
|
||||
|
||||
function subtest_offline_sync(osc) {
|
||||
// Open the folder chooser.
|
||||
plan_for_modal_dialog("mailnews:selectOffline",
|
||||
subtest_check_offline_folder_list);
|
||||
osc.click(osc.eid("select"));
|
||||
wait_for_modal_dialog("mailnews:selectOffline");
|
||||
|
||||
osc.window.document.documentElement.cancelDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Bug 464710
|
||||
* Check the folder list picker is not empty.
|
||||
*/
|
||||
function subtest_check_offline_folder_list(listc) {
|
||||
let tree = listc.e("synchronizeTree");
|
||||
// We should see the newsgroups from the NNTP server here.
|
||||
assert_true(tree.view.rowCount > 0, "Folder tree was empty in offline sync selection!");
|
||||
listc.window.document.documentElement.cancelDialog();
|
||||
}
|
||||
|
||||
function teardownModule() {
|
||||
MailServices.accounts.removeAccount(nntpAccount);
|
||||
}
|
|
@ -236,14 +236,12 @@ function subtest_save_search(savc) {
|
|||
savc.assertValue(searchVal1, "bar");
|
||||
|
||||
// - name the search
|
||||
// I am having no luck with click/type on XUL things. workaround it.
|
||||
savc.e("name").value = "SearchSaved";
|
||||
savc.window.doEnabling();
|
||||
savc.type(savc.eid("name"), "SearchSaved");
|
||||
|
||||
// - save it!
|
||||
// this will close the dialog, which wait_for_modal_dialog is making sure
|
||||
// happens.
|
||||
savc.window.onOK();
|
||||
savc.window.document.documentElement.acceptDialog();
|
||||
}
|
||||
|
||||
function test_close_search_window() {
|
||||
|
|
|
@ -187,8 +187,8 @@ function open_content_tab_with_url(aURL, aClickHandler, aBackground, aController
|
|||
* be opened in the foreground. The element is expected to be associated with
|
||||
* the given controller.
|
||||
*
|
||||
* @param aElem The element to click.
|
||||
* @param aExpectedURL The URL that is expected to be opened (string).
|
||||
* @param aElem The element to click or a function that causes the tab to open.
|
||||
* @param aExpectedURL The URL that is expected to be opened (string).
|
||||
* @param [aController] The controller the element is associated with. Defaults
|
||||
* to |mc|.
|
||||
* @returns The newly-opened tab.
|
||||
|
@ -198,7 +198,11 @@ function open_content_tab_with_click(aElem, aExpectedURL, aController) {
|
|||
aController = mc;
|
||||
|
||||
let preCount = aController.tabmail.tabContainer.childNodes.length;
|
||||
aController.click(new elib.Elem(aElem));
|
||||
if (typeof(aElem) != "function")
|
||||
aController.click(new elib.Elem(aElem));
|
||||
else
|
||||
aElem();
|
||||
|
||||
utils.waitFor(() => (
|
||||
aController.tabmail.tabContainer.childNodes.length == preCount + 1),
|
||||
"Timeout waiting for the content tab to open",
|
||||
|
|
|
@ -951,10 +951,10 @@ var AugmentEverybodyWith = {
|
|||
* @param aRootPopup The base popup. The caller is expected to activate it
|
||||
* (by clicking/rightclicking the right widget). We will only wait for it
|
||||
* to open if it is in the process.
|
||||
* @param aActions A list of objects where each object has a single
|
||||
* attribute with a single value. We pick the menu option whose DOM
|
||||
* node has an attribute with that name and value. We click whatever we
|
||||
* find. We throw if we don't find what you were asking for.
|
||||
* @param aActions An array of objects where each object has attributes
|
||||
* with a value defined. We pick the menu item whose DOM node matches
|
||||
* all the attributes with the specified names and value. We click whatever
|
||||
* we find. We throw if the element being asked for is not found.
|
||||
* @param aKeepOpen If set to true the popups are not closed after last click.
|
||||
*
|
||||
* @return An array of popup elements that were left open. It will be
|
||||
|
@ -979,8 +979,7 @@ var AugmentEverybodyWith = {
|
|||
*/
|
||||
let findMatch = function(aNode) {
|
||||
// Ignore some elements and just use their children instead.
|
||||
if (aNode.localName == "hbox" || aNode.localName == "vbox" ||
|
||||
aNode.localName == "splitmenu") {
|
||||
if (aNode.localName == "hbox" || aNode.localName == "vbox" ) {
|
||||
for (let i = 0; i < aNode.children.length; i++) {
|
||||
let childMatch = findMatch(aNode.children[i]);
|
||||
if (childMatch)
|
||||
|
@ -1010,13 +1009,31 @@ var AugmentEverybodyWith = {
|
|||
break;
|
||||
}
|
||||
|
||||
if (!matchingNode)
|
||||
if (!matchingNode) {
|
||||
throw new Error("Did not find matching menu item for action index " +
|
||||
iAction + ": " + JSON.stringify(actionObj));
|
||||
}
|
||||
|
||||
this.click(new elib.Elem(matchingNode));
|
||||
if ("menupopup" in matchingNode) {
|
||||
curPopup = matchingNode.menupopup;
|
||||
if ((matchingNode.localName == "splitmenu") &&
|
||||
((iAction < aActions.length - 1) || aKeepOpen)) {
|
||||
// For splitmenus, click the submenu arrow to open its menupopup,
|
||||
// unless this is the last item being searched for. In that case,
|
||||
// click the main item.
|
||||
this.click(new elib.Elem(matchingNode.menu));
|
||||
} else
|
||||
this.click(new elib.Elem(matchingNode));
|
||||
|
||||
let newPopup = null;
|
||||
if ("menupopup" in matchingNode)
|
||||
newPopup = matchingNode.menupopup;
|
||||
else if ((matchingNode.localName == "splitmenu") &&
|
||||
("menupopup" in matchingNode.menu)) {
|
||||
// We should actually fetch matchingNode.menu.menupopup here,
|
||||
// but it doesn't seem to work.
|
||||
newPopup = matchingNode.querySelector("menupopup");
|
||||
}
|
||||
if (newPopup) {
|
||||
curPopup = newPopup;
|
||||
closeStack.push(curPopup);
|
||||
utils.waitFor(function() { return curPopup.state == "open"; },
|
||||
"Popup never opened at action depth " + iAction +
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
<?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
|
||||
|
||||
<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/msgSynchronize.dtd" >
|
||||
<dialog xmlns:NC="http://home.netscape.com/NC-rdf#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="msg-synchronizer"
|
||||
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="msg-synchronizer"
|
||||
windowtype="mailnews:synchronizeOffline"
|
||||
title="&MsgSynchronize.label;"
|
||||
onload="OnLoad();"
|
||||
style="width: 35em;"
|
||||
|
|
|
@ -78,7 +78,8 @@
|
|||
<hbox align="center">
|
||||
<label id="chosenFoldersCount"/>
|
||||
<spacer flex="1"/>
|
||||
<button label="&chooseFoldersButton.label;"
|
||||
<button id="folderListPicker"
|
||||
label="&chooseFoldersButton.label;"
|
||||
accesskey="&chooseFoldersButton.accesskey;"
|
||||
oncommand="chooseFoldersToSearch();"/>
|
||||
</hbox>
|
||||
|
|
Загрузка…
Ссылка в новой задаче