OLD | NEW |
1 #library('ElementTest'); | 1 #library('ElementTest'); |
2 #import('../../pkg/unittest/unittest.dart'); | 2 #import('../../pkg/unittest/unittest.dart'); |
3 #import('../../pkg/unittest/html_config.dart'); | 3 #import('../../pkg/unittest/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 14 matching lines...) Expand all Loading... |
25 row.nodes.add(new Element.tag('td')); | 25 row.nodes.add(new Element.tag('td')); |
26 | 26 |
27 Expect.equals(2, row.cells.length); | 27 Expect.equals(2, row.cells.length); |
28 | 28 |
29 TableRowElement headerRow = table.rows[0]; | 29 TableRowElement headerRow = table.rows[0]; |
30 Expect.equals(2, headerRow.cells.length); | 30 Expect.equals(2, headerRow.cells.length); |
31 }); | 31 }); |
32 test('dataAttributes', () { | 32 test('dataAttributes', () { |
33 Element div = new Element.tag('div'); | 33 Element div = new Element.tag('div'); |
34 | 34 |
35 Expect.isTrue(div.dataAttributes.isEmpty()); | 35 Expect.isTrue(div.dataAttributes.isEmpty); |
36 Expect.equals(null, div.dataAttributes['foo']); | 36 Expect.equals(null, div.dataAttributes['foo']); |
37 Expect.isTrue(div.dataAttributes.isEmpty()); | 37 Expect.isTrue(div.dataAttributes.isEmpty); |
38 | 38 |
39 div.dataAttributes['foo'] = 'foo-value'; | 39 div.dataAttributes['foo'] = 'foo-value'; |
40 Expect.equals('foo-value', div.dataAttributes['foo']); | 40 Expect.equals('foo-value', div.dataAttributes['foo']); |
41 Expect.isFalse(div.dataAttributes.isEmpty()); | 41 Expect.isFalse(div.dataAttributes.isEmpty); |
42 | 42 |
43 Expect.isTrue(div.dataAttributes.containsValue('foo-value')); | 43 Expect.isTrue(div.dataAttributes.containsValue('foo-value')); |
44 Expect.isFalse(div.dataAttributes.containsValue('bar-value')); | 44 Expect.isFalse(div.dataAttributes.containsValue('bar-value')); |
45 Expect.isTrue(div.dataAttributes.containsKey('foo')); | 45 Expect.isTrue(div.dataAttributes.containsKey('foo')); |
46 Expect.isFalse(div.dataAttributes.containsKey('bar')); | 46 Expect.isFalse(div.dataAttributes.containsKey('bar')); |
47 | 47 |
48 bool hasBeenInvoked; | 48 bool hasBeenInvoked; |
49 String f() { | 49 String f() { |
50 hasBeenInvoked = true; | 50 hasBeenInvoked = true; |
51 return 'bar-value'; | 51 return 'bar-value'; |
(...skipping 15 matching lines...) Expand all Loading... |
67 }); | 67 }); |
68 Expect.setEquals(const <String> ['foo', 'bar'], keys); | 68 Expect.setEquals(const <String> ['foo', 'bar'], keys); |
69 Expect.setEquals(const <String> ['foo-value', 'bar-value'], values); | 69 Expect.setEquals(const <String> ['foo-value', 'bar-value'], values); |
70 | 70 |
71 Expect.setEquals(const <String> ['foo', 'bar'], | 71 Expect.setEquals(const <String> ['foo', 'bar'], |
72 new List<String>.from(div.dataAttributes.getKeys())); | 72 new List<String>.from(div.dataAttributes.getKeys())); |
73 Expect.setEquals(const <String> ['foo-value', 'bar-value'], | 73 Expect.setEquals(const <String> ['foo-value', 'bar-value'], |
74 new List<String>.from(div.dataAttributes.getValues())); | 74 new List<String>.from(div.dataAttributes.getValues())); |
75 | 75 |
76 Expect.equals(2, div.dataAttributes.length); | 76 Expect.equals(2, div.dataAttributes.length); |
77 Expect.isFalse(div.dataAttributes.isEmpty()); | 77 Expect.isFalse(div.dataAttributes.isEmpty); |
78 | 78 |
79 Expect.isNull(div.dataAttributes.remove('qux')); | 79 Expect.isNull(div.dataAttributes.remove('qux')); |
80 Expect.equals(2, div.dataAttributes.length); | 80 Expect.equals(2, div.dataAttributes.length); |
81 Expect.isFalse(div.dataAttributes.isEmpty()); | 81 Expect.isFalse(div.dataAttributes.isEmpty); |
82 | 82 |
83 Expect.equals('foo-value', div.dataAttributes.remove('foo')); | 83 Expect.equals('foo-value', div.dataAttributes.remove('foo')); |
84 Expect.equals(1, div.dataAttributes.length); | 84 Expect.equals(1, div.dataAttributes.length); |
85 Expect.isFalse(div.dataAttributes.isEmpty()); | 85 Expect.isFalse(div.dataAttributes.isEmpty); |
86 | 86 |
87 div.dataAttributes.clear(); | 87 div.dataAttributes.clear(); |
88 Expect.equals(0, div.dataAttributes.length); | 88 Expect.equals(0, div.dataAttributes.length); |
89 Expect.isTrue(div.dataAttributes.isEmpty()); | 89 Expect.isTrue(div.dataAttributes.isEmpty); |
90 }); | 90 }); |
91 } | 91 } |
OLD | NEW |