| 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 node_bindings_test; | 5 library node_bindings_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'package:mdv/mdv.dart' as mdv; | 9 import 'package:mdv/mdv.dart' as mdv; |
| 10 import 'package:observe/observe.dart'; | 10 import 'package:observe/observe.dart'; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 setUp(() { | 31 setUp(() { |
| 32 document.body.append(testDiv = new DivElement()); | 32 document.body.append(testDiv = new DivElement()); |
| 33 }); | 33 }); |
| 34 | 34 |
| 35 tearDown(() { | 35 tearDown(() { |
| 36 testDiv.remove(); | 36 testDiv.remove(); |
| 37 testDiv = null; | 37 testDiv = null; |
| 38 }); | 38 }); |
| 39 | 39 |
| 40 dispatchEvent(type, target) { | |
| 41 target.dispatchEvent(new Event(type, cancelable: false)); | |
| 42 } | |
| 43 | |
| 44 observeTest('Text', () { | 40 observeTest('Text', () { |
| 45 var template = new Element.html('<template bind>{{a}} and {{b}}'); | 41 var template = new Element.html('<template bind>{{a}} and {{b}}'); |
| 46 testDiv.append(template); | 42 testDiv.append(template); |
| 47 var model = toSymbolMap({'a': 1, 'b': 2}); | 43 var model = toSymbolMap({'a': 1, 'b': 2}); |
| 48 template.model = model; | 44 template.model = model; |
| 49 performMicrotaskCheckpoint(); | 45 performMicrotaskCheckpoint(); |
| 50 var text = testDiv.nodes[1]; | 46 var text = testDiv.nodes[1]; |
| 51 expect(text.text, '1 and 2'); | 47 expect(text.text, '1 and 2'); |
| 52 | 48 |
| 53 model[sym('a')] = 3; | 49 model[sym('a')] = 3; |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 | 394 |
| 399 var model = toSymbolMap({'foo': 'bar'}); | 395 var model = toSymbolMap({'foo': 'bar'}); |
| 400 el.attributes['foo'] = '{{foo}} {{foo}}'; | 396 el.attributes['foo'] = '{{foo}} {{foo}}'; |
| 401 template.model = model; | 397 template.model = model; |
| 402 | 398 |
| 403 performMicrotaskCheckpoint(); | 399 performMicrotaskCheckpoint(); |
| 404 el = testDiv.nodes[1]; | 400 el = testDiv.nodes[1]; |
| 405 expect(el.attributes['foo'], 'bar bar'); | 401 expect(el.attributes['foo'], 'bar bar'); |
| 406 }); | 402 }); |
| 407 } | 403 } |
| OLD | NEW |