| OLD | NEW |
| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 final element = new Element.html( | 291 final element = new Element.html( |
| 292 '''<div class="foo" style="overflow: hidden" data-foo="bar" | 292 '''<div class="foo" style="overflow: hidden" data-foo="bar" |
| 293 data-foo2="bar2" dir="rtl"> | 293 data-foo2="bar2" dir="rtl"> |
| 294 </div>'''); | 294 </div>'''); |
| 295 final attributes = element.attributes; | 295 final attributes = element.attributes; |
| 296 expect(attributes['class'], 'foo'); | 296 expect(attributes['class'], 'foo'); |
| 297 expect(attributes['style'], startsWith('overflow: hidden')); | 297 expect(attributes['style'], startsWith('overflow: hidden')); |
| 298 expect(attributes['data-foo'], 'bar'); | 298 expect(attributes['data-foo'], 'bar'); |
| 299 expect(attributes['data-foo2'], 'bar2'); | 299 expect(attributes['data-foo2'], 'bar2'); |
| 300 expect(attributes.length, 5); | 300 expect(attributes.length, 5); |
| 301 expect(element.dataAttributes.length, 2); | 301 expect(element.dataset.length, 2); |
| 302 element.dataAttributes['foo'] = 'baz'; | 302 element.dataset['foo'] = 'baz'; |
| 303 expect(element.dataAttributes['foo'], 'baz'); | 303 expect(element.dataset['foo'], 'baz'); |
| 304 expect(attributes['data-foo'], 'baz'); | 304 expect(attributes['data-foo'], 'baz'); |
| 305 attributes['data-foo2'] = 'baz2'; | 305 attributes['data-foo2'] = 'baz2'; |
| 306 expect(attributes['data-foo2'], 'baz2'); | 306 expect(attributes['data-foo2'], 'baz2'); |
| 307 expect(element.dataAttributes['foo2'], 'baz2'); | 307 expect(element.dataset['foo2'], 'baz2'); |
| 308 expect(attributes['dir'], 'rtl'); | 308 expect(attributes['dir'], 'rtl'); |
| 309 | 309 |
| 310 final dataAttributes = element.dataAttributes; | 310 final dataset = element.dataset; |
| 311 dataAttributes.remove('foo2'); | 311 dataset.remove('foo2'); |
| 312 expect(attributes.length, 4); | 312 expect(attributes.length, 4); |
| 313 expect(dataAttributes.length, 1); | 313 expect(dataset.length, 1); |
| 314 attributes.remove('style'); | 314 attributes.remove('style'); |
| 315 expect(attributes.length, 3); | 315 expect(attributes.length, 3); |
| 316 dataAttributes['foo3'] = 'baz3'; | 316 dataset['foo3'] = 'baz3'; |
| 317 expect(dataAttributes.length, 2); | 317 expect(dataset.length, 2); |
| 318 expect(attributes.length, 4); | 318 expect(attributes.length, 4); |
| 319 attributes['style'] = 'width: 300px;'; | 319 attributes['style'] = 'width: 300px;'; |
| 320 expect(attributes.length, 5); | 320 expect(attributes.length, 5); |
| 321 }); | 321 }); |
| 322 | 322 |
| 323 test('namespaces', () { | 323 test('namespaces', () { |
| 324 var element = new svg.SvgElement.svg( | 324 var element = new svg.SvgElement.svg( |
| 325 '''<svg xmlns="http://www.w3.org/2000/svg" | 325 '''<svg xmlns="http://www.w3.org/2000/svg" |
| 326 xmlns:xlink="http://www.w3.org/1999/xlink"> | 326 xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 327 <image xlink:href="foo" data-foo="bar"/> | 327 <image xlink:href="foo" data-foo="bar"/> |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 }); | 641 }); |
| 642 | 642 |
| 643 test('getRange', () { | 643 test('getRange', () { |
| 644 var range = makeElList().getRange(1, 2); | 644 var range = makeElList().getRange(1, 2); |
| 645 expect(range, isElementList); | 645 expect(range, isElementList); |
| 646 expect(range[0], isImageElement); | 646 expect(range[0], isImageElement); |
| 647 expect(range[1], isInputElement); | 647 expect(range[1], isInputElement); |
| 648 }); | 648 }); |
| 649 }); | 649 }); |
| 650 } | 650 } |
| OLD | NEW |