mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Replies now display mentions with @displayname (#1957)
* reply with mentions * fixed a bug and wrote a test for it * error message
This commit is contained in:
@@ -555,6 +555,52 @@ class AttributedStringBuilderTests: XCTestCase {
|
||||
XCTAssertEqual(foundLink, url)
|
||||
XCTAssertEqual(foundAttachments, 2)
|
||||
}
|
||||
|
||||
func testMultipleMentions2() {
|
||||
guard let url = URL(string: "https://matrix.to/#/@test:matrix.org") else {
|
||||
XCTFail("Invalid url")
|
||||
return
|
||||
}
|
||||
|
||||
let string = "\(url) @room"
|
||||
guard let attributedStringFromHTML = attributedStringBuilder.fromHTML(string) else {
|
||||
XCTFail("Attributed string is nil")
|
||||
return
|
||||
}
|
||||
|
||||
var foundAttachments = 0
|
||||
var foundLink: URL?
|
||||
for run in attributedStringFromHTML.runs {
|
||||
if run.attachment != nil {
|
||||
foundAttachments += 1
|
||||
}
|
||||
|
||||
if let link = run.link {
|
||||
foundLink = link
|
||||
}
|
||||
}
|
||||
XCTAssertEqual(foundLink, url)
|
||||
XCTAssertEqual(foundAttachments, 2)
|
||||
|
||||
guard let attributedStringFromPlain = attributedStringBuilder.fromPlain(string) else {
|
||||
XCTFail("Attributed string is nil")
|
||||
return
|
||||
}
|
||||
|
||||
foundAttachments = 0
|
||||
foundLink = nil
|
||||
for run in attributedStringFromPlain.runs {
|
||||
if run.attachment != nil {
|
||||
foundAttachments += 1
|
||||
}
|
||||
|
||||
if let link = run.link {
|
||||
foundLink = link
|
||||
}
|
||||
}
|
||||
XCTAssertEqual(foundLink, url)
|
||||
XCTAssertEqual(foundAttachments, 2)
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d20d3c8a4bcebf86630fb5173f1e19b80c25fa2aad136024cbc36c876cca47cb
|
||||
size 132631
|
||||
oid sha256:23ba537d93a78dd7c69dc1d9482ae972ba50f0eb05dadbcb0f0ecc2b9fea2695
|
||||
size 145983
|
||||
|
||||
Reference in New Issue
Block a user