Sha256: 9dedbd8654b9f37367b55f770099b40ca1ba800c3efe12d9170e879a2bb20675

Contents?: true

Size: 1.86 KB

Versions: 4

Compression:

Stored size: 1.86 KB

Contents

// Copyright 2012 Twitter, Inc
// http://www.apache.org/licenses/LICENSE-2.0

var TwitterCldr = require('../../../lib/assets/javascripts/twitter_cldr/core.js');
var data = require('../../../lib/assets/javascripts/twitter_cldr/en.js');
TwitterCldr.set_data(data);

describe("Languages", function() {
  describe("#all", function() {
    it("checks if some locales are supported in the current locale", function() {
      expect(TwitterCldr.Languages.all().ja).not.toBe(null);
      expect(TwitterCldr.Languages.all().es).not.toBe(null);
      expect(TwitterCldr.Languages.all().gl).not.toBe(null);
      expect(TwitterCldr.Languages.all().ur).not.toBe(null);
    });
  });
  describe("#from_code", function() {
    it("returns the language name in current locale based on it's code", function() {
      expect(TwitterCldr.Languages.from_code("ru")).toEqual("Russian");
      expect(TwitterCldr.Languages.from_code("ja")).toEqual("Japanese");
    });
    it("returns null for an invalid language code", function() {
      expect(TwitterCldr.Languages.from_code("xx")).toBe(null);
    });
  });
  describe("#is_rtl", function() {
    it("should return true for certain locales", function() {
      expect(TwitterCldr.Languages.is_rtl("ar")).toBe(true);
      expect(TwitterCldr.Languages.is_rtl("he")).toBe(true);
      expect(TwitterCldr.Languages.is_rtl("ur")).toBe(true);
      expect(TwitterCldr.Languages.is_rtl("fa")).toBe(true);
    });
    it("should return false for certain locales", function() {
      expect(TwitterCldr.Languages.is_rtl("en")).toBe(false);
      expect(TwitterCldr.Languages.is_rtl("es")).toBe(false);
      expect(TwitterCldr.Languages.is_rtl("hu")).toBe(false);
      expect(TwitterCldr.Languages.is_rtl("ja")).toBe(false);
    });
    it("should return null for invalid locales", function() {
      expect(TwitterCldr.Languages.is_rtl("xx")).toBe(null);
    });
  });
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
twitter_cldr_js-3.3.0 spec/js/shared/languages.spec.js
twitter_cldr_js-3.2.0 spec/js/shared/languages.spec.js
twitter_cldr_js-3.1.1 spec/js/shared/languages.spec.js
twitter_cldr_js-3.1.0 spec/js/shared/languages.spec.js