From: Tim Wood Date: Sun, 2 Sep 2012 00:31:34 +0000 (-0700) Subject: Adding tests for #408 X-Git-Tag: 2.0.0~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c37dccb998fabc4ec50dbf55684b6040e53348bf;p=thirdparty%2Fmoment.git Adding tests for #408 --- diff --git a/test/moment/format.js b/test/moment/format.js index 3f38173f8..1b4d576dc 100644 --- a/test/moment/format.js +++ b/test/moment/format.js @@ -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(); } };