-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chat messages selectable / copyable #521
Closed
Closed
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
87b45a1
chat messages selectable / copyable
nnice f4c327a
Merge branch 'master' of github.com:Qabel/qabel-desktop into 519_chat…
nnice 0d7f53d
Merge branch 'master' of github.com:Qabel/qabel-desktop into 519_chat…
nnice 4d8b42c
the background color set to the right color, transparent doenst work …
nnice 45aea73
add InlineCssTextArea to style the textarea better
nnice 0167fb9
this should do it
nnice f31d558
cleanup and removed scenic view, add forgot selector and definitions…
nnice 5640c74
cleanup and removed scenic view, add forgot selector and definitions…
nnice File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ public void testSendMessage() { | |
String text = "Message"; | ||
waitUntil(() -> controller.textarea != null); | ||
Identity i = controller.identity; | ||
controller.contact = new Contact(i.getAlias(),i.getDropUrls(), i.getEcPublicKey()); | ||
controller.contact = new Contact(i.getAlias(), i.getDropUrls(), i.getEcPublicKey()); | ||
clickOn("#textarea").write(text); | ||
robot.push(KeyCode.ENTER); | ||
List<DropMessage> list = receiveMessages(); | ||
|
@@ -48,6 +48,22 @@ private List<DropMessage> receiveMessages() { | |
@Test | ||
public void multilineInput() { | ||
controller.contact = new Contact(identity.getAlias(), identity.getDropUrls(), identity.getEcPublicKey()); | ||
writeTwoLinesOfText(); | ||
|
||
submitChat(); | ||
|
||
DropMessage message = receiveMessages().get(0); | ||
assertEquals(DropMessageRepository.PAYLOAD_TYPE_MESSAGE, message.getDropPayloadType()); | ||
assertEquals("line1\nline2", TextMessage.fromJson(message.getDropPayload()).getText()); | ||
} | ||
|
||
private void submitChat() { | ||
assertTrue(receiveMessages().isEmpty()); | ||
robot.push(KeyCode.ENTER); | ||
assertFalse(receiveMessages().isEmpty()); | ||
} | ||
|
||
private void writeTwoLinesOfText() { | ||
FxRobot textArea = clickOn("#textarea"); | ||
textArea.write("line1"); | ||
robot.press(KeyCode.SHIFT); | ||
|
@@ -57,16 +73,21 @@ public void multilineInput() { | |
robot.release(KeyCode.SHIFT); | ||
} | ||
robot.write("line2"); | ||
} | ||
|
||
assertTrue(receiveMessages().isEmpty()); | ||
robot.push(KeyCode.ENTER); | ||
assertFalse(receiveMessages().isEmpty()); | ||
|
||
DropMessage message = receiveMessages().get(0); | ||
assertEquals(DropMessageRepository.PAYLOAD_TYPE_MESSAGE, message.getDropPayloadType()); | ||
assertEquals("line1\nline2", TextMessage.fromJson(message.getDropPayload()).getText()); | ||
private void writeTwoLinesOfText(String line1, String line2) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unused. Either remove it or use it instead of writeTwoLinesOfText. I would prefer the latter because it increases the tests readability / clearifies the intent: writeTwoLinesOfText("line1", "line2");
...
assertEquals("line1\nline2", ...); |
||
FxRobot textArea = clickOn("#textarea"); | ||
textArea.write(line1); | ||
robot.press(KeyCode.SHIFT); | ||
try { | ||
robot.push(KeyCode.ENTER); | ||
} finally { | ||
robot.release(KeyCode.SHIFT); | ||
} | ||
robot.write(line2); | ||
} | ||
|
||
|
||
@Test | ||
public void testSendMessageWithoutContent() { | ||
waitUntil(() -> controller.textarea != null); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works but in html this would be very expensive because it selects from right to left and would select every element and then check its perent recursively. Not sure how javafx does this but I would prefer to replace
*
by the exact element if you can figure that out. Scenic View might be of help...