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

Side by Side Diff: pkg/mdv/test/element_bindings_test.dart

Issue 18117012: [package:mdv] Support binding to HTMLSelectElement.selectedIndex (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix merge issue 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/mdv/lib/src/select_element.dart ('k') | pkg/mdv/test/template_element_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/mdv.dart' as mdv; 9 import 'package:mdv/mdv.dart' as mdv;
10 import 'package:observe/observe.dart'; 10 import 'package:observe/observe.dart';
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 var model = toSymbolMap({'a': {'b': false}}); 365 var model = toSymbolMap({'a': {'b': false}});
366 input.bind('checked', model, 'a.b'); 366 input.bind('checked', model, 'a.b');
367 367
368 input.click(); 368 input.click();
369 expect(model[sym('a')][sym('b')], true); 369 expect(model[sym('a')][sym('b')], true);
370 370
371 input.click(); 371 input.click();
372 expect(model[sym('a')][sym('b')], false); 372 expect(model[sym('a')][sym('b')], false);
373 }); 373 });
374 374
375 test('Select selectedIndex', function() {
376 var select = new SelectElement();
377 testDiv.append(select);
378 var option0 = select.append(new OptionElement());
379 var option1 = select.append(new OptionElement());
380 var option2 = select.append(new OptionElement());
381
382 var model = toSymbolMap({'val': 2});
383
384 select.bind('selectedIndex', model, 'val');
385 deliverChangeRecords();
386 expect(select.selectedIndex, 2);
387
388 select.selectedIndex = 1;
389 dispatchEvent('change', select);
390 expect(model[sym('val')], 1);
391 });
392
375 test('MultipleReferences', () { 393 test('MultipleReferences', () {
376 var el = new DivElement(); 394 var el = new DivElement();
377 var template = new Element.html('<template bind>'); 395 var template = new Element.html('<template bind>');
378 template.content.append(el); 396 template.content.append(el);
379 testDiv.append(template); 397 testDiv.append(template);
380 398
381 var model = toSymbolMap({'foo': 'bar'}); 399 var model = toSymbolMap({'foo': 'bar'});
382 el.attributes['foo'] = '{{foo}} {{foo}}'; 400 el.attributes['foo'] = '{{foo}} {{foo}}';
383 template.model = model; 401 template.model = model;
384 402
385 deliverChangeRecords(); 403 deliverChangeRecords();
386 el = testDiv.nodes[1]; 404 el = testDiv.nodes[1];
387 expect(el.attributes['foo'], 'bar bar'); 405 expect(el.attributes['foo'], 'bar bar');
388 }); 406 });
389 } 407 }
OLDNEW
« no previous file with comments | « pkg/mdv/lib/src/select_element.dart ('k') | pkg/mdv/test/template_element_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698