[Pkg-javascript-commits] [dojo] 77/87: 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:25 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag 1.7.5
in repository dojo.

commit 2bbabb6c1f209ab79570032673f98709d4aab8cd
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.7/dojo@30348 560b804f-0ae3-0310-86f3-f6aa0a117693
---
 tests/_base/html_rtl.html      | 58 +++++++++++++++++-------------------------
 tests/_base/scrollingIframe.js |  2 +-
 2 files changed, 25 insertions(+), 35 deletions(-)

diff --git a/tests/_base/html_rtl.html b/tests/_base/html_rtl.html
index a33e8b6..e066473 100644
--- a/tests/_base/html_rtl.html
+++ b/tests/_base/html_rtl.html
@@ -18,8 +18,8 @@
 							runTest: function(t){
 								var d = new doh.Deferred();
 								setTimeout(d.getTestErrback(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
+									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");
@@ -32,10 +32,8 @@
 
 						{
 							name: "eventClientXY_IE",
-							timeout: 1000,
+							timeout: 2000,
 							runTest: function(t){
-								if(!dojo.isIE){ return; }
-
 								var
 								d = new doh.Deferred(),
 								rect = dojo.byId("rect100"),
@@ -43,36 +41,28 @@
 									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,
-											d.getTestCallback(function(e){
-												var offsetX = (event||e).offsetX,
-													offsetY = (event||e).offsetY;
-												dojo.disconnect(handler);
-												t.is(0, offsetX);
-												t.is(0, offsetY);
-											}));
-										setTimeout(d.getTestErrback(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
-									}));
+										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(!document.createEvent){
-										rect.offsetParent.fireEvent('onclick');
+									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;
 							}
 						},
@@ -143,14 +133,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