@@ -494,4 +494,48 @@ class TextStorageTests: XCTestCase {
494494
495495 XCTAssertEqual ( expectedResult, result)
496496 }
497+
498+ func testEmptyListOutput( ) {
499+ let initialHTML = " <ul><li></li></ul> "
500+
501+ // Setup
502+ let defaultAttributes : [ NSAttributedString . Key : Any ] = [ . font: UIFont . systemFont ( ofSize: 14 ) ,
503+ . paragraphStyle: ParagraphStyle . default]
504+
505+ storage. setHTML ( initialHTML, defaultAttributes: defaultAttributes)
506+ var expectedResult = String ( . paragraphSeparator)
507+ var result = String ( storage. string)
508+
509+ XCTAssertEqual ( expectedResult, result)
510+
511+ storage. htmlConverter. characterToReplaceLastEmptyLine = Character ( . zeroWidthSpace)
512+
513+ storage. setHTML ( initialHTML, defaultAttributes: defaultAttributes)
514+ expectedResult = String ( . zeroWidthSpace)
515+ result = String ( storage. string)
516+
517+ XCTAssertEqual ( expectedResult, result)
518+ }
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+ }
497541}
0 commit comments