dap commit: minor fixes and cleanup of tests; fixed false positive when testing if on* exists before setting it to a function

changeset:   161:b386ba6732ce
tag:         tip
user:        Marcos Caceres <w3c@marcosc.com>
date:        Mon Jul 16 12:56:43 2012 +0100
files:       light/tests/submissions/marcosc/DeviceLight_tests.js proximity/tests/submissions/marcos/DeviceProximityEvent_tests.js proximity/tests/submissions/marcos/UserProximityEvent_tests.js
description:
minor fixes and cleanup of tests; fixed false positive when testing if on* exists before setting it to a function


diff -r 33dc7875ee36 -r b386ba6732ce light/tests/submissions/marcosc/DeviceLight_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();
   };
-
 })();
diff -r 33dc7875ee36 -r b386ba6732ce proximity/tests/submissions/marcos/DeviceProximityEvent_tests.js
--- 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');
diff -r 33dc7875ee36 -r b386ba6732ce proximity/tests/submissions/marcos/UserProximityEvent_tests.js
--- 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';

Received on Monday, 16 July 2012 11:56:57 UTC