Skip to content

Commit d77712e

Browse files
committed
Add quote and list tests
1 parent 23eb282 commit d77712e

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

app/src/androidTest/kotlin/org/wordpress/aztec/demo/tests/MixedTextFormattingTests.kt

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class MixedTextFormattingTests : BaseTest() {
169169

170170
@Test
171171
fun testQuotedListFormatting() {
172-
var text = "some text\nsome text\nsome text"
172+
val text = "some text\nsome text\nsome text"
173173
val html = "<blockquote><ul><li>some text</li><li>some text</li><li>some text</li></ul></blockquote>"
174174

175175
EditorPage()
@@ -179,4 +179,33 @@ class MixedTextFormattingTests : BaseTest() {
179179
.toggleHtml()
180180
.verifyHTML(html)
181181
}
182+
183+
@Test
184+
fun testQuotedListRemoveListFormatting() {
185+
val text = "some text\nsome text\nsome text"
186+
val html = "<blockquote><ul><li>some text</li><li>some text</li></ul>\nsome text</blockquote>"
187+
188+
EditorPage()
189+
.toggleQuote()
190+
.makeList(EditorPage.ListStyle.UNORDERED)
191+
.insertText(text)
192+
.makeList(EditorPage.ListStyle.UNORDERED)
193+
.toggleHtml()
194+
.verifyHTML(html)
195+
}
196+
197+
@Test
198+
fun testListwithQuoteFormatting() {
199+
val text1 = "some text\nsome text\nsome text\n"
200+
val text2 = "some text"
201+
val html = "<ul><li>some text</li><li>some text</li><li>some text</li><li><blockquote>some text</blockquote></li></ul>"
202+
203+
EditorPage()
204+
.makeList(EditorPage.ListStyle.UNORDERED)
205+
.insertText(text1)
206+
.toggleQuote()
207+
.insertText(text2)
208+
.toggleHtml()
209+
.verifyHTML(html)
210+
}
182211
}

app/src/androidTest/kotlin/org/wordpress/aztec/demo/tests/SimpleTextFormattingTests.kt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,29 @@ class SimpleTextFormattingTests : BaseTest() {
306306
.verifyHTML(expected2)
307307
}
308308

309+
@Test
310+
fun testRemoveListFormatting() {
311+
312+
val text = "some text\nsome text\nsome text"
313+
val expected1 = "<ul><li>some text</li><li>some text</li><li>some text</li></ul>"
314+
val expected2 = "<ul><li>some text</li><li>some text</li></ul>\nsome text"
315+
316+
EditorPage()
317+
.makeList(EditorPage.ListStyle.UNORDERED)
318+
.insertText(text)
319+
.toggleHtml()
320+
.verifyHTML(expected1)
321+
.toggleHtml()
322+
.makeList(EditorPage.ListStyle.UNORDERED)
323+
.toggleHtml()
324+
.verifyHTML(expected2)
325+
.toggleHtml()
326+
.selectAllText()
327+
.makeList(EditorPage.ListStyle.UNORDERED)
328+
.toggleHtml()
329+
.verifyHTML(text)
330+
}
331+
309332
// Test reproducing the issue described in
310333
// https://github.com/wordpress-mobile/AztecEditor-Android/pull/466#issuecomment-322404363
311334
@Test

0 commit comments

Comments
 (0)