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

Unified Diff: test/com/dom_distiller/client/DomToSaxParserTest.java

Issue 275493007: filter out invisible elements (Closed) Base URL: https://code.google.com/p/dom-distiller/@master
Patch Set: addressed comments Created 6 years, 7 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
Index: test/com/dom_distiller/client/DomToSaxParserTest.java
diff --git a/test/com/dom_distiller/client/DomToSaxParserTest.java b/test/com/dom_distiller/client/DomToSaxParserTest.java
deleted file mode 100644
index 8a9b60fd82eaf9294a191140c3d6e3f7c53e9d08..0000000000000000000000000000000000000000
--- a/test/com/dom_distiller/client/DomToSaxParserTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package com.dom_distiller.client;
-
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-
-import com.google.gwt.junit.client.GWTTestCase;
-
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.dom.client.Document;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.Node;
-import com.google.gwt.dom.client.NodeList;
-import com.google.gwt.dom.client.Text;
-import com.google.gwt.user.client.DOM;
-
-import org.xml.sax.Attributes;
-
-public class DomToSaxParserTest extends GWTTestCase {
- @Override
- public String getModuleName() {
- return "com.dom_distiller.DomDistillerJUnit";
- }
-
- public void testGetAttributes() {
- Element e = Document.get().createDivElement();
- e.setInnerHTML("<div style=\"width:50px; height:100px\" id=\"f\" class=\"sdf\"></div>");
- e = Element.as(e.getChildNodes().getItem(0));
- JsArray<Node> jsAttrs = DomUtil.getAttributes(e);
- assertEquals(3, jsAttrs.length());
- }
-
- public void testGetSaxAttributes() {
- Element e = Document.get().createDivElement();
- e.setInnerHTML("<div style=\"width:50px; height:100px\" id=\"f\" class=\"sdf\"></div>");
- e = Element.as(e.getChildNodes().getItem(0));
- Attributes attrs = DomToSaxParser.getSaxAttributes(e);
- assertEquals(3, attrs.getLength());
- assertEquals("f", attrs.getValue("id"));
- assertEquals("sdf", attrs.getValue("class"));
- }
-
- private void runDomParserTest(String innerHtml) throws Throwable {
- Element container = Document.get().createDivElement();
- container.setInnerHTML(innerHtml);
- SimpleContentHandler contentHandler = new SimpleContentHandler();
- DomToSaxParser.parse(container, contentHandler);
- String expectedDocument = "<div>" + innerHtml + "</div>";
- assertEquals(expectedDocument, contentHandler.getDocumentString().toLowerCase());
- }
-
- public void testDomParserText() throws Throwable {
- runDomParserTest("foo");
- }
-
- public void testDomParserElement() throws Throwable {
- runDomParserTest("<div></div>");
- }
-
- public void testDomParserSiblings() throws Throwable {
- runDomParserTest("<div></div><div></div>");
- }
-
- public void testDomParserAttribute() throws Throwable {
- runDomParserTest("<div style=\"width:50px; height:100px\" id=\"f\" class=\"sdf\"></div>");
- }
-
- public void testDomParserSimplePage() throws Throwable {
- String simpleHtml =
- "<div id=\"a\" class=\"foo\">foo<a href=\"x.com/#1\">x.com</a>bar</div>" +
- "<div>baz</div>";
- runDomParserTest(simpleHtml);
- }
-}
« no previous file with comments | « src/com/dom_distiller/client/FilteringDomVisitor.java ('k') | test/com/dom_distiller/client/DomToSaxVisitorTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698