| 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>test Tooltip</title> |
| 8 | |
| 9 | <script type="text/javascript" src="../../../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base','SpinWheel','Tooltip']"></script> |
| 10 | <script type="text/javascript" src="../../../../../dojo/dojo.js" data-dojo-config="parseOnLoad: true, has: {'dojo-bidi': true }"></script> |
| 11 | |
| 12 | <script type="text/javascript"> |
| 13 | require([ |
| 14 | "dijit/registry", |
| 15 | "doh/runner", |
| 16 | "dojo/dom", |
| 17 | "dojo/ready", |
| 18 | "dojo/query", |
| 19 | "dojox/mobile/Tooltip", |
| 20 | "dojox/mobile", |
| 21 | "dojox/mobile/compat", |
| 22 | "dojox/mobile/parser" |
| 23 | ], function(registry,runner,dom,ready,query){ |
| 24 | ready(function(){ |
| 25 | runner.register("Bidi Tooltip", [ |
| 26 | { |
| 27 | name: "mobile", |
| 28 | runTest: function(){ |
| 29 | var tooltip1 = registry.byId('textTooltip1'); |
| 30 | tooltip1.set("textDir","rtl"); |
| 31 | query(" > *",dom.byId('textTooltip1')).forEach(function(node, index, arr){ |
| 32 | var currentNode = (node.nodeType === 1 && node.childNodes.length === 1) ? node.firstChild : node; |
| 33 | if(currentNode.nodeType === 1 && currentNode.childNodes.length === 1 && currentNode.nodeValue) |
| 34 | runner.is(String.fromCharCode(8235), currentNode.nodeValue.charAt(0), "bidi nodes of first tooltip have direction correspondent to 'textDir'"); |
| 35 | }); |
| 36 | |
| 37 | query("> *",dom.byId('textTooltip2')).forEach(function(node, index, arr){ |
| 38 | var currentNode = (node.nodeType === 1 && node.childNodes.length === 1) ? node.firstChild : node; |
| 39 | if(currentNode.nodeType === 1 && currentNode.childNodes.length === 1 && currentNode.nodeValue) |
| 40 | runner.is(String.fromCharCode(8235), currentNode.nodeValue.charAt(0), "bidi nodes of second tooltip have direction correspondent to 'textDir'"); |
| 41 | }); |
| 42 | } |
| 43 | } |
| 44 | ]); |
| 45 | |
| 46 | runner.register("log", function(){ |
| 47 | dom.byId('failures').innerHTML = runner._failureCount; |
| 48 | dom.byId('errors').innerHTML = runner._errorCount; |
| 49 | }); |
| 50 | |
| 51 | runner.run(); |
| 52 | }); |
| 53 | }, |
| 54 | toggleTextDir = function(){ |
| 55 | w2 = dijit.registry.byId("textTooltip1"); |
| 56 | w2.set("textDir", (w2.get("textDir") !== "rtl") ? "rtl" : "ltr"); |
| 57 | }); |
| 58 | </script> |
| 59 | |
| 60 | <style> |
| 61 | .dj_phone BUTTON { |
| 62 | display:none; |
| 63 | } |
| 64 | INPUT { |
| 65 | font-family: monospace; |
| 66 | border-radius: 0px; |
| 67 | } |
| 68 | #spin1 { |
| 69 | width: 304px; |
| 70 | } |
| 71 | #pt { |
| 72 | width: 20px; |
| 73 | background-color: #C4C9DB; |
| 74 | opacity: 0.2; |
| 75 | } |
| 76 | #txt { |
| 77 | width: 10px; |
| 78 | margin-left: -15px; |
| 79 | padding-top: 85px; |
| 80 | font-size: 24px; |
| 81 | font-weight: bold; |
| 82 | border: none; |
| 83 | } |
| 84 | HTML { |
| 85 | min-height: 100%; /* workaround for android 3.x position:fixed bug */ |
| 86 | } |
| 87 | </style> |
| 88 | </head> |
| 89 | <body style="visibility:hidden;"> |
| 90 | <center style="width:100%;"> |
| 91 | <input readonly onclick="dijit.byId('textTooltip1').show(this, ['above-centered','below-centered','after','before'])" value="below" size="5"> |
| 92 | <br><br><b>Click boundary nodes to see tooltips</b> |
| 93 | <br><input id="btn" type="button" onclick="toggleTextDir()" value="Toggle tooltip textDir"><br> |
| 94 | </center> |
| 95 | <center id="bot" class="bottom" style="position:fixed;bottom:10%;width:100%;"> |
| 96 | <input readonly tabindex="0" onclick="dijit.byId('textTooltip1').show(this, ['above-centered','below-centered','before','after'])" value="above" size="5"> |
| 97 | </center> |
| 98 | <center style="position:fixed;bottom:33%;width:100%;"> |
| 99 | <input readonly onclick="dijit.byId('textTooltip1').hide()" value="click to hide text tooltip" size="26"> |
| 100 | </center> |
| 101 | <div style="position:fixed;top:50%;left:1px;direction:ltr;"> |
| 102 | <input readonly onclick="dijit.byId('textTooltip1').show(this, ['before','after','below-centered','above-centered'])" value="right" size="5"> |
| 103 | </div> |
| 104 | <div style="position:fixed;bottom:50%;right:1px;direction:rtl;"> |
| 105 | <input readonly onclick="dijit.byId('textTooltip1').show(this, ['after','before','below','above'])" value="left" size="4"> |
| 106 | </div> |
| 107 | |
| 108 | <div id="textTooltip1" data-dojo-type="dojox/mobile/Tooltip" class="mblTooltipBubble">Dear friend!<br><span style="background-color:Lime">Enter any value.</span><br><center>Please!</center><div style="border:solid; text-align:center"> Thanks.</div> </div> |
| 109 | <div id="textTooltip2" data-dojo-type="dojox/mobile/Tooltip" data-dojo-props='textDir:"rtl"' class="mblTooltipBubble">Dear friend!<br><span style="background-color:Lime">Enter any value.</span><br><center>Please!</center><div style="border:solid; text-align:center"> Thanks.</div> </div> |
| 110 | |
| 111 | <div style="position:fixed;bottom:0;"> |
| 112 | <br>Errors: <span id="errors">?</span> |
| 113 | <br>Failures: <span id="failures">?</span> |
| 114 | </div> |
| 115 | </body> |
| 116 | </html> |