[Pkg-javascript-commits] [dojo] 63/149: Test that setting dojoClick:true doesn't suppress mousedown and mouseup events. Note that the dojo/touch test is pre-existing failures in other areas.

David Prévot taffit at moszumanska.debian.org
Sat Feb 27 03:13:48 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 b6721c0f2fa94ff383964e3a4ebca5e82b455784
Author: Bill Keese <bill at dojotoolkit.org>
Date:   Tue Apr 7 16:44:20 2015 +0900

    Test that setting dojoClick:true doesn't suppress mousedown and mouseup events.
    Note that the dojo/touch test is pre-existing failures in other areas.
    
    Refs #18478.
---
 tests/functional/touch.js | 55 ++++++++++++++++++++++++-----------------------
 1 file changed, 28 insertions(+), 27 deletions(-)

diff --git a/tests/functional/touch.js b/tests/functional/touch.js
index 43c58f3..fa36364 100644
--- a/tests/functional/touch.js
+++ b/tests/functional/touch.js
@@ -45,13 +45,28 @@ define([
 				return loadPage(this);
 			},
 
-			'press': function () {
-				var elementPromise = this.get('remote')
+			'click/tap': function () {
+				var remote = this.get('remote');
+				var elementPromise = remote
 					.executeAsync(function (done) {
-						require(['sinon', 'dojo/on', 'dojo/touch'], function (sinon, on, touch) {
-							window.tracker = sinon.stub();
+						require(['dojo/on', 'dojo/touch'], function (on, touch) {
+							window.log = [];
 							var node = document.getElementById('upper-right');
-							on(node, touch.press, tracker);
+							on(node, touch.press, function () {
+								log.push('touch.press');
+							});
+							on(node, touch.release, function () {
+								log.push('touch.release');
+							});
+							on(node, 'mousedown', function () {
+								log.push('mousedown');
+							});
+							on(node, 'mouseup', function () {
+								log.push('mouseup');
+							});
+							on(node, 'click', function () {
+								log.push('click');
+							});
 							done();
 						});
 					})
@@ -59,10 +74,16 @@ define([
 
 				return tapOrClick(elementPromise)
 					.execute(function () {
-						return tracker.calledOnce;
+						return window.log.join(', ');
 					})
 					.then(function (result) {
-						assert.isTrue(result);
+						// Test that proper touch.* events fired, and also that mousedown and mouseup weren't suppressed.
+						// Tricky though because the order mousedown/mouseup events occurs varies by browser.
+						// See https://github.com/dojo/dojo/pull/138.
+						assert(/touch\.press.*touch\.release.*click/.test(result),
+							"touch.press --> touch.release --> click");
+						assert(/mousedown.*mouseup.*click/.test(result),
+							"mousedown --> mouseup --> click");
 					});
 			},
 
@@ -94,26 +115,6 @@ define([
 					});
 			},
 
-			'release': function () {
-				return this.get('remote')
-					.executeAsync(function (done) {
-						require(['sinon', 'dojo/on', 'dojo/touch'], function (sinon, on, touch) {
-							var node = document.getElementById('upper-left');
-							window.tracker = sinon.stub();
-							on(node, touch.release, tracker);
-							done();
-						});
-					})
-					.findById('upper-left')
-					.click()
-					.execute(function () {
-						return tracker.called;
-					})
-					.then(function (result) {
-						assert.isTrue(result);
-					});
-			},
-
 			'cancel': function () {
 				var session = this.get('remote');
 

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