2008-07-18 11:34:06 -04:00
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" / >
< title > Timeago jQuery Plugin Tests< / title >
< script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type = "text/javascript" > < / script >
< script src = "jquery.timeago.js" type = "text/javascript" > < / script >
2008-07-18 15:58:26 -04:00
< script src = "test.js" type = "text/javascript" > < / script >
2008-07-18 11:34:06 -04:00
< script type = "text/javascript" >
2008-08-06 07:04:15 -04:00
jQuery.timeago.settings.allowFuture = true;
2009-02-14 14:09:53 -05:00
//loadPigLatin();
//loadRussian();
//loadYoungOldYears();
2008-08-19 19:40:43 -04:00
2008-07-18 11:34:06 -04:00
jQuery(document).ready(function($) {
// functional tests
$('abbr[class*=timeago]').timeago();
// unit tests
$('abbr[class*=todate]').each(function() {
var date = $.timeago.parse(this.title);
$(this).text(date.toString());
});
2008-07-18 15:58:26 -04:00
// unit tests
$('abbr[class*=towords]').each(function() {
var string = $.timeago.inWords(parseInt(this.title) * 1000);
$(this).text(string);
});
2008-07-20 17:08:34 -04:00
// unit tests
$("#helper_date").text($.timeago(new Date()));
$("#helper_string").text($.timeago(iso8601(new Date())));
2008-07-30 10:38:21 -04:00
$("#helper_element").text($.timeago($("#helper_element")));
2008-07-18 11:34:06 -04:00
});
< / script >
2008-07-18 15:58:26 -04:00
< style >
abbr { border-bottom: 1px dotted #333; }
< / style >
2008-07-18 11:34:06 -04:00
< / head >
< body >
< h1 > Functional tests:< / h1 >
2008-07-18 15:58:26 -04:00
< h2 > Short term< / h2 >
You opened this page < abbr class = "loaded timeago" > sometime before now< / abbr > .< br / >
2008-07-19 10:36:59 -04:00
This page was last modified < abbr class = "modified timeago" > sometime before now (your browser might not support document.lastModified for local resources)< / abbr > .< br / >
2008-07-18 15:58:26 -04:00
2008-07-18 11:34:06 -04:00
< h2 > Long term< / h2 >
Jett was born < abbr class = "timeago" title = "2008-02-27T00:23:00Z" > bleh< / abbr > [from Z]< br / >
Jett was born < abbr class = "timeago" title = "2008-02-26T19:23:00-0500" > bleh< / abbr > [from -0500]< br / >
< br / >
Logan was born < abbr class = "timeago" title = "2005-06-17T23:42:00Z" > bleh< / abbr > [from Z]< br / >
Logan was born < abbr class = "timeago" title = "2005-06-17T19:42:00-0400" > bleh< / abbr > [from -0400]< br / >
< br / >
Ryan was born < abbr class = "timeago" title = "1978-12-18T17:17:00Z" > bleh< / abbr > [from Z]< br / >
Ryan was born < abbr class = "timeago" title = "1978-12-18T12:17:00-05:00" > bleh< / abbr > [from -0500]< br / >
2008-07-18 15:58:26 -04:00
< h2 > Other formats< / h2 >
Date only: < abbr class = "timeago" title = "2008-02-26" > (you shouldn't see this)< / abbr > .< br / >
< h2 > Errors< / h2 >
Bad (letters): < abbr class = "timeago" title = "bleh" > (this should be displayed)< / abbr > .< br / >
Bad (numbers): < abbr class = "timeago" title = "1234" > (this should be displayed)< / abbr > .< br / >
2008-07-19 10:36:59 -04:00
Bad (blank): < abbr class = "timeago" title = "" > (this should be displayed)< / abbr > .< br / >
2008-07-18 15:58:26 -04:00
Bad (missing): < abbr class = "timeago" > (this should be displayed)< / abbr > .< br / >
2008-07-18 11:34:06 -04:00
< h1 > Parsing unit tests:< / h1 >
< strong > Ryan was born...< / strong > < br / >
< abbr class = "todate" title = "1978-12-18T17:17:00Z" > < / abbr > [from Z]< br / >
< abbr class = "todate" title = "1978-12-18T17:17:00-00:00" > < / abbr > [from -00:00]< br / >
< abbr class = "todate" title = "1978-12-18T12:17:00-05:00" > < / abbr > [from -05:00]< br / >
< abbr class = "todate" title = "1978-12-18T12:17:00-0500" > < / abbr > [from -0500]< br / >
< abbr class = "todate" title = "1978-12-19T02:17:00+09:00" > < / abbr > [from +09:00]< br / >
< abbr class = "todate" title = "1978-12-19T02:17:00+0900" > < / abbr > [from +0900]< br / >
2008-10-13 17:52:12 -04:00
< abbr class = "todate" title = "2008-09-09 15:50:34" > < / abbr > [from blank TZ]< br / >
2008-07-18 15:58:26 -04:00
< h1 > Wording unit tests:< / h1 >
2008-08-06 07:04:15 -04:00
< abbr class = "towords" title = "-7200" > < / abbr > [-120 min]< br / >
2008-07-20 16:08:59 -04:00
< abbr class = "towords" title = "-60" > < / abbr > [-60 sec]< br / >
< abbr class = "towords" title = "-30" > < / abbr > [-30 sec]< br / >
2008-07-18 15:58:26 -04:00
< abbr class = "towords" title = "-1" > < / abbr > [-1 sec]< br / >
< abbr class = "towords" title = "0" > < / abbr > [0 sec]< br / >
< abbr class = "towords" title = "30" > < / abbr > [30 sec]< br / >
< abbr class = "towords" title = "45" > < / abbr > [45 sec]< br / >
< abbr class = "towords" title = "90" > < / abbr > [90 sec]< br / >
< abbr class = "towords" title = "120" > < / abbr > [120 sec]< br / >
< abbr class = "towords" title = "2700" > < / abbr > [45 min]< br / >
< abbr class = "towords" title = "5340" > < / abbr > [89 min]< br / >
< abbr class = "towords" title = "5400" > < / abbr > [90 min]< br / >
< abbr class = "towords" title = "7200" > < / abbr > [120 min]< br / >
< abbr class = "towords" title = "82800" > < / abbr > [1380 min]< br / >
2008-08-19 19:24:59 -04:00
< abbr class = "towords" title = "90000" > < / abbr > [25 hours]< br / >
< abbr class = "towords" title = "172800" > < / abbr > [48 hours]< br / >
2008-07-18 15:58:26 -04:00
< abbr class = "towords" title = "2505600" > < / abbr > [696 hours]< br / >
< abbr class = "towords" title = "2592000" > < / abbr > [30 days]< br / >
< abbr class = "towords" title = "16416000" > < / abbr > [190 days]< br / >
< abbr class = "towords" title = "31622400" > < / abbr > [366 days]< br / >
< abbr class = "towords" title = "94608000" > < / abbr > [1095 days]< br / >
2008-07-20 17:08:34 -04:00
< h1 > Helper unit tests:< / h1 >
You opened this page < abbr id = "helper_date" > < / abbr > [won't refresh]< br / >
You opened this page < abbr id = "helper_string" > < / abbr > [won't refresh]< br / >
2008-07-30 10:38:21 -04:00
You opened this page < abbr id = "helper_element" class = "a loaded" > < / abbr > [won't refresh]< br / >
2008-07-18 11:34:06 -04:00
< / body >
< / html >