]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Add failing unit tests asserting old moment().lang(str) behavior
authorIskren Chernev <iskren.chernev@gmail.com>
Thu, 31 Jul 2014 08:33:15 +0000 (01:33 -0700)
committerIskren Chernev <iskren.chernev@gmail.com>
Thu, 31 Jul 2014 18:12:16 +0000 (11:12 -0700)
test/moment/locale.js

index 85b402e5b0ed51732c1a8a7e95b1ec4047342511..9588b9cf8d89b05cbe32f268364ec52f0e62d93d 100644 (file)
@@ -427,5 +427,22 @@ exports.locale = {
         moment.locale('fr');
         test.equal('en', mom.locale());
         test.done();
+    },
+
+    "setting a language on instance returns the original moment for chaining" : function (test) {
+        var mom = moment();
+
+        test.equal(mom.lang('fr'), mom, "setting the language (lang) returns the original moment for chaining");
+        test.equal(mom.locale('it'), mom, "setting the language (locale) returns the original moment for chaining");
+
+        test.done();
+    },
+
+    "lang(key) changes the language of the instance" : function (test) {
+        var m = moment().month(0);
+        m.lang("fr");
+        test.equal(m.locale(), "fr", "m.lang(key) changes instance locale");
+
+        test.done()
     }
 };