Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Massive overhauls to the test suite - it is now generated dynamically…
…, along with the documentation.
- Loading branch information
Showing
10 changed files
with
465 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
function parse( f ) { | ||
var c = [], bm, m; | ||
var blockMatch = /\/\*\*\s*((.|\n)*?)\s*\*\//g; | ||
var paramMatch = /\@(\S+) *((.|\n)*?)(?=\n\@|!!!)/m; | ||
|
||
while ( bm = blockMatch.exec(f) ) { | ||
block = bm[1].replace(/^\s*\* ?/mg,"") + "!!!"; | ||
var ret = { params: [], examples: [], tests: [] }; | ||
|
||
while ( m = paramMatch.exec( block ) ) { | ||
block = block.replace( paramMatch, "" ); | ||
|
||
var n = m[1]; | ||
var v = m[2] | ||
.replace(/\s*$/g,"") | ||
.replace(/^\s*/g,"") | ||
.replace(/&/g, "&") | ||
.replace(/</g, "<") | ||
.replace(/>/g, ">") | ||
//.replace(/\n/g, "<br/>") | ||
/*.replace(/(\s\s+)/g, function(a){ | ||
var ret = ""; | ||
for ( var i = 0; i < a.length; i++ ) | ||
ret += " "; | ||
return ret; | ||
})*/ || 1; | ||
|
||
if ( n == 'param' || n == 'any' ) { | ||
var args = v.split(/\s+/); | ||
v = args.slice( 2, args.length ); | ||
v = { type: args[0], name: args[1], desc: v.join(' ') }; | ||
if ( n == 'any' ) v.any = 1; | ||
n = "params"; | ||
} else if ( n == 'example' ) { | ||
v = { code: v }; | ||
n = "examples"; | ||
} else if ( n == 'test' ) { | ||
n = "tests"; | ||
} | ||
|
||
if ( n == 'desc' || n == 'before' || n == 'after' || n == 'result' ) { | ||
ret.examples[ ret.examples.length - 1 ][ n ] = v; | ||
} else { | ||
if ( ret[ n ] ) { | ||
if ( ret[ n ].constructor == Array ) { | ||
ret[ n ].push( v ); | ||
} else { | ||
ret[ n ] = [ ret[ n ], v ]; | ||
} | ||
} else { | ||
ret[ n ] = v; | ||
} | ||
} | ||
} | ||
|
||
ret.desc = block.replace(/\s*!!!$/,"") | ||
.replace(/</g, "<") | ||
.replace(/>/g, ">"); | ||
//.replace(/\n\n/g, "<br/><br/>") | ||
//.replace(/\n/g, " "); | ||
|
||
var m = /^((.|\n)*?(\.|$))/.exec( ret.desc ); | ||
if ( m ) ret['short'] = m[1]; | ||
|
||
if ( ret.name ) c.push( ret ); | ||
} | ||
|
||
return c; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,55 @@ | ||
<html> | ||
<html id="html"> | ||
<head> | ||
<script type="text/javascript" src="lib/Test/Harness.js"></script> | ||
<script type="text/javascript" src="lib/Test/Harness/Browser.js"></script> | ||
<script type="text/javascript" src="../dist/jquery.js"></script> | ||
<script type="text/javascript" src="js/test.js"></script> | ||
<script> | ||
$(document).ready(function(){ | ||
runTests([{FILES}]); | ||
}); | ||
</script> | ||
<style>.pass { color: green; } .fail { color: red; } #tests ol { display: none; }</style> | ||
</head> | ||
<body> | ||
<body id="body"> | ||
<h1>jQuery - Test Suite</h1> | ||
|
||
<!-- Test HTML --> | ||
<dl style="display:none;"> | ||
<div id="main" style="display: none;"> | ||
<p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p> | ||
<p id="ap"> | ||
Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>, | ||
<a id="groups" href="http://groups.google.com/">Google Groups</a>. | ||
This link has <code><a href="#" id="anchor1">class="blog"</a></code>: | ||
<a href="http://diveintomark.org/" class="blog" hreflang="en" id="mark">diveintomark</a> | ||
|
||
<script type="text/javascript"> | ||
new Test.Harness.Browser().runTests( | ||
"tests/prereq.html", | ||
"tests/css1.html", | ||
"tests/css2.html", | ||
"tests/css3.html", | ||
"tests/xpath.html", | ||
"tests/custom.html", | ||
"tests/basic.html" | ||
); | ||
</script> | ||
</p> | ||
<div id="foo"> | ||
<p id="sndp">Everything inside the red border is inside a div with | ||
<code>id="foo"</code>.</p> | ||
<p lang="en" id="en">This is a normal link: | ||
<a id="yahoo" href="http://www.yahoo.com/" class="blogTest">Yahoo</a></p> | ||
<p id="sap">This link has <code><a href="#2" id="anchor2">class="blog"</a></code>: | ||
<a href="http://simon.incutio.com/" class="blog link" id="simon">Simon Willison's Weblog</a></p> | ||
|
||
</div> | ||
<p id="first">Try them out: </p> | ||
<ul id="firstUL"></ul> | ||
<ol id="empty"></ol> | ||
<form id="form"> | ||
<input type="text" value="Test" id="text1"/> | ||
<input type="text" value="Test" id="text2" disabled="disabled"/> | ||
<input type="radio" name="radio1" id="radio1"/> | ||
|
||
<input type="radio" name="radio2" id="radio2" checked/> | ||
<input type="checkbox" name="check" id="check1" checked/> | ||
<input type="checkbox" name="check" id="check2"/> | ||
|
||
<input type="hidden" name="hidden" id="hidden1"/> | ||
<input type="text" style="display:none;" id="hidden2"/> | ||
</form> | ||
</div> | ||
</dl> | ||
|
||
<ol id="tests"></ol> | ||
</body> | ||
</html> |
Oops, something went wrong.