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

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

Issue 1364253003: Amend "Strip style attributes from all tags" (Closed) Base URL: git@github.com:chromium/dom-distiller.git@master
Patch Set: Created 5 years, 3 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 | « java/org/chromium/distiller/webdocument/WebText.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/ContentExtractorTest.java
diff --git a/javatests/org/chromium/distiller/ContentExtractorTest.java b/javatests/org/chromium/distiller/ContentExtractorTest.java
index fc43de08c212deb59205f17d8c717e9c7fc8d52f..0b03d6a9dd95b2177f5233aaa61e93beb6229ef7 100644
--- a/javatests/org/chromium/distiller/ContentExtractorTest.java
+++ b/javatests/org/chromium/distiller/ContentExtractorTest.java
@@ -143,6 +143,53 @@ public class ContentExtractorTest extends DomDistillerJsTestCase {
TestUtil.removeAllDirAttributes(extractedContent));
}
+ public void testRemoveStyleAttributes() {
+ String html =
+ "<h1 style=\"font-weight: folder\">" +
+ CONTENT_TEXT +
+ "</h1>" +
+ "<p style=\"\">" +
+ CONTENT_TEXT +
+ "</p>" +
+ "<table style=\"position: absolute\">" +
+ "<tbody style=\"font-size: 2\">" +
+ "<tr style=\"z-index: 0\">" +
+ "<th style=\"top: 0px\">" + CONTENT_TEXT + "</th>" +
+ "<th style=\"width: 20px\">" + CONTENT_TEXT + "</th>" +
+ "</tr><tr style=\"left: 0\">" +
+ "<td style=\"display: block\">" + CONTENT_TEXT + "</td>" +
+ "<td style=\"color: #123\">" + CONTENT_TEXT + "</td>" +
+ "</tr>" +
+ "</tbody>" +
+ "</table>";
+
+ final String expected =
+ "<h1>" +
+ CONTENT_TEXT +
+ "</h1>" +
+ "<p>" +
+ CONTENT_TEXT +
+ "</p>" +
+ "<table>" +
+ "<tbody>" +
+ "<tr>" +
+ "<th>" + CONTENT_TEXT + "</th>" +
+ "<th>" + CONTENT_TEXT + "</th>" +
+ "</tr><tr>" +
+ "<td>" + CONTENT_TEXT + "</td>" +
+ "<td>" + CONTENT_TEXT + "</td>" +
+ "</tr>" +
+ "</tbody>" +
+ "</table>";
+
+ mBody.setInnerHTML(html);
+
+ ContentExtractor extractor = new ContentExtractor(mRoot);
+ String extractedContent = extractor.extractContent();
+ assertEquals(expected,
+ TestUtil.removeAllDirAttributes(extractedContent));
+ }
+
public void testPreserveOrderedList() {
Element outerListTag = Document.get().createElement("OL");
mBody.appendChild(outerListTag);
« no previous file with comments | « java/org/chromium/distiller/webdocument/WebText.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698