Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 library ElementTest; | 1 library ElementTest; |
| 2 import '../../pkg/unittest/lib/unittest.dart'; | 2 import '../../pkg/unittest/lib/unittest.dart'; |
| 3 import '../../pkg/unittest/lib/html_config.dart'; | 3 import '../../pkg/unittest/lib/html_config.dart'; |
| 4 import 'dart:html'; | 4 import 'dart:html'; |
| 5 | 5 |
| 6 main() { | 6 main() { |
| 7 useHtmlConfiguration(); | 7 useHtmlConfiguration(); |
| 8 test('InnerHTML', () { | 8 test('InnerHTML', () { |
| 9 Element element = new Element.tag('div'); | 9 Element element = new Element.tag('div'); |
| 10 element.id = 'test'; | 10 element.id = 'test'; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 hasBeenInvoked = false; | 54 hasBeenInvoked = false; |
| 55 expect(div.dataAttributes.putIfAbsent('bar', f), 'bar-value'); | 55 expect(div.dataAttributes.putIfAbsent('bar', f), 'bar-value'); |
| 56 expect(hasBeenInvoked, isTrue); | 56 expect(hasBeenInvoked, isTrue); |
| 57 | 57 |
| 58 hasBeenInvoked = false; | 58 hasBeenInvoked = false; |
| 59 expect(div.dataAttributes.putIfAbsent('bar', f), 'bar-value'); | 59 expect(div.dataAttributes.putIfAbsent('bar', f), 'bar-value'); |
| 60 expect(hasBeenInvoked, isFalse); | 60 expect(hasBeenInvoked, isFalse); |
| 61 | 61 |
| 62 final keys = <String> []; | 62 final keys = <String> []; |
| 63 final values = <String> []; | 63 final values = <String> []; |
| 64 div.dataAttributes.forEach(void f(String key, String value) { | 64 div.dataAttributes.forEach((String key, String value) { |
|
Emily Fortuna
2012/12/21 00:44:18
I thought this was supported? no longer?
blois
2012/12/21 01:05:42
It's supported, just needed to remove the return v
Emily Fortuna
2012/12/21 01:07:31
Oh okay. I thought for some reason that the vm and
blois
2012/12/21 01:13:17
Dartc was saying it's deprecated, but I don't know
| |
| 65 keys.add(key); | 65 keys.add(key); |
| 66 values.add(value); | 66 values.add(value); |
| 67 }); | 67 }); |
| 68 expect(keys, unorderedEquals(['foo', 'bar'])); | 68 expect(keys, unorderedEquals(['foo', 'bar'])); |
| 69 expect(values, unorderedEquals(['foo-value', 'bar-value'])); | 69 expect(values, unorderedEquals(['foo-value', 'bar-value'])); |
| 70 | 70 |
| 71 expect(new List<String>.from(div.dataAttributes.keys), | 71 expect(new List<String>.from(div.dataAttributes.keys), |
| 72 unorderedEquals(['foo', 'bar'])); | 72 unorderedEquals(['foo', 'bar'])); |
| 73 expect(new List<String>.from(div.dataAttributes.values), | 73 expect(new List<String>.from(div.dataAttributes.values), |
| 74 unorderedEquals(['foo-value', 'bar-value'])); | 74 unorderedEquals(['foo-value', 'bar-value'])); |
| 75 | 75 |
| 76 expect(div.dataAttributes.length, 2); | 76 expect(div.dataAttributes.length, 2); |
| 77 expect(div.dataAttributes.isEmpty, isFalse); | 77 expect(div.dataAttributes.isEmpty, isFalse); |
| 78 | 78 |
| 79 expect(div.dataAttributes.remove('qux'), isNull); | 79 expect(div.dataAttributes.remove('qux'), isNull); |
| 80 expect(div.dataAttributes.length, 2); | 80 expect(div.dataAttributes.length, 2); |
| 81 expect(div.dataAttributes.isEmpty, isFalse); | 81 expect(div.dataAttributes.isEmpty, isFalse); |
| 82 | 82 |
| 83 expect(div.dataAttributes.remove('foo'), 'foo-value'); | 83 expect(div.dataAttributes.remove('foo'), 'foo-value'); |
| 84 expect(div.dataAttributes.length, 1); | 84 expect(div.dataAttributes.length, 1); |
| 85 expect(div.dataAttributes.isEmpty, isFalse); | 85 expect(div.dataAttributes.isEmpty, isFalse); |
| 86 | 86 |
| 87 div.dataAttributes.clear(); | 87 div.dataAttributes.clear(); |
| 88 expect(div.dataAttributes.length, 0); | 88 expect(div.dataAttributes.length, 0); |
| 89 expect(div.dataAttributes.isEmpty, isTrue); | 89 expect(div.dataAttributes.isEmpty, isTrue); |
| 90 }); | 90 }); |
| 91 } | 91 } |
| OLD | NEW |