OLD | NEW |
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; |
11 import com.google.gwt.dom.client.Element; | 11 import com.google.gwt.dom.client.Element; |
12 import com.google.gwt.dom.client.Text; | 12 import com.google.gwt.dom.client.Text; |
13 | 13 |
14 import java.util.List; | |
15 | |
16 public class WebTextTest extends DomDistillerJsTestCase { | 14 public class WebTextTest extends DomDistillerJsTestCase { |
17 public void testGenerateOutputMultipleContentNodes() { | 15 public void testGenerateOutputMultipleContentNodes() { |
18 Element container = Document.get().createDivElement(); | 16 Element container = Document.get().createDivElement(); |
19 mBody.appendChild(container); | 17 mBody.appendChild(container); |
20 | 18 |
21 Element content1 = Document.get().createPElement(); | 19 Element content1 = Document.get().createPElement(); |
22 content1.appendChild(Document.get().createTextNode("Some text content 1.
")); | 20 content1.appendChild(Document.get().createTextNode("Some text content 1.
")); |
23 container.appendChild(content1); | 21 container.appendChild(content1); |
24 | 22 |
25 Element content2 = Document.get().createPElement(); | 23 Element content2 = Document.get().createPElement(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 98 |
101 WebTextBuilder builder = new WebTextBuilder(); | 99 WebTextBuilder builder = new WebTextBuilder(); |
102 builder.textNode(Text.as(container.getChild(0)), 0); | 100 builder.textNode(Text.as(container.getChild(0)), 0); |
103 | 101 |
104 WebText text = builder.build(0); | 102 WebText text = builder.build(0); |
105 String got = text.generateOutput(false); | 103 String got = text.generateOutput(false); |
106 String want = "Some text content 1."; | 104 String want = "Some text content 1."; |
107 assertEquals(want, TestUtil.removeAllDirAttributes(got)); | 105 assertEquals(want, TestUtil.removeAllDirAttributes(got)); |
108 } | 106 } |
109 } | 107 } |
OLD | NEW |