OLD | NEW |
(Empty) | |
| 1 library CssTest; |
| 2 import 'package:unittest/unittest.dart'; |
| 3 import 'package:unittest/html_individual_config.dart'; |
| 4 import 'dart:html'; |
| 5 |
| 6 main() { |
| 7 useHtmlIndividualConfiguration(); |
| 8 |
| 9 group('supportsPointConversions', () { |
| 10 test('supported', () { |
| 11 expect(Window.supportsPointConversions, true); |
| 12 }); |
| 13 }); |
| 14 |
| 15 group('functional', () { |
| 16 test('DomPoint', () { |
| 17 var expectation = Window.supportsPointConversions ? |
| 18 returnsNormally : throws; |
| 19 expect(() { |
| 20 Element element = new Element.tag('div'); |
| 21 element.attributes['style'] = |
| 22 ''' |
| 23 position: absolute; |
| 24 width: 60px; |
| 25 height: 100px; |
| 26 left: 0px; |
| 27 top: 0px; |
| 28 background-color: red; |
| 29 -webkit-transform: translate3d(250px, 100px, 0px); |
| 30 -moz-transform: translate3d(250px, 100px, 0px); |
| 31 '''; |
| 32 document.body.append(element); |
| 33 |
| 34 var elemRect = element.getBoundingClientRect(); |
| 35 |
| 36 checkPoint(250, 100, new Point(elemRect.left, elemRect.top)); |
| 37 checkPoint(310, 200, new Point(elemRect.right, elemRect.bottom)); |
| 38 }, expectation); |
| 39 }); |
| 40 }); |
| 41 } |
| 42 |
| 43 void checkPoint(expectedX, expectedY, Point point) { |
| 44 expect(point.x.round(), equals(expectedX), reason: 'Wrong point.x'); |
| 45 expect(point.y.round(), equals(expectedY), reason: 'Wrong point.y'); |
| 46 } |
OLD | NEW |