[Pkg-javascript-commits] [dojo] 25/32: Fixes #16120. Add Math.round to fix IE10 partial px tests. Change event coordinate test to not use e.offsetX since IE10 gives an incorrect value for this in RTL mode. Backport thru 1.6.
David Prévot
taffit at moszumanska.debian.org
Thu Aug 21 17:39:09 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag 1.6.2
in repository dojo.
commit 89bda6a79174273f71394c36c39fc91f73cc2e0b
Author: Douglas Hays <doughays at dojotoolkit.org>
Date: Mon Jan 14 20:07:43 2013 +0000
Fixes #16120. Add Math.round to fix IE10 partial px tests. Change event coordinate test to not use e.offsetX since IE10 gives an incorrect value for this in RTL mode. Backport thru 1.6.
git-svn-id: http://svn.dojotoolkit.org/src/branches/1.6/dojo@30348 560b804f-0ae3-0310-86f3-f6aa0a117693
---
tests/_base/html_rtl.html | 70 +++++++++++++++++-------------------------
tests/_base/scrollingIframe.js | 2 +-
2 files changed, 30 insertions(+), 42 deletions(-)
diff --git a/tests/_base/html_rtl.html b/tests/_base/html_rtl.html
index 79a2c6c..c8914de 100644
--- a/tests/_base/html_rtl.html
+++ b/tests/_base/html_rtl.html
@@ -20,64 +20,52 @@
timeout: 1000,
runTest: function(t){
var d = new doh.Deferred();
- setTimeout(function(){ // allow browsers time to return the scroll point back to the last position
- scrollTo(100, 50); // scroll a little
- scrollBy(-50, 0); // net 50px horizontal movement: back-n-forth scrolling helps with different browsers
+ setTimeout(d.getTestErrback(function(){ // allow browsers time to return the scroll point back to the last position
+ scrollTo(100, 100); // scroll a little
+ scrollBy(-50, -50); // net 50px horizontal movement: back-n-forth scrolling helps with different browsers
setTimeout(d.getTestCallback(function(){ // time to scroll
var pos = dojo.position('rect100', true);
t.is(100, pos.y, "y pos should be 100 after vertical scroll");
t.is(100, pos.x, "x pos should be 100 after horizontal scroll");
}), 100);
- }, 100);
+ }), 100);
return d;
}
},
{
name: "eventClientXY_IE",
- timeout: 1000,
+ timeout: 2000,
runTest: function(t){
- if(!dojo.isIE){ return; }
-
var
d = new doh.Deferred(),
rect = dojo.byId("rect100"),
handler = dojo.connect(rect.offsetParent, "onclick", null,
- function(e){
+ d.getTestErrback(function(e){
// move the rectangle to the mouse point
dojo.disconnect(handler);
- rect.style.left = e.pageX + "px";
- rect.style.top = e.pageY + "px";
- handler = dojo.connect(rect, 'ondblclick', null,
- function(e){
- var offsetX = (event||e).offsetX,
- offsetY = (event||e).offsetY;
- dojo.disconnect(handler);
- d.getTestCallback(function(){
- t.is(0, offsetX);
- t.is(0, offsetY);
- })();
- });
- setTimeout(function(){
- if(!document.createEvent){
- rect.fireEvent('ondblclick');
- }else{
- var clickEvent = document.createEvent("MouseEvent");
- clickEvent.initMouseEvent("dblclick", true, true, window, 0,0,0,0,0,0,0,0,0,0,null);
- rect.dispatchEvent(clickEvent);
- }
- }, 100); // time to move rect to cursor position
- });
- setTimeout(function(){
- if(!document.createEvent){
- rect.offsetParent.fireEvent('onclick');
+ var scroll = dojo._docScroll(),
+ pageX = (e.pageX || e.pageY) ? e.pageX : ((e.clientX || 0) + scroll.x),
+ pageY = (e.pageX || e.pageY) ? e.pageY : ((e.clientY || 0) + scroll.y);
+ rect.style.left = pageX + "px";
+ rect.style.top = pageY + "px";
+ setTimeout(d.getTestCallback(function(){
+ var rectPos = dojo.position(rect, true);
+ t.is(pageX, rectPos.x, "pageX");
+ t.is(pageY, rectPos.y, "pageY");
+ }), 500); // time to move rect to cursor position
+ })
+ );
+ rect.scrollIntoView();
+ setTimeout(d.getTestErrback(function(){
+ if(!("dispatchEvent" in rect.offsetParent)){
+ rect.offsetParent.fireEvent('onclick'); // IE < 9
}else{
- var clickEvent = document.createEvent("MouseEvent");
- clickEvent.initMouseEvent("click", true, true, window, 0,0,0,0,0,0,0,0,0,0,null);
+ var clickEvent = rect.offsetParent.ownerDocument.createEvent("MouseEvent");
+ clickEvent.initMouseEvent("click", false, false, window, 0,0,0,60,60,0,0,0,0,0,null);
rect.offsetParent.dispatchEvent(clickEvent);
}
-
- }, 100); // time to finish any pre-scrolling
+ }), 500); // time to finish any pre-scrolling
return d;
}
},
@@ -97,7 +85,7 @@
}
]
);
-
+
// test to make sure position() works with a variety of scrollbars
dojo.forEach(["None", "Horz", "Vert", "Both"], function(scroll){
dojo.forEach(["Quirks", "Strict"], function(doctype){
@@ -148,14 +136,14 @@
}
</style>
</head>
- <body>
+ <body style="min-height:2000px;min-width:2000px;">
<h1>testing Core HTML/DOM/CSS/Style utils</h1>
<div id="rect100">
100px rect, abs,
mouse point is at top-left after the test "eventClientXY"
</div>
- <div id="rect_vert" style="height:1600px;">show vertical scrollbar</div>
- <div id="rect_horz" style="width:1600px;position:relative;right:-200px;">show horizonal scrollbar</div>
+ <div id="rect_vert" style="padding:100px;visibility:hidden;"><input disabled value="show vertical scrollbar" style="display:block;height:100%;"></div>
+ <div id="rect_horz" style="padding:100px;visibility:hidden;"><input disabled value="show horizonal scrollbar" style="display:block;width:100%;"></div>
<br>
<script type="text/javascript" src="scrollingIframe.js"></script>
<div id="iframeContainer"></div>
diff --git a/tests/_base/scrollingIframe.js b/tests/_base/scrollingIframe.js
index 7882e28..76d060b 100644
--- a/tests/_base/scrollingIframe.js
+++ b/tests/_base/scrollingIframe.js
@@ -24,7 +24,7 @@ function runScrollingTest(resultNode){
abs1.style.top = p.y + "px";
setTimeout(function(){
cw = dojo.hitch(dojo, "withGlobal")(window, "position", dojo, [clientWidth, false]);
- if(cw.x >= 0 || (cw.x < 0 && root.clientWidth - cw.w == cw.x)){
+ if(cw.x >= 0 || (cw.x < 0 && Math.round(root.clientWidth - cw.w - cw.x) == 0)){
if(abs1.offsetLeft == control.offsetLeft){
if(abs1.offsetTop == control.offsetTop){
resultNode.testResult = "EQUAL";
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git
More information about the Pkg-javascript-commits
mailing list