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

Unified Diff: pkg/unittest/lib/html_config.dart

Issue 12824008: Making it easier to run individual HTML tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/unittest/lib/html_individual_config.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/html_config.dart
diff --git a/pkg/unittest/lib/html_config.dart b/pkg/unittest/lib/html_config.dart
index 2246bf33ea76df6700dd4e8fced2854d85593d0e..7fa56f2bbd2a92d2f84f2cfdb1c3b5c876b510ab 100644
--- a/pkg/unittest/lib/html_config.dart
+++ b/pkg/unittest/lib/html_config.dart
@@ -51,6 +51,10 @@ void _showResultsInPage(int passed, int failed, int errors,
}
newBody.write("</tbody></table>");
document.body.innerHtml = newBody.toString();
+
+ window.onHashChange.listen((_) {
+ window.location.reload();
+ });
}
}
@@ -68,7 +72,7 @@ String _toHtml(TestCase test_) {
<tr>
<td>${test_.id}</td>
<td class="unittest-${test_.result}">${test_.result.toUpperCase()}</td>
- <td>Expectation: ${test_.description}. ${_htmlEscape(test_.message)}</td>
+ <td>Expectation: <a href="#testFilter=${test_.description}">${test_.description}</a>. ${_htmlEscape(test_.message)}</td>
</tr>''';
if (test_.stackTrace != null) {
@@ -126,6 +130,23 @@ class HtmlConfiguration extends Configuration {
window.postMessage('unittest-suite-wait-for-done', '*');
}
+ void onStart() {
+ // If the URL has a #testFilter=testName then filter tests to that.
+ // This is used to make it easy to run a single test- but is only intended
+ // for interactive debugging scenarios.
+ var hash = window.location.hash;
+ if (hash != null && hash.length > 1) {
+ var params = hash.substring(1).split('&');
+ for (var param in params) {
+ var parts = param.split('=');
+ if (parts.length == 2 && parts[0] == 'testFilter') {
+ filterTests('^${parts[1]}');
+ }
+ }
+ }
+ super.onStart();
+ }
+
void onSummary(int passed, int failed, int errors, List<TestCase> results,
String uncaughtError) {
_showResultsInPage(passed, failed, errors, results, _isLayoutTest,
« no previous file with comments | « no previous file | pkg/unittest/lib/html_individual_config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698