From: Alexander Hramov Date: Sat, 25 Feb 2012 08:08:03 +0000 (+0400) Subject: Fixed test failed with "a day" form X-Git-Tag: 1.5.0~20^2~1^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de558aeaab6dda186c533ac4c6bb7350ec40f38b;p=thirdparty%2Fmoment.git Fixed test failed with "a day" form --- diff --git a/test/lang/ru.js b/test/lang/ru.js index b37ad6f51..9d9b14000 100644 --- a/test/lang/ru.js +++ b/test/lang/ru.js @@ -72,7 +72,7 @@ exports["lang:ru"] = { test.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.'); test.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.'); test.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.'); - + test.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.'); test.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.'); test.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.'); @@ -83,7 +83,7 @@ exports["lang:ru"] = { test.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.'); test.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.'); test.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.'); - + test.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.'); test.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.'); test.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.'); @@ -94,7 +94,7 @@ exports["lang:ru"] = { test.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.'); test.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.'); test.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.'); - + test.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.'); test.done(); }, @@ -135,10 +135,10 @@ exports["lang:ru"] = { test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 часа", "90 minutes = 2 hours"); test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 часов", "5 hours = 5 hours"); test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 час", "21 hours = 21 hours"); - test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "1 день", "22 hours = a day"); - test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "1 день", "35 hours = a day"); + test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "день", "22 hours = a day"); + test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "день", "35 hours = a day"); test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 дня", "36 hours = 2 days"); - test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "1 день", "1 day = a day"); + test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "день", "1 day = a day"); test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 дней", "5 days = 5 days"); test.equal(start.from(moment([2007, 1, 28]).add({d:11}), true), "11 дней", "11 days = 11 days"); test.equal(start.from(moment([2007, 1, 28]).add({d:21}), true), "21 день", "21 days = 21 days"); @@ -179,9 +179,9 @@ exports["lang:ru"] = { "calendar day" : function(test) { test.expect(6); moment.lang('ru'); - + var a = moment().hours(2).minutes(0).seconds(0); - + test.equal(moment(a).calendar(), "Сегодня в 02:00", "today at the same time"); test.equal(moment(a).add({ m: 25 }).calendar(), "Сегодня в 02:25", "Now plus 25 min"); test.equal(moment(a).add({ h: 1 }).calendar(), "Сегодня в 03:00", "Now plus 1 hour"); @@ -194,14 +194,14 @@ exports["lang:ru"] = { "calendar next week" : function(test) { test.expect(15); moment.lang('ru'); - + var i; var m; - + function makeFormat(d) { return d.day() === 1 ? '[Во] dddd [в] LT' : '[В] dddd [в] LT'; } - + for (i = 2; i < 7; i++) { m = moment().add({ d: i }); test.equal(m.calendar(), m.format(makeFormat(m)), "Today + " + i + " days current time"); @@ -216,10 +216,10 @@ exports["lang:ru"] = { "calendar last week" : function(test) { test.expect(15); moment.lang('ru'); - + var i; var m; - + function makeFormat(d) { switch (d.day()) { case 0: @@ -232,7 +232,7 @@ exports["lang:ru"] = { return '[В прошлую] dddd [в] LT'; } } - + for (i = 2; i < 7; i++) { m = moment().subtract({ d: i }); test.equal(m.calendar(), m.format(makeFormat(m)), "Today - " + i + " days current time"); @@ -249,13 +249,13 @@ exports["lang:ru"] = { moment.lang('ru'); var weeksAgo = moment().subtract({ w: 1 }); var weeksFromNow = moment().add({ w: 1 }); - + test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago"); test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week"); - + weeksAgo = moment().subtract({ w: 2 }); weeksFromNow = moment().add({ w: 2 }); - + test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago"); test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks"); test.done();