cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject spec commit: [CB-3487] Fixed globalization test to include getPreferredLanguage
Date Thu, 20 Jun 2013 01:47:31 GMT
Updated Branches:
  refs/heads/master ed3f3d080 -> 950c42e64


[CB-3487] Fixed globalization test to include getPreferredLanguage

- added a test to check whether the getPreferredLanguage method exists
- added a test to check the language value on success


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/950c42e6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/950c42e6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/950c42e6

Branch: refs/heads/master
Commit: 950c42e644f987927e3ad31cbb7abd46606dbf23
Parents: ed3f3d0
Author: ldeluca <ldeluca@us.ibm.com>
Authored: Thu May 23 14:40:34 2013 -0400
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Wed Jun 19 18:47:23 2013 -0700

----------------------------------------------------------------------
 autotest/tests/globalization.tests.js | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/950c42e6/autotest/tests/globalization.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/globalization.tests.js b/autotest/tests/globalization.tests.js
index 8413c15..81fed8e 100644
--- a/autotest/tests/globalization.tests.js
+++ b/autotest/tests/globalization.tests.js
@@ -21,6 +21,33 @@ describe('Globalization (navigator.globalization)', function () {
         expect(navigator.globalization).toBeDefined();
     });
     
+    describe("getPreferredLanguage", function() {
+        it("globalization.spec.1 should exist", function() {
+            expect(typeof navigator.globalization.getPreferredLanguage).toBeDefined();
+            expect(typeof navigator.globalization.getPreferredLanguage == 'function').toBe(true);
+        });
+        it("globalization.spec.3 getPreferredLanguage success callback should be called with
a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(typeof a.value).toBe('string');
+                    expect(a.value.length > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.getPreferredLanguage(win, fail);
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+    });
+    
     describe("getLocaleName", function() {
         it("globalization.spec.1 should exist", function() {
             expect(typeof navigator.globalization.getLocaleName).toBeDefined();


Mime
View raw message