Sha256: 2689e6f29c4f510ed62e1a90ba2aa4586c227314d1590cffa1d71add5acc1694
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
var I18n = require("../../app/assets/javascripts/i18n") , Translations = require("./translations") ; describe("Interpolation", function(){ var actual, expected; beforeEach(function(){ I18n.reset(); I18n.translations = Translations(); }); it("performs single interpolation", function(){ actual = I18n.t("greetings.name", {name: "John Doe"}); expect(actual).toEqual("Hello John Doe!"); }); it("performs multiple interpolations", function(){ actual = I18n.t("profile.details", {name: "John Doe", age: 27}); expect(actual).toEqual("John Doe is 27-years old"); }); it("performs interpolation with the count option", function(){ expect(I18n.t("inbox", {count: 0})).toEqual("You have no messages"); expect(I18n.t("inbox", {count: 1})).toEqual("You have 1 message"); expect(I18n.t("inbox", {count: 5})).toEqual("You have 5 messages"); }); it("outputs missing placeholder message if interpolation value is missing", function(){ actual = I18n.t("greetings.name"); expect(actual).toEqual("Hello [missing {{name}} value]!"); }) });
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
i18n-js-3.0.0.rc7 | spec/js/interpolation.spec.js |