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

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

Issue 12549025: Narrowing attribute maps to only accept strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/html/instance_of_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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 e.onClick.listen((event) { 273 e.onClick.listen((event) {
274 firedEvent = true; 274 firedEvent = true;
275 }); 275 });
276 expect(firedEvent, false); 276 expect(firedEvent, false);
277 e.click(); 277 e.click();
278 expect(firedEvent, true); 278 expect(firedEvent, true);
279 }); 279 });
280 }); 280 });
281 281
282 group('attributes', () { 282 group('attributes', () {
283 test('coercion', () {
284 final element = new Element.tag('div');
285 element.attributes['foo'] = 42;
286 element.attributes['bar'] = 3.1;
287 expect(element.attributes['foo'], '42');
288 expect(element.attributes['bar'], '3.1');
289 });
290 test('manipulation', () { 283 test('manipulation', () {
291 final element = new Element.html( 284 final element = new Element.html(
292 '''<div class="foo" style="overflow: hidden" data-foo="bar" 285 '''<div class="foo" style="overflow: hidden" data-foo="bar"
293 data-foo2="bar2" dir="rtl"> 286 data-foo2="bar2" dir="rtl">
294 </div>'''); 287 </div>''');
295 final attributes = element.attributes; 288 final attributes = element.attributes;
296 expect(attributes['class'], 'foo'); 289 expect(attributes['class'], 'foo');
297 expect(attributes['style'], startsWith('overflow: hidden')); 290 expect(attributes['style'], startsWith('overflow: hidden'));
298 expect(attributes['data-foo'], 'bar'); 291 expect(attributes['data-foo'], 'bar');
299 expect(attributes['data-foo2'], 'bar2'); 292 expect(attributes['data-foo2'], 'bar2');
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 }); 638 });
646 639
647 test('sublist', () { 640 test('sublist', () {
648 var range = makeElList().sublist(1, 3); 641 var range = makeElList().sublist(1, 3);
649 expect(range, isElementList); 642 expect(range, isElementList);
650 expect(range[0], isImageElement); 643 expect(range[0], isImageElement);
651 expect(range[1], isInputElement); 644 expect(range[1], isInputElement);
652 }); 645 });
653 }); 646 });
654 } 647 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/html/instance_of_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698