Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Unified Diff: javatests/org/chromium/distiller/webdocument/ElementActionTest.java

Issue 1190343004: Process ordered list items as a single WebText (Closed) Base URL: https://github.com/chromium/dom-distiller.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « javatests/org/chromium/distiller/TestUtil.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: javatests/org/chromium/distiller/webdocument/ElementActionTest.java
diff --git a/javatests/org/chromium/distiller/webdocument/ElementActionTest.java b/javatests/org/chromium/distiller/webdocument/ElementActionTest.java
index 2f0500b10fa2f8b4cf2210a57b7fa0085e2e3596..477f69ac184a0e1fda42c699e9f3b5f3141b9389 100644
--- a/javatests/org/chromium/distiller/webdocument/ElementActionTest.java
+++ b/javatests/org/chromium/distiller/webdocument/ElementActionTest.java
@@ -12,15 +12,31 @@ import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
public class ElementActionTest extends DomDistillerJsTestCase {
- private ElementAction getForHtml(String html) {
+ private Element createElementWithInnerHtml(String html) {
Element container = Document.get().createDivElement();
mBody.appendChild(container);
container.setInnerHTML(html);
+ return container;
+ }
+
+ private ElementAction getForHtml(String html) {
+ Element container = createElementWithInnerHtml(html);
assertEquals(1, container.getChildCount());
Element e = container.getFirstChildElement();
return ElementAction.getForElement(e);
}
+ private ElementAction getForHtmlFirstChild(String html) {
+ Element container = createElementWithInnerHtml(html);
+ assertEquals(1, container.getChildCount());
+ Element e = container.getFirstChildElement();
+
+ assertEquals(1, e.getChildCount());
+ Element firstChild = e.getFirstChildElement();
+
+ return ElementAction.getForElement(firstChild);
+ }
+
public void testFlush() {
assertFalse(getForHtml("<span></span>").flush);
assertTrue(getForHtml("<div></div>").flush);
@@ -29,6 +45,10 @@ public class ElementActionTest extends DomDistillerJsTestCase {
assertTrue(getForHtml("<span style=\"display: flex\"></span>").flush);
assertFalse(getForHtml("<div style=\"display: inline\"></div>").flush);
+
+ assertTrue(getForHtml("<li></li>").flush);
+ assertTrue(getForHtmlFirstChild("<ul><li></li></ul>").flush);
+ assertFalse(getForHtmlFirstChild("<ol><li></li></ol>").flush);
}
public void testIsAnchor() {
@@ -49,6 +69,10 @@ public class ElementActionTest extends DomDistillerJsTestCase {
assertTrue(getForHtml("<span style=\"display: block\"></span>").changesTagLevel);
assertTrue(getForHtml("<div style=\"display: inline-block\"></div>").changesTagLevel);
assertTrue(getForHtml("<table></table>").changesTagLevel);
+
+ assertTrue(getForHtml("<li></li>").changesTagLevel);
+ assertTrue(getForHtmlFirstChild("<ul><li></li></ul>").changesTagLevel);
+ assertFalse(getForHtmlFirstChild("<ol><li></li></ol>").changesTagLevel);
}
private boolean hasLabel(ElementAction a, String label) {
« no previous file with comments | « javatests/org/chromium/distiller/TestUtil.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698