minor fixes and cleanup of tests; fixed false positive when testing if on* exists before setting it to a function
authorMarcos Caceres <w3c@marcosc.com>
Mon, 16 Jul 2012 12:56:43 +0100
changeset 161 b386ba6732ce
parent 160 33dc7875ee36
child 162 36f5f46ecbad
minor fixes and cleanup of tests; fixed false positive when testing if on* exists before setting it to a function
light/tests/submissions/marcosc/DeviceLight_tests.js
proximity/tests/submissions/marcos/DeviceProximityEvent_tests.js
proximity/tests/submissions/marcos/UserProximityEvent_tests.js
--- a/light/tests/submissions/marcosc/DeviceLight_tests.js	Mon Jul 16 12:43:26 2012 +0100
+++ b/light/tests/submissions/marcosc/DeviceLight_tests.js	Mon Jul 16 12:56:43 2012 +0100
@@ -256,10 +256,12 @@
 
   test(function() {
     var desc = 'window.ondevicelight did not accept callable object',
-      func = function() {};
+      func = function() {},
+      desc = 'Expected to find ondevicelight attribute on window object';
+    assert_own_property(window, 'ondevicelight', desc);
     window.ondevicelight = func;
     assert_equals(window.ondevicelight, func, desc);
-  }, 'ondevicelight is set to function');
+  }, 'expected ondevicelight on window and to be set to function');
 
   test(function() {
     var desc = 'window.ondevicelight did not treat noncallable as null';
@@ -339,5 +341,4 @@
     });
     t2.done();
   };
-
 })();
--- a/proximity/tests/submissions/marcos/DeviceProximityEvent_tests.js	Mon Jul 16 12:43:26 2012 +0100
+++ b/proximity/tests/submissions/marcos/DeviceProximityEvent_tests.js	Mon Jul 16 12:56:43 2012 +0100
@@ -247,7 +247,9 @@
 
     test(function() {
         var desc = 'window.ondeviceproximity did not accept callable object',
-            func = function() {};
+            func = function() {},
+            desc = 'Expected to find ondeviceproximity attribute on window object';
+        assert_own_property(window, 'ondeviceproximity', desc);
         window.ondeviceproximity = func;
         assert_equals(window.ondeviceproximity, func, desc);
     }, 'ondeviceproximity is set to function');
--- a/proximity/tests/submissions/marcos/UserProximityEvent_tests.js	Mon Jul 16 12:43:26 2012 +0100
+++ b/proximity/tests/submissions/marcos/UserProximityEvent_tests.js	Mon Jul 16 12:56:43 2012 +0100
@@ -239,10 +239,12 @@
 
     test(function() {
         var desc = 'window.onuserproximity did not accept callable object',
-            func = function() {}
+            func = function() {},
+            desc = 'onuserproximity does not exist';
+        assert_own_property(window, 'onuserproximity', desc);
         window.onuserproximity = func;
         assert_equals(window.onuserproximity, func, desc);
-    }, 'onuserproximity is set to function');
+    }, 'onuserproximity exists and can be set to a function');
 
     test(function() {
         var desc = 'window.onuserproximity did not treat noncallable as null';