| OLD | NEW |
| 1 library ElementTest; | 1 library ElementTest; |
| 2 |
| 2 import 'package:unittest/unittest.dart'; | 3 import 'package:unittest/unittest.dart'; |
| 3 import 'package:unittest/html_config.dart'; | 4 import 'package:unittest/html_config.dart'; |
| 4 import 'dart:html'; | 5 import 'dart:html'; |
| 5 import 'utils.dart'; | 6 import 'utils.dart'; |
| 6 | 7 |
| 7 main() { | 8 main() { |
| 8 useHtmlConfiguration(); | 9 useHtmlConfiguration(); |
| 9 test('InnerHTML', () { | 10 test('InnerHTML', () { |
| 10 Element element = new Element.tag('div'); | 11 Element element = new Element.tag('div'); |
| 11 element.id = 'test'; | 12 element.id = 'test'; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 54 } |
| 54 | 55 |
| 55 hasBeenInvoked = false; | 56 hasBeenInvoked = false; |
| 56 expect(div.dataset.putIfAbsent('bar', f), 'bar-value'); | 57 expect(div.dataset.putIfAbsent('bar', f), 'bar-value'); |
| 57 expect(hasBeenInvoked, isTrue); | 58 expect(hasBeenInvoked, isTrue); |
| 58 | 59 |
| 59 hasBeenInvoked = false; | 60 hasBeenInvoked = false; |
| 60 expect(div.dataset.putIfAbsent('bar', f), 'bar-value'); | 61 expect(div.dataset.putIfAbsent('bar', f), 'bar-value'); |
| 61 expect(hasBeenInvoked, isFalse); | 62 expect(hasBeenInvoked, isFalse); |
| 62 | 63 |
| 63 final keys = <String> []; | 64 final keys = <String>[]; |
| 64 final values = <String> []; | 65 final values = <String>[]; |
| 65 div.dataset.forEach((String key, String value) { | 66 div.dataset.forEach((String key, String value) { |
| 66 keys.add(key); | 67 keys.add(key); |
| 67 values.add(value); | 68 values.add(value); |
| 68 }); | 69 }); |
| 69 expect(keys, unorderedEquals(['foo', 'bar'])); | 70 expect(keys, unorderedEquals(['foo', 'bar'])); |
| 70 expect(values, unorderedEquals(['foo-value', 'bar-value'])); | 71 expect(values, unorderedEquals(['foo-value', 'bar-value'])); |
| 71 | 72 |
| 72 expect(new List<String>.from(div.dataset.keys), | 73 expect(new List<String>.from(div.dataset.keys), |
| 73 unorderedEquals(['foo', 'bar'])); | 74 unorderedEquals(['foo', 'bar'])); |
| 74 expect(new List<String>.from(div.dataset.values), | 75 expect(new List<String>.from(div.dataset.values), |
| 75 unorderedEquals(['foo-value', 'bar-value'])); | 76 unorderedEquals(['foo-value', 'bar-value'])); |
| 76 | 77 |
| 77 expect(div.dataset.length, 2); | 78 expect(div.dataset.length, 2); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 93 '<div id="dataDiv" data-my-message="Hello World"></div>', | 94 '<div id="dataDiv" data-my-message="Hello World"></div>', |
| 94 treeSanitizer: new NullTreeSanitizer()); | 95 treeSanitizer: new NullTreeSanitizer()); |
| 95 expect(otherDiv.dataset.containsKey('myMessage'), isTrue); | 96 expect(otherDiv.dataset.containsKey('myMessage'), isTrue); |
| 96 | 97 |
| 97 Element anotherDiv = new Element.html( | 98 Element anotherDiv = new Element.html( |
| 98 '<div id="dataDiv" data-eggs="bacon"></div>', | 99 '<div id="dataDiv" data-eggs="bacon"></div>', |
| 99 treeSanitizer: new NullTreeSanitizer()); | 100 treeSanitizer: new NullTreeSanitizer()); |
| 100 expect(anotherDiv.dataset.containsKey('eggs'), isTrue); | 101 expect(anotherDiv.dataset.containsKey('eggs'), isTrue); |
| 101 }); | 102 }); |
| 102 } | 103 } |
| OLD | NEW |