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

Unified Diff: pkg/custom_element/test/custom_element_test.dart

Issue 23647014: Updating custom element test to only load polyfill when needed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/custom_element/test/custom_element_test.dart
diff --git a/pkg/custom_element/test/custom_element_test.dart b/pkg/custom_element/test/custom_element_test.dart
index 341713aa364db6f061643e4c0b43f6a588efa2c2..3094518494192ce1837f94cd628a54a416ae2c55 100644
--- a/pkg/custom_element/test/custom_element_test.dart
+++ b/pkg/custom_element/test/custom_element_test.dart
@@ -13,16 +13,16 @@ import 'package:unittest/unittest.dart';
main() {
useHtmlConfiguration();
- // Load the MutationObserver polyfill.
- HttpRequest.getString('/root_dart/pkg/mutation_observer/lib/'
- 'mutation_observer.js').then((code) {
- document.head.children.add(new ScriptElement()..text = code);
-
- customElementTests();
+ setUp(() {
+ // Load the MutationObserver polyfill if needed.
+ if (!MutationObserver.supported) {
+ var script = new ScriptElement()
+ ..src = '/packages/mutation_observer/mutation_observer.js';
+ document.head.append(script);
+ return script.onLoad.first;
Jennifer Messerly 2013/09/12 20:43:48 Nice! This blocks the test until it loads? That wa
blois 2013/09/12 21:23:13 The setUp function handles Future return types jus
+ }
});
-}
-customElementTests() {
test('register creates the element and calls lifecycle methods', () {
// Add element to the page.
var element = new Element.html('<fancy-button>foo bar</fancy-button>',
« 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