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

Unified Diff: pkg/template_binding/test/template_binding_test.dart

Issue 52553007: fix selected index binding to not count microtasks (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/template_binding/lib/src/input_bindings.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/template_binding/test/template_binding_test.dart
diff --git a/pkg/template_binding/test/template_binding_test.dart b/pkg/template_binding/test/template_binding_test.dart
index 2e5c3279952d9bfd48f4ea8b15890ec045070457..d43e36b426f40ff4fe1df4da00d50c4335a145af 100644
--- a/pkg/template_binding/test/template_binding_test.dart
+++ b/pkg/template_binding/test/template_binding_test.dart
@@ -1147,7 +1147,9 @@ templateInstantiationTests() {
expect(div.nodes[i++].text, 'Item 2');
});
- observeTest('Attribute Template Option/Optgroup', () {
+ // Note: we don't need a zone for this test, and we don't want to alter timing
+ // since we're testing a rather subtle relationship between select and option.
+ test('Attribute Template Option/Optgroup', () {
var div = createTestHtml(
'<template bind>'
'<select selectedIndex="{{ selected }}">'
@@ -1165,27 +1167,27 @@ templateInstantiationTests() {
});
recursivelySetTemplateModel(div, m);
- performMicrotaskCheckpoint();
-
- var select = div.nodes[0].nextNode;
- expect(select.nodes.length, 2);
-
- scheduleMicrotask(expectAsync0(() {
- scheduleMicrotask(expectAsync0(() {
- // TODO(jmesserly): this should be called sooner.
- expect(select.selectedIndex, 1);
- }));
- }));
- expect(select.nodes[0].tagName, 'TEMPLATE');
- expect((templateBind(templateBind(select.nodes[0]).ref)
- .content.nodes[0] as Element).tagName, 'OPTGROUP');
-
- var optgroup = select.nodes[1];
- expect(optgroup.nodes[0].tagName, 'TEMPLATE');
- expect(optgroup.nodes[1].tagName, 'OPTION');
- expect(optgroup.nodes[1].text, '0');
- expect(optgroup.nodes[2].tagName, 'OPTION');
- expect(optgroup.nodes[2].text, '1');
+ Observable.dirtyCheck();
+
+ // Use a timer so it's slower than mutation observers.
+ return new Future(() {
+ var select = div.nodes[0].nextNode;
+ expect(select.nodes.length, 2);
+
+ expect(select.selectedIndex, 1, reason: 'selected index should update by '
+ 'animationFrame time');
+
+ expect(select.nodes[0].tagName, 'TEMPLATE');
+ expect((templateBind(templateBind(select.nodes[0]).ref)
+ .content.nodes[0] as Element).tagName, 'OPTGROUP');
+
+ var optgroup = select.nodes[1];
+ expect(optgroup.nodes[0].tagName, 'TEMPLATE');
+ expect(optgroup.nodes[1].tagName, 'OPTION');
+ expect(optgroup.nodes[1].text, '0');
+ expect(optgroup.nodes[2].tagName, 'OPTION');
+ expect(optgroup.nodes[2].text, '1');
+ });
});
observeTest('NestedIterateTableMixedSemanticNative', () {
« no previous file with comments | « pkg/template_binding/lib/src/input_bindings.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698