]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Adding tests for #408
authorTim Wood <washwithcare@gmail.com>
Sun, 2 Sep 2012 00:31:34 +0000 (17:31 -0700)
committerTim Wood <washwithcare@gmail.com>
Sun, 2 Sep 2012 00:31:34 +0000 (17:31 -0700)
test/moment/format.js

index 3f38173f81a2f0a64d6ba70b5cfefaaadb4558c4..1b4d576dcb88778de8f732c45460ba752b41d490 100644 (file)
@@ -107,5 +107,16 @@ exports.format = {
         var isoRegex = /\d{4}.\d\d.\d\dT\d\d.\d\d.\d\d[\+\-]\d\d:\d\d/;
         test.ok(isoRegex.exec(moment().format()), "default format (" + moment().format() + ") should match ISO");
         test.done();
+    },
+
+    "escaping quotes" : function(test) {
+        test.expect(4);
+        moment.lang('en');
+        var date = moment([2012, 0]);
+        test.equal(date.format('MMM \'YY'), "Jan '12", "Should be able to format with single parenthesis");
+        test.equal(date.format('MMM "YY'),  'Jan "12', "Should be able to format with double parenthesis");
+        test.equal(date.format("MMM 'YY"),  "Jan '12", "Should be able to format with single parenthesis");
+        test.equal(date.format("MMM \"YY"), 'Jan "12', "Should be able to format with double parenthesis");
+        test.done();
     }
 };