From: Wasil W Siargiejczyk Date: Sun, 21 Sep 2014 11:05:07 +0000 (+0600) Subject: modify tests for Russian locale X-Git-Tag: 2.8.4~4^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2d97c5a78023d8abb357b64fc87acd90c37c5bd;p=thirdparty%2Fmoment.git modify tests for Russian locale --- diff --git a/test/locale/ru.js b/test/locale/ru.js index 612753cbd..1aee0752e 100644 --- a/test/locale/ru.js +++ b/test/locale/ru.js @@ -276,9 +276,9 @@ exports['locale:ru'] = { }, 'calendar last week' : function (test) { - var i, m; + var i, m, now; - function makeFormat(d) { + function makeFormatLast(d) { switch (d.day()) { case 0: return '[В прошлое] dddd [в] LT'; @@ -293,14 +293,41 @@ exports['locale:ru'] = { } } + function makeFormatThis(d) { + switch (d.day()) { + case 0: + return '[В это] dddd [в] LT'; + case 1: + case 2: + case 4: + return '[В этот] dddd [в] LT'; + case 3: + case 5: + case 6: + return '[В эту] dddd [в] LT'; + } + } + + now = moment().startOf('week'); for (i = 2; i < 7; i++) { - m = moment().subtract({d: i}); - test.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days current time'); + m = moment(now).subtract({d: i}); + test.equal(m.calendar(now), m.format(makeFormatLast(m)), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - test.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days beginning of day'); + test.equal(m.calendar(now), m.format(makeFormatLast(m)), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - test.equal(m.calendar(), m.format(makeFormat(m)), 'Today - ' + i + ' days end of day'); + test.equal(m.calendar(now), m.format(makeFormatLast(m)), 'Today - ' + i + ' days end of day'); } + + now = moment().endOf('week'); + for (i = 2; i < 7; i++) { + m = moment(now).subtract({d: i}); + test.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today - ' + i + ' days current time'); + m.hours(0).minutes(0).seconds(0).milliseconds(0); + test.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today - ' + i + ' days beginning of day'); + m.hours(23).minutes(59).seconds(59).milliseconds(999); + test.equal(m.calendar(now), m.format(makeFormatThis(m)), 'Today - ' + i + ' days end of day'); + } + test.done(); },