@@ -67,7 +67,9 @@ import io.element.android.libraries.matrix.test.room.aRoomSummary
67
67
import io.element.android.libraries.matrix.test.roomlist.FakeRoomListService
68
68
import io.element.android.libraries.matrix.test.sync.FakeSyncService
69
69
import io.element.android.libraries.matrix.test.verification.FakeSessionVerificationService
70
+ import io.element.android.libraries.preferences.api.store.AppPreferencesStore
70
71
import io.element.android.libraries.preferences.api.store.SessionPreferencesStore
72
+ import io.element.android.libraries.preferences.test.InMemoryAppPreferencesStore
71
73
import io.element.android.libraries.preferences.test.InMemorySessionPreferencesStore
72
74
import io.element.android.libraries.push.api.notifications.NotificationCleaner
73
75
import io.element.android.libraries.push.test.notifications.FakeNotificationCleaner
@@ -312,6 +314,35 @@ class RoomListPresenterTest {
312
314
}
313
315
}
314
316
317
+ @Test
318
+ fun `present - show context menu with view source on` () = runTest {
319
+ val presenter = createRoomListPresenter(
320
+ appPreferencesStore = InMemoryAppPreferencesStore (
321
+ isDeveloperModeEnabled = true ,
322
+ )
323
+ )
324
+ presenter.test {
325
+ val initialState = awaitItem()
326
+ val summary = createRoomListRoomSummary()
327
+ initialState.eventSink(RoomListEvents .ShowContextMenu (summary))
328
+ awaitItem().also { state ->
329
+ assertThat(state.contextMenu)
330
+ .isEqualTo(
331
+ RoomListState .ContextMenu .Shown (
332
+ roomId = summary.roomId,
333
+ roomName = summary.name,
334
+ isDm = false ,
335
+ isFavorite = false ,
336
+ markAsUnreadFeatureFlagEnabled = true ,
337
+ // true here.
338
+ eventCacheFeatureFlagEnabled = true ,
339
+ hasNewContent = false ,
340
+ )
341
+ )
342
+ }
343
+ }
344
+ }
345
+
315
346
@Test
316
347
fun `present - hide context menu` () = runTest {
317
348
val room = FakeMatrixRoom ()
@@ -643,6 +674,7 @@ class RoomListPresenterTest {
643
674
searchPresenter : Presenter <RoomListSearchState > = Presenter { aRoomListSearchState() },
644
675
acceptDeclineInvitePresenter : Presenter <AcceptDeclineInviteState > = Presenter { anAcceptDeclineInviteState() },
645
676
notificationCleaner : NotificationCleaner = FakeNotificationCleaner (),
677
+ appPreferencesStore : AppPreferencesStore = InMemoryAppPreferencesStore (),
646
678
) = RoomListPresenter (
647
679
client = client,
648
680
syncService = syncService,
@@ -672,6 +704,7 @@ class RoomListPresenterTest {
672
704
fullScreenIntentPermissionsPresenter = { aFullScreenIntentPermissionsState() },
673
705
notificationCleaner = notificationCleaner,
674
706
logoutPresenter = { aDirectLogoutState() },
707
+ appPreferencesStore = appPreferencesStore,
675
708
)
676
709
}
677
710
0 commit comments