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

Side by Side Diff: pkg/template_binding/test/template_binding_test.dart

Issue 86153003: attempt to reduce IE flakiness in template_bind_test (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 | « no previous file | no next file » | 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 template_binding.test.template_binding_test; 5 library template_binding.test.template_binding_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:html'; 9 import 'dart:html';
10 import 'dart:math' as math; 10 import 'dart:math' as math;
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 '</template>'); 1170 '</template>');
1171 1171
1172 var m = toObservable({ 1172 var m = toObservable({
1173 'selected': 1, 1173 'selected': 1,
1174 'groups': [{ 1174 'groups': [{
1175 'name': 'one', 'items': [{ 'val': 0 }, { 'val': 1 }] 1175 'name': 'one', 'items': [{ 'val': 0 }, { 'val': 1 }]
1176 }], 1176 }],
1177 }); 1177 });
1178 1178
1179 recursivelySetTemplateModel(div, m); 1179 recursivelySetTemplateModel(div, m);
1180
1181 var completer = new Completer();
1182
1183 new MutationObserver((records, observer) {
1184 var select = div.nodes[0].nextNode;
1185 if (select == null || select.querySelector('option') == null) return;
1186
1187 observer.disconnect();
1188 new Future(() {
1189 expect(select.nodes.length, 2);
1190
1191 expect(select.selectedIndex, 1, reason: 'selected index should update '
1192 'after template expands.');
1193
1194 expect(select.nodes[0].tagName, 'TEMPLATE');
1195 expect((templateBind(templateBind(select.nodes[0]).ref)
1196 .content.nodes[0] as Element).tagName, 'OPTGROUP');
1197
1198 var optgroup = select.nodes[1];
1199 expect(optgroup.nodes[0].tagName, 'TEMPLATE');
1200 expect(optgroup.nodes[1].tagName, 'OPTION');
1201 expect(optgroup.nodes[1].text, '0');
1202 expect(optgroup.nodes[2].tagName, 'OPTION');
1203 expect(optgroup.nodes[2].text, '1');
1204
1205 completer.complete();
1206 });
1207 })..observe(div, childList: true, subtree: true);
1208
1180 Observable.dirtyCheck(); 1209 Observable.dirtyCheck();
1181 1210
1182 // Use a timer so it's slower than mutation observers. 1211 return completer.future;
1183 return new Future(() {
1184 var select = div.nodes[0].nextNode;
1185 expect(select.nodes.length, 2);
1186
1187 expect(select.selectedIndex, 1, reason: 'selected index should update by '
1188 'animationFrame time');
1189
1190 expect(select.nodes[0].tagName, 'TEMPLATE');
1191 expect((templateBind(templateBind(select.nodes[0]).ref)
1192 .content.nodes[0] as Element).tagName, 'OPTGROUP');
1193
1194 var optgroup = select.nodes[1];
1195 expect(optgroup.nodes[0].tagName, 'TEMPLATE');
1196 expect(optgroup.nodes[1].tagName, 'OPTION');
1197 expect(optgroup.nodes[1].text, '0');
1198 expect(optgroup.nodes[2].tagName, 'OPTION');
1199 expect(optgroup.nodes[2].text, '1');
1200 });
1201 }); 1212 });
1202 1213
1203 observeTest('NestedIterateTableMixedSemanticNative', () { 1214 observeTest('NestedIterateTableMixedSemanticNative', () {
1204 if (!parserHasNativeTemplate) return; 1215 if (!parserHasNativeTemplate) return;
1205 1216
1206 var div = createTestHtml( 1217 var div = createTestHtml(
1207 '<table><tbody>' 1218 '<table><tbody>'
1208 '<template repeat="{{}}">' 1219 '<template repeat="{{}}">'
1209 '<tr>' 1220 '<tr>'
1210 '<td template repeat="{{}}" class="{{ val }}">{{ val }}</td>' 1221 '<td template repeat="{{}}" class="{{ val }}">{{ val }}</td>'
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 prepareBinding(path, name, node) { 1877 prepareBinding(path, name, node) {
1867 if (name != 'text' || path != 'age') return null; 1878 if (name != 'text' || path != 'age') return null;
1868 1879
1869 return (model, node) { 1880 return (model, node) {
1870 expect(model['age'], expectedAge); 1881 expect(model['age'], expectedAge);
1871 count++; 1882 count++;
1872 return model; 1883 return model;
1873 }; 1884 };
1874 } 1885 }
1875 } 1886 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698