307742d07e
Since unittest is known to work with test.dart as a test runner and is strong mode clean, it's a safer bet than test. Change-Id: Id120d4f871827b1f131dff2a5ef2f7efb15a8382 Reviewed-on: https://dart-review.googlesource.com/12125 Reviewed-by: Terry Lucas <terry@google.com>
45 lines
1.2 KiB
Dart
45 lines
1.2 KiB
Dart
library CssTest;
|
|
|
|
import 'dart:html';
|
|
|
|
import 'package:unittest/unittest.dart';
|
|
|
|
main() {
|
|
group('supportsPointConversions', () {
|
|
test('supported', () {
|
|
expect(Window.supportsPointConversions, true);
|
|
});
|
|
});
|
|
|
|
group('functional', () {
|
|
test('DomPoint', () {
|
|
var expectation =
|
|
Window.supportsPointConversions ? returnsNormally : throws;
|
|
expect(() {
|
|
Element element = new Element.tag('div');
|
|
element.attributes['style'] = '''
|
|
position: absolute;
|
|
width: 60px;
|
|
height: 100px;
|
|
left: 0px;
|
|
top: 0px;
|
|
background-color: red;
|
|
-webkit-transform: translate3d(250px, 100px, 0px);
|
|
-moz-transform: translate3d(250px, 100px, 0px);
|
|
''';
|
|
document.body.append(element);
|
|
|
|
var elemRect = element.getBoundingClientRect();
|
|
|
|
checkPoint(250, 100, new Point(elemRect.left, elemRect.top));
|
|
checkPoint(310, 200, new Point(elemRect.right, elemRect.bottom));
|
|
}, expectation);
|
|
});
|
|
});
|
|
}
|
|
|
|
void checkPoint(expectedX, expectedY, Point point) {
|
|
expect(point.x.round(), equals(expectedX), reason: 'Wrong point.x');
|
|
expect(point.y.round(), equals(expectedY), reason: 'Wrong point.y');
|
|
}
|