DEV: Remove old user profile navigation menu tests (#20386)

Since 359dc1c532, support for the old user
profile navigation menu has been dropped. This commit seeks to remove
code from the client side that still relies on the `currentUser.redesigned_user_page_nav_enabled` prop.
This commit is contained in:
Alan Guo Xiang Tan 2023-02-21 14:03:40 +08:00 committed by GitHub
parent 6efebd7f11
commit c1486790d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 466 additions and 562 deletions

View File

@ -63,7 +63,9 @@ acceptance(
}
);
function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
acceptance(
"User Private Messages - user with group messages",
function (needs) {
let fetchedNew;
let fetchUserNew;
let fetchedGroupNew;
@ -72,7 +74,7 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
id: 5,
username: "charlie",
groups: [{ id: 14, name: "awesome_group", has_messages: true }],
...(customUserProps || {}),
redesigned_user_page_nav_enabled: true,
});
needs.site({
@ -329,7 +331,10 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
);
}
for (const url of ["/u/charlie/messages", "/u/charlie/messages/archive"]) {
for (const url of [
"/u/charlie/messages",
"/u/charlie/messages/archive",
]) {
await visit(url);
await publishGroupArchiveToMessageBus({ groupIds: [14], topicId: 1 });
@ -347,7 +352,6 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
await publishUnreadToMessageBus({ topicId: 1 });
await publishNewToMessageBus({ topicId: 2 });
if (customUserProps?.redesigned_user_page_nav_enabled) {
assert.strictEqual(
query(".user-nav__messages-new").innerText.trim(),
I18n.t("user.messages.new_with_count", { count: 1 }),
@ -359,19 +363,6 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
I18n.t("user.messages.unread_with_count", { count: 1 }),
"displays the right count"
);
} else {
assert.strictEqual(
query(".messages-nav li a.new").innerText.trim(),
I18n.t("user.messages.new_with_count", { count: 1 }),
"displays the right count"
);
assert.strictEqual(
query(".messages-nav li a.unread").innerText.trim(),
I18n.t("user.messages.unread_with_count", { count: 1 }),
"displays the right count"
);
}
});
test("incoming new messages while viewing new", async function (assert) {
@ -379,19 +370,11 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
await publishNewToMessageBus({ topicId: 1 });
if (customUserProps?.redesigned_user_page_nav_enabled) {
assert.strictEqual(
query(".messages-nav .user-nav__messages-new").innerText.trim(),
I18n.t("user.messages.new_with_count", { count: 1 }),
"displays the right count"
);
} else {
assert.strictEqual(
query(".messages-nav li a.new").innerText.trim(),
I18n.t("user.messages.new_with_count", { count: 1 }),
"displays the right count"
);
}
assert.ok(exists(".show-mores"), "displays the topic incoming info");
});
@ -401,19 +384,11 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
await publishUnreadToMessageBus();
if (customUserProps?.redesigned_user_page_nav_enabled) {
assert.strictEqual(
query(".messages-nav .user-nav__messages-unread").innerText.trim(),
I18n.t("user.messages.unread_with_count", { count: 1 }),
"displays the right count"
);
} else {
assert.strictEqual(
query(".messages-nav li a.unread").innerText.trim(),
I18n.t("user.messages.unread_with_count", { count: 1 }),
"displays the right count"
);
}
assert.ok(exists(".show-mores"), "displays the topic incoming info");
});
@ -424,7 +399,6 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
await publishUnreadToMessageBus({ groupIds: [14], topicId: 1 });
await publishNewToMessageBus({ groupIds: [14], topicId: 2 });
if (customUserProps?.redesigned_user_page_nav_enabled) {
assert.strictEqual(
query(
".messages-nav .user-nav__messages-group-unread"
@ -454,35 +428,6 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
I18n.t("user.messages.new"),
"displays the right count"
);
} else {
assert.strictEqual(
query(".messages-nav a.unread").innerText.trim(),
I18n.t("user.messages.unread_with_count", { count: 1 }),
"displays the right count"
);
assert.strictEqual(
query(".messages-nav a.new").innerText.trim(),
I18n.t("user.messages.new_with_count", { count: 1 }),
"displays the right count"
);
assert.ok(exists(".show-mores"), "displays the topic incoming info");
await visit("/u/charlie/messages/unread");
assert.strictEqual(
query(".messages-nav a.unread").innerText.trim(),
I18n.t("user.messages.unread"),
"displays the right count"
);
assert.strictEqual(
query(".messages-nav a.new").innerText.trim(),
I18n.t("user.messages.new"),
"displays the right count"
);
}
});
test("incoming messages is not tracked on non user messages route", async function (assert) {
@ -515,19 +460,11 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
await click(".btn.dismiss-read");
await click("#dismiss-read-confirm");
if (customUserProps?.redesigned_user_page_nav_enabled) {
assert.strictEqual(
query(".user-nav__messages-unread").innerText.trim(),
I18n.t("user.messages.unread"),
"displays the right count"
);
} else {
assert.strictEqual(
query(".messages-nav li a.unread").innerText.trim(),
I18n.t("user.messages.unread"),
"displays the right count"
);
}
assert.strictEqual(
count(".topic-list-item"),
@ -589,19 +526,11 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
await click(".btn.dismiss-read");
if (customUserProps?.redesigned_user_page_nav_enabled) {
assert.strictEqual(
query(".messages-nav .user-nav__messages-new").innerText.trim(),
I18n.t("user.messages.new"),
"displays the right count"
);
} else {
assert.strictEqual(
query(".messages-nav li a.new").innerText.trim(),
I18n.t("user.messages.new"),
"displays the right count"
);
}
assert.strictEqual(
count(".topic-list-item"),
@ -768,7 +697,6 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
);
});
if (customUserProps?.redesigned_user_page_nav_enabled) {
test("navigating between user messages route with dropdown", async function (assert) {
await visit("/u/charlie/messages");
@ -780,11 +708,7 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
"User personal inbox is selected in dropdown"
);
if (customUserProps?.redesigned_user_page_nav_enabled) {
await click(".user-nav__messages-sent");
} else {
await click(".messages-sent");
}
assert.strictEqual(
messagesDropdown.header().name(),
@ -807,11 +731,7 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
"Group inbox is selected in dropdown"
);
if (customUserProps?.redesigned_user_page_nav_enabled) {
await click(".user-nav__messages-group-new");
} else {
await click(".messages-group-new");
}
assert.strictEqual(
messagesDropdown.header().name(),
@ -867,22 +787,6 @@ function testUserPrivateMessagesWithGroupMessages(needs, customUserProps) {
}
});
}
}
acceptance(
"User Private Messages - user with group messages",
function (needs) {
return testUserPrivateMessagesWithGroupMessages(needs);
}
);
acceptance(
"User Private Messages - user with group messages - redesigned user page nav enabled",
function (needs) {
return testUserPrivateMessagesWithGroupMessages(needs, {
redesigned_user_page_nav_enabled: true,
});
}
);
acceptance("User Private Messages - user with no messages", function (needs) {