Skip to content
This repository was archived by the owner on May 23, 2019. It is now read-only.

Commit 1087401

Browse files
author
Long Ho
committed
add tests for custom format, fixes #158
1 parent 94abd75 commit 1087401

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
],
1616
"author": "Eric Ferraiuolo <eferraiuolo@gmail.com>",
1717
"contributors": [
18-
"Drew Folta <drew@folta.net>",
18+
"Anthony Pipkin <a.pipkin@yahoo.com>",
1919
"Caridy Patino <caridy@gmail.com>",
20-
"Anthony Pipkin <a.pipkin@yahoo.com>"
20+
"Drew Folta <drew@folta.net>",
21+
"Long Ho <holevietlong@gmail.com"
2122
],
2223
"bugs": {
2324
"url": "https://github.com/formatjs/intl-messageformat/issues"

src/en.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// GENERATED FILE
2-
export default {"locale":"en"};
2+
export default { locale: "en" };

tests/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,4 +447,24 @@ describe("IntlMessageFormat", function() {
447447
expect(ptMZ.format({ num: 100 })).to.equal("other");
448448
});
449449
});
450+
451+
it("custom formats should work", function() {
452+
var msg = "Today is {time, date, verbose}";
453+
var mf = new IntlMessageFormat(msg, "pt", {
454+
date: {
455+
verbose: {
456+
month: "long",
457+
day: "numeric",
458+
year: "numeric",
459+
hour: "numeric",
460+
minute: "numeric",
461+
second: "numeric",
462+
timeZoneName: "short"
463+
}
464+
}
465+
});
466+
expect(mf.format({ time: 0 })).to.contain(
467+
"Today is 31 de dezembro de 1969 19:00:00"
468+
);
469+
});
450470
});

tests/runner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ if (typeof Intl === "undefined") {
22
require("intl");
33
}
44

5-
require('intl-pluralrules')
5+
require("intl-pluralrules");
66

77
global.expect = require("expect.js");
88
global.IntlMessageFormat = require("../");

0 commit comments

Comments
 (0)