mirror of https://github.com/zulip/zulip.git
node tests: Clean up subs test.
We start our stream_id sequence at 101, and we clarify the somewhat strange assertions related to the "active" class.
This commit is contained in:
parent
c407293577
commit
9fc1adce60
|
@ -15,8 +15,10 @@ zrequire("stream_data");
|
|||
zrequire("search_util");
|
||||
set_global("page_params", {});
|
||||
|
||||
const denmark_stream_id = 101;
|
||||
|
||||
set_global("location", {
|
||||
hash: "#streams/1/announce",
|
||||
hash: `#streams/${denmark_stream_id}/announce`,
|
||||
});
|
||||
|
||||
zrequire("subs");
|
||||
|
@ -45,7 +47,7 @@ run_test("filter_table", () => {
|
|||
elem: "denmark",
|
||||
subscribed: false,
|
||||
name: "Denmark",
|
||||
stream_id: 1,
|
||||
stream_id: denmark_stream_id,
|
||||
description: "Copenhagen",
|
||||
subscribers: [1],
|
||||
stream_weekly_traffic: null,
|
||||
|
@ -55,7 +57,7 @@ run_test("filter_table", () => {
|
|||
elem: "poland",
|
||||
subscribed: true,
|
||||
name: "Poland",
|
||||
stream_id: 2,
|
||||
stream_id: 102,
|
||||
description: "monday",
|
||||
subscribers: [1, 2, 3],
|
||||
stream_weekly_traffic: 13,
|
||||
|
@ -65,7 +67,7 @@ run_test("filter_table", () => {
|
|||
elem: "pomona",
|
||||
subscribed: true,
|
||||
name: "Pomona",
|
||||
stream_id: 3,
|
||||
stream_id: 103,
|
||||
description: "college",
|
||||
subscribers: [],
|
||||
stream_weekly_traffic: 0,
|
||||
|
@ -75,7 +77,7 @@ run_test("filter_table", () => {
|
|||
elem: "cpp",
|
||||
subscribed: true,
|
||||
name: "C++",
|
||||
stream_id: 4,
|
||||
stream_id: 104,
|
||||
description: "programming lang",
|
||||
subscribers: [1, 2],
|
||||
stream_weekly_traffic: 6,
|
||||
|
@ -85,7 +87,7 @@ run_test("filter_table", () => {
|
|||
elem: "zzyzx",
|
||||
subscribed: true,
|
||||
name: "Zzyzx",
|
||||
stream_id: 5,
|
||||
stream_id: 105,
|
||||
description: "california town",
|
||||
subscribers: [1, 2],
|
||||
stream_weekly_traffic: 6,
|
||||
|
@ -145,8 +147,19 @@ run_test("filter_table", () => {
|
|||
assert.equal(elem, $("#subscription_overlay .streams-list"));
|
||||
};
|
||||
|
||||
// Filtering has the side effect of setting the "active" class
|
||||
// on our current stream, even if it doesn't match the filter.
|
||||
const denmark_row = $(`.stream-row[data-stream-id='${denmark_stream_id}']`);
|
||||
// sanity check it's not set to active
|
||||
assert(!denmark_row.hasClass("active"));
|
||||
|
||||
// Search with single keyword
|
||||
subs.filter_table({input: "Po", subscribed_only: false});
|
||||
|
||||
// The denmark row is active, even though it's not displayed.
|
||||
assert(denmark_row.hasClass("active"));
|
||||
|
||||
// We only display poland and pomona
|
||||
assert($(".stream-row-denmark").hasClass("notdisplayed"));
|
||||
assert(!$(".stream-row-poland").hasClass("notdisplayed"));
|
||||
assert(!$(".stream-row-pomona").hasClass("notdisplayed"));
|
||||
|
@ -302,9 +315,4 @@ run_test("filter_table", () => {
|
|||
assert($(".stream-row-pomona").hasClass("notdisplayed"));
|
||||
assert($(".stream-row-cpp").hasClass("notdisplayed"));
|
||||
assert($(".stream-row-zzyzx").hasClass("notdisplayed"));
|
||||
|
||||
// test selected row set to active
|
||||
$(".stream-row[data-stream-id='1']").removeClass("active");
|
||||
subs.filter_table({input: "", subscribed_only: false});
|
||||
assert($(".stream-row[data-stream-id='1']").hasClass("active"));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue