Skip to content

Commit 4019c7e

Browse files
Merge pull request #1267 from wordpress-mobile/issue/1266_links_with_mix_characters
Issue/1266 links with mixed characters
2 parents f90d62d + 27cfe82 commit 4019c7e

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

Aztec/Classes/Libxml2/DOM/Data/Element.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public struct Element: RawRepresentable, Hashable {
3030
public static var mergeableBlockLevelElements = Set<Element>([.blockquote, .div, .figure, .figcaption, .h1, .h2, .h3, .h4, .h5, .h6, .hr, .li, .ol, .ul, .p, .pre])
3131

3232
/// List of style HTML elements that can be merged together when they are sibling to each other
33-
public static var mergeableStyleElements = Set<Element>([.i, .em, .b, .strong, .strike, .u, .code, .cite])
33+
public static var mergeableStyleElements = Set<Element>([.i, .em, .b, .strong, .strike, .u, .code, .cite, .a])
3434

3535
/// List of block level elements that can be merged but only when they have a single children that is also mergeable
3636
///

AztecTests/TextKit/TextViewTests.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,4 +2106,14 @@ class TextViewTests: XCTestCase {
21062106
XCTAssertEqual(attributes[.foregroundColor] as! UIColor,UIColor.green)
21072107
}
21082108

2109+
func testLinksWithMultipleCharactersNonLatinDontBreak() {
2110+
let textView = TextViewStub(withHTML: "<p><a href=\"www.worpdress.com\">WordPress 워드 프레스</a></p>")
2111+
let html = textView.getHTML()
2112+
XCTAssertEqual(html, "<p><a href=\"www.worpdress.com\">WordPress 워드 프레스</a></p>")
2113+
2114+
textView.setHTML("<p><a href=\"www.worpdress.com\">WordPress</a><a href=\"www.jetpack.com\">워드 프레스</a></p>")
2115+
let htmlTwoLinks = textView.getHTML()
2116+
XCTAssertEqual(htmlTwoLinks, "<p><a href=\"www.worpdress.com\">WordPress</a><a href=\"www.jetpack.com\">워드 프레스</a></p>")
2117+
}
2118+
21092119
}

0 commit comments

Comments
 (0)