| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:html'; | 6 import 'dart:html'; |
| 7 | 7 |
| 8 import 'package:logging/logging.dart'; | 8 import 'package:logging/logging.dart'; |
| 9 import 'package:observe/observe.dart'; | 9 import 'package:observe/observe.dart'; |
| 10 import 'package:polymer_expressions/polymer_expressions.dart'; | 10 import 'package:polymer_expressions/polymer_expressions.dart'; |
| 11 import 'package:template_binding/template_binding.dart'; | 11 import 'package:template_binding/template_binding.dart'; |
| 12 import 'package:unittest/html_enhanced_config.dart'; | 12 import 'package:unittest/html_config.dart'; |
| 13 import 'package:unittest/unittest.dart'; | 13 import 'package:unittest/unittest.dart'; |
| 14 | 14 |
| 15 main() { | 15 main() { |
| 16 useHtmlEnhancedConfiguration(); | 16 useHtmlConfiguration(); |
| 17 | 17 |
| 18 group('PolymerExpressions', () { | 18 group('PolymerExpressions', () { |
| 19 var testDiv; | 19 var testDiv; |
| 20 | 20 |
| 21 setUp(() { | 21 setUp(() { |
| 22 document.body.append(testDiv = new DivElement()); | 22 document.body.append(testDiv = new DivElement()); |
| 23 }); | 23 }); |
| 24 | 24 |
| 25 tearDown(() { | 25 tearDown(() { |
| 26 testDiv.firstChild.remove(); | 26 testDiv.firstChild.remove(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // the template should be the only node | 60 // the template should be the only node |
| 61 expect(testDiv.nodes.length, 1); | 61 expect(testDiv.nodes.length, 1); |
| 62 expect(testDiv.nodes[0].id, 'test'); | 62 expect(testDiv.nodes[0].id, 'test'); |
| 63 }); | 63 }); |
| 64 | 64 |
| 65 test('should silently handle bad variable names', () { | 65 test('should silently handle bad variable names', () { |
| 66 var logger = new Logger('polymer_expressions'); | 66 var logger = new Logger('polymer_expressions'); |
| 67 var logFuture = logger.onRecord.toList(); | 67 var logFuture = logger.onRecord.toList(); |
| 68 testDiv.nodes.add(new Element.html(''' | 68 testDiv.nodes.add(new Element.html(''' |
| 69 <template id="test" bind>{{ foo }}</template>''')); | 69 <template id="test" bind>{{ foo }}</template>''')); |
| 70 templateBind(query('#test')).bindingDelegate = new PolymerExpressions(); | 70 templateBind(query('#test')) |
| 71 ..bindingDelegate = new PolymerExpressions() |
| 72 ..model = []; |
| 71 return new Future(() { | 73 return new Future(() { |
| 72 logger.clearListeners(); | 74 logger.clearListeners(); |
| 73 return logFuture.then((records) { | 75 return logFuture.then((records) { |
| 74 expect(records.length, 1); | 76 expect(records.length, 1); |
| 75 expect(records.first.message, | 77 expect(records.first.message, |
| 76 contains('Error evaluating expression')); | 78 contains('Error evaluating expression')); |
| 77 expect(records.first.message, contains('foo')); | 79 expect(records.first.message, contains('foo')); |
| 78 }); | 80 }); |
| 79 }); | 81 }); |
| 80 }); | 82 }); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 104 String getFullName() => '$_firstName $_lastName'; | 106 String getFullName() => '$_firstName $_lastName'; |
| 105 | 107 |
| 106 List<String> get items => _items; | 108 List<String> get items => _items; |
| 107 | 109 |
| 108 void set items(List<String> value) { | 110 void set items(List<String> value) { |
| 109 _items = notifyPropertyChange(#items, _items, value); | 111 _items = notifyPropertyChange(#items, _items, value); |
| 110 } | 112 } |
| 111 | 113 |
| 112 String toString() => "Person(firstName: $_firstName, lastName: $_lastName)"; | 114 String toString() => "Person(firstName: $_firstName, lastName: $_lastName)"; |
| 113 } | 115 } |
| OLD | NEW |