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

Unified Diff: javatests/org/chromium/distiller/DomUtilTest.java

Issue 1508963003: Make isVisible() faster and more accurate Base URL: git@github.com:chromium/dom-distiller.git@master
Patch Set: address mdjones' comments Created 5 years 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
Index: javatests/org/chromium/distiller/DomUtilTest.java
diff --git a/javatests/org/chromium/distiller/DomUtilTest.java b/javatests/org/chromium/distiller/DomUtilTest.java
index a636a5e181f8e99e66ba9ff21716f351d42758b9..20d490ead8e325b0168e5acfdbe5ec916d5edc10 100644
--- a/javatests/org/chromium/distiller/DomUtilTest.java
+++ b/javatests/org/chromium/distiller/DomUtilTest.java
@@ -345,4 +345,34 @@ public class DomUtilTest extends DomDistillerJsTestCase {
DomUtil.stripStyleAttributes(mBody);
assertEquals(expected, mBody.getInnerHTML());
}
+
+ public void testIsVisibleParentDisplayNone() {
+ String html =
+ "<div style=\"display: none;\">" +
+ "<div>Some Text</div>" +
+ "</div>";
+ mBody.setInnerHTML(html);
+ Element child = mBody.getFirstChildElement().getFirstChildElement();
+ assertFalse(DomUtil.isVisible(child));
+ }
+
+ public void testIsVisibleChildDisplayNone() {
+ String html =
+ "<div>" +
+ "<div style=\"display: none;\">Some Text</div>" +
+ "</div>";
+ mBody.setInnerHTML(html);
+ Element child = mBody.getFirstChildElement().getFirstChildElement();
+ assertFalse(DomUtil.isVisible(child));
+ }
+
+ public void testIsVisibleDisplayBlock() {
+ String html =
+ "<div>" +
+ "<div>Some Text</div>" +
+ "</div>";
+ mBody.setInnerHTML(html);
+ Element child = mBody.getFirstChildElement().getFirstChildElement();
+ assertTrue(DomUtil.isVisible(child));
+ }
}
« no previous file with comments | « java/org/chromium/distiller/DomUtil.java ('k') | javatests/org/chromium/distiller/webdocument/DomConverterTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698