mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 11:58:32 +00:00
Add proper separated blockquotes fixtures and fix the tests.
This commit is contained in:
@@ -68,9 +68,11 @@ enum HTMLFixtures: String, CaseIterable {
|
|||||||
"""
|
"""
|
||||||
case .separatedBlockQuotes:
|
case .separatedBlockQuotes:
|
||||||
"""
|
"""
|
||||||
<blockquote>First blockquote with a <a href=\"https://www.matrix.org/\">link</a> in it</blockquote>
|
Text before blockquote
|
||||||
<blockquote>Second blockquote with a <a href=\"https://www.matrix.org/\">link</a> in it</blockquote>
|
<blockquote>Some blockquote</blockquote>
|
||||||
<blockquote>Third blockquote with a <a href=\"https://www.matrix.org/\">link</a> in it</blockquote>
|
Text after first blockquote
|
||||||
|
<blockquote>Some other blockquote</blockquote>
|
||||||
|
Text after second blockquote
|
||||||
"""
|
"""
|
||||||
case .codeBlocks:
|
case .codeBlocks:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -424,19 +424,19 @@ class AttributedStringBuilderV1Tests: XCTestCase {
|
|||||||
let coalescedComponents = attributedString.formattedComponents
|
let coalescedComponents = attributedString.formattedComponents
|
||||||
|
|
||||||
if AttributedStringBuilder.useNextGenHTMLParser {
|
if AttributedStringBuilder.useNextGenHTMLParser {
|
||||||
XCTAssertEqual(attributedString.runs.count, 11)
|
XCTAssertEqual(attributedString.runs.count, 5)
|
||||||
XCTAssertEqual(coalescedComponents.count, 5)
|
XCTAssertEqual(coalescedComponents.count, 5)
|
||||||
} else {
|
} else {
|
||||||
XCTAssertEqual(attributedString.runs.count, 7)
|
XCTAssertEqual(attributedString.runs.count, 6)
|
||||||
XCTAssertEqual(coalescedComponents.count, 1)
|
XCTAssertEqual(coalescedComponents.count, 5)
|
||||||
}
|
}
|
||||||
|
|
||||||
var numberOfBlockquotes = 0
|
var numberOfBlockquotes = 0
|
||||||
for run in attributedString.runs where run.elementX.blockquote ?? false && run.link != nil {
|
for run in attributedString.runs where run.elementX.blockquote ?? false {
|
||||||
numberOfBlockquotes += 1
|
numberOfBlockquotes += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertEqual(numberOfBlockquotes, 3, "Couldn't find all the blockquotes")
|
XCTAssertEqual(numberOfBlockquotes, 2, "Couldn't find all the blockquotes")
|
||||||
}
|
}
|
||||||
|
|
||||||
func testUserPermalinkMentionAtachment() {
|
func testUserPermalinkMentionAtachment() {
|
||||||
|
|||||||
Reference in New Issue
Block a user