You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2014/06/23 19:55:31 UTC
spec commit: Fix failing battery tests. Add a dummy battery listener
to avoid updates in the middle of a test case
Repository: cordova-mobile-spec
Updated Branches:
refs/heads/master 9037e9c0b -> 005641907
Fix failing battery tests. Add a dummy battery listener to avoid updates in the middle of a test case
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/00564190
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/00564190
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/00564190
Branch: refs/heads/master
Commit: 005641907754e04895135e502ef9fcb6f24d353f
Parents: 9037e9c
Author: Martin Bektchiev <ma...@telerik.com>
Authored: Mon Jun 23 16:25:29 2014 +0300
Committer: Martin Bektchiev <ma...@telerik.com>
Committed: Mon Jun 23 16:28:33 2014 +0300
----------------------------------------------------------------------
autotest/tests/battery.tests.js | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/00564190/autotest/tests/battery.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/battery.tests.js b/autotest/tests/battery.tests.js
index 11c159b..47a86d4 100644
--- a/autotest/tests/battery.tests.js
+++ b/autotest/tests/battery.tests.js
@@ -21,15 +21,14 @@
describe('Battery (navigator.battery)', function () {
-
+ // used to keep the count of event listeners > 0, in order to avoid battery level being updated with the real value when adding the first listener during test cases
+ var dummyOnEvent = jasmine.createSpy();
beforeEach(function () {
-
+ window.addEventListener("batterycritical", dummyOnEvent, false);
});
afterEach(function () {
-
-
-
+ window.removeEventListener("batterystatus", dummyOnEvent, false);
});