mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Fixed the link color and improved link dection in code blocks (#2466)
This commit is contained in:
@@ -493,11 +493,22 @@ class AttributedStringBuilderTests: XCTestCase {
|
||||
checkAttachment(attributedString: attributedStringFromPlain2, expectedRuns: 1)
|
||||
}
|
||||
|
||||
func testLinksAreIgnoredInCode() {
|
||||
let htmlString = "<pre><code>test https://matrix.org test</code></pre>"
|
||||
let attributedStringFromHTML = attributedStringBuilder.fromHTML(htmlString)
|
||||
func testURLsAreIgnoredInCode() {
|
||||
var htmlString = "<pre><code>test https://matrix.org test</code></pre>"
|
||||
var attributedStringFromHTML = attributedStringBuilder.fromHTML(htmlString)
|
||||
XCTAssert(attributedStringFromHTML?.runs.count == 1)
|
||||
XCTAssertNil(attributedStringFromHTML?.link)
|
||||
|
||||
htmlString = "<pre><code>matrix.org</code></pre>"
|
||||
attributedStringFromHTML = attributedStringBuilder.fromHTML(htmlString)
|
||||
XCTAssert(attributedStringFromHTML?.runs.count == 1)
|
||||
XCTAssertNil(attributedStringFromHTML?.link)
|
||||
}
|
||||
|
||||
func testHyperlinksAreNotIgnoredInCode() {
|
||||
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)
|
||||
}
|
||||
|
||||
func testUserMentionIsIgnoredInCode() {
|
||||
|
||||
Reference in New Issue
Block a user