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 canvas { height: 50px; background-color: pink; } |
| 8 inline-block { display: inline-block; width: 50px; height: 50px; background: gre
en; } |
| 9 grand-child { width: 50px; height: 50px; transform: translate3d(100px, 0, 0); ba
ckground: papayawhip; } |
8 </style> | 10 </style> |
9 <foo /><bar /> | 11 <foo /><bar /> |
10 <parent> | 12 <parent> |
11 <child>Foo bar</child> | 13 <child>Foo bar</child> |
| 14 <inline-block> |
| 15 <grand-child /> |
| 16 </inline-block> |
12 </parent> | 17 </parent> |
13 <canvas /> | 18 <canvas /> |
14 <script> | 19 <script> |
15 import "../resources/third_party/unittest/unittest.dart"; | 20 import "../resources/third_party/unittest/unittest.dart"; |
16 import "../resources/unit.dart"; | 21 import "../resources/unit.dart"; |
17 | 22 |
18 import "dart:sky"; | 23 import "dart:sky"; |
19 | 24 |
20 void main() { | 25 void main() { |
21 initUnit(); | 26 initUnit(); |
(...skipping 23 matching lines...) Expand all Loading... |
45 test("should hit test child and parent", () { | 50 test("should hit test child and parent", () { |
46 hitTestWithChildren(); | 51 hitTestWithChildren(); |
47 }); | 52 }); |
48 | 53 |
49 test("should hit test child with layered parent", () { | 54 test("should hit test child with layered parent", () { |
50 document.querySelector('parent').style["transform"] = "translate3d(0, 0, 0)"
; | 55 document.querySelector('parent').style["transform"] = "translate3d(0, 0, 0)"
; |
51 hitTestWithChildren(); | 56 hitTestWithChildren(); |
52 }); | 57 }); |
53 | 58 |
54 test("should hit test transformed child", () { | 59 test("should hit test transformed child", () { |
| 60 document.querySelector('parent').style["display"] = "block"; |
55 document.querySelector('child').style["transform"] = "translate3d(100px, 0,
0)"; | 61 document.querySelector('child').style["transform"] = "translate3d(100px, 0,
0)"; |
56 expect(document.elementFromPoint(50, 210).tagName, equals('parent')); | 62 expect(document.elementFromPoint(50, 210).tagName, equals('parent')); |
57 expect(document.elementFromPoint(150, 210).tagName, equals('child')); | 63 expect(document.elementFromPoint(150, 210).tagName, equals('child')); |
| 64 expect(document.elementFromPoint(25, 240).tagName, equals('inline-block')); |
| 65 // TODO(ojan): This is incorrect. It should hit grand-child. |
| 66 // This broke sometime before 4153b8a515d54275934d4244aaf2d5a7a8fe3333. |
| 67 expect(document.elementFromPoint(150, 240).tagName, equals('sky')); |
58 }); | 68 }); |
59 | 69 |
60 test("should hit test canvas", () { | 70 test("should hit test canvas", () { |
61 expect(document.elementFromPoint(50, 310).tagName, equals('canvas')); | 71 expect(document.elementFromPoint(50, 310).tagName, equals('canvas')); |
62 }); | 72 }); |
63 } | 73 } |
64 </script> | 74 </script> |
65 </sky> | 75 </sky> |
OLD | NEW |