OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * A simple unit test library for running tests in a browser. | 6 * A simple unit test library for running tests in a browser. |
7 * | 7 * |
8 * Provides enhanced HTML output with collapsible group headers | 8 * Provides enhanced HTML output with collapsible group headers |
9 * and other at-a-glance information about the test results. | 9 * and other at-a-glance information about the test results. |
10 */ | 10 */ |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 for (final test_ in flattened) { | 165 for (final test_ in flattened) { |
166 | 166 |
167 // replace everything but numbers and letters from the group name with | 167 // replace everything but numbers and letters from the group name with |
168 // '_' so we can use in id and class properties. | 168 // '_' so we can use in id and class properties. |
169 var safeGroup = test_.currentGroup.replaceAll(nonAlphanumeric,'_'); | 169 var safeGroup = test_.currentGroup.replaceAll(nonAlphanumeric,'_'); |
170 | 170 |
171 if (test_.currentGroup != previousGroup){ | 171 if (test_.currentGroup != previousGroup){ |
172 | 172 |
173 previousGroup = test_.currentGroup; | 173 previousGroup = test_.currentGroup; |
174 | 174 |
175 var testsInGroup = results.filter( | 175 var testsInGroup = results |
176 (TestCase t) => t.currentGroup == previousGroup); | 176 .where((TestCase t) => t.currentGroup == previousGroup) |
| 177 .toList(); |
177 var groupTotalTestCount = testsInGroup.length; | 178 var groupTotalTestCount = testsInGroup.length; |
178 var groupTestPassedCount = testsInGroup.filter( | 179 var groupTestPassedCount = testsInGroup.where( |
179 (TestCase t) => t.result == 'pass').length; | 180 (TestCase t) => t.result == 'pass').length; |
180 groupPassFail = groupTotalTestCount == groupTestPassedCount; | 181 groupPassFail = groupTotalTestCount == groupTestPassedCount; |
181 var passFailClass = "unittest-group-status unittest-group-" | 182 var passFailClass = "unittest-group-status unittest-group-" |
182 "status-${groupPassFail ? 'pass' : 'fail'}"; | 183 "status-${groupPassFail ? 'pass' : 'fail'}"; |
183 | 184 |
184 te.elements.add(new Element.html(""" | 185 te.elements.add(new Element.html(""" |
185 <div> | 186 <div> |
186 <div id='${safeGroup}' | 187 <div id='${safeGroup}' |
187 class='unittest-group ${safeGroup} test${safeGroup}'> | 188 class='unittest-group ${safeGroup} test${safeGroup}'> |
188 <div ${_isIE ? "style='display:inline-block' ": ""} | 189 <div ${_isIE ? "style='display:inline-block' ": ""} |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 .unittest-row-description | 406 .unittest-row-description |
406 { | 407 { |
407 } | 408 } |
408 | 409 |
409 '''; | 410 '''; |
410 } | 411 } |
411 | 412 |
412 void useHtmlEnhancedConfiguration([bool isLayoutTest = false]) { | 413 void useHtmlEnhancedConfiguration([bool isLayoutTest = false]) { |
413 configure(new HtmlEnhancedConfiguration(isLayoutTest)); | 414 configure(new HtmlEnhancedConfiguration(isLayoutTest)); |
414 } | 415 } |
OLD | NEW |