@@ -32,6 +32,8 @@ import DMRoomMap from "../../../../src/utils/DMRoomMap";
3232import dis from "../../../../src/dispatcher/dispatcher" ;
3333import { Action } from "../../../../src/dispatcher/actions" ;
3434import { IRoomState } from "../../../../src/components/structures/RoomView" ;
35+ import PinningUtils from "../../../../src/utils/PinningUtils" ;
36+ import { Layout } from "../../../../src/settings/enums/Layout" ;
3537
3638describe ( "EventTile" , ( ) => {
3739 const ROOM_ID = "!roomId:example.org" ;
@@ -91,6 +93,10 @@ describe("EventTile", () => {
9193 } ) ;
9294 } ) ;
9395
96+ afterEach ( ( ) => {
97+ jest . spyOn ( PinningUtils , "isPinned" ) . mockReturnValue ( false ) ;
98+ } ) ;
99+
94100 describe ( "EventTile thread summary" , ( ) => {
95101 beforeEach ( ( ) => {
96102 jest . spyOn ( client , "supportsThreads" ) . mockReturnValue ( true ) ;
@@ -154,6 +160,27 @@ describe("EventTile", () => {
154160 } ) ;
155161 } ) ;
156162
163+ describe ( "EventTile renderingType: Threads" , ( ) => {
164+ it ( "should display the pinned message badge" , async ( ) => {
165+ jest . spyOn ( PinningUtils , "isPinned" ) . mockReturnValue ( true ) ;
166+ getComponent ( { } , TimelineRenderingType . Thread ) ;
167+
168+ expect ( screen . getByText ( "Pinned message" ) ) . toBeInTheDocument ( ) ;
169+ } ) ;
170+ } ) ;
171+
172+ describe ( "EventTile renderingType: default" , ( ) => {
173+ it . each ( [ [ Layout . Group ] , [ Layout . Bubble ] , [ Layout . IRC ] ] ) (
174+ "should display the pinned message badge" ,
175+ async ( layout ) => {
176+ jest . spyOn ( PinningUtils , "isPinned" ) . mockReturnValue ( true ) ;
177+ getComponent ( { layout } ) ;
178+
179+ expect ( screen . getByText ( "Pinned message" ) ) . toBeInTheDocument ( ) ;
180+ } ,
181+ ) ;
182+ } ) ;
183+
157184 describe ( "EventTile in the right panel" , ( ) => {
158185 beforeAll ( ( ) => {
159186 const dmRoomMap : DMRoomMap = {
0 commit comments