OLD | NEW |
(Empty) | |
| 1 dart_library.library('lib/html/css_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'unittest' |
| 4 ], function load__css_test(exports, dart_sdk, unittest) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const html = dart_sdk.html; |
| 8 const math = dart_sdk.math; |
| 9 const dart = dart_sdk.dart; |
| 10 const dartx = dart_sdk.dartx; |
| 11 const html_individual_config = unittest.html_individual_config; |
| 12 const unittest$ = unittest.unittest; |
| 13 const src__matcher__expect = unittest.src__matcher__expect; |
| 14 const src__matcher__core_matchers = unittest.src__matcher__core_matchers; |
| 15 const src__matcher__throws_matcher = unittest.src__matcher__throws_matcher; |
| 16 const css_test = Object.create(null); |
| 17 let PointOfnum = () => (PointOfnum = dart.constFn(math.Point$(core.num)))(); |
| 18 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 19 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da
rt.void, [])))(); |
| 20 let dynamicAnddynamicAndPointOfnumTovoid = () => (dynamicAnddynamicAndPointOfn
umTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart
.dynamic, PointOfnum()])))(); |
| 21 css_test.main = function() { |
| 22 html_individual_config.useHtmlIndividualConfiguration(); |
| 23 unittest$.group('supportsPointConversions', dart.fn(() => { |
| 24 unittest$.test('supported', dart.fn(() => { |
| 25 src__matcher__expect.expect(html.Window[dartx.supportsPointConversions],
true); |
| 26 }, VoidTodynamic())); |
| 27 }, VoidTovoid())); |
| 28 unittest$.group('functional', dart.fn(() => { |
| 29 unittest$.test('DomPoint', dart.fn(() => { |
| 30 let expectation = dart.test(html.Window[dartx.supportsPointConversions])
? src__matcher__core_matchers.returnsNormally : src__matcher__throws_matcher.th
rows; |
| 31 src__matcher__expect.expect(dart.fn(() => { |
| 32 let element = html.Element.tag('div'); |
| 33 element[dartx.attributes][dartx.set]('style', ' position: abs
olute;\n width: 60px;\n height: 100px;\n left: 0px;\n
top: 0px;\n background-color: red;\n -webkit-transfo
rm: translate3d(250px, 100px, 0px);\n -moz-transform: translate3d(250px
, 100px, 0px);\n '); |
| 34 html.document[dartx.body][dartx.append](element); |
| 35 let elemRect = element[dartx.getBoundingClientRect](); |
| 36 css_test.checkPoint(250, 100, new (PointOfnum())(elemRect[dartx.left],
elemRect[dartx.top])); |
| 37 css_test.checkPoint(310, 200, new (PointOfnum())(elemRect[dartx.right]
, elemRect[dartx.bottom])); |
| 38 }, VoidTodynamic()), expectation); |
| 39 }, VoidTodynamic())); |
| 40 }, VoidTovoid())); |
| 41 }; |
| 42 dart.fn(css_test.main, VoidTodynamic()); |
| 43 css_test.checkPoint = function(expectedX, expectedY, point) { |
| 44 src__matcher__expect.expect(point.x[dartx.round](), src__matcher__core_match
ers.equals(expectedX), {reason: 'Wrong point.x'}); |
| 45 src__matcher__expect.expect(point.y[dartx.round](), src__matcher__core_match
ers.equals(expectedY), {reason: 'Wrong point.y'}); |
| 46 }; |
| 47 dart.fn(css_test.checkPoint, dynamicAnddynamicAndPointOfnumTovoid()); |
| 48 // Exports: |
| 49 exports.css_test = css_test; |
| 50 }); |
OLD | NEW |