mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Fixes #2807 - Stop inserting string attributes to code blocks.
This commit is contained in:
committed by
Stefan Ceriu
parent
45ac47ce16
commit
77f92ad068
@@ -491,10 +491,10 @@ class AttributedStringBuilderTests: XCTestCase {
|
||||
XCTAssertNil(attributedStringFromHTML?.link)
|
||||
}
|
||||
|
||||
func testHyperlinksAreNotIgnoredInCode() {
|
||||
func testHyperlinksAreIgnoredInCode() {
|
||||
let htmlString = "<pre><code>test <a href=\"https://matrix.org\">matrix</a> test</code></pre>"
|
||||
let attributedStringFromHTML = attributedStringBuilder.fromHTML(htmlString)
|
||||
checkLinkIn(attributedString: attributedStringFromHTML, expectedLink: "https://matrix.org", expectedRuns: 3)
|
||||
XCTAssertNil(attributedStringFromHTML?.link)
|
||||
}
|
||||
|
||||
func testUserMentionIsIgnoredInCode() {
|
||||
@@ -504,6 +504,13 @@ class AttributedStringBuilderTests: XCTestCase {
|
||||
XCTAssertNil(attributedStringFromHTML?.attachment)
|
||||
}
|
||||
|
||||
func testPlainTextUserMentionIsIgnoredInCode() {
|
||||
let htmlString = "<pre><code>Hey @some.user.ceriu:matrix.org</code></pre>"
|
||||
let attributedStringFromHTML = attributedStringBuilder.fromHTML(htmlString)
|
||||
XCTAssert(attributedStringFromHTML?.runs.count == 1)
|
||||
XCTAssertNil(attributedStringFromHTML?.attachment)
|
||||
}
|
||||
|
||||
func testAllUsersIsIgnoredInCode() {
|
||||
let htmlString = "<pre><code>test @room test</code></pre>"
|
||||
let attributedStringFromHTML = attributedStringBuilder.fromHTML(htmlString)
|
||||
|
||||
Reference in New Issue
Block a user