[Pkg-javascript-commits] [dojo] 17/28: Position test element so it is actually fixed to viewport

David Prévot taffit at moszumanska.debian.org
Thu Aug 21 17:39:48 UTC 2014


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

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

commit 9648ab5d2b3360dbdb340bcda3ca4831e2cecd67
Author: Colin Snover <github.com at zetafleet.com>
Date:   Fri Dec 20 16:39:17 2013 +0000

    Position test element so it is actually fixed to viewport
    
    Fixes #17626
    
    (cherry picked from commit 65e989efbcda628e72c9616faf11d480aacebf2f)
    (cherry picked from commit ab088a9741a6383495a20bc34e84403e2962ed03)
---
 on.js                       |  1 +
 tests/on/event-focusin.html | 16 ++++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/on.js b/on.js
index 71e8f70..5c32088 100644
--- a/on.js
+++ b/on.js
@@ -17,6 +17,7 @@ define(["./has!dom-addeventlistener?:./aspect", "./_base/kernel", "./has"], func
 					var element = doc.createElement('input'),
 						activeElement = doc.activeElement;
 					element.style.position = 'fixed';
+					element.style.top = element.style.left = '0';
 					element.addEventListener('focusin', testFocus, false);
 					doc.body.appendChild(element);
 					element.focus();
diff --git a/tests/on/event-focusin.html b/tests/on/event-focusin.html
index 44cc298..646e704 100644
--- a/tests/on/event-focusin.html
+++ b/tests/on/event-focusin.html
@@ -4,8 +4,8 @@
 		<title>dojo/on focusin feature detection</title>
 	</head>
 	<body>
-		<script src="../../dojo.js" data-dojo-config="async:1"></script>
-		<div style="padding: 4000px 0 0 4000px;"><input id="a"></div>
+		<script src="../../dojo.js" data-dojo-config="async:1,has:{'dojo-undef-api':1}"></script>
+		<div style="padding: 4000px;"><input id="a"></div>
 		<script>
 require([ "doh" ], function(doh){
 	doh.register(function focusInTest(t){
@@ -34,6 +34,18 @@ require([ "doh" ], function(doh){
 			t.is(lastScroll.x, newScroll.x, "Horizontal scroll should not have changed");
 			t.is(lastScroll.y, newScroll.y, "Vertical scroll should not have changed");
 			t.is(input, document.activeElement, "Focus should still be set on the originally focused input");
+
+			input.blur();
+			window.scrollTo(0, 0);
+			delete has.cache["event-focusin"];
+			require.undef("dojo/on");
+			require([ "dojo/on" ], function () {
+				t.is("boolean", typeof has("event-focusin"), "focusin feature detection should have executed (2)");
+
+				var scrollPosition = getScrollPosition();
+				t.is(0, scrollPosition.x, "Horizontal scroll should not have changed (2)");
+				t.is(0, scrollPosition.y, "Vertical scroll should not have changed (2)");
+			});
 		}));
 
 		return dfd;

-- 
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