@@ -32,6 +32,8 @@ import DMRoomMap from "../../../../src/utils/DMRoomMap";
32
32
import dis from "../../../../src/dispatcher/dispatcher" ;
33
33
import { Action } from "../../../../src/dispatcher/actions" ;
34
34
import { IRoomState } from "../../../../src/components/structures/RoomView" ;
35
+ import PinningUtils from "../../../../src/utils/PinningUtils" ;
36
+ import { Layout } from "../../../../src/settings/enums/Layout" ;
35
37
36
38
describe ( "EventTile" , ( ) => {
37
39
const ROOM_ID = "!roomId:example.org" ;
@@ -91,6 +93,10 @@ describe("EventTile", () => {
91
93
} ) ;
92
94
} ) ;
93
95
96
+ afterEach ( ( ) => {
97
+ jest . spyOn ( PinningUtils , "isPinned" ) . mockReturnValue ( false ) ;
98
+ } ) ;
99
+
94
100
describe ( "EventTile thread summary" , ( ) => {
95
101
beforeEach ( ( ) => {
96
102
jest . spyOn ( client , "supportsThreads" ) . mockReturnValue ( true ) ;
@@ -154,6 +160,27 @@ describe("EventTile", () => {
154
160
} ) ;
155
161
} ) ;
156
162
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
+
157
184
describe ( "EventTile in the right panel" , ( ) => {
158
185
beforeAll ( ( ) => {
159
186
const dmRoomMap : DMRoomMap = {
0 commit comments