Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F114633
D111.1732569223.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D111.1732569223.diff
View Options
diff --git a/src/contents/ui/SendMessageBox.qml b/src/contents/ui/SendMessageBox.qml
--- a/src/contents/ui/SendMessageBox.qml
+++ b/src/contents/ui/SendMessageBox.qml
@@ -181,6 +181,7 @@
}
ToolButton {
+ objectName: 'sendButton'
action: sendAction
display: AbstractButton.IconOnly
}
@@ -235,6 +236,7 @@
sendMessageBox.draftRelType = '';
sendMessageBox.draftRelatedTo = '';
}
+ enabled: textArea.text !== ''
}
Kirigami.Action {
id: sendMediaFileAction
diff --git a/src/tests/quick-tests/tst_SendMessageBox.qml b/src/tests/quick-tests/tst_SendMessageBox.qml
--- a/src/tests/quick-tests/tst_SendMessageBox.qml
+++ b/src/tests/quick-tests/tst_SendMessageBox.qml
@@ -20,6 +20,7 @@
width: 800
height: 600
+ property var mockHelper: TestHelpers.MockHelper {}
function makeRoom () {
return {
timeline () {
@@ -41,6 +42,8 @@
members () {
return membersModel;
},
+ setTyping: mockHelper.noop(),
+ sendTextMessage: mockHelper.noop(),
};
}
@@ -73,6 +76,7 @@
function init() {
membersModel.count = 2;
findChild(sendMessageBox, 'draftMessage').text = '';
+ mockHelper.clearAll();
}
function test_empty() {
@@ -204,5 +208,18 @@
const completionPopup = findChild(sendMessageBox, 'completionPopup');
tryVerify(() => !completionPopup.opened);
}
+
+ function test_emptySend() {
+ mouseClick(findChild(sendMessageBox, 'sendButton'));
+ verify(room.sendTextMessage.calledTimes() === 0);
+
+ const textArea = findChild(sendMessageBox, 'draftMessage');
+ mouseClick(textArea);
+ tryVerify(() => textArea.activeFocus);
+ keySequence('Ctrl+Enter');
+ verify(room.sendTextMessage.calledTimes() === 0);
+ keySequence('Ctrl+Return');
+ verify(room.sendTextMessage.calledTimes() === 0);
+ }
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 1:13 PM (11 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39816
Default Alt Text
D111.1732569223.diff (1 KB)
Attached To
Mode
D111: Prevent user from sending an empty message
Attached
Detach File
Event Timeline
Log In to Comment