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

Side by Side Diff: javatests/org/chromium/distiller/webdocument/WebTextTest.java

Issue 2285133003: Use .innerText in text-only mode (Closed) Base URL: git@github.com:chromium/dom-distiller.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « javatests/org/chromium/distiller/EmbedExtractorTest.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.distiller.webdocument; 5 package org.chromium.distiller.webdocument;
6 6
7 import org.chromium.distiller.DomDistillerJsTestCase; 7 import org.chromium.distiller.DomDistillerJsTestCase;
8 import org.chromium.distiller.TestUtil; 8 import org.chromium.distiller.TestUtil;
9 9
10 import com.google.gwt.dom.client.Document; 10 import com.google.gwt.dom.client.Document;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 builder.textNode(Text.as(content1.getChild(2)), 0); 81 builder.textNode(Text.as(content1.getChild(2)), 0);
82 builder.lineBreak(content1.getChild(3)); 82 builder.lineBreak(content1.getChild(3));
83 builder.textNode(Text.as(content1.getChild(4)), 0); 83 builder.textNode(Text.as(content1.getChild(4)), 0);
84 builder.lineBreak(content1.getChild(5)); 84 builder.lineBreak(content1.getChild(5));
85 builder.textNode(Text.as(content1.getChild(6)), 0); 85 builder.textNode(Text.as(content1.getChild(6)), 0);
86 86
87 WebText text = builder.build(0); 87 WebText text = builder.build(0);
88 String got = text.generateOutput(false); 88 String got = text.generateOutput(false);
89 String want = "<p>Words<br>split<br>with<br>lines</p>"; 89 String want = "<p>Words<br>split<br>with<br>lines</p>";
90 assertEquals(want, TestUtil.removeAllDirAttributes(got)); 90 assertEquals(want, TestUtil.removeAllDirAttributes(got));
91
92 got = text.generateOutput(true);
93 want = "Words\nsplit\nwith\nlines";
94 assertEquals(want, got);
91 } 95 }
92 96
93 public void testGenerateOutputLIElements() { 97 public void testGenerateOutputLIElements() {
94 Element container = Document.get().createLIElement(); 98 Element container = Document.get().createLIElement();
95 mBody.appendChild(container); 99 mBody.appendChild(container);
96 100
97 container.appendChild(TestUtil.createText("Some text content 1.")); 101 container.appendChild(TestUtil.createText("Some text content 1."));
98 102
99 WebTextBuilder builder = new WebTextBuilder(); 103 WebTextBuilder builder = new WebTextBuilder();
100 builder.textNode(Text.as(container.getChild(0)), 0); 104 builder.textNode(Text.as(container.getChild(0)), 0);
101 105
102 WebText text = builder.build(0); 106 WebText text = builder.build(0);
103 String got = text.generateOutput(false); 107 String got = text.generateOutput(false);
104 String want = "Some text content 1."; 108 String want = "Some text content 1.";
105 assertEquals(want, TestUtil.removeAllDirAttributes(got)); 109 assertEquals(want, TestUtil.removeAllDirAttributes(got));
106 } 110 }
107 } 111 }
OLDNEW
« no previous file with comments | « javatests/org/chromium/distiller/EmbedExtractorTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698