OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 void onInit() { | 64 void onInit() { |
65 _installHandlers(); | 65 _installHandlers(); |
66 //initialize and load CSS | 66 //initialize and load CSS |
67 final String _CSSID = '_unittestcss_'; | 67 final String _CSSID = '_unittestcss_'; |
68 | 68 |
69 var cssElement = document.head.query('#${_CSSID}'); | 69 var cssElement = document.head.query('#${_CSSID}'); |
70 if (cssElement == null){ | 70 if (cssElement == null){ |
71 document.head.children.add(new Element.html( | 71 cssElement = new StyleElement(); |
72 '<style id="${_CSSID}"></style>')); | 72 cssElement.id = _CSSID; |
73 cssElement = document.head.query('#${_CSSID}'); | 73 document.head.append(cssElement); |
74 } | 74 } |
75 | 75 |
76 cssElement.innerHtml = _htmlTestCSS; | 76 cssElement.text = _htmlTestCSS; |
77 window.postMessage('unittest-suite-wait-for-done', '*'); | 77 window.postMessage('unittest-suite-wait-for-done', '*'); |
78 } | 78 } |
79 | 79 |
80 void onStart() { | 80 void onStart() { |
81 // Listen for uncaught errors. | 81 // Listen for uncaught errors. |
82 _installOnErrorHandler(); | 82 _installOnErrorHandler(); |
83 } | 83 } |
84 | 84 |
85 void onSummary(int passed, int failed, int errors, List<TestCase> results, | 85 void onSummary(int passed, int failed, int errors, List<TestCase> results, |
86 String uncaughtError) { | 86 String uncaughtError) { |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 417 |
418 '''; | 418 '''; |
419 } | 419 } |
420 | 420 |
421 void useHtmlEnhancedConfiguration([bool isLayoutTest = false]) { | 421 void useHtmlEnhancedConfiguration([bool isLayoutTest = false]) { |
422 unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonNotLayout; | 422 unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonNotLayout; |
423 } | 423 } |
424 | 424 |
425 final _singletonLayout = new HtmlEnhancedConfiguration(true); | 425 final _singletonLayout = new HtmlEnhancedConfiguration(true); |
426 final _singletonNotLayout = new HtmlEnhancedConfiguration(false); | 426 final _singletonNotLayout = new HtmlEnhancedConfiguration(false); |
OLD | NEW |