mirror of
https://github.com/scratchfoundation/jquery-timeago.git
synced 2024-11-23 15:57:54 -05:00
97 lines
4.6 KiB
HTML
97 lines
4.6 KiB
HTML
<!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>
|
|
<script src="test.js" type="text/javascript"></script>
|
|
<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());
|
|
});
|
|
|
|
// unit tests
|
|
$('abbr[class*=towords]').each(function() {
|
|
var string = $.timeago.inWords(parseInt(this.title) * 1000);
|
|
$(this).text(string);
|
|
});
|
|
|
|
// unit tests
|
|
$("#helper_date").text($.timeago(new Date()));
|
|
$("#helper_string").text($.timeago(iso8601(new Date())));
|
|
$("#helper_element").text($.timeago($("#helper_element")));
|
|
});
|
|
</script>
|
|
<style>
|
|
abbr { border-bottom: 1px dotted #333; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Functional tests:</h1>
|
|
|
|
<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 />
|
|
|
|
<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 />
|
|
|
|
<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 />
|
|
Bad (missing): <abbr class="timeago">(this should be displayed)</abbr>.<br />
|
|
|
|
<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 />
|
|
|
|
<h1>Wording unit tests:</h1>
|
|
<abbr class="towords" title="-60"></abbr> [-60 sec]<br />
|
|
<abbr class="towords" title="-30"></abbr> [-30 sec]<br />
|
|
<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 />
|
|
|
|
<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 />
|
|
You opened this page <abbr id="helper_element" class="a loaded"></abbr> [won't refresh]<br />
|
|
</body>
|
|
</html>
|