Skip to content

Commit 4d5551e

Browse files
committed
Add extra unit test to check if only paragraph separator is replaced.
1 parent cb29d33 commit 4d5551e

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

AztecTests/TextKit/TextStorageTests.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,4 +516,26 @@ class TextStorageTests: XCTestCase {
516516

517517
XCTAssertEqual(expectedResult, result)
518518
}
519+
520+
func testCiteOutput() {
521+
let initialHTML = "<cite>Hello<br></cite>"
522+
523+
// Setup
524+
let defaultAttributes: [NSAttributedString.Key: Any] = [.font: UIFont.systemFont(ofSize: 14),
525+
.paragraphStyle: ParagraphStyle.default]
526+
527+
storage.setHTML(initialHTML, defaultAttributes: defaultAttributes)
528+
var expectedResult = String("Hello")+String(.lineSeparator)
529+
var result = String(storage.string)
530+
531+
XCTAssertEqual(expectedResult, result)
532+
533+
storage.htmlConverter.characterToReplaceLastEmptyLine = Character(.zeroWidthSpace)
534+
535+
storage.setHTML(initialHTML, defaultAttributes: defaultAttributes)
536+
expectedResult = String("Hello")+String(.lineSeparator)
537+
result = String(storage.string)
538+
539+
XCTAssertEqual(expectedResult, result)
540+
}
519541
}

0 commit comments

Comments
 (0)