| 1 | <!DOCTYPE HTML> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="content-type" content="text/html; charset=utf-8"/> |
| 5 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" /> |
| 6 | <meta name="apple-mobile-web-app-capable" content="yes" /> |
| 7 | <title>ScrollablePane Tests</title> |
| 8 | <script type="text/javascript" src="../../../../../dojox/mobile/deviceTheme.js"></script> |
| 9 | <script type="text/javascript" src="../../../../../dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: true"></script> |
| 10 | <script language="JavaScript" type="text/javascript"> |
| 11 | require([ |
| 12 | "dojo/ready", |
| 13 | "dojo/sniff", |
| 14 | "dojo/dom", |
| 15 | "dojo/dom-class", |
| 16 | "dojo/dom-geometry", |
| 17 | "dojo/_base/window", |
| 18 | "doh/runner", |
| 19 | "dojox/mobile", // This is a mobile app. |
| 20 | "dojox/mobile/parser", // This mobile app uses declarative programming with fast mobile parser |
| 21 | "dojox/mobile/ScrollablePane" |
| 22 | ], function(ready, has, dom, domClass, domGeom, win, runner){ |
| 23 | ready(function(){ |
| 24 | var view = dom.byId("view"); |
| 25 | var containerDiv = dom.byId("containerDiv"); |
| 26 | var scrollablePane = dom.byId("scrollablePane"); |
| 27 | runner.register("dojox.mobile.test.doh.scrollablepane.ScrollablePaneTests", [ |
| 28 | { |
| 29 | name: "Verify that ticket #15761 is fixed", |
| 30 | timeout: 4000, |
| 31 | runTest: function(){ |
| 32 | var bodyTopPadding = domClass.contains(win.doc.documentElement, "windows_theme") ? 8 : 0; |
| 33 | var viewPosition = domGeom.position(view, false); |
| 34 | console.log(viewPosition); |
| 35 | runner.assertEqual(0 + bodyTopPadding, viewPosition.y, "view position y is not the expected one"); |
| 36 | runner.assertEqual(180, viewPosition.h, "view position h is not the expected one"); |
| 37 | var containerDivPosition = domGeom.position(containerDiv, false); |
| 38 | runner.assertEqual(20 + bodyTopPadding, containerDivPosition.y, "container DIV position y is not the expected one"); |
| 39 | runner.assertEqual(140, containerDivPosition.h, "container DIV position h is not the expected one"); |
| 40 | console.log(containerDivPosition); |
| 41 | var scrollablePanePosition = domGeom.position(scrollablePane, false); |
| 42 | console.log(scrollablePanePosition); |
| 43 | runner.assertEqual(40 + bodyTopPadding, scrollablePanePosition.y, "scrollable pane position y is not the expected one"); |
| 44 | runner.assertEqual(100, scrollablePanePosition.h, "scrollable pane position h is not the expected one"); |
| 45 | } |
| 46 | } |
| 47 | ]); |
| 48 | runner.run(); |
| 49 | }); |
| 50 | }); |
| 51 | </script> |
| 52 | <style type="text/css"> |
| 53 | </style> |
| 54 | </head> |
| 55 | <body style="visibility:hidden;"> |
| 56 | <div id="view" data-dojo-type="dojox.mobile.View" style="border-top: 20px solid blue; border-bottom: 20px solid blue;"> |
| 57 | <div id="containerDiv" style="border-top: 20px solid green; border-bottom: 20px solid green; height: 100px; position: relative;"> |
| 58 | <div id="scrollablePane" data-dojo-type="dojox.mobile.ScrollablePane" height="inherit" style="border-top: 20px solid white; border-bottom: 20px solid white; background-color: red; color: white;"> |
| 59 | This is a first scrollable pane. |
| 60 | </div> |
| 61 | </div> |
| 62 | </div> |
| 63 | </body> |
| 64 | </html> |