@@ -22,7 +22,7 @@ import { EventType, MatrixEvent, Room } from "matrix-js-sdk/src/matrix";
22
22
23
23
import dis from "../../../../src/dispatcher/dispatcher" ;
24
24
import SettingsStore from "../../../../src/settings/SettingsStore" ;
25
- import { RoomCreate } from "../../../../src/components/views/messages/RoomCreate " ;
25
+ import { RoomPredecessorTile } from "../../../../src/components/views/messages/RoomPredecessorTile " ;
26
26
import { stubClient , upsertRoomStateEvents } from "../../../test-utils/test-utils" ;
27
27
import { Action } from "../../../../src/dispatcher/actions" ;
28
28
import RoomContext from "../../../../src/contexts/RoomContext" ;
@@ -31,7 +31,7 @@ import { MatrixClientPeg } from "../../../../src/MatrixClientPeg";
31
31
32
32
jest . mock ( "../../../../src/dispatcher/dispatcher" ) ;
33
33
34
- describe ( "<RoomCreate />" , ( ) => {
34
+ describe ( "<RoomPredecessorTile />" , ( ) => {
35
35
const userId = "@alice:server.org" ;
36
36
const roomId = "!room:server.org" ;
37
37
const createEvent = new MatrixEvent ( {
@@ -97,34 +97,34 @@ describe("<RoomCreate />", () => {
97
97
jest . spyOn ( SettingsStore , "setValue" ) . mockRestore ( ) ;
98
98
} ) ;
99
99
100
- function renderRoomCreate ( room : Room ) {
100
+ function renderTile ( room : Room ) {
101
101
return render (
102
102
< RoomContext . Provider value = { getRoomContext ( room , { } ) } >
103
- < RoomCreate mxEvent = { createEvent } />
103
+ < RoomPredecessorTile mxEvent = { createEvent } />
104
104
</ RoomContext . Provider > ,
105
105
) ;
106
106
}
107
107
108
108
it ( "Renders as expected" , ( ) => {
109
- const roomCreate = renderRoomCreate ( roomJustCreate ) ;
109
+ const roomCreate = renderTile ( roomJustCreate ) ;
110
110
expect ( roomCreate . asFragment ( ) ) . toMatchSnapshot ( ) ;
111
111
} ) ;
112
112
113
113
it ( "Links to the old version of the room" , ( ) => {
114
- renderRoomCreate ( roomJustCreate ) ;
114
+ renderTile ( roomJustCreate ) ;
115
115
expect ( screen . getByText ( "Click here to see older messages." ) ) . toHaveAttribute (
116
116
"href" ,
117
117
"https://matrix.to/#/old_room_id/tombstone_event_id" ,
118
118
) ;
119
119
} ) ;
120
120
121
121
it ( "Shows an empty div if there is no predecessor" , ( ) => {
122
- renderRoomCreate ( roomNoPredecessors ) ;
122
+ renderTile ( roomNoPredecessors ) ;
123
123
expect ( screen . queryByText ( "Click here to see older messages." , { exact : false } ) ) . toBeNull ( ) ;
124
124
} ) ;
125
125
126
126
it ( "Opens the old room on click" , async ( ) => {
127
- renderRoomCreate ( roomJustCreate ) ;
127
+ renderTile ( roomJustCreate ) ;
128
128
const link = screen . getByText ( "Click here to see older messages." ) ;
129
129
130
130
await act ( ( ) => userEvent . click ( link ) ) ;
@@ -142,7 +142,7 @@ describe("<RoomCreate />", () => {
142
142
} ) ;
143
143
144
144
it ( "Ignores m.predecessor if labs flag is off" , ( ) => {
145
- renderRoomCreate ( roomCreateAndPredecessor ) ;
145
+ renderTile ( roomCreateAndPredecessor ) ;
146
146
expect ( screen . getByText ( "Click here to see older messages." ) ) . toHaveAttribute (
147
147
"href" ,
148
148
"https://matrix.to/#/old_room_id/tombstone_event_id" ,
@@ -161,23 +161,23 @@ describe("<RoomCreate />", () => {
161
161
} ) ;
162
162
163
163
it ( "Uses the create event if there is no m.predecessor" , ( ) => {
164
- renderRoomCreate ( roomJustCreate ) ;
164
+ renderTile ( roomJustCreate ) ;
165
165
expect ( screen . getByText ( "Click here to see older messages." ) ) . toHaveAttribute (
166
166
"href" ,
167
167
"https://matrix.to/#/old_room_id/tombstone_event_id" ,
168
168
) ;
169
169
} ) ;
170
170
171
171
it ( "Uses m.predecessor when it's there" , ( ) => {
172
- renderRoomCreate ( roomCreateAndPredecessor ) ;
172
+ renderTile ( roomCreateAndPredecessor ) ;
173
173
expect ( screen . getByText ( "Click here to see older messages." ) ) . toHaveAttribute (
174
174
"href" ,
175
175
"https://matrix.to/#/old_room_id_from_predecessor" ,
176
176
) ;
177
177
} ) ;
178
178
179
179
it ( "Links to the event in the room if event ID is provided" , ( ) => {
180
- renderRoomCreate ( roomCreateAndPredecessorWithEventId ) ;
180
+ renderTile ( roomCreateAndPredecessorWithEventId ) ;
181
181
expect ( screen . getByText ( "Click here to see older messages." ) ) . toHaveAttribute (
182
182
"href" ,
183
183
"https://matrix.to/#/old_room_id_from_predecessor/tombstone_event_id_from_predecessor" ,
0 commit comments