Sha256: cb67317ad780209103765f5d9e6a1d73632c44b35536487dca6c3d8aa352abcc

Contents?: true

Size: 1.31 KB

Versions: 18

Compression:

Stored size: 1.31 KB

Contents

var I18n = require("../../app/assets/javascripts/i18n")
  , Translations = require("./translations")
;

describe("Localization", function(){
  var actual, expected;

  beforeEach(function() {
    I18n.reset();
    I18n.translations = Translations();
  });

  it("localizes number", function(){
    expect(I18n.l("number", 1234567)).toEqual("1,234,567.000");
  });

  it("localizes currency", function(){
    expect(I18n.l("currency", 1234567)).toEqual("$1,234,567.00");
  });

  it("localizes date strings", function(){
    I18n.locale = "pt-BR";

    expect(I18n.l("date.formats.default", "2009-11-29")).toEqual("29/11/2009");
    expect(I18n.l("date.formats.short", "2009-01-07")).toEqual("07 de Janeiro");
    expect(I18n.l("date.formats.long", "2009-01-07")).toEqual("07 de Janeiro de 2009");
  });

  it("localizes time strings", function(){
    I18n.locale = "pt-BR";

    expect(I18n.l("time.formats.default", "2009-11-29 15:07:59")).toEqual("Domingo, 29 de Novembro de 2009, 15:07 h");
    expect(I18n.l("time.formats.short", "2009-01-07 09:12:35")).toEqual("07/01, 09:12 h");
    expect(I18n.l("time.formats.long", "2009-11-29 15:07:59")).toEqual("Domingo, 29 de Novembro de 2009, 15:07 h");
  });

  it("localizes percentage", function(){
    I18n.locale = "pt-BR";
    expect(I18n.l("percentage", 123.45)).toEqual("123,45%");
  });
});

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
i18n-js-3.0.0.rc7 spec/js/localization.spec.js
i18n-js-3.0.0.rc6 spec/js/localization.spec.js
i18n-js-pika-3.0.0.rc9 spec/js/localization.spec.js
i18n-js-pika-3.0.0.rc8 spec/js/localization.spec.js
i18n-js-pika-3.0.0.rc7 spec/js/localization.spec.js
i18n-js-pika-3.0.0.rc6 spec/js/localization.spec.js
i18n-js-3.0.0.rc5 spec/js/localization.spec.js
i18n-js-3.0.0.rc4 spec/js/localization.spec.js
i18n-js-3.0.0.rc3 spec/js/localization.spec.js
socialcast-i18n-js-4.0.0.rc8 spec/js/localization.spec.js
socialcast-i18n-js-4.0.0.rc7 spec/js/localization.spec.js
socialcast-i18n-js-4.0.0.rc6 spec/js/localization.spec.js
socialcast-i18n-js-4.0.0.rc5 spec/js/localization.spec.js
socialcast-i18n-js-4.0.0.rc4 spec/js/localization.spec.js
socialcast-i18n-js-4.0.0.rc3 spec/js/localization.spec.js
socialcast-i18n-js-4.0.0.rc2 spec/js/localization.spec.js
socialcast-i18n-js-4.0.0.rc1 spec/js/localization.spec.js
i18n-js-3.0.0.rc2 spec/js/localization.spec.js