Added test for future cutoff dates

Ref #183
This commit is contained in:
Ryan McGeary 2014-05-01 14:57:04 -04:00
parent dd17e5598f
commit 66d0ef5277

View file

@ -65,9 +65,13 @@
<h2>Cutoff</h2> <h2>Cutoff</h2>
<p>Date that is older than cutoff: <abbr class="timeago cutoff doCutoff" title="1978-12-18">(this should be displayed)</abbr></p> <p>Date that is before a past cutoff: <abbr class="timeago cutoff doCutoffPast" title="1978-12-18">(this should be displayed)</abbr></p>
<p>Date that is newer than cutoff: <abbr class="timeago loaded cutoff dontCutoff">(you shouldn't see this)</abbr></p> <p>Date that is after a past cutoff: <abbr class="timeago loaded cutoff dontCutoffPast">(you shouldn't see this)</abbr></p>
<p>Date that is past a future cutoff: <abbr class="timeago cutoff doCutoffFuture" title="2999-12-18">(this should be displayed)</abbr></p>
<p>Date that is before a future cutoff: <abbr class="timeago loaded cutoff dontCutoffFuture">(you shouldn't see this)</abbr></p>
<h2>Errors</h2> <h2>Errors</h2>
@ -332,13 +336,25 @@
module("Cutoff"); module("Cutoff");
test("should not change dates older than cutoff setting", function () { test("should not change dates older than cutoff setting", function () {
ok(testElements("abbr.doCutoff", function (element) { ok(testElements("abbr.doCutoffPast", function (element) {
return (element.html() === "(this should be displayed)"); return (element.html() === "(this should be displayed)");
}), "Cutoff setting working fine"); }), "Cutoff setting working fine");
}); });
test("should change dates newer than cutoff setting", function () { test("should change dates newer than cutoff setting", function () {
ok(testElements("abbr.dontCutoff", function (element) { ok(testElements("abbr.dontCutoffPast", function (element) {
return (element.html() === "less than a minute ago");
}), "Cutoff setting working fine");
});
test("should not change dates older than cutoff setting", function () {
ok(testElements("abbr.doCutoffFuture", function (element) {
return (element.html() === "(this should be displayed)");
}), "Cutoff setting working fine");
});
test("should change dates newer than cutoff setting", function () {
ok(testElements("abbr.dontCutoffFuture", function (element) {
return (element.html() === "less than a minute ago"); return (element.html() === "less than a minute ago");
}), "Cutoff setting working fine"); }), "Cutoff setting working fine");
}); });