OLD | NEW |
1 <sky> | 1 <sky> |
2 <style> | 2 <style> |
3 foo, parent { width: 100px; height: 100px; background: blue; } | 3 foo, parent { width: 100px; height: 100px; background: blue; } |
4 bar { width: 100px; height: 100px; background: purple; } | 4 bar { width: 100px; height: 100px; background: purple; } |
5 parent { display: paragraph; } | 5 parent { display: paragraph; } |
6 child { background: salmon; } | 6 child { background: salmon; } |
| 7 canvas { height: 50px; background-color: pink; } |
7 </style> | 8 </style> |
8 <foo /><bar /> | 9 <foo /><bar /> |
9 <parent> | 10 <parent> |
10 <child>Foo bar</child> | 11 <child>Foo bar</child> |
11 </parent> | 12 </parent> |
| 13 <canvas /> |
12 <script> | 14 <script> |
13 import "../resources/third_party/unittest/unittest.dart"; | 15 import "../resources/third_party/unittest/unittest.dart"; |
14 import "../resources/unit.dart"; | 16 import "../resources/unit.dart"; |
15 | 17 |
16 import "dart:sky"; | 18 import "dart:sky"; |
17 | 19 |
18 void main() { | 20 void main() { |
19 initUnit(); | 21 initUnit(); |
20 | 22 |
21 test("should hit test", () { | 23 test("should hit test", () { |
(...skipping 19 matching lines...) Expand all Loading... |
41 } | 43 } |
42 | 44 |
43 test("should hit test child and parent", () { | 45 test("should hit test child and parent", () { |
44 hitTestWithChildren(); | 46 hitTestWithChildren(); |
45 }); | 47 }); |
46 | 48 |
47 test("should hit test child with layered parent", () { | 49 test("should hit test child with layered parent", () { |
48 document.querySelector('parent').style.setProperty("transform", "translate3d
(0, 0, 0)"); | 50 document.querySelector('parent').style.setProperty("transform", "translate3d
(0, 0, 0)"); |
49 hitTestWithChildren(); | 51 hitTestWithChildren(); |
50 }); | 52 }); |
| 53 |
| 54 test("should hit test transformed child", () { |
| 55 document.querySelector('child').style.setProperty("transform", "translate3d(
100px, 0, 0)"); |
| 56 expect(document.elementFromPoint(50, 210).tagName, equals('parent')); |
| 57 expect(document.elementFromPoint(150, 210).tagName, equals('child')); |
| 58 }); |
| 59 |
| 60 test("should hit test canvas", () { |
| 61 expect(document.elementFromPoint(50, 310).tagName, equals('canvas')); |
| 62 }); |
51 } | 63 } |
52 </script> | 64 </script> |
53 </sky> | 65 </sky> |
OLD | NEW |