@@ -63,6 +63,12 @@ <h2>Other formats</h2>
6363 < p > < time id ="testTimeTitle " class ="timeago " datetime ="2012-05-07T10:06:02+02:00 " title ="May 10, 2012 10:06 "> May 10, 2012</ time > </ p >
6464 < p > < time id ="testTimeTitle2 " class ="timeago " datetime ="2012-05-07T10:06:02+02:00 "> May 10, 2012</ time > </ p >
6565
66+ < h2 > Cutoff</ h2 >
67+
68+ < p > Date that is older than cutoff: < abbr class ="timeago cutoff doCutoff " title ="1978-12-18 "> (this should be displayed)</ abbr > </ p >
69+
70+ < p > Date that is newer than cutoff: < abbr class ="timeago loaded cutoff dontCutoff "> (you shouldn't see this)</ abbr > </ p >
71+
6672 < h2 > Errors</ h2 >
6773
6874 < p > Bad (letters): < abbr class ="bad timeago " title ="bleh "> (this should be displayed)</ abbr > .</ p >
@@ -212,9 +218,13 @@ <h2>Settings</h2>
212218
213219 prepareDynamicDates ( ) ;
214220
215- $ ( "abbr.timeago" ) . timeago ( ) ;
221+ $ ( "abbr.timeago" ) . not ( "abbr.cutoff" ) . timeago ( ) ;
216222 $ ( "time.timeago" ) . timeago ( ) ;
217223
224+ loadCutoffSetting ( ) ;
225+ $ ( "abbr.cutoff" ) . timeago ( ) ;
226+ unloadCutoffSetting ( ) ;
227+
218228 var tooltip = $ ( "#testTooltip" ) . data ( "timeago" ) ;
219229
220230 $ ( "abbr.todate" ) . each ( function ( ) {
@@ -291,6 +301,20 @@ <h2>Settings</h2>
291301 ok ( tooltip . datetime , "datetime set" ) ;
292302 } ) ;
293303
304+ module ( "Cutoff" ) ;
305+
306+ test ( "should not change dates older than cutoff setting" , function ( ) {
307+ ok ( testElements ( "abbr.doCutoff" , function ( element ) {
308+ return ( element . html ( ) === "(this should be displayed)" ) ;
309+ } ) , "Cutoff setting working fine" ) ;
310+ } ) ;
311+
312+ test ( "should change dates newer than cutoff setting" , function ( ) {
313+ ok ( testElements ( "abbr.dontCutoff" , function ( element ) {
314+ return ( element . html ( ) === "less than a minute ago" ) ;
315+ } ) , "Cutoff setting working fine" ) ;
316+ } ) ;
317+
294318 module ( "Tooltip" ) ;
295319
296320 test ( "should set title to original text contents" , function ( ) {
0 commit comments