Skip to content

Commit

Permalink
Add tests showing parsing handling of <br> nested in <p> vs <div>
Browse files Browse the repository at this point in the history
  • Loading branch information
mchowning committed Apr 11, 2019
1 parent 7e968c3 commit 1ee4b20
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions aztec/src/test/kotlin/org/wordpress/aztec/AztecParserTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1228,4 +1228,23 @@ class AztecParserTest : AndroidTestCase() {
val output = mParser.toHtml(span)
Assert.assertEquals(input, output)
}

@Test
@Throws(Exception::class)
fun parseParagraphContainingLineBreak() {
val input = "<p>a<br></p>"
val span = SpannableString(mParser.fromHtml(input, RuntimeEnvironment.application.applicationContext))
val output = mParser.toHtml(span)
Assert.assertEquals("<p>a</p>", output) // removes <br> tag
}

@Test
@Throws(Exception::class)
fun parseDivContainingLineBreak() {
val input = "<div>a<br></div>"
val span = SpannableString(mParser.fromHtml(input, RuntimeEnvironment.application.applicationContext))
val output = mParser.toHtml(span)
Assert.assertEquals("<div>a</div><br>", output) // moves, but does not remove, <br> tag
}

}

0 comments on commit 1ee4b20

Please sign in to comment.