From 5177683fd2a5b180125b6649a85fb76e10279d30 Mon Sep 17 00:00:00 2001 From: Cameron Voell Date: Mon, 20 Jul 2020 16:00:32 -0700 Subject: [PATCH 1/3] Update Aztec to use default strikethrough tag of instead of --- .../kotlin/org/wordpress/aztec/spans/AztecStrikethroughSpan.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aztec/src/main/kotlin/org/wordpress/aztec/spans/AztecStrikethroughSpan.kt b/aztec/src/main/kotlin/org/wordpress/aztec/spans/AztecStrikethroughSpan.kt index 9cd181222..f11dcc266 100644 --- a/aztec/src/main/kotlin/org/wordpress/aztec/spans/AztecStrikethroughSpan.kt +++ b/aztec/src/main/kotlin/org/wordpress/aztec/spans/AztecStrikethroughSpan.kt @@ -3,7 +3,7 @@ package org.wordpress.aztec.spans import android.text.style.StrikethroughSpan import org.wordpress.aztec.AztecAttributes -class AztecStrikethroughSpan(tag: String = "del", +class AztecStrikethroughSpan(tag: String = "s", override var attributes: AztecAttributes = AztecAttributes()) : StrikethroughSpan(), IAztecInlineSpan { override val TAG = tag From 9bdc077c32119c8e4817f2b1dfd1d830d58963a8 Mon Sep 17 00:00:00 2001 From: Cameron Voell Date: Mon, 20 Jul 2020 16:18:34 -0700 Subject: [PATCH 2/3] Update unit tests for strikethrough default to --- .../org/wordpress/aztec/AztecToolbarTest.kt | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/aztec/src/test/kotlin/org/wordpress/aztec/AztecToolbarTest.kt b/aztec/src/test/kotlin/org/wordpress/aztec/AztecToolbarTest.kt index d6156c76c..ce9934eb4 100644 --- a/aztec/src/test/kotlin/org/wordpress/aztec/AztecToolbarTest.kt +++ b/aztec/src/test/kotlin/org/wordpress/aztec/AztecToolbarTest.kt @@ -176,7 +176,7 @@ class AztecToolbarTest { Assert.assertTrue(strikeThroughButton.isChecked) editText.append("strike") - Assert.assertEquals("strike", editText.toHtml()) + Assert.assertEquals("strike", editText.toHtml()) strikeThroughButton.performClick() Assert.assertFalse(strikeThroughButton.isChecked) @@ -196,7 +196,7 @@ class AztecToolbarTest { editText.setSelection(0, editText.length()) strikeThroughButton.performClick() Assert.assertTrue(strikeThroughButton.isChecked) - Assert.assertEquals("strike", editText.toHtml()) + Assert.assertEquals("strike", editText.toHtml()) strikeThroughButton.performClick() Assert.assertFalse(strikeThroughButton.isChecked) @@ -275,14 +275,14 @@ class AztecToolbarTest { editText.append("Str") strikeThroughButton.performClick() editText.append("ike") - Assert.assertEquals("BoldItalicStrike", editText.toHtml()) + Assert.assertEquals("BoldItalicStrike", editText.toHtml()) // Underline underlineButton.performClick() editText.append("Under") underlineButton.performClick() editText.append("line") - Assert.assertEquals("BoldItalicStrikeUnderline", editText.toHtml()) + Assert.assertEquals("BoldItalicStrikeUnderline", editText.toHtml()) // Clear text editText.setText("") @@ -306,14 +306,14 @@ class AztecToolbarTest { strikeThroughButton.performClick() editText.append("ike") strikeThroughButton.performClick() - Assert.assertEquals("BoldItalicStrike", editText.toHtml()) + Assert.assertEquals("BoldItalicStrike", editText.toHtml()) // Underline editText.append("Under") underlineButton.performClick() editText.append("line") underlineButton.performClick() - Assert.assertEquals("BoldItalicStrikeUnderline", editText.toHtml()) + Assert.assertEquals("BoldItalicStrikeUnderline", editText.toHtml()) } /** @@ -352,7 +352,7 @@ class AztecToolbarTest { editText.append("Str") strikeThroughButton.performClick() editText.append("ike") - Assert.assertEquals(" Bold Italic Strike", editText.toHtml()) + Assert.assertEquals(" Bold Italic Strike", editText.toHtml()) // Space editText.append(" ") @@ -362,7 +362,7 @@ class AztecToolbarTest { editText.append("Under") underlineButton.performClick() editText.append("line") - Assert.assertEquals(" Bold Italic Strike Underline", editText.toHtml()) + Assert.assertEquals(" Bold Italic Strike Underline", editText.toHtml()) } /** @@ -407,14 +407,14 @@ class AztecToolbarTest { strikeThroughButton.performClick() Assert.assertTrue(strikeThroughButton.isChecked) - Assert.assertEquals("bold bolditalic italic strike underline normal", editText.toHtml()) + Assert.assertEquals("bold bolditalic italic strike underline normal", editText.toHtml()) editText.setSelection(30, 39) underlineButton.performClick() Assert.assertTrue(underlineButton.isChecked) - Assert.assertEquals("bold bolditalic italic strike underline normal", editText.toHtml()) + Assert.assertEquals("bold bolditalic italic strike underline normal", editText.toHtml()) } /** @@ -447,19 +447,19 @@ class AztecToolbarTest { strikeThroughButton.performClick() Assert.assertTrue(strikeThroughButton.isChecked) editText.append("strike") - Assert.assertEquals("boldbolditalicitalicstrike", editText.toHtml()) + Assert.assertEquals("boldbolditalicitalicstrike", editText.toHtml()) strikeThroughButton.performClick() Assert.assertFalse(strikeThroughButton.isChecked) underlineButton.performClick() Assert.assertTrue(underlineButton.isChecked) editText.append("underline") - Assert.assertEquals("boldbolditalicitalicstrikeunderline", editText.toHtml()) + Assert.assertEquals("boldbolditalicitalicstrikeunderline", editText.toHtml()) underlineButton.performClick() Assert.assertFalse(underlineButton.isChecked) editText.append("normal") - Assert.assertEquals("boldbolditalicitalicstrikeunderlinenormal", editText.toHtml()) + Assert.assertEquals("boldbolditalicitalicstrikeunderlinenormal", editText.toHtml()) } /** @@ -470,7 +470,7 @@ class AztecToolbarTest { @Test @Throws(Exception::class) fun testSelection() { - editText.fromHtml("boldbolditalicitalicstrikeunderlinenormal") + editText.fromHtml("boldbolditalicitalicstrikeunderlinenormal") // cursor is at bold text editText.setSelection(2) @@ -554,7 +554,7 @@ class AztecToolbarTest { /** * Select part of text with one common style applied to it (bold) and another style (strikethrough) - * applied to part of it ("ds" from boldstrike) and extend partially + * applied to part of it ("ds" from boldstrike) and extend partially * applied style (strikethrough) to other part of selection. * * @throws Exception @@ -562,7 +562,7 @@ class AztecToolbarTest { @Test @Throws(Exception::class) fun extendStyleStrikethroughPartialSelection() { - editText.fromHtml("boldstrike") + editText.fromHtml("boldstrike") val selectedText = editText.text.substring(3, 5) Assert.assertEquals("ds", selectedText) // sanity check @@ -572,7 +572,7 @@ class AztecToolbarTest { Assert.assertFalse(strikeThroughButton.isChecked) strikeThroughButton.performClick() - Assert.assertEquals("boldstrike", editText.toHtml()) + Assert.assertEquals("boldstrike", editText.toHtml()) } /** @@ -685,7 +685,7 @@ class AztecToolbarTest { editText.setSelection(9, 15) strikeThroughButton.performClick() - Assert.assertEquals("
Div
Span
Hidden
", + Assert.assertEquals("
Div
Span
Hidden
", editText.toHtml()) } From f3da0bb9e287080cd541e7381de5ed0e5b4b5dbd Mon Sep 17 00:00:00 2001 From: Cameron Voell Date: Mon, 20 Jul 2020 19:14:06 -0700 Subject: [PATCH 3/3] Update default strikethrough tag in tests --- .../org/wordpress/aztec/demo/tests/FormattingHistoryTests.kt | 2 +- .../wordpress/aztec/demo/tests/SimpleTextFormattingTests.kt | 4 ++-- aztec/src/test/kotlin/org/wordpress/aztec/LinkTest.kt | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/androidTest/kotlin/org/wordpress/aztec/demo/tests/FormattingHistoryTests.kt b/app/src/androidTest/kotlin/org/wordpress/aztec/demo/tests/FormattingHistoryTests.kt index ea13de73e..837016ff7 100644 --- a/app/src/androidTest/kotlin/org/wordpress/aztec/demo/tests/FormattingHistoryTests.kt +++ b/app/src/androidTest/kotlin/org/wordpress/aztec/demo/tests/FormattingHistoryTests.kt @@ -232,7 +232,7 @@ class FormattingHistoryTests : BaseHistoryTest() { fun testMakeStrikethroughUndoRedo() { val snippet1 = "There's no crying in" val snippet2 = " baseball!" - val html = "$snippet1$snippet2" + val html = "$snippet1$snippet2" val editorPage = EditorPage() // Insert first snippet diff --git a/app/src/androidTest/kotlin/org/wordpress/aztec/demo/tests/SimpleTextFormattingTests.kt b/app/src/androidTest/kotlin/org/wordpress/aztec/demo/tests/SimpleTextFormattingTests.kt index 36e4dd0fd..64352f278 100644 --- a/app/src/androidTest/kotlin/org/wordpress/aztec/demo/tests/SimpleTextFormattingTests.kt +++ b/app/src/androidTest/kotlin/org/wordpress/aztec/demo/tests/SimpleTextFormattingTests.kt @@ -46,7 +46,7 @@ class SimpleTextFormattingTests : BaseTest() { fun testSimpleStrikethroughFormatting() { val text1 = "some" val text2 = "text" - val html = "$text1$text2" + val html = "$text1$text2" EditorPage() .insertText(text1) @@ -351,7 +351,7 @@ class SimpleTextFormattingTests : BaseTest() { fun testInlineStyleAndSpace() { val text1 = "some" val text2 = "text " - val html = "$text1$text2" + val html = "$text1$text2" EditorPage() .insertText(text1) diff --git a/aztec/src/test/kotlin/org/wordpress/aztec/LinkTest.kt b/aztec/src/test/kotlin/org/wordpress/aztec/LinkTest.kt index 576475312..3941475b0 100644 --- a/aztec/src/test/kotlin/org/wordpress/aztec/LinkTest.kt +++ b/aztec/src/test/kotlin/org/wordpress/aztec/LinkTest.kt @@ -47,11 +47,11 @@ class LinkTest { @Test @Throws(Exception::class) fun insertLinkIntoStyledText() { - editText.fromHtml("leftright") + editText.fromHtml("leftright") editText.setSelection(4) editText.link("http://wordpress.com", "WordPress") // Still valid, but order of b and del is switched here for some reason. - Assert.assertEquals("leftWordPressright", editText.toHtml()) + Assert.assertEquals("leftWordPressright", editText.toHtml()) } @Test