Page MenuHomePhorge

D92.1732349514.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D92.1732349514.diff

diff --git a/src/contents/ui/room-settings/RoomSettingsPage.qml b/src/contents/ui/room-settings/RoomSettingsPage.qml
--- a/src/contents/ui/room-settings/RoomSettingsPage.qml
+++ b/src/contents/ui/room-settings/RoomSettingsPage.qml
@@ -173,6 +173,7 @@
}
Button {
+ objectName: 'leaveRoomButton'
text: l10n.get('room-leave-action')
Layout.fillWidth: true
onClicked: {
@@ -192,6 +193,7 @@
}
property var confirmLeaveOverlay: Kazv.ConfirmationOverlay {
+ objectName: 'confirmLeaveRoomPopup'
parent: roomSettingsPage.overlay
title: l10n.get('room-leave-confirm-popup-title')
message: l10n.get('room-leave-confirm-popup-message')
@@ -205,10 +207,10 @@
trigger: () => room.leaveRoom()
onResolved: {
if (success) {
- showPassiveNotification(l10n.get('leave-room-success-prompt', { room: roomId }));
+ showPassiveNotification(l10n.get('leave-room-success-prompt', { room: room.roomId }));
inviteOverlay.close();
} else {
- showPassiveNotification(l10n.get('leave-room-failed-prompt', { room: roomId, errorCode: data.errorCode, errorMsg: data.error }));
+ showPassiveNotification(l10n.get('leave-room-failed-prompt', { room: room.roomId, errorCode: data.errorCode, errorMsg: data.error }));
}
}
}
diff --git a/src/tests/quick-tests/tst_RoomSettingsPage.qml b/src/tests/quick-tests/tst_RoomSettingsPage.qml
--- a/src/tests/quick-tests/tst_RoomSettingsPage.qml
+++ b/src/tests/quick-tests/tst_RoomSettingsPage.qml
@@ -39,7 +39,8 @@
})
property var roomJoined: Helpers.factory.room({
- membership: MK.MatrixRoom.Join
+ membership: MK.MatrixRoom.Join,
+ leaveRoom: mockHelper.promise(),
})
property var showPassiveNotification: mockHelper.noop()
@@ -117,5 +118,24 @@
roomLeft.forgetRoom.lastRetVal().resolve(false, {});
tryVerify(() => item.showPassiveNotification.calledTimes() === 1);
}
+
+ function test_leaveRoom() {
+ const leaveRoomButton = findChild(pageJoined, 'leaveRoomButton');
+ const confirmPopup = findChild(pageJoined, 'confirmLeaveRoomPopup');
+ verify(leaveRoomButton.visible);
+
+ confirmPopup.accepted();
+ tryVerify(() => roomJoined.leaveRoom.calledTimes() === 1);
+ roomJoined.leaveRoom.lastRetVal().resolve(true, {});
+ console.log(roomJoined.membership);
+ tryVerify(() => item.showPassiveNotification.calledTimes() === 1);
+ }
+
+ function test_leaveRoomFailure() {
+ const confirmPopup = findChild(pageJoined, 'confirmLeaveRoomPopup');
+ confirmPopup.accepted();
+ roomJoined.leaveRoom.lastRetVal().resolve(false, {});
+ tryVerify(() => item.showPassiveNotification.calledTimes() === 1);
+ }
}
}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 12:11 AM (16 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39120
Default Alt Text
D92.1732349514.diff (2 KB)

Event Timeline