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