OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 import 'package:polymer/auto_binding.dart'; | 7 import 'package:polymer/auto_binding.dart'; |
8 import 'package:polymer/polymer.dart'; | 8 import 'package:polymer/polymer.dart'; |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 import 'package:unittest/html_config.dart'; | 10 import 'package:unittest/html_config.dart'; |
(...skipping 21 matching lines...) Expand all Loading... |
32 if (e.target.id == 'one') { | 32 if (e.target.id == 'one') { |
33 expect(e.target, template); | 33 expect(e.target, template); |
34 | 34 |
35 var t = template; | 35 var t = template; |
36 var h = t.$['h']; | 36 var h = t.$['h']; |
37 expect(h.text, t.model.greeting, reason: 'binding applied'); | 37 expect(h.text, t.model.greeting, reason: 'binding applied'); |
38 var ce = t.fire('tap', onNode: h, detail: []); | 38 var ce = t.fire('tap', onNode: h, detail: []); |
39 expect(ce.detail, ['handled'], reason: 'element event handler fired'); | 39 expect(ce.detail, ['handled'], reason: 'element event handler fired'); |
40 } | 40 } |
41 | 41 |
42 if (events == 2) completer.complete(); | 42 if (events == 3) completer.complete(); |
| 43 }); |
| 44 |
| 45 /// test dynamic creation |
| 46 new Future(() { |
| 47 var d = new DivElement(); |
| 48 d.setInnerHtml('<template is="auto-binding">Dynamical' |
| 49 ' <input value="{{value}}"><div>{{value}}</div></template>', |
| 50 treeSanitizer: new _NullSanitizer()); |
| 51 document.body.append(d); |
43 }); | 52 }); |
44 | 53 |
45 return completer.future; | 54 return completer.future; |
46 }); | 55 }); |
47 }); | 56 }); |
| 57 |
| 58 class _NullSanitizer implements NodeTreeSanitizer { |
| 59 sanitizeTree(Node node) {} |
| 60 } |
OLD | NEW |