| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library polymer.test.nested_binding_test; |
| 6 |
| 7 import 'dart:async'; |
| 8 import 'dart:html'; |
| 9 import 'dart:mirrors'; // import mirrors so we include String.length |
| 10 import 'package:polymer/polymer.dart'; |
| 11 import 'package:unittest/unittest.dart'; |
| 12 import 'package:unittest/html_config.dart'; |
| 13 import 'package:unittest/matcher.dart'; |
| 14 |
| 15 @CustomTag('my-test') |
| 16 class MyTest extends PolymerElement { |
| 17 final List fruits = toObservable(['apples', 'oranges', 'pears']); |
| 18 |
| 19 final _testDone = new Completer(); |
| 20 |
| 21 MyTest.created() : super.created(); |
| 22 |
| 23 _runTest(_) { |
| 24 expect($['fruit'].text.trim(), 'Short name: [pears]'); |
| 25 _testDone.complete(); |
| 26 } |
| 27 |
| 28 ready() { |
| 29 onMutation($['fruit']).then(_runTest); |
| 30 } |
| 31 |
| 32 } |
| 33 |
| 34 main() { |
| 35 reflectClass(String); // use the mirrors import to suppress a warning. |
| 36 |
| 37 initPolymer(); |
| 38 useHtmlConfiguration(); |
| 39 |
| 40 setUp(() => Polymer.onReady); |
| 41 |
| 42 test('ready called', () => (query('my-test') as MyTest)._testDone.future); |
| 43 } |
| OLD | NEW |