beautify_js
This commit is contained in:
parent
0febe4f5fd
commit
5c2f32e184
208 changed files with 3891 additions and 1474 deletions
|
@ -1,6 +1,6 @@
|
|||
function getDateAgo(date, days) {
|
||||
var dateCopy = new Date(date);
|
||||
|
||||
dateCopy.setDate( date.getDate() - days );
|
||||
return dateCopy.getDate();
|
||||
|
||||
dateCopy.setDate(date.getDate() - days);
|
||||
return dateCopy.getDate();
|
||||
}
|
|
@ -1,20 +1,20 @@
|
|||
describe("getDateAgo", function() {
|
||||
|
||||
it("1 день до 02.01.2015 -> число 1", function() {
|
||||
assert.equal( getDateAgo(new Date(2015, 0, 2), 1), 1 );
|
||||
assert.equal(getDateAgo(new Date(2015, 0, 2), 1), 1);
|
||||
});
|
||||
|
||||
|
||||
it("2 день до 02.01.2015 -> число 31", function() {
|
||||
assert.equal( getDateAgo(new Date(2015, 0, 2), 2), 31 );
|
||||
assert.equal(getDateAgo(new Date(2015, 0, 2), 2), 31);
|
||||
});
|
||||
|
||||
it("100 дней от 02.01.2015 -> число 24", function() {
|
||||
assert.equal( getDateAgo(new Date(2015, 0, 2), 100), 24 );
|
||||
assert.equal(getDateAgo(new Date(2015, 0, 2), 100), 24);
|
||||
});
|
||||
|
||||
it("365 дней от 02.01.2015 -> число 2", function() {
|
||||
assert.equal( getDateAgo(new Date(2015, 0, 2), 365), 2 );
|
||||
assert.equal(getDateAgo(new Date(2015, 0, 2), 365), 2);
|
||||
});
|
||||
|
||||
it("не меняет переданный объект Date", function() {
|
||||
|
@ -23,5 +23,5 @@ describe("getDateAgo", function() {
|
|||
getDateAgo(dateCopy, 100);
|
||||
assert.equal(date.getTime(), dateCopy.getTime());
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue