[Pkg-javascript-commits] [dojo] 131/149: fixes #18546, update dojo/on test to match implementation

David Prévot taffit at moszumanska.debian.org
Sat Feb 27 03:13:55 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 1d32043df68bce115d324efcf2838f4cc6beb3d2
Author: Brandon Payton <brandon at happycode.net>
Date:   Tue Jan 12 06:05:49 2016 -0700

    fixes #18546, update dojo/on test to match implementation
---
 tests/unit/on.js | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tests/unit/on.js b/tests/unit/on.js
index 5b6a47d..407e82d 100644
--- a/tests/unit/on.js
+++ b/tests/unit/on.js
@@ -65,9 +65,19 @@ define([
 			},
 
 			'.emit return value': function () {
+				// NOTE: Uncancelable events are treated inconsistently.
+				// The return value depends on whether the browser DOM offers
+				// an `addEventListener` method and whether the event is a DOM or simple object event.
+				// Therefore, the purpose of testing the return value for uncancelable events
+				// is to codify current behavior and catch unintentional changes.
 				var returnValue = on.emit(target, testEventName, { cancelable: false });
-				assert.ok(returnValue);
-				assert.propertyVal(returnValue, 'cancelable', false);
+				if (has('dom-addeventlistener') && 'dispatchEvent' in target) {
+					assert.ok(returnValue);
+					assert.propertyVal(returnValue, 'cancelable', false);
+				}
+				else {
+					assert.isFalse(returnValue);
+				}
 
 				returnValue = on.emit(target, testEventName, { cancelable: true });
 				assert.ok(returnValue);

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