From: Tim Wood Date: Wed, 5 Sep 2012 17:06:47 +0000 (-0700) Subject: Failing tests for #427 X-Git-Tag: 1.7.1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5b5b02d1459b0763af7906bcdd786cb002c56f7;p=thirdparty%2Fmoment.git Failing tests for #427 --- diff --git a/test/moment/create.js b/test/moment/create.js index 480386dca..404c1751d 100644 --- a/test/moment/create.js +++ b/test/moment/create.js @@ -81,7 +81,7 @@ exports.create = { "string with format dropped am/pm bug" : function(test) { moment.lang('en'); test.expect(3); - + test.equal(moment('05/1/2012', 'MM/DD/YYYY h:m:s a').format('MM/DD/YYYY'), '05/01/2012', 'should not break if am/pm is left off from the parsing tokens'); test.equal(moment('05/1/2012 12:25:00 am', 'MM/DD/YYYY h:m:s a').format('MM/DD/YYYY'), '05/01/2012', 'should not break if am/pm is left off from the parsing tokens'); test.equal(moment('05/1/2012 12:25:00 pm', 'MM/DD/YYYY h:m:s a').format('MM/DD/YYYY'), '05/01/2012', 'should not break if am/pm is left off from the parsing tokens'); @@ -91,11 +91,19 @@ exports.create = { "empty string with formats" : function(test) { test.expect(3); - + test.equal(moment(' ', 'MM').format('YYYY-MM-DD HH:mm:ss'), '0000-01-01 00:00:00', 'should not break if input is an empty string'); test.equal(moment(' ', 'DD').format('YYYY-MM-DD HH:mm:ss'), '0000-01-01 00:00:00', 'should not break if input is an empty string'); test.equal(moment(' ', ['MM', "DD"]).format('YYYY-MM-DD HH:mm:ss'), '0000-01-01 00:00:00', 'should not break if input is an empty string'); - + + test.done(); + }, + + "matching am/pm" : function(test) { + test.expect(1); + + test.equal(moment('2012-09-03T03:00PM', 'YYYY-MM-DDThh:mmA').format('YYYY-MM-DDThh:mmA'), '2012-09-03T03:00PM', 'am/pm should parse correctly even if the input string contains other letters'); + test.done(); }, @@ -132,7 +140,7 @@ exports.create = { ['HH:mm:ss SSS', '00:30:00 789'] ], i; - + test.expect(a.length); for (i = 0; i < a.length; i++) { test.equal(moment(a[i][1], a[i][0]).format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); @@ -153,7 +161,7 @@ exports.create = { for (i = 0; i < a.length; i++) { test.equal(moment(a[i][1], a[i][0]).format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]); } - + test.done(); }, @@ -287,7 +295,7 @@ exports.create = { var m = moment('2011-10-08T18:04:20.111Z'); test.equal(m.utc().format('YYYY-MM-DDTHH:mm:ss.SSS'), '2011-10-08T18:04:20.111', "moment should be able to parse ISO 2011-10-08T18:04:20.111Z"); - + test.done(); },