| 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 library template_binding.test.template_binding_test; | 5 library template_binding.test.template_binding_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'dart:js' show JsObject; | 9 import 'dart:js' show JsObject; |
| 10 import 'dart:math' as math; | 10 import 'dart:math' as math; |
| 11 import 'package:observe/observe.dart'; | 11 import 'package:observe/observe.dart'; |
| 12 import 'package:template_binding/template_binding.dart'; | 12 import 'package:template_binding/template_binding.dart'; |
| 13 import 'package:unittest/html_config.dart'; | 13 import 'package:unittest/html_config.dart'; |
| 14 import 'package:unittest/unittest.dart'; | 14 import 'package:unittest/unittest.dart'; |
| 15 | 15 |
| 16 // TODO(jmesserly): merge this file? | 16 // TODO(jmesserly): merge this file? |
| 17 import 'binding_syntax.dart' show syntaxTests; | 17 import 'binding_syntax.dart' show syntaxTests; |
| 18 import 'utils.dart'; | 18 import 'utils.dart'; |
| 19 | 19 |
| 20 // Note: this file ported from TemplateBinding's tests/tests.js | 20 // Note: this file ported from TemplateBinding's tests/tests.js |
| 21 | 21 |
| 22 // TODO(jmesserly): submit a small cleanup patch to original. I fixed some | 22 // TODO(jmesserly): submit a small cleanup patch to original. I fixed some |
| 23 // cases where "div" and "t" were unintentionally using the JS global scope; | 23 // cases where "div" and "t" were unintentionally using the JS global scope; |
| 24 // look for "assertNodesAre". | 24 // look for "assertNodesAre". |
| 25 | 25 |
| 26 main() => dirtyCheckZone().run(() { | 26 main() => dirtyCheckZone().run(() { |
| 27 useHtmlConfiguration(); | 27 useHtmlConfiguration(); |
| 28 | 28 |
| 29 // Load MutationObserver polyfill in case IE needs it. | 29 setUp(() { |
| 30 var script = new ScriptElement() | |
| 31 ..src = '/root_dart/pkg/mutation_observer/lib/mutation_observer.min.js'; | |
| 32 var polyfillLoaded = script.onLoad.first; | |
| 33 document.head.append(script); | |
| 34 | |
| 35 setUp(() => polyfillLoaded.then((_) { | |
| 36 document.body.append(testDiv = new DivElement()); | 30 document.body.append(testDiv = new DivElement()); |
| 37 })); | 31 }); |
| 38 | 32 |
| 39 tearDown(() { | 33 tearDown(() { |
| 40 testDiv.remove(); | 34 testDiv.remove(); |
| 41 clearAllTemplates(testDiv); | 35 clearAllTemplates(testDiv); |
| 42 testDiv = null; | 36 testDiv = null; |
| 43 }); | 37 }); |
| 44 | 38 |
| 45 test('MutationObserver is supported', () { | 39 test('MutationObserver is supported', () { |
| 46 expect(MutationObserver.supported, true, reason: 'polyfill was loaded.'); | 40 expect(MutationObserver.supported, true, reason: 'polyfill was loaded.'); |
| 47 }); | 41 }); |
| (...skipping 2682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2730 class TestAccessorModel extends Observable { | 2724 class TestAccessorModel extends Observable { |
| 2731 @observable var value = 1; | 2725 @observable var value = 1; |
| 2732 var count = 0; | 2726 var count = 0; |
| 2733 | 2727 |
| 2734 @reflectable | 2728 @reflectable |
| 2735 get prop { | 2729 get prop { |
| 2736 count++; | 2730 count++; |
| 2737 return value; | 2731 return value; |
| 2738 } | 2732 } |
| 2739 } | 2733 } |
| OLD | NEW |