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

Side by Side Diff: tests/html/node_bindings_test.dart

Issue 14883008: use .append instead of .nodes.add (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: revert node_test and element_test Created 7 years, 7 months 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
« no previous file with comments | « tests/html/native_gc_test.dart ('k') | tests/html/postmessage_structured_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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_observe/mdv_observe.dart'; 9 import 'package:mdv_observe/mdv_observe.dart';
10 import 'package:unittest/html_config.dart'; 10 import 'package:unittest/html_config.dart';
11 import 'package:unittest/unittest.dart'; 11 import 'package:unittest/unittest.dart';
12 import 'mdv_observe_utils.dart'; 12 import 'mdv_observe_utils.dart';
13 13
14 // Note: this file ported from 14 // Note: this file ported from
15 // https://github.com/toolkitchen/mdv/blob/master/tests/node_bindings.js 15 // https://github.com/toolkitchen/mdv/blob/master/tests/node_bindings.js
16 16
17 main() { 17 main() {
18 useHtmlConfiguration(); 18 useHtmlConfiguration();
19 group('Node Bindings', nodeBindingTests); 19 group('Node Bindings', nodeBindingTests);
20 } 20 }
21 21
22 sym(x) => new Symbol(x); 22 sym(x) => new Symbol(x);
23 23
24 nodeBindingTests() { 24 nodeBindingTests() {
25 var testDiv; 25 var testDiv;
26 26
27 setUp(() { 27 setUp(() {
28 document.body.nodes.add(testDiv = new DivElement()); 28 document.body.append(testDiv = new DivElement());
29 }); 29 });
30 30
31 tearDown(() { 31 tearDown(() {
32 testDiv.remove(); 32 testDiv.remove();
33 testDiv = null; 33 testDiv = null;
34 }); 34 });
35 35
36 dispatchEvent(type, target) { 36 dispatchEvent(type, target) {
37 target.dispatchEvent(new Event(type, cancelable: false)); 37 target.dispatchEvent(new Event(type, cancelable: false));
38 } 38 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 input.unbind('checked'); 128 input.unbind('checked');
129 129
130 input.checked = false; 130 input.checked = false;
131 dispatchEvent('change', input); 131 dispatchEvent('change', input);
132 expect(model[sym('x')], true, 132 expect(model[sym('x')], true,
133 reason: 'disconnected binding should not fire'); 133 reason: 'disconnected binding should not fire');
134 }); 134 });
135 135
136 test('Checkbox Input', () { 136 test('Checkbox Input', () {
137 var input = new InputElement(); 137 var input = new InputElement();
138 testDiv.nodes.add(input); 138 testDiv.append(input);
139 input.type = 'checkbox'; 139 input.type = 'checkbox';
140 var model = toSymbolMap({'x': true}); 140 var model = toSymbolMap({'x': true});
141 input.bind('checked', model, 'x'); 141 input.bind('checked', model, 'x');
142 expect(input.checked, true); 142 expect(input.checked, true);
143 143
144 model[sym('x')] = false; 144 model[sym('x')] = false;
145 expect(input.checked, true, reason: 'changes delivered async'); 145 expect(input.checked, true, reason: 'changes delivered async');
146 deliverChangeRecords(); 146 deliverChangeRecords();
147 expect(input.checked, false); 147 expect(input.checked, false);
148 148
149 input.click(); 149 input.click();
150 expect(model[sym('x')], true); 150 expect(model[sym('x')], true);
151 deliverChangeRecords(); 151 deliverChangeRecords();
152 152
153 input.click(); 153 input.click();
154 expect(model[sym('x')], false); 154 expect(model[sym('x')], false);
155 }); 155 });
156 } 156 }
OLDNEW
« no previous file with comments | « tests/html/native_gc_test.dart ('k') | tests/html/postmessage_structured_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698