Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Added click tests

Mike McGannb3ba158b11fa
diff --git a/buster.js b/buster.js
index e353726ef..32f8a136f 100644
--- a/buster.js
+++ b/buster.js
@@ -27,6 +27,7 @@ config["wv"] = {
"web/js/wv.*.js",
"!web/js/wv.main.js",
"web/js/ui/wv.ui.js",
+ "web/js/ui/wv.ui.click.js",
"web/js/ui/wv.ui.indicator.js",
"web/js/date/wv.*.js",
"web/js/layers/wv.*.js",
diff --git a/test/ui/wv.ui.click-test.js b/test/ui/wv.ui.click-test.js
new file mode 100644
index 000000000..40db4c679
--- /dev/null
+++ b/test/ui/wv.ui.click-test.js
@@ -0,0 +1,46 @@
+/*
+ * NASA Worldview
+ *
+ * This code was originally developed at NASA/Goddard Space Flight Center for
+ * the Earth Science Data and Information System (ESDIS) project.
+ *
+ * Copyright (C) 2013 - 2014 United States Government as represented by the
+ * Administrator of the National Aeronautics and Space Administration.
+ * All Rights Reserved.
+ */
+
+buster.testCase("wv.ui.click", function() {
+
+ var self = {};
+ var element, down, up;
+
+ self.setUp = function() {
+ element = {
+ mousedown: function(handler) {
+ down = handler;
+ },
+ mouseup: function(handler) {
+ up = handler;
+ }
+ };
+ };
+
+ self["Within click limit"] = function() {
+ var callback = this.stub();
+ wv.ui.click(element, callback);
+ down({ clientX: 0, clientY: 0});
+ up({clientX: 2, clientY: 2});
+ buster.assert.called(callback);
+ };
+
+ self["Outside click limit"] = function() {
+ var callback = this.stub();
+ wv.ui.click(element, callback);
+ down({ clientX: 0, clientY: 0});
+ up({clientX: 12, clientY: 12});
+ buster.refute.called(callback);
+ };
+
+ return self;
+
+}());