@@ -63,6 +63,12 @@ <h2>Other formats</h2>
63
63
< 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 >
64
64
< p > < time id ="testTimeTitle2 " class ="timeago " datetime ="2012-05-07T10:06:02+02:00 "> May 10, 2012</ time > </ p >
65
65
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
+
66
72
< h2 > Errors</ h2 >
67
73
68
74
< p > Bad (letters): < abbr class ="bad timeago " title ="bleh "> (this should be displayed)</ abbr > .</ p >
@@ -212,9 +218,13 @@ <h2>Settings</h2>
212
218
213
219
prepareDynamicDates ( ) ;
214
220
215
- $ ( "abbr.timeago" ) . timeago ( ) ;
221
+ $ ( "abbr.timeago" ) . not ( "abbr.cutoff" ) . timeago ( ) ;
216
222
$ ( "time.timeago" ) . timeago ( ) ;
217
223
224
+ loadCutoffSetting ( ) ;
225
+ $ ( "abbr.cutoff" ) . timeago ( ) ;
226
+ unloadCutoffSetting ( ) ;
227
+
218
228
var tooltip = $ ( "#testTooltip" ) . data ( "timeago" ) ;
219
229
220
230
$ ( "abbr.todate" ) . each ( function ( ) {
@@ -291,6 +301,20 @@ <h2>Settings</h2>
291
301
ok ( tooltip . datetime , "datetime set" ) ;
292
302
} ) ;
293
303
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
+
294
318
module ( "Tooltip" ) ;
295
319
296
320
test ( "should set title to original text contents" , function ( ) {
0 commit comments