OLD | NEW |
(Empty) | |
| 1 dart_library.library('lib/html/wheelevent_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'unittest' |
| 4 ], function load__wheelevent_test(exports, dart_sdk, unittest) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const html = dart_sdk.html; |
| 8 const dart = dart_sdk.dart; |
| 9 const dartx = dart_sdk.dartx; |
| 10 const html_config = unittest.html_config; |
| 11 const unittest$ = unittest.unittest; |
| 12 const src__matcher__expect = unittest.src__matcher__expect; |
| 13 const wheelevent_test = Object.create(null); |
| 14 let WheelEventTovoid = () => (WheelEventTovoid = dart.constFn(dart.functionTyp
e(dart.void, [html.WheelEvent])))(); |
| 15 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun
ctionType(dart.dynamic, [dart.dynamic])))(); |
| 16 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 17 wheelevent_test.main = function() { |
| 18 html_config.useHtmlConfiguration(); |
| 19 unittest$.test('wheelEvent', dart.fn(() => { |
| 20 let element = html.DivElement.new(); |
| 21 let eventType = html.Element.mouseWheelEvent.getEventType(element); |
| 22 element[dartx.onMouseWheel].listen(WheelEventTovoid()._check(unittest$.exp
ectAsync(dart.fn(e => { |
| 23 src__matcher__expect.expect(dart.dload(dart.dload(e, 'screen'), 'x'), 10
0); |
| 24 src__matcher__expect.expect(dart.dload(e, 'deltaX'), 0); |
| 25 src__matcher__expect.expect(dart.dsend(dart.dload(e, 'deltaY'), 'toDoubl
e'), 240.0); |
| 26 src__matcher__expect.expect(dart.dload(e, 'deltaMode'), html.WheelEvent.
DOM_DELTA_PAGE); |
| 27 }, dynamicTodynamic())))); |
| 28 let event = html.WheelEvent.new(eventType, {deltaX: 0, deltaY: 240, deltaM
ode: html.WheelEvent.DOM_DELTA_PAGE, screenX: 100}); |
| 29 element[dartx.dispatchEvent](event); |
| 30 }, VoidTodynamic())); |
| 31 unittest$.test('wheelEvent with deltaZ', dart.fn(() => { |
| 32 let element = html.DivElement.new(); |
| 33 let eventType = html.Element.mouseWheelEvent.getEventType(element); |
| 34 element[dartx.onMouseWheel].listen(WheelEventTovoid()._check(unittest$.exp
ectAsync(dart.fn(e => { |
| 35 src__matcher__expect.expect(dart.dload(e, 'deltaX'), 0); |
| 36 src__matcher__expect.expect(dart.dload(e, 'deltaY'), 0); |
| 37 src__matcher__expect.expect(dart.dload(dart.dload(e, 'screen'), 'x'), 0)
; |
| 38 src__matcher__expect.expect(dart.dsend(dart.dload(e, 'deltaZ'), 'toDoubl
e'), 1.0); |
| 39 }, dynamicTodynamic())))); |
| 40 let event = html.WheelEvent.new(eventType, {deltaZ: 1.0}); |
| 41 element[dartx.dispatchEvent](event); |
| 42 }, VoidTodynamic())); |
| 43 unittest$.test('wheelEvent Stream', dart.fn(() => { |
| 44 let element = html.DivElement.new(); |
| 45 let eventType = html.Element.mouseWheelEvent.getEventType(element); |
| 46 element[dartx.onMouseWheel].listen(WheelEventTovoid()._check(unittest$.exp
ectAsync(dart.fn(e => { |
| 47 src__matcher__expect.expect(dart.dload(dart.dload(e, 'screen'), 'x'), 10
0); |
| 48 src__matcher__expect.expect(dart.dsend(dart.dload(e, 'deltaX'), 'toDoubl
e'), 240.0); |
| 49 src__matcher__expect.expect(dart.dload(e, 'deltaY'), 0); |
| 50 }, dynamicTodynamic())))); |
| 51 let event = html.WheelEvent.new(eventType, {deltaX: 240, deltaY: 0, screen
X: 100}); |
| 52 element[dartx.dispatchEvent](event); |
| 53 }, VoidTodynamic())); |
| 54 }; |
| 55 dart.fn(wheelevent_test.main, VoidTodynamic()); |
| 56 // Exports: |
| 57 exports.wheelevent_test = wheelevent_test; |
| 58 }); |
OLD | NEW |