Skip to content

Commit a20543b

Browse files
author
Chuck Dumont
authored
Merge pull request #63 from chuckdumont/work
i18n unit tests
2 parents e8ad028 + 07a950e commit a20543b

File tree

15 files changed

+104
-4
lines changed

15 files changed

+104
-4
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = [
2+
[/define dependencies not supported in langauge files/]
3+
];
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
define(["dojo/i18n!./nls/strings"], function(strings) {
2+
strings;
3+
throw new Error("Should not get here");
4+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
define(["dep"], function() {
2+
return {
3+
root: ({
4+
hello: 'Hello'
5+
})
6+
};
7+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var path = require("path");
2+
var DojoWebpackPlugin = require("../../../../index");
3+
module.exports = {
4+
entry: "test/index",
5+
plugins: [
6+
new DojoWebpackPlugin({
7+
loaderConfig: {
8+
paths:{test: "."}
9+
},
10+
loader: path.join(__dirname, "../../../js/dojo/dojo.js")
11+
})
12+
]
13+
};

test/TestCases/loaders/i18n/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
define(["dojo/_base/config", "dojo/i18n!./nls/strings1", "dojo/i18n!./nls/strings2"], function(config, strings1, strings2) {
2+
const lang = config.locale ? config.locale : "default";
3+
it(`should load strings for ${lang} language`, function() {
4+
strings1.hello.should.be.eql(lang === "fr" ? "Bonjoure" : lang === "es" ? "Hola" : "Hello");
5+
strings2.goodby.should.be.eql(lang === "fr" ? "Bon par" : lang === "de" ? "Auf Wiedersehen" : "Good by");
6+
it("should load locale specific strings", function(done) {
7+
// load a locale specific bundle
8+
require(["dojo/i18n!./nls/fr/strings1"], function(strings) {
9+
strings.hello.should.be.eql("Bonjoure");
10+
done();
11+
});
12+
});
13+
});
14+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
define({
2+
hello: 'Hallo'
3+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
define({
2+
goodby: 'Auf Wiedersehen'
3+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
define({
2+
hello: 'Hola'
3+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
define({
2+
goodby: 'Bueno por'
3+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
define({
2+
hello: 'Bonjoure'
3+
});

0 commit comments

Comments
 (0)