jquery-timeago/test.html

86 lines
4 KiB
HTML
Raw Permalink Normal View History

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">
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-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 />
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 />
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-07-18 15:58:26 -04:00
<h1>Wording unit tests:</h1>
<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 />
<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-18 11:34:06 -04:00
</body>
</html>