| 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.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.DomUtil; | 8 import org.chromium.distiller.DomUtil; |
| 9 import org.chromium.distiller.labels.DefaultLabels; | 9 import org.chromium.distiller.labels.DefaultLabels; |
| 10 | 10 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 bodyElement.setClassName("comment"); | 101 bodyElement.setClassName("comment"); |
| 102 assertFalse(hasLabel(ElementAction.getForElement(bodyElement), | 102 assertFalse(hasLabel(ElementAction.getForElement(bodyElement), |
| 103 DefaultLabels.STRICTLY_NOT_CONTENT)); | 103 DefaultLabels.STRICTLY_NOT_CONTENT)); |
| 104 | 104 |
| 105 assertTrue(hasLabel(getForHtml("<div class=\" comment \"></div>"), | 105 assertTrue(hasLabel(getForHtml("<div class=\" comment \"></div>"), |
| 106 DefaultLabels.STRICTLY_NOT_CONTENT)); | 106 DefaultLabels.STRICTLY_NOT_CONTENT)); |
| 107 assertTrue(hasLabel(getForHtml("<div class=\"foo.1 comment-thing\"></div
>"), | 107 assertTrue(hasLabel(getForHtml("<div class=\"foo.1 comment-thing\"></div
>"), |
| 108 DefaultLabels.STRICTLY_NOT_CONTENT)); | 108 DefaultLabels.STRICTLY_NOT_CONTENT)); |
| 109 assertTrue(hasLabel(getForHtml("<div id=\"comments\"></div>"), | 109 assertTrue(hasLabel(getForHtml("<div id=\"comments\"></div>"), |
| 110 DefaultLabels.STRICTLY_NOT_CONTENT)); | 110 DefaultLabels.STRICTLY_NOT_CONTENT)); |
| 111 assertTrue(hasLabel(getForHtml("<div class=\"user-comments\"></div>"), |
| 112 DefaultLabels.STRICTLY_NOT_CONTENT)); |
| 111 | 113 |
| 112 assertTrue(hasLabel(getForHtml("<div class=\"user-comments\"></div>"), | 114 assertFalse(hasLabel(getForHtml("<article class=\"user-comments\"></div>
"), |
| 113 DefaultLabels.STRICTLY_NOT_CONTENT)); | 115 DefaultLabels.STRICTLY_NOT_CONTENT)); |
| 114 | 116 |
| 115 /** | 117 /** |
| 116 * Element.getClassName() returns SVGAnimatedString for SvgElement | 118 * Element.getClassName() returns SVGAnimatedString for SvgElement |
| 117 * https://code.google.com/p/google-web-toolkit/issues/detail?id=9195 | 119 * https://code.google.com/p/google-web-toolkit/issues/detail?id=9195 |
| 118 */ | 120 */ |
| 119 assertFalse(hasLabel(getForHtml("<svg></svg>"), DefaultLabels.STRICTLY_N
OT_CONTENT)); | 121 assertFalse(hasLabel(getForHtml("<svg></svg>"), DefaultLabels.STRICTLY_N
OT_CONTENT)); |
| 120 | 122 |
| 121 assertFalse(hasLabel(getForHtml( | 123 assertFalse(hasLabel(getForHtml( |
| 122 "<div class=\"user-comments another-class lots-of-classes too-ma
ny-classes" + | 124 "<div class=\"user-comments another-class lots-of-classes too-ma
ny-classes" + |
| 123 "class1 class2 class3 class4 class5 class6 class7 c
lass8\"></div>"), | 125 "class1 class2 class3 class4 class5 class6 class7 c
lass8\"></div>"), |
| 124 DefaultLabels.STRICTLY_NOT_CONTENT)); | 126 DefaultLabels.STRICTLY_NOT_CONTENT)); |
| 125 assertTrue(hasLabel(getForHtml( | 127 assertTrue(hasLabel(getForHtml( |
| 126 "<div class=\" user-comments a
b \"></div>"), | 128 "<div class=\" user-comments a
\"></div>"), |
| 127 DefaultLabels.STRICTLY_NOT_CONTENT)); | 129 DefaultLabels.STRICTLY_NOT_CONTENT)); |
| 128 } | 130 } |
| 129 } | 131 } |
| OLD | NEW |