Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: pkg/polymer/test/bind_mdv_test.dart

Issue 41293002: Fixes from polymer.dart API review (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Made Job a part of polymer Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 polymer.test.bind_mdv_test; 5 library polymer.test.bind_mdv_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'package:custom_element/polyfill.dart'; 9 import 'package:custom_element/polyfill.dart';
10 import 'package:template_binding/template_binding.dart'; 10 import 'package:template_binding/template_binding.dart';
11 import 'package:observe/observe.dart'; 11 import 'package:observe/observe.dart';
12 import 'package:observe/src/microtask.dart' show runMicrotask;
13 import 'package:polymer/platform.dart' as Platform;
14 import 'package:unittest/html_config.dart'; 12 import 'package:unittest/html_config.dart';
15 import 'package:unittest/unittest.dart'; 13 import 'package:unittest/unittest.dart';
16 14
17 main() { 15 main() {
18 useHtmlConfiguration(); 16 useHtmlConfiguration();
19 17
20 var registered = loadCustomElementPolyfill().then((_) { 18 var registered = loadCustomElementPolyfill().then((_) {
21 document.register('my-div', MyDivElement); 19 document.register('my-div', MyDivElement);
22 }); 20 });
23 21
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 58
61 test('bind input', () { 59 test('bind input', () {
62 var fragment = parseAndBindHTML('<input value="{{bar}}" />', div); 60 var fragment = parseAndBindHTML('<input value="{{bar}}" />', div);
63 div.append(fragment); 61 div.append(fragment);
64 var a = div.query('input'); 62 var a = div.query('input');
65 63
66 div.bar = 'hello'; 64 div.bar = 'hello';
67 // TODO(sorvell): fix this when observe-js lets us explicitly listen for 65 // TODO(sorvell): fix this when observe-js lets us explicitly listen for
68 // a change on input.value 66 // a change on input.value
69 Observable.dirtyCheck(); 67 Observable.dirtyCheck();
70 Platform.endOfMicrotask(expectAsync0(() { 68 return new Future.microtask(() {
71 expect(a.value, 'hello'); 69 expect(a.value, 'hello');
72 })); 70 });
73 }); 71 });
74 } 72 }
75 73
76 class MyDivElement extends HtmlElement with Observable { 74 class MyDivElement extends HtmlElement with Observable {
77 factory MyDivElement() => new Element.tag('my-div'); 75 factory MyDivElement() => new Element.tag('my-div');
78 MyDivElement.created() : super.created(); 76 MyDivElement.created() : super.created();
79 @observable var bar; 77 @observable var bar;
80 } 78 }
81 79
82 class NullTreeSanitizer implements NodeTreeSanitizer { 80 class NullTreeSanitizer implements NodeTreeSanitizer {
83 const NullTreeSanitizer(); 81 const NullTreeSanitizer();
84 void sanitizeTree(Node node) {} 82 void sanitizeTree(Node node) {}
85 } 83 }
86 84
87 Future onAttributeChange(Element node) { 85 Future onAttributeChange(Element node) {
88 var completer = new Completer(); 86 var completer = new Completer();
89 new MutationObserver((records, observer) { 87 new MutationObserver((records, observer) {
90 observer.disconnect(); 88 observer.disconnect();
91 completer.complete(); 89 completer.complete();
92 })..observe(node, attributes: true); 90 })..observe(node, attributes: true);
93 Platform.flush(); 91 scheduleMicrotask(Observable.dirtyCheck);
94 return completer.future; 92 return completer.future;
95 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698