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

Side by Side Diff: lib/unittest/html_enhanced_config.dart

Issue 10636035: Fix the normalization of test group names before use as DOM class or id names. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 List<TestCase> flattened = new List<TestCase>(); 126 List<TestCase> flattened = new List<TestCase>();
127 127
128 groupedBy 128 groupedBy
129 .getValues() 129 .getValues()
130 .forEach((tList){ 130 .forEach((tList){
131 tList.sort((tcA, tcB) => tcA.id - tcB.id); 131 tList.sort((tcA, tcB) => tcA.id - tcB.id);
132 flattened.addAll(tList); 132 flattened.addAll(tList);
133 } 133 }
134 ); 134 );
135 135
136 var nonAlphanumeric = new RegExp('[^a-z0-9A-Z]');
137
136 // output group headers and test rows 138 // output group headers and test rows
137 for (final test_ in flattened) { 139 for (final test_ in flattened) {
138 140
139 // replace everything but numbers and letters from the group name with 141 // replace everything but numbers and letters from the group name with
140 // '_' so we can use in id and class properties. 142 // '_' so we can use in id and class properties.
141 var safeGroup = test_.currentGroup 143 var safeGroup = test_.currentGroup.replaceAll(nonAlphanumeric,'_');
Siggi Cherem (dart-lang) 2012/06/25 21:37:23 add space after ','
142 .replaceAll("(?:[^a-z0-9 ]|(?<=['\"])s)",'_')
143 .replaceAll(' ','_');
144 144
145 if (test_.currentGroup != previousGroup){ 145 if (test_.currentGroup != previousGroup){
146 146
147 previousGroup = test_.currentGroup; 147 previousGroup = test_.currentGroup;
148 148
149 var testsInGroup = results.filter( 149 var testsInGroup = results.filter(
150 (TestCase t) => t.currentGroup == previousGroup); 150 (TestCase t) => t.currentGroup == previousGroup);
151 var groupTotalTestCount = testsInGroup.length; 151 var groupTotalTestCount = testsInGroup.length;
152 var groupTestPassedCount = testsInGroup.filter( 152 var groupTestPassedCount = testsInGroup.filter(
153 (TestCase t) => t.result == 'pass').length; 153 (TestCase t) => t.result == 'pass').length;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 .unittest-row-description 363 .unittest-row-description
364 { 364 {
365 } 365 }
366 366
367 '''; 367 ''';
368 } 368 }
369 369
370 void useHtmlEnhancedConfiguration([bool isLayoutTest = false]) { 370 void useHtmlEnhancedConfiguration([bool isLayoutTest = false]) {
371 configure(new HtmlEnhancedConfiguration(isLayoutTest)); 371 configure(new HtmlEnhancedConfiguration(isLayoutTest));
372 } 372 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698