Bug 650702 - Message/Mark All Read doesn't get disabled when there are no (zero) unread messages/all messages are read; r=bwinton

This commit is contained in:
Jim Porter 2011-05-02 22:36:08 -05:00
Родитель 5e2efd072f
Коммит 7cdf3727d3
2 изменённых файлов: 31 добавлений и 0 удалений

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

@ -431,6 +431,8 @@ var DefaultController =
case "cmd_undoCloseTab":
return (document.getElementById("tabmail").recentlyClosedTabs.length > 0);
case "cmd_markAllRead":
return IsFolderSelected() && gDBView &&
gDBView.msgFolder.getNumUnread(false) > 0;
case "cmd_markReadByDate":
return IsFolderSelected();
case "cmd_find":

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

@ -113,9 +113,15 @@ function enable_archiving(enabled) {
.setBoolPref("mail.identity.default.archive_enabled", enabled);
}
/**
* Mark a message read or unread via the context menu
* @param index the row in the thread pane of the message to mark read/unread
* @param read true the message should be marked read, false otherwise
*/
function mark_read_via_menu(index, read) {
let menuItem = read ? "mailContext-markRead" : "mailContext-markUnread";
right_click_on_row(index);
wait_for_popup_to_open(mc.e("mailContext"));
mc.click_menus_in_sequence(mc.e("mailContext"), [{id: "mailContext-mark"},
{id: menuItem}]);
close_popup(mc, mc.eid("mailContext"));
@ -255,6 +261,29 @@ function test_mark_menu_mixed() {
check_read_menuitems(0, true, true);
}
function test_mark_all_read() {
be_in_folder(unreadFolder);
let curMessage = select_click_row(0);
curMessage.markRead(false);
// Make sure we can mark all read with >0 messages unread.
right_click_on_row(0);
wait_for_popup_to_open(mc.e("mailContext"));
mc.click_menus_in_sequence(mc.e("mailContext"), [{id: "mailContext-mark"},
{id: "mailContext-markAllRead"}]);
close_popup(mc, mc.eid("mailContext"));
assert_true(curMessage.isRead, "Message should have been marked read!");
// Make sure we can't mark all read, now that all messages are already read.
right_click_on_row(0);
wait_for_popup_to_open(mc.e("mailContext"));
mc.click_menus_in_sequence(mc.e("mailContext"), [{id: "mailContext-mark"}]);
let allReadDisabled = mc.e("mailContext-markAllRead").disabled;
assert_true(allReadDisabled, "Mark All Read menu item should be disabled!");
}
function test_yearly_archive() {
yearly_archive(false);
}