| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 |
<title>Dojo Tooltip Widget Test with Bidi support</title> |
| 6 |
|
| 7 |
<style type="text/css"> |
| 8 |
@import "../../../../dijit/themes/tundra/tundra.css"; |
| 9 |
@import "../../../../dojo/resources/dojo.css"; |
| 10 |
|
| 11 |
td { padding: 20px; } |
| 12 |
</style> |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
<script type="text/javascript" src="../../../../dojo/dojo.js" |
| 18 |
data-dojo-config="parseOnLoad: true, isDebug: true, has: { 'dojo-bidi': true }"> |
| 19 |
</script> |
| 20 |
|
| 21 |
<script type="text/javascript"> |
| 22 |
dojo.require("dojo.parser"); |
| 23 |
dojo.require("doh.runner"); |
| 24 |
|
| 25 |
dojo.require("dijit.form.ValidationTextBox"); |
| 26 |
dojo.require("dijit.Tooltip"); |
| 27 |
|
| 28 |
dojo.ready(function(){ |
| 29 |
function checkContextualDir(text){ |
| 30 |
var fdc = /[A-Za-z\u05d0-\u065f\u066a-\u06ef\u06fa-\u07ff\ufb1d-\ufdff\ufe70-\ufefc]/.exec(text); |
| 31 |
// if found return the direction that defined by the character, else return widgets dir as defult. |
| 32 |
return fdc ? ( fdc[0] <= 'z' ? "ltr" : "rtl" ) : "ltr"; |
| 33 |
} |
| 34 |
doh.register("tooltip text direction", [ |
| 35 |
{ |
| 36 |
name: "tooltip LTR text direction for LTR widget", |
| 37 |
runTest: function(){ |
| 38 |
var d = new doh.Deferred(); |
| 39 |
var tt = dijit.byId("id1_tooltip"); |
| 40 |
tt.open(dojo.byId("id1")); |
| 41 |
setTimeout(d.getTestCallback(function(){ |
| 42 |
doh.is("ltr",tt.textDir, "textDir of : " + tt.id); |
| 43 |
doh.is("ltr",dijit._masterTT.containerNode.dir, "direction of : " + tt.id); |
| 44 |
tt.close(); |
| 45 |
}), 200); |
| 46 |
return d; |
| 47 |
} |
| 48 |
}, |
| 49 |
{ |
| 50 |
name: "tooltip RTL text direction for LTR widget", |
| 51 |
runTest: function(){ |
| 52 |
var d = new doh.Deferred(); |
| 53 |
var tt = dijit.byId("id2_tooltip"); |
| 54 |
tt.open(dojo.byId("id2")); |
| 55 |
setTimeout(d.getTestCallback(function(){ |
| 56 |
doh.is("rtl",tt.textDir, "textDir of : " + tt.id); |
| 57 |
doh.is("rtl",dijit._masterTT.containerNode.dir, "direction of : " + tt.id); |
| 58 |
tt.close(); |
| 59 |
}), 400); |
| 60 |
return d; |
| 61 |
|
| 62 |
} |
| 63 |
}, |
| 64 |
{ |
| 65 |
name: "tooltip AUTO text direction for LTR widget", |
| 66 |
runTest: function(){ |
| 67 |
var d = new doh.Deferred(); |
| 68 |
var tt = dijit.byId("id3_tooltip"); |
| 69 |
tt.open(dojo.byId("id3")); |
| 70 |
setTimeout(d.getTestCallback(function(){ |
| 71 |
doh.is("auto",tt.textDir, "textDir of : " + tt.id); |
| 72 |
doh.is("rtl",dijit._masterTT.containerNode.dir, "direction of : " + tt.id); |
| 73 |
tt.close(); |
| 74 |
}), 400); |
| 75 |
return d; |
| 76 |
} |
| 77 |
} |
| 78 |
]); |
| 79 |
doh.register("tooltip RTL text direction for tooltip with HTML inline elements", [ |
| 80 |
{ |
| 81 |
name: "tooltip RTL text direction for LTR widget", |
| 82 |
runTest: function(){ |
| 83 |
var d = new doh.Deferred(); |
| 84 |
var tt = dijit.byId("id7_tooltip"); |
| 85 |
tt.open(dojo.byId("id7")); |
| 86 |
setTimeout(d.getTestCallback(function(){ |
| 87 |
doh.is("rtl",tt.textDir, "textDir of : " + tt.id); |
| 88 |
doh.is("rtl",dijit._masterTT.containerNode.dir, "direction of : " + tt.id); |
| 89 |
tt.close(); |
| 90 |
}), 400); |
| 91 |
return d; |
| 92 |
} |
| 93 |
}, |
| 94 |
{ |
| 95 |
name: "tooltip LTR text direction for RTL widget", |
| 96 |
runTest: function(){ |
| 97 |
var d = new doh.Deferred(); |
| 98 |
var tt = dijit.byId("id4_tooltip"); |
| 99 |
tt.open(dojo.byId("id4")); |
| 100 |
setTimeout(d.getTestCallback(function(){ |
| 101 |
doh.is("ltr",tt.textDir, "textDir of : " + tt.id); |
| 102 |
doh.is("ltr",dijit._masterTT.containerNode.dir, "direction of : " + tt.id); |
| 103 |
tt.close(); |
| 104 |
}), 400); |
| 105 |
return d; |
| 106 |
} |
| 107 |
}, |
| 108 |
{ |
| 109 |
name: "tooltip text alignment for tooltip with dir 'rtl'", |
| 110 |
runTest: function(){ |
| 111 |
var d = new doh.Deferred(); |
| 112 |
var tt = dijit.byId("id4_tooltip"); |
| 113 |
tt.open(dojo.byId("id4")); |
| 114 |
setTimeout(d.getTestCallback(function(){ |
| 115 |
doh.is("right",dijit._masterTT.containerNode.align, "alignment of : " + tt.id); |
| 116 |
tt.close(); |
| 117 |
}), 400); |
| 118 |
return d; |
| 119 |
} |
| 120 |
}, |
| 121 |
{ |
| 122 |
name: "tooltip RTL text direction for RTL widget", |
| 123 |
runTest: function(){ |
| 124 |
var d = new doh.Deferred(); |
| 125 |
var tt = dijit.byId("id5_tooltip"); |
| 126 |
tt.open(dojo.byId("id5")); |
| 127 |
setTimeout(d.getTestCallback(function(){ |
| 128 |
doh.is("rtl",tt.textDir, "textDir of : " + tt.id); |
| 129 |
doh.is("rtl",dijit._masterTT.containerNode.dir, "direction of : " + tt.id); |
| 130 |
tt.close(); |
| 131 |
}), 400); |
| 132 |
return d; |
| 133 |
} |
| 134 |
}, |
| 135 |
{ |
| 136 |
name: "tooltip AUTO text direction for RTL widget", |
| 137 |
runTest: function(){ |
| 138 |
var d = new doh.Deferred(); |
| 139 |
var tt = dijit.byId("id6_tooltip"); |
| 140 |
tt.open(dojo.byId("id6")); |
| 141 |
setTimeout(d.getTestCallback(function(){ |
| 142 |
doh.is("auto",tt.textDir, "textDir of : " + tt.id); |
| 143 |
doh.is("rtl",dijit._masterTT.containerNode.dir, "direction of : " + tt.id); |
| 144 |
tt.close(); |
| 145 |
}), 400); |
| 146 |
return d; |
| 147 |
} |
| 148 |
} |
| 149 |
]); |
| 150 |
|
| 151 |
doh.register("tooltip RTL text direction for tooltip with HTML inline elements", [ |
| 152 |
{ |
| 153 |
name: "tooltip RTL text direction for LTR widget", |
| 154 |
runTest: function(){ |
| 155 |
var d = new doh.Deferred(); |
| 156 |
var tt = dijit.byId("id7_tooltip"); |
| 157 |
tt.open(dojo.byId("id7")); |
| 158 |
setTimeout(d.getTestCallback(function(){ |
| 159 |
doh.is("rtl",tt.textDir, "textDir of : " + tt.id); |
| 160 |
doh.is("rtl",dijit._masterTT.containerNode.dir, "direction of : " + tt.id); |
| 161 |
tt.close(); |
| 162 |
}), 400); |
| 163 |
return d; |
| 164 |
} |
| 165 |
} |
| 166 |
]); |
| 167 |
|
| 168 |
doh.register("tooltip with children nodes", [ |
| 169 |
{ |
| 170 |
name: "tooltip AUTO text direction, check text direction for children", |
| 171 |
runTest: function(){ |
| 172 |
var d = new doh.Deferred(); |
| 173 |
var tt = dijit.byId("id8_tooltip"); |
| 174 |
tt.open(dojo.byId("id8")); |
| 175 |
setTimeout(d.getTestCallback(function(){ |
| 176 |
dojo.forEach(dijit._masterTT.containerNode.children, function(child){ |
| 177 |
var dir = checkContextualDir(dojo.isIE? child.outerText : child.textContent); |
| 178 |
doh.is(dir, child.dir, "direction of : " + tt.id); |
| 179 |
}, this); |
| 180 |
doh.is("auto",tt.textDir, "textDir of : " + tt.id); |
| 181 |
tt.close(); |
| 182 |
}), 400); |
| 183 |
return d; |
| 184 |
} |
| 185 |
}, |
| 186 |
{ |
| 187 |
name: "Check text direction for tooltip with AUTO text direction and RTL dir attribute", |
| 188 |
runTest: function(){ |
| 189 |
var d = new doh.Deferred(); |
| 190 |
var tt = dijit.byId("id10_tooltip"); |
| 191 |
tt.open(dojo.byId("id10")); |
| 192 |
setTimeout(d.getTestCallback(function(){ |
| 193 |
dojo.forEach(dijit._masterTT.containerNode.children, function(child){ |
| 194 |
var dir = checkContextualDir(dojo.isIE? child.outerText : child.textContent); |
| 195 |
doh.is(dir, child.dir, "direction of nodes : " + tt.id); |
| 196 |
}, this); |
| 197 |
doh.is("auto",tt.textDir, "textDir of : " + tt.id); |
| 198 |
tt.close(); |
| 199 |
}), 400); |
| 200 |
return d; |
| 201 |
} |
| 202 |
}, |
| 203 |
{ |
| 204 |
name: "Check alignment for tooltip with RTL dir attribute", |
| 205 |
runTest: function(){ |
| 206 |
var d = new doh.Deferred(); |
| 207 |
var tt = dijit.byId("id10_tooltip"); |
| 208 |
tt.open(dojo.byId("id10")); |
| 209 |
setTimeout(d.getTestCallback(function(){ |
| 210 |
doh.is("right",dijit._masterTT.containerNode.align, "alignment of : " + tt.id); |
| 211 |
tt.close(); |
| 212 |
}), 400); |
| 213 |
return d; |
| 214 |
} |
| 215 |
} |
| 216 |
]); |
| 217 |
|
| 218 |
doh.run(); |
| 219 |
}); |
| 220 |
|
| 221 |
</script> |
| 222 |
</head> |
| 223 |
<body class="tundra"> |
| 224 |
|
| 225 |
<h1 class="testTitle">Tooltip test</h1> |
| 226 |
|
| 227 |
<p>Mouse-over or focus the items below to test tooltips.</p> |
| 228 |
|
| 229 |
<input type="text" id="id1" name="test1" data-dojo-type="dijit/form/ValidationTextBox" value="#1 tooltip ltr"/><br> |
| 230 |
<input type="text" id="id2" name="test2" data-dojo-type="dijit/form/ValidationTextBox" value="#2 tooltip rtl"/><br> |
| 231 |
<input type="text" id="id3" name="test3" data-dojo-type="dijit/form/ValidationTextBox" value="#3 tooltip auto"/><br><br /> |
| 232 |
|
| 233 |
<input type="text" id="id7" name="test7" data-dojo-type="dijit/form/ValidationTextBox" value="tooltip inline HTML elements"/><br><br /> |
| 234 |
<input type="text" id="id8" name="test8" data-dojo-type="dijit/form/ValidationTextBox" value="tooltip auto with children nodes"/><br> |
| 235 |
|
| 236 |
<div dir="rtl"> |
| 237 |
<input type="text" id="id4" name="test4" data-dojo-type="dijit/form/ValidationTextBox" value="#4 tooltip ltr"/><br> |
| 238 |
<input type="text" id="id5" name="test5" data-dojo-type="dijit/form/ValidationTextBox" value="#5 tooltip rtl"/><br> |
| 239 |
<input type="text" id="id6" name="test5" data-dojo-type="dijit/form/ValidationTextBox" value="#6 tooltip auto"/><br><br /> |
| 240 |
</div> |
| 241 |
<input type="text" id="id10" name="test10" data-dojo-type="dijit/form/ValidationTextBox" value="tooltip auto with children nodes" dir="rtl"/><br> |
| 242 |
|
| 243 |
<br> |
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
<span id="id1_tooltip" data-dojo-type="dijit/Tooltip" data-dojo-props='connectId:["id1"], textDir: "ltr"'>חדש! tooltip #1 !!!</span> |
| 248 |
<span id="id2_tooltip" data-dojo-type="dijit/Tooltip" data-dojo-props='connectId:["id2"], textDir: "rtl"'>חדש! tooltip #2!!!</span> |
| 249 |
<span id="id3_tooltip" data-dojo-type="dijit/Tooltip" data-dojo-props='connectId:["id3"], textDir: "auto"'>חדש! tooltip #3...</span> |
| 250 |
<span id="id4_tooltip" data-dojo-type="dijit/Tooltip" data-dojo-props='connectId:["id4"], textDir: "ltr", dir: "rtl"'>חדש! tooltip #4 !!!</span> |
| 251 |
<span id="id5_tooltip" data-dojo-type="dijit/Tooltip" data-dojo-props='connectId:["id5"], textDir: "rtl"'>חדש! tooltip #5!!!</span> |
| 252 |
<span id="id6_tooltip" data-dojo-type="dijit/Tooltip" data-dojo-props='connectId:["id6"], textDir: "auto"'>חדש! tooltip #6...</span> |
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
<span id="id7_tooltip" data-dojo-type="dijit/Tooltip" data-dojo-props='connectId:["id7"], textDir:"rtl"'> |
| 257 |
<i> |
| 258 |
ערך חדש! |
| 259 |
</i> |
| 260 |
textDir : |
| 261 |
<b> |
| 262 |
RTL... |
| 263 |
</b></span> |
| 264 |
|
| 265 |
<span id="id8_tooltip" data-dojo-type="dijit/Tooltip" data-dojo-props='connectId:["id8"], textDir: "auto"'> |
| 266 |
<b> |
| 267 |
Tooltip "auto" with block elements |
| 268 |
</b> |
| 269 |
<div> |
| 270 |
DIV element |
| 271 |
<p> ערך חדש p element! </p> |
| 272 |
</div> |
| 273 |
<b> |
| 274 |
ערך חדש! |
| 275 |
</b> |
| 276 |
<div> |
| 277 |
ערך חדש! |
| 278 |
</div> |
| 279 |
<p>long long long long long long long long long long long text ..</p> |
| 280 |
</span> |
| 281 |
|
| 282 |
<span id="id10_tooltip" data-dojo-type="dijit/Tooltip" data-dojo-props='connectId:["id10"], textDir: "auto", dir: "rtl"'> |
| 283 |
<b> |
| 284 |
Tooltip "auto" with block elements |
| 285 |
</b> |
| 286 |
<div> |
| 287 |
DIV element |
| 288 |
<p> ערך חדש p element! </p> |
| 289 |
</div> |
| 290 |
<b> |
| 291 |
ערך חדש! |
| 292 |
</b> |
| 293 |
<div> |
| 294 |
ערך חדש! |
| 295 |
</div> |
| 296 |
<p>long long long long long long long long long long long text ..</p> |
| 297 |
</span> |
| 298 |
|
| 299 |
</body> |
| 300 |
</html> |