Skip to content
This repository has been archived by the owner on May 13, 2023. It is now read-only.

Commit

Permalink
Added unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee Jones authored and leejones committed Jan 25, 2010
1 parent 2163025 commit 65eb14d
Show file tree
Hide file tree
Showing 10 changed files with 1,434 additions and 10 deletions.
10 changes: 10 additions & 0 deletions README.mdown
@@ -0,0 +1,10 @@
Usage
=====

Opens external links in a new window

<code><pre>
$(document).ready(function() {
$("a").prepare_links();
});
</pre></code>
7 changes: 0 additions & 7 deletions README.rdoc

This file was deleted.

7 changes: 4 additions & 3 deletions jquery.prepare_links.js
Expand Up @@ -2,15 +2,16 @@ jQuery(function($) {
jQuery.fn.prepare_links = function() {

var current_host = new RegExp(window.location.host);

var localhost = RegExp('localhost');

return this.each(function(){
a = $(this);

if (a.attr('href') != undefined && a[0].host != undefined) {
host = a[0].host;
var host = a[0].host;

// external links should open in new window
if(!current_host.test(host)) {
if(!current_host.test(host) && !localhost.test(host)) {
a.attr({ target : "_blank" });
}
}
Expand Down
19 changes: 19 additions & 0 deletions shared/jquery-1.3.2.min.js

Large diffs are not rendered by default.

151 changes: 151 additions & 0 deletions shared/jquery-1.4.min.js

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions tests/index.html
@@ -0,0 +1,28 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Prepare Links UnitTests</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="Lee Jones">
<!-- Date: 2010-01-24 -->

<link rel="stylesheet" href="qunit.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="qunit.js" type="text/javascript" charset="utf-8"></script>

<script src="../shared/jquery-1.4.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../jquery.prepare_links.js" type="text/javascript" charset="utf-8"></script>

<script src="shared.js" type="text/javascript" charset="utf-8"></script>
<script src="unit-tests.js" type="text/javascript" charset="utf-8"></script>

</head>
<body>
<h1 id="qunit-header">Skoshi - Unit Tests</h1>
<h2 id="qunit-userAgent"></h2>
<h2 id="qunit-banner"></h2>
<ol id="qunit-tests"></ol>
</body>
</html>
119 changes: 119 additions & 0 deletions tests/qunit.css
@@ -0,0 +1,119 @@

ol#qunit-tests {
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
margin:0;
padding:0;
list-style-position:inside;

font-size: smaller;
}
ol#qunit-tests li{
padding:0.4em 0.5em 0.4em 2.5em;
border-bottom:1px solid #fff;
font-size:small;
list-style-position:inside;
}
ol#qunit-tests li ol{
box-shadow: inset 0px 2px 13px #999;
-moz-box-shadow: inset 0px 2px 13px #999;
-webkit-box-shadow: inset 0px 2px 13px #999;
margin-top:0.5em;
margin-left:0;
padding:0.5em;
background-color:#fff;
border-radius:15px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
}
ol#qunit-tests li li{
border-bottom:none;
margin:0.5em;
background-color:#fff;
list-style-position: inside;
padding:0.4em 0.5em 0.4em 0.5em;
}

ol#qunit-tests li li.pass{
border-left:26px solid #C6E746;
background-color:#fff;
color:#5E740B;
}
ol#qunit-tests li li.fail{
border-left:26px solid #EE5757;
background-color:#fff;
color:#710909;
}
ol#qunit-tests li.pass{
background-color:#D2E0E6;
color:#528CE0;
}
ol#qunit-tests li.fail{
background-color:#EE5757;
color:#000;
}
ol#qunit-tests li strong {
cursor:pointer;
}
h1#qunit-header{
background-color:#0d3349;
margin:0;
padding:0.5em 0 0.5em 1em;
color:#fff;
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
border-top-right-radius:15px;
border-top-left-radius:15px;
-moz-border-radius-topright:15px;
-moz-border-radius-topleft:15px;
-webkit-border-top-right-radius:15px;
-webkit-border-top-left-radius:15px;
text-shadow: rgba(0, 0, 0, 0.5) 4px 4px 1px;
}
h2#qunit-banner{
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
height:5px;
margin:0;
padding:0;
}
h2#qunit-banner.qunit-pass{
background-color:#C6E746;
}
h2#qunit-banner.qunit-fail, #qunit-testrunner-toolbar {
background-color:#EE5757;
}
#qunit-testrunner-toolbar {
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
padding:0;
/*width:80%;*/
padding:0em 0 0.5em 2em;
font-size: small;
}
h2#qunit-userAgent {
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
background-color:#2b81af;
margin:0;
padding:0;
color:#fff;
font-size: small;
padding:0.5em 0 0.5em 2.5em;
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
}
p#qunit-testresult{
font-family:"Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial;
margin:0;
font-size: small;
color:#2b81af;
border-bottom-right-radius:15px;
border-bottom-left-radius:15px;
-moz-border-radius-bottomright:15px;
-moz-border-radius-bottomleft:15px;
-webkit-border-bottom-right-radius:15px;
-webkit-border-bottom-left-radius:15px;
background-color:#D2E0E6;
padding:0.5em 0.5em 0.5em 2.5em;
}
strong b.fail{
color:#710909;
}
strong b.pass{
color:#5E740B;
}

0 comments on commit 65eb14d

Please sign in to comment.