From 8a879c7fca6530f5a03b0402a6af67c5e9f1e7a7 Mon Sep 17 00:00:00 2001 From: R Midhun Suresh Date: Mon, 21 Jul 2025 17:28:54 +0530 Subject: [PATCH] Message preview should show tooltip with the full message on hover (#30265) * Add title attribute for message preview So that the full message is shown in a tooltip on hover. * Fix test * Update src/components/views/rooms/RoomListPanel/RoomListItemView.tsx Co-authored-by: Florian Duros --------- Co-authored-by: Florian Duros --- .../rooms/RoomListPanel/RoomListItemView.tsx | 6 +++- .../RoomListPanel/RoomListItemView-test.tsx | 2 +- .../__snapshots__/RoomList-test.tsx.snap | 30 ------------------- .../RoomListItemView-test.tsx.snap | 12 ++------ 4 files changed, 8 insertions(+), 42 deletions(-) diff --git a/src/components/views/rooms/RoomListPanel/RoomListItemView.tsx b/src/components/views/rooms/RoomListPanel/RoomListItemView.tsx index cabb034975..a0259d0a6a 100644 --- a/src/components/views/rooms/RoomListPanel/RoomListItemView.tsx +++ b/src/components/views/rooms/RoomListPanel/RoomListItemView.tsx @@ -94,7 +94,11 @@ export const RoomListItemView = memo(function RoomListItemView({
{vm.name}
-
{vm.messagePreview}
+ {vm.messagePreview && ( +
+ {vm.messagePreview} +
+ )} {showHoverMenu ? ( ", () => { }); test("should render a room item with a message preview", () => { - defaultValue.messagePreview = "The message looks list this"; + defaultValue.messagePreview = "The message looks like this"; const onClick = jest.fn(); const { asFragment } = render(); diff --git a/test/unit-tests/components/views/rooms/RoomListPanel/__snapshots__/RoomList-test.tsx.snap b/test/unit-tests/components/views/rooms/RoomListPanel/__snapshots__/RoomList-test.tsx.snap index acd5569702..f312fd6e41 100644 --- a/test/unit-tests/components/views/rooms/RoomListPanel/__snapshots__/RoomList-test.tsx.snap +++ b/test/unit-tests/components/views/rooms/RoomListPanel/__snapshots__/RoomList-test.tsx.snap @@ -69,9 +69,6 @@ exports[` should render a room list 1`] = ` > room0 -
@@ -123,9 +120,6 @@ exports[` should render a room list 1`] = ` > room1 -
@@ -177,9 +171,6 @@ exports[` should render a room list 1`] = ` > room2 -
@@ -231,9 +222,6 @@ exports[` should render a room list 1`] = ` > room3 -
@@ -285,9 +273,6 @@ exports[` should render a room list 1`] = ` > room4 -
@@ -339,9 +324,6 @@ exports[` should render a room list 1`] = ` > room5 -
@@ -393,9 +375,6 @@ exports[` should render a room list 1`] = ` > room6 -
@@ -447,9 +426,6 @@ exports[` should render a room list 1`] = ` > room7 -
@@ -501,9 +477,6 @@ exports[` should render a room list 1`] = ` > room8 -
@@ -555,9 +528,6 @@ exports[` should render a room list 1`] = ` > room9 -
diff --git a/test/unit-tests/components/views/rooms/RoomListPanel/__snapshots__/RoomListItemView-test.tsx.snap b/test/unit-tests/components/views/rooms/RoomListPanel/__snapshots__/RoomListItemView-test.tsx.snap index 4340cb4200..ddadd26105 100644 --- a/test/unit-tests/components/views/rooms/RoomListPanel/__snapshots__/RoomListItemView-test.tsx.snap +++ b/test/unit-tests/components/views/rooms/RoomListPanel/__snapshots__/RoomListItemView-test.tsx.snap @@ -45,9 +45,6 @@ exports[` should be selected if isSelected=true 1`] = ` > room1 -
@@ -100,9 +97,6 @@ exports[` should display notification decoration 1`] = ` > room1 -
-
@@ -224,8 +215,9 @@ exports[` should render a room item with a message preview 1
- The message looks list this + The message looks like this