some specs for the i18n widget
This commit is contained in:
parent
b89a59ca55
commit
9046273ebd
2 changed files with 46 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ src_files:
|
|||
- public/javascripts/diaspora.js
|
||||
- public/javascripts/widgets/alert.js
|
||||
- public/javascripts/widgets/embedder.js
|
||||
- public/javascripts/widgets/i18n.js
|
||||
- public/javascripts/mobile.js
|
||||
- public/javascripts/aspect-edit.js
|
||||
- public/javascripts/aspect-contacts.js
|
||||
|
|
|
|||
45
spec/javascripts/widget-i18n-spec.js
Normal file
45
spec/javascripts/widget-i18n-spec.js
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* Created by .
|
||||
* User: dan
|
||||
* Date: Jan 27, 2011
|
||||
* Time: 3:20:57 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
describe("Diaspora", function() {
|
||||
beforeEach(function() {
|
||||
Diaspora.widgets.i18n.loadLocale(null/* TODO: spec.retrieveFixture("locale")*/, "en");
|
||||
});
|
||||
describe("widgets", function() {
|
||||
describe("i18n", function() {
|
||||
describe("loadLocale", function() {
|
||||
it("sets the class's locale variable", function() {
|
||||
Diaspora.widgets.i18n.loadLocale({sup: "hi"});
|
||||
expect(Diaspora.widgets.i18n.locale).toEqual({sup: "hi"});
|
||||
});
|
||||
});
|
||||
describe("t", function() {
|
||||
it("returns the specified translation", function() {
|
||||
Diaspora.widgets.i18n.loadLocale({yo: "sup"}, "en");
|
||||
var translation = Diaspora.widgets.i18n.t("yo");
|
||||
expect(translation).toEqual("sup");
|
||||
});
|
||||
it("will go through a infinitely deep object", function() {
|
||||
Diaspora.widgets.i18n.loadLocale({
|
||||
yo: {
|
||||
hi: {
|
||||
sup: {
|
||||
test: "test"
|
||||
}
|
||||
}
|
||||
},
|
||||
more: {
|
||||
another: "i hope this spec is green"
|
||||
}
|
||||
});
|
||||
expect(Diaspora.widgets.i18n.t("yo.hi.sup.test")).toEqual("test");
|
||||
expect(Diaspora.widgets.i18n.t("more.another")).toEqual("i hope this spec is green");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue