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

Unified Diff: pkg/mdv/test/node_bindings_test.dart

Issue 19593006: [mdv] Implement two-way binding to HTMLTextArea.value (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: pkg/mdv/test/node_bindings_test.dart
diff --git a/pkg/mdv/test/node_bindings_test.dart b/pkg/mdv/test/node_bindings_test.dart
index 7cd1e035b077062fab32f00ec9480db9ad7f5155..b05a7fb96871c22e69b663a9b12388490733eb12 100644
--- a/pkg/mdv/test/node_bindings_test.dart
+++ b/pkg/mdv/test/node_bindings_test.dart
@@ -84,32 +84,36 @@ nodeBindingTests() {
expect(element.id, 'x');
});
- observeTest('Text Input', () {
- var input = new InputElement();
+ inputTextAreaValueTest(String tagName) {
+ var el = new Element.tag(tagName);
+ testDiv.nodes.add(el);
var model = toSymbolMap({'x': 42});
- input.bind('value', model, 'x');
- expect(input.value, '42');
+ el.bind('value', model, 'x');
+ expect(el.value, '42');
model[sym('x')] = 'Hi';
- expect(input.value, '42', reason: 'changes delivered async');
+ expect(el.value, '42', reason: 'changes delivered async');
performMicrotaskCheckpoint();
- expect(input.value, 'Hi');
+ expect(el.value, 'Hi');
- input.value = 'changed';
- dispatchEvent('input', input);
+ el.value = 'changed';
+ dispatchEvent('input', el);
expect(model[sym('x')], 'changed');
- input.unbind('value');
+ el.unbind('value');
- input.value = 'changed again';
- dispatchEvent('input', input);
+ el.value = 'changed again';
+ dispatchEvent('input', el);
expect(model[sym('x')], 'changed');
- input.bind('value', model, 'x');
+ el.bind('value', model, 'x');
model[sym('x')] = null;
performMicrotaskCheckpoint();
- expect(input.value, '');
- });
+ expect(el.value, '');
+ }
+
+ observeTest('Input.value', () => inputTextAreaValueTest('input'));
+ observeTest('TextArea.value', () => inputTextAreaValueTest('textarea'));
observeTest('Radio Input', () {
var input = new InputElement();
« pkg/mdv/lib/src/input_bindings.dart ('K') | « pkg/mdv/lib/src/text_area_element.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698