mirror of
https://github.com/zulip/zulip.git
synced 2025-10-29 11:03:54 +00:00
Compare commits
2 Commits
12.0-dev
...
buddy-list
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d0e5b1b4e | ||
|
|
5c77244fb0 |
@@ -35,8 +35,7 @@ class BuddyListConf {
|
|||||||
return Number.parseInt(opts.$li.expectOne().attr("data-user-id"), 10);
|
return Number.parseInt(opts.$li.expectOne().attr("data-user-id"), 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
get_data_from_keys(opts) {
|
get_data_from_keys(keys) {
|
||||||
const keys = opts.keys;
|
|
||||||
const data = buddy_data.get_items_for_users(keys);
|
const data = buddy_data.get_items_for_users(keys);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -80,9 +79,7 @@ export class BuddyList extends BuddyListConf {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const items = this.get_data_from_keys({
|
const items = this.get_data_from_keys(more_keys);
|
||||||
keys: more_keys,
|
|
||||||
});
|
|
||||||
|
|
||||||
const html = this.items_to_html({
|
const html = this.items_to_html({
|
||||||
items,
|
items,
|
||||||
|
|||||||
@@ -57,8 +57,7 @@ run_test("basics", ({override}) => {
|
|||||||
const buddy_list = new BuddyList();
|
const buddy_list = new BuddyList();
|
||||||
init_simulated_scrolling();
|
init_simulated_scrolling();
|
||||||
|
|
||||||
override(buddy_list, "get_data_from_keys", (opts) => {
|
override(buddy_list, "get_data_from_keys", (keys) => {
|
||||||
const keys = opts.keys;
|
|
||||||
assert.deepEqual(keys, [alice.user_id]);
|
assert.deepEqual(keys, [alice.user_id]);
|
||||||
return "data-stub";
|
return "data-stub";
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -91,3 +91,52 @@ run_test("set_focused_recipient", ({override_rewire}) => {
|
|||||||
assert.ok(!compose_fade_helper.should_fade_message(good_msg));
|
assert.ok(!compose_fade_helper.should_fade_message(good_msg));
|
||||||
assert.ok(compose_fade_helper.should_fade_message(bad_msg));
|
assert.ok(compose_fade_helper.should_fade_message(bad_msg));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
run_test("want_normal_display", () => {
|
||||||
|
const stream_id = 110;
|
||||||
|
const sub = {
|
||||||
|
stream_id,
|
||||||
|
name: "display testing",
|
||||||
|
subscribed: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
stream_data.clear_subscriptions();
|
||||||
|
|
||||||
|
// No focused recipient.
|
||||||
|
compose_fade_helper.set_focused_recipient(undefined);
|
||||||
|
assert.ok(compose_fade_helper.want_normal_display());
|
||||||
|
|
||||||
|
// Focused recipient is a sub that doesn't exist.
|
||||||
|
compose_fade_helper.set_focused_recipient({
|
||||||
|
type: "stream",
|
||||||
|
stream_id,
|
||||||
|
topic: "",
|
||||||
|
});
|
||||||
|
assert.ok(compose_fade_helper.want_normal_display());
|
||||||
|
|
||||||
|
// Focused recipient is a valid stream with no topic set
|
||||||
|
stream_data.add_sub(sub);
|
||||||
|
assert.ok(compose_fade_helper.want_normal_display());
|
||||||
|
|
||||||
|
// If we're focused to a topic, then we do want to fade.
|
||||||
|
compose_fade_helper.set_focused_recipient({
|
||||||
|
type: "stream",
|
||||||
|
stream_id,
|
||||||
|
topic: "lunch",
|
||||||
|
});
|
||||||
|
assert.ok(!compose_fade_helper.want_normal_display());
|
||||||
|
|
||||||
|
// Private message with no recipient.
|
||||||
|
compose_fade_helper.set_focused_recipient({
|
||||||
|
type: "private",
|
||||||
|
reply_to: "",
|
||||||
|
});
|
||||||
|
assert.ok(compose_fade_helper.want_normal_display());
|
||||||
|
|
||||||
|
// Private message with a recipient.
|
||||||
|
compose_fade_helper.set_focused_recipient({
|
||||||
|
type: "private",
|
||||||
|
reply_to: "hello@zulip.com",
|
||||||
|
});
|
||||||
|
assert.ok(!compose_fade_helper.want_normal_display());
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user