1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
/* 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/. */
/*
* Test that the message filter bar toggles into and out of existence and
* states are updated as appropriate.
*/
"use strict";
var {
assert_messages_in_view,
be_in_folder,
create_folder,
focus_thread_tree,
get_about_3pane,
make_message_sets_in_folders,
mc,
} = ChromeUtils.import(
"resource://testing-common/mozmill/FolderDisplayHelpers.jsm"
);
var {
assert_constraints_expressed,
assert_quick_filter_bar_visible,
assert_quick_filter_button_enabled,
clear_constraints,
toggle_boolean_constraints,
toggle_quick_filter_bar,
cleanup_qfb_button,
} = ChromeUtils.import(
"resource://testing-common/mozmill/QuickFilterBarHelpers.jsm"
);
var folder;
var setUnstarred, setStarred;
add_setup(async function () {
folder = await create_folder("QuickFilterBarToggleBar");
[setUnstarred, setStarred] = await make_message_sets_in_folders(
[folder],
[{ count: 1 }, { count: 1 }]
);
setStarred.setStarred(true);
registerCleanupFunction(async () => {
await ensure_cards_view();
});
});
add_task(async function test_hidden_on_account_central() {
await be_in_folder(folder.rootFolder);
await assert_quick_filter_button_enabled(false);
assert_quick_filter_bar_visible(false);
teardownTest();
});
add_task(async function test_visible_by_default() {
await be_in_folder(folder);
await ensure_table_view();
await assert_quick_filter_button_enabled(true);
assert_quick_filter_bar_visible(true);
teardownTest();
});
add_task(async function test_direct_toggle() {
assert_quick_filter_bar_visible(true);
await toggle_quick_filter_bar();
assert_quick_filter_bar_visible(false);
await toggle_quick_filter_bar();
assert_quick_filter_bar_visible(true);
teardownTest();
});
add_task(async function test_control_shift_k_triggers_display() {
// hide it
await toggle_quick_filter_bar();
assert_quick_filter_bar_visible(false);
// focus explicitly on the thread pane so we know where the focus is.
focus_thread_tree();
// hit control-shift-k
EventUtils.synthesizeKey("k", { accelKey: true, shiftKey: true });
// now we should be visible again!
assert_quick_filter_bar_visible(true);
teardownTest();
});
add_task(async function test_constraints_disappear_when_collapsed() {
// set some constraints
toggle_boolean_constraints("starred");
assert_constraints_expressed({ starred: true });
assert_messages_in_view(setStarred);
// collapse, now we should see them all again!
await toggle_quick_filter_bar();
assert_messages_in_view([setUnstarred, setStarred]);
// uncollapse, we should still see them all!
await toggle_quick_filter_bar();
assert_messages_in_view([setUnstarred, setStarred]);
// there better be no constraints left!
assert_constraints_expressed({});
teardownTest();
});
registerCleanupFunction(async () => {
await ensure_cards_view();
await cleanup_qfb_button();
});
function teardownTest() {
clear_constraints();
}
|