OLD | NEW |
1 <html> | |
2 <foo /> | |
3 <script> | |
4 import "../resources/third_party/unittest/unittest.dart"; | 1 import "../resources/third_party/unittest/unittest.dart"; |
5 import "../resources/unit.dart"; | 2 import "../resources/unit.dart"; |
6 | 3 |
7 import "dart:sky"; | 4 import "dart:sky"; |
8 | 5 |
9 void main() { | 6 void main() { |
10 initUnit(); | 7 initUnit(); |
11 | 8 |
12 test('should not crash when setting style to null', () { | 9 test('should not crash when setting style to null', () { |
13 var foo = document.querySelector('foo'); | 10 LayoutRoot layoutRoot = new LayoutRoot(); |
| 11 var document = new Document(); |
| 12 var foo = document.createElement('foo'); |
| 13 layoutRoot.rootElement = foo; |
| 14 |
14 expect(foo.style['color'], isNull); | 15 expect(foo.style['color'], isNull); |
15 foo.style["color"] = null; // This used to crash. | 16 foo.style["color"] = null; // This used to crash. |
16 expect(foo.style['color'], isNull); | 17 expect(foo.style['color'], isNull); |
17 foo.style["color"] = "blue"; | 18 foo.style["color"] = "blue"; |
18 expect(foo.style['color'], equals("rgb(0, 0, 255)")); | 19 expect(foo.style['color'], equals("rgb(0, 0, 255)")); |
19 foo.style["color"] = null; | 20 foo.style["color"] = null; |
20 expect(foo.style['color'], isNull); | 21 expect(foo.style['color'], isNull); |
21 foo.style["color"] = "blue"; | 22 foo.style["color"] = "blue"; |
22 expect(foo.style['color'], equals("rgb(0, 0, 255)")); | 23 expect(foo.style['color'], equals("rgb(0, 0, 255)")); |
23 foo.style.removeProperty("color"); | 24 foo.style.removeProperty("color"); |
24 expect(foo.style['color'], isNull); | 25 expect(foo.style['color'], isNull); |
| 26 |
| 27 layoutRoot.layout(); |
25 }); | 28 }); |
26 } | 29 } |
27 </script> | |
28 </html> | |
OLD | NEW |