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

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

Issue 12086062: Rename mappedBy to map. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Undo change to test-script. Created 7 years, 10 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/element_classes_test.dart ('k') | tests/html/streams_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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 ElementTest; 5 library ElementTest;
6 import '../../pkg/unittest/lib/unittest.dart'; 6 import '../../pkg/unittest/lib/unittest.dart';
7 import '../../pkg/unittest/lib/html_individual_config.dart'; 7 import '../../pkg/unittest/lib/html_individual_config.dart';
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:html'; 9 import 'dart:html';
10 import 'dart:svg' as svg; 10 import 'dart:svg' as svg;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 </table>'''); 102 </table>''');
103 expect(node, predicate((x) => x is TableElement, 'is a TableElement')); 103 expect(node, predicate((x) => x is TableElement, 'is a TableElement'));
104 expect(node.tagName, 'TABLE'); 104 expect(node.tagName, 'TABLE');
105 expect(node.parent, isNull); 105 expect(node.parent, isNull);
106 expect(node.caption.innerHtml, 106 expect(node.caption.innerHtml,
107 'Characteristics with positive and negative sides'); 107 'Characteristics with positive and negative sides');
108 expect(node.tHead.rows.length, 1); 108 expect(node.tHead.rows.length, 1);
109 expect(node.tHead.rows[0].cells.length, 3); 109 expect(node.tHead.rows[0].cells.length, 3);
110 expect(node.tBodies.length, 1); 110 expect(node.tBodies.length, 1);
111 expect(node.tBodies[0].rows.length, 2); 111 expect(node.tBodies[0].rows.length, 2);
112 expect(node.tBodies[0].rows[1].cells.mappedBy((c) => c.innerHtml), 112 expect(node.tBodies[0].rows[1].cells.map((c) => c.innerHtml),
113 [' Failing\n ', ' Grade\n ', ' Passing\n']); 113 [' Failing\n ', ' Grade\n ', ' Passing\n']);
114 }); 114 });
115 115
116 test('.html caption', () { 116 test('.html caption', () {
117 var node = new Element.html('<caption><p>Table 1.'); 117 var node = new Element.html('<caption><p>Table 1.');
118 expect(node, predicate((x) => x is TableCaptionElement, 118 expect(node, predicate((x) => x is TableCaptionElement,
119 'is a TableCaptionElement')); 119 'is a TableCaptionElement'));
120 expect(node.tagName, 'CAPTION'); 120 expect(node.tagName, 'CAPTION');
121 expect(node.parent, isNull); 121 expect(node.parent, isNull);
122 expect(node.innerHtml, '<p>Table 1.</p>'); 122 expect(node.innerHtml, '<p>Table 1.</p>');
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 expect(node.rows[0].cells.length, 2); 175 expect(node.rows[0].cells.length, 2);
176 expect(node.innerHtml, innerHtml); 176 expect(node.innerHtml, innerHtml);
177 }); 177 });
178 178
179 test('.html tr', () { 179 test('.html tr', () {
180 var node = new Element.html('<tr><td>foo<td>bar'); 180 var node = new Element.html('<tr><td>foo<td>bar');
181 expect(node, predicate((x) => x is TableRowElement, 181 expect(node, predicate((x) => x is TableRowElement,
182 'is a TableRowElement')); 182 'is a TableRowElement'));
183 expect(node.tagName, 'TR'); 183 expect(node.tagName, 'TR');
184 expect(node.parent, isNull); 184 expect(node.parent, isNull);
185 expect(node.cells.mappedBy((c) => c.innerHtml), ['foo', 'bar']); 185 expect(node.cells.map((c) => c.innerHtml), ['foo', 'bar']);
186 }); 186 });
187 187
188 test('.html td', () { 188 test('.html td', () {
189 var node = new Element.html('<td>foobar'); 189 var node = new Element.html('<td>foobar');
190 expect(node, predicate((x) => x is TableCellElement, 190 expect(node, predicate((x) => x is TableCellElement,
191 'is a TableCellElement')); 191 'is a TableCellElement'));
192 expect(node.tagName, 'TD'); 192 expect(node.tagName, 'TD');
193 expect(node.parent, isNull); 193 expect(node.parent, isNull);
194 expect(node.innerHtml, 'foobar'); 194 expect(node.innerHtml, 'foobar');
195 }); 195 });
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 532
533 test('forEach', () { 533 test('forEach', () {
534 var els = []; 534 var els = [];
535 getQueryAll().forEach((el) => els.add(el)); 535 getQueryAll().forEach((el) => els.add(el));
536 expect(els[0], isAnchorElement); 536 expect(els[0], isAnchorElement);
537 expect(els[1], isSpanElement); 537 expect(els[1], isSpanElement);
538 expect(els[2], isHRElement); 538 expect(els[2], isHRElement);
539 }); 539 });
540 540
541 test('mappedBy', () { 541 test('mappedBy', () {
542 var texts = getQueryAll().mappedBy((el) => el.text).toList(); 542 var texts = getQueryAll().map((el) => el.text).toList();
543 expect(texts, equals(['Dart!', 'Hello', ''])); 543 expect(texts, equals(['Dart!', 'Hello', '']));
544 }); 544 });
545 545
546 test('where', () { 546 test('where', () {
547 var filtered = getQueryAll().where((n) => n is SpanElement).toList(); 547 var filtered = getQueryAll().where((n) => n is SpanElement).toList();
548 expect(filtered.length, 1); 548 expect(filtered.length, 1);
549 expect(filtered[0], isSpanElement); 549 expect(filtered[0], isSpanElement);
550 expect(filtered, isElementList); 550 expect(filtered, isElementList);
551 }); 551 });
552 552
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 }); 630 });
631 631
632 test('getRange', () { 632 test('getRange', () {
633 var range = makeElList().getRange(1, 2); 633 var range = makeElList().getRange(1, 2);
634 expect(range, isElementList); 634 expect(range, isElementList);
635 expect(range[0], isImageElement); 635 expect(range[0], isImageElement);
636 expect(range[1], isInputElement); 636 expect(range[1], isInputElement);
637 }); 637 });
638 }); 638 });
639 } 639 }
OLDNEW
« no previous file with comments | « tests/html/element_classes_test.dart ('k') | tests/html/streams_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698