fix navigation in stand-alone msg window, and add mozmill test, r=asuth, sr=standard8, 498334

This commit is contained in:
David Bienvenu 2009-06-22 07:50:55 -07:00
Родитель adf056d62f
Коммит 496c0e74f0
3 изменённых файлов: 27 добавлений и 9 удалений

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

@ -102,6 +102,7 @@ StandaloneFolderDisplayWidget.prototype = {
onCreatedView:
function StandaloneMessageDisplayWidget_onCreatedView() {
this._fakeTreeBox.view = this.view.dbView;
this._magicTreeSelection.view = this.view.dbView;
// only if we're not dealing with a dummy message (from .eml file /
// attachment should we try and hook up the selection object.) Otherwise
// the view will not operate in stand alone message mode.

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

@ -45,6 +45,7 @@ var RELATIVE_ROOT = '../shared-modules';
var MODULE_REQUIRES = ['folder-display-helpers', 'window-helpers'];
var folder;
var msgSet;
function setupModule(module) {
let fdh = collector.getModule('folder-display-helpers');
@ -53,8 +54,8 @@ function setupModule(module) {
wh.installInto(module);
folder = create_folder("MessageWindowA");
// create a single message in the folder to display
make_new_sets_in_folder(folder, [{count: 1}]);
// create three messages in the folder to display
[msgSet] = make_new_sets_in_folder(folder, [{count: 3}]);
}
/** The message window controller. */
@ -71,6 +72,16 @@ function test_open_message_window() {
assert_selected_and_displayed(msgc, curMessage);
}
/**
* Use the "f" keyboard accelerator to navigate to the next message,
* and verify that it is indeed loaded.
*/
function test_navigate_to_next_message() {
msgc.keypress(null, "f", {});
wait_for_message_display_completion(msgc, true);
assert_selected_and_displayed(msgc, 1);
}
/**
* Close the window by hitting escape.
*/

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

@ -116,6 +116,10 @@ JSTreeSelection.prototype = {
*/
_count: 0,
// In the case of the stand-alone message window, there's no tree, but
// there's a view.
_view: null,
get tree JSTreeSelection_get_treeBoxObject() {
return this._treeBoxObject;
},
@ -123,6 +127,9 @@ JSTreeSelection.prototype = {
this._treeBoxObject = aTreeBoxObject;
},
set view JSTreeSelection_set_view(aView) {
this._view = aView;
},
/**
* Although the nsITreeSelection documentation doesn't say, what this method
* is supposed to do is check if the seltype attribute on the XUL tree is any
@ -607,14 +614,13 @@ JSTreeSelection.prototype = {
// don't fire if we are suppressed; we will fire when un-suppressed
if (this.selectEventsSuppressed)
return;
// we need a box object to get at the view
if (!this._treeBoxObject)
return;
// we need a view to have a view...
if (!this._treeBoxObject.view)
return;
let view;
if (this._treeBoxObject && this._treeBoxObject.view)
view = this._treeBoxObject.view;
else
view = this._view;
let view = this._treeBoxObject.view.QueryInterface(Ci.nsITreeView);
view = view.QueryInterface(Ci.nsITreeView);
view.selectionChanged();
},