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

Side by Side Diff: javatests/org/chromium/distiller/DomUtilTest.java

Issue 1508963003: Make isVisible() faster and more accurate Base URL: git@github.com:chromium/dom-distiller.git@master
Patch Set: address mdjones' comments Created 5 years 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
OLDNEW
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 org.chromium.distiller.webdocument.WebTable; 7 import org.chromium.distiller.webdocument.WebTable;
8 8
9 import com.google.gwt.core.client.JsArray; 9 import com.google.gwt.core.client.JsArray;
10 import com.google.gwt.dom.client.Document; 10 import com.google.gwt.dom.client.Document;
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 "<td>text</td>" + 338 "<td>text</td>" +
339 "<td>text</td>" + 339 "<td>text</td>" +
340 "</tr>" + 340 "</tr>" +
341 "</tbody>" + 341 "</tbody>" +
342 "</table>"; 342 "</table>";
343 343
344 mBody.setInnerHTML(html); 344 mBody.setInnerHTML(html);
345 DomUtil.stripStyleAttributes(mBody); 345 DomUtil.stripStyleAttributes(mBody);
346 assertEquals(expected, mBody.getInnerHTML()); 346 assertEquals(expected, mBody.getInnerHTML());
347 } 347 }
348
349 public void testIsVisibleParentDisplayNone() {
350 String html =
351 "<div style=\"display: none;\">" +
352 "<div>Some Text</div>" +
353 "</div>";
354 mBody.setInnerHTML(html);
355 Element child = mBody.getFirstChildElement().getFirstChildElement();
356 assertFalse(DomUtil.isVisible(child));
357 }
358
359 public void testIsVisibleChildDisplayNone() {
360 String html =
361 "<div>" +
362 "<div style=\"display: none;\">Some Text</div>" +
363 "</div>";
364 mBody.setInnerHTML(html);
365 Element child = mBody.getFirstChildElement().getFirstChildElement();
366 assertFalse(DomUtil.isVisible(child));
367 }
368
369 public void testIsVisibleDisplayBlock() {
370 String html =
371 "<div>" +
372 "<div>Some Text</div>" +
373 "</div>";
374 mBody.setInnerHTML(html);
375 Element child = mBody.getFirstChildElement().getFirstChildElement();
376 assertTrue(DomUtil.isVisible(child));
377 }
348 } 378 }
OLDNEW
« no previous file with comments | « java/org/chromium/distiller/DomUtil.java ('k') | javatests/org/chromium/distiller/webdocument/DomConverterTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698