| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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; | 5 package org.chromium.distiller; |
| 6 | 6 |
| 7 import com.google.gwt.dom.client.AnchorElement; | 7 import com.google.gwt.dom.client.AnchorElement; |
| 8 import com.google.gwt.dom.client.Style; | 8 import com.google.gwt.dom.client.Style; |
| 9 import org.chromium.distiller.webdocument.WebElement; | 9 import org.chromium.distiller.webdocument.WebElement; |
| 10 import org.chromium.distiller.webdocument.WebEmbed; | 10 import org.chromium.distiller.webdocument.WebEmbed; |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 } | 539 } |
| 540 | 540 |
| 541 public void testFigureWithCaptionWithoutAnchor() { | 541 public void testFigureWithCaptionWithoutAnchor() { |
| 542 ImageElement image = TestUtil.createImage(); | 542 ImageElement image = TestUtil.createImage(); |
| 543 image.setSrc("http://wwww.example.com/image.jpeg"); | 543 image.setSrc("http://wwww.example.com/image.jpeg"); |
| 544 image.setAttribute("width", "100"); | 544 image.setAttribute("width", "100"); |
| 545 image.setAttribute("height", "100"); | 545 image.setAttribute("height", "100"); |
| 546 Element figure = Document.get().createElement("FIGURE"); | 546 Element figure = Document.get().createElement("FIGURE"); |
| 547 figure.appendChild(image); | 547 figure.appendChild(image); |
| 548 Element figcaption = Document.get().createElement("FIGCAPTION"); | 548 Element figcaption = Document.get().createElement("FIGCAPTION"); |
| 549 figcaption.setInnerHTML("<div><span>This is a caption</span></div>"); | 549 figcaption.setInnerHTML("<div><span>This is a caption</span><a></a></div
>"); |
| 550 figure.appendChild(figcaption); | 550 figure.appendChild(figcaption); |
| 551 mBody.appendChild(figure); | 551 mBody.appendChild(figure); |
| 552 | 552 |
| 553 EmbedExtractor extractor = new ImageExtractor(); | 553 EmbedExtractor extractor = new ImageExtractor(); |
| 554 WebImage result = (WebImage) extractor.extract(figure); | 554 WebImage result = (WebImage) extractor.extract(figure); |
| 555 String expected = | 555 String expected = |
| 556 "<figure>" + | 556 "<figure>" + |
| 557 "<img src=\"http://wwww.example.com/image.jpeg\"" + | 557 "<img src=\"http://wwww.example.com/image.jpeg\"" + |
| 558 " width=\"100\" height=\"100\">" + | 558 " width=\"100\" height=\"100\">" + |
| 559 "<figcaption>This is a caption</figcaption>" + | 559 "<figcaption>This is a caption</figcaption>" + |
| (...skipping 22 matching lines...) Expand all Loading... |
| 582 "<img src=\"http://wwww.example.com/image.jpeg\"" + | 582 "<img src=\"http://wwww.example.com/image.jpeg\"" + |
| 583 " width=\"100\" height=\"100\">" + | 583 " width=\"100\" height=\"100\">" + |
| 584 "<figcaption>\nThis is a caption</figcaption>" + | 584 "<figcaption>\nThis is a caption</figcaption>" + |
| 585 "</figure>"; | 585 "</figure>"; |
| 586 EmbedExtractor extractor = new ImageExtractor(); | 586 EmbedExtractor extractor = new ImageExtractor(); |
| 587 WebElement result = extractor.extract(figure); | 587 WebElement result = extractor.extract(figure); |
| 588 assertEquals(expected, TestUtil.removeAllDirAttributes( | 588 assertEquals(expected, TestUtil.removeAllDirAttributes( |
| 589 result.generateOutput(false))); | 589 result.generateOutput(false))); |
| 590 } | 590 } |
| 591 } | 591 } |
| OLD | NEW |