[Pkg-javascript-commits] [dojo] 60/149: Fix problem where native controls don't respond for 1000ms after clicking control with dojoClick=true. Thanks to reiprecht for the fix. Fixes #18362.
David Prévot
taffit at moszumanska.debian.org
Sat Feb 27 03:13:47 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository dojo.
commit 98d78d464dfcce4411f04f9f398f8bfc8580f544
Author: Bill Keese <bill at dojotoolkit.org>
Date: Thu May 7 07:49:07 2015 +0900
Fix problem where native controls don't respond for 1000ms
after clicking control with dojoClick=true. Thanks to reiprecht for the fix.
Fixes #18362.
---
tests/functional/support/touch_dojoclick.html | 47 +++++++++++++++++++++++++++
tests/functional/touch.js | 45 +++++++++++++++++++++++--
touch.js | 2 +-
3 files changed, 90 insertions(+), 4 deletions(-)
diff --git a/tests/functional/support/touch_dojoclick.html b/tests/functional/support/touch_dojoclick.html
new file mode 100644
index 0000000..4b30c75
--- /dev/null
+++ b/tests/functional/support/touch_dojoclick.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>test dojo/touch dojoClick property</title>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <script src="../../../dojo.js" data-dojo-config="async: true, isDebug: true"></script>
+ <script>
+ var ready = false;
+ // this, along with setting dojoClick, triggers the bug
+ require(["dojo/touch", "dojo/domReady!"], function(){
+ ready = true;
+ });
+ </script>
+ <style>
+ .button {
+ background: #ccc;
+ padding: 5px;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ }
+ </style>
+ </head>
+ <body>
+ <h1>Test dojo/touch's dojoClick property</h1>
+ <span id="dojoClickBtn" class="button">dojoClick=true</span>
+ <script>
+ dojoClickBtn.dojoClick = true;
+ dojoClickBtn.onclick = function(){
+ dojoClicks.value++;
+ };
+ </script>
+ clicks: <input id="dojoClicks" value="0" autocomplete="off">
+ <br><br>
+
+ <span id="nativeClickBtn" class="button">dojoClick=false</span>
+ <script>
+ nativeClickBtn.onclick = function(){
+ nativeClicks.value++;
+ };
+ </script>
+ clicks: <input id="nativeClicks" value="0" autocomplete="off">
+ <br><br>
+ </body>
+</html>
diff --git a/tests/functional/touch.js b/tests/functional/touch.js
index c50c3be..43c58f3 100644
--- a/tests/functional/touch.js
+++ b/tests/functional/touch.js
@@ -1,8 +1,9 @@
define([
'require',
'intern!object',
- 'intern/chai!assert'
-], function (require, registerSuite, assert) {
+ 'intern/chai!assert',
+ '../support/ready'
+], function (require, registerSuite, assert, ready) {
/* globals tracker */
function loadPage(driver) {
@@ -225,4 +226,42 @@ define([
}
};
});
-});
+
+ registerSuite(function () {
+ var tapOrClick;
+
+ return {
+ name: 'dojo/touch dojoClick tests',
+
+ 'before': function () {
+ // Not all browsers or drivers support touch events
+ tapOrClick = this.get('remote').environmentType.touchEnabled ?
+ tapElement :
+ clickElement;
+ },
+
+ 'beforeEach': function () {
+ return ready(this.get('remote'), require.toUrl('./support/touch_dojoclick.html'));
+ },
+
+ 'press': function () {
+ return tapOrClick(this.get('remote').findById('dojoClickBtn'))
+ .execute(function () {
+ return dojoClicks.value;
+ })
+ .then(function (result) {
+ assert.equal(result, 1, 'dojoClicks');
+ })
+ .end()
+ .findById('nativeClickBtn')
+ .click()
+ .execute(function () {
+ return nativeClicks.value;
+ })
+ .then(function (result) {
+ assert.equal(result, 1, 'nativeClicks');
+ })
+ }
+ };
+ });
+});
\ No newline at end of file
diff --git a/touch.js b/touch.js
index 9174a63..b219c7a 100644
--- a/touch.js
+++ b/touch.js
@@ -187,7 +187,7 @@ function(dojo, aspect, dom, domClass, lang, on, has, mouse, domReady, win){
// sent shortly after ours, similar to what is done in dualEvent.
// The INPUT.dijitOffScreen test is for offscreen inputs used in dijit/form/Button, on which
// we call click() explicitly, we don't want to stop this event.
- if(!e._dojo_click &&
+ if(clickTracker && !e._dojo_click &&
(new Date()).getTime() <= clickTime + 1000 &&
!(e.target.tagName == "INPUT" && domClass.contains(e.target, "dijitOffScreen"))){
e.stopPropagation();
--
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