You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/06/20 03:47:31 UTC

spec commit: [CB-3487] Fixed globalization test to include getPreferredLanguage

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 <ld...@us.ibm.com>
Authored: Thu May 23 14:40:34 2013 -0400
Committer: Fil Maj <ma...@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();