DateAssert.js revision 33d85edf47749fa345d7b636b9b4b9d0d0386f44
/**
* The DateAssert object provides functions to test JavaScript Date objects
* for a variety of cases.
* @namespace YUITest
* @class DateAssert
* @static
*/
YUITest.DateAssert = {
/**
* Asserts that a date's month, day, and year are equal to another date's.
* @param {Date} expected The expected date.
* @param {Date} actual The actual date to test.
* @param {String} message (Optional) The message to display if the assertion fails.
* @method datesAreEqual
* @static
*/
var msg = "";
//check years first
msg = "Years should be equal.";
}
//now check months
msg = "Months should be equal.";
}
//last, check the day of the month
msg = "Days of month should be equal.";
}
}
} else {
throw new TypeError("YUITest.DateAssert.datesAreEqual(): Expected and actual values must be Date objects.");
}
},
/**
* Asserts that a date's hour, minutes, and seconds are equal to another date's.
* @param {Date} expected The expected date.
* @param {Date} actual The actual date to test.
* @param {String} message (Optional) The message to display if the assertion fails.
* @method timesAreEqual
* @static
*/
var msg = "";
//check hours first
msg = "Hours should be equal.";
}
//now check minutes
msg = "Minutes should be equal.";
}
//last, check the seconds
msg = "Seconds should be equal.";
}
}
} else {
throw new TypeError("YUITest.DateAssert.timesAreEqual(): Expected and actual values must be Date objects.");
}
}
};