Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>script.aculo.us Unit test file</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="../../lib/prototype.js" type="text/javascript"></script>
<script src="../../src/scriptaculous.js" type="text/javascript"></script>
<script src="../../src/unittest.js" type="text/javascript"></script>
<link rel="stylesheet" href="../test.css" type="text/css" />
<style type="text/css" media="screen">
#style_test_1 { color:rgb(0, 0, 255); background-color: rgb(0, 0, 255); }
blah { color:rgb(0, 255, 0); }
#op2 { opacity:0.5;filter:alpha(opacity=50)progid:DXImageTransform.Microsoft.Blur(strength=10);}
</style>
</head>
<body>
<h1>script.aculo.us Unit test file</h1>
<p>
Tests for Element extensions in effects.js
</p>
<!-- Log output -->
<div id="testlog"> </div>
<!-- Test elements follow -->
<div id="test_1" class="a bbbbbbbbbbbb cccccccccc dddd"> </div>
<div id="test_2" class="classA-foobar classB-foobar"> </div> <span> </span>
<div id="style_test_1" style="display:none;"></div>
<div id="style_test_2" class="blah" style="font-size:11px;"></div>
<div id="style_test_3">blah</div>
<div id="test_whitespace"> <span> </span>
<div><div></div> </div><span> </span>
</div>
<!-- Test Element opacity functions -->
<img id="op1" alt="op2" src="icon.png" style="opacity:0.5;filter:alpha(opacity=50)" />
<img id="op2" alt="op2" src="icon.png"/>
<img id="op3" alt="op3" src="icon.png"/>
<img id="op4-ie" alt="op3" src="icon.png" style="filter:alpha(opacity=30)" />
<!-- Test Element.childrenWithClassName -->
<div id="Container" class="moo hoo">
<span id="1" class="firstClass">First class</span>
<span id="2" class="secondClass">Second class</span>
<span id="3" class="firstClass secondClass">First and Second class</span>
<span id="4" class="thirdClass">Third class <span id="5" class="firstClass">Nested First class</span></span>
<div id="collect">1<span class="ignore"><span class="someclass">2</span>3</span><ul><li class="ignore">4</li></ul></div>
</div>
<div id="perftest1"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></div>
<!-- Tests follow -->
<script type="text/javascript" language="javascript" charset="utf-8">
// <![CDATA[
new Test.Unit.Runner({
testElementCollectTextNodes: function() { with(this) {
assertEqual('1234', Element.collectTextNodes('collect'));
assert(benchmark(function(){
Element.collectTextNodes('collect')
},50) < 1000);
benchmark(function(){
Element.collectTextNodes('collect')
},10,'Element.collectTextNodes');
assertEqual('1234', Element.collectTextNodesIgnoreClass('collect', 'somethingcompletelydifferent'));
assertEqual('1', $('collect').collectTextNodesIgnoreClass('ignore'));
benchmark(function(){
Element.collectTextNodesIgnoreClass('collect','ignore')
},10,'Element.collectTextNodesIgnoreClass');
assertEqual('134', Element.collectTextNodesIgnoreClass('collect', 'someclass'));
}},
testVisualEffect: function() { with(this) {
assert($('style_test_3') == $('style_test_3').visualEffect('fade'));
wait(1500,function(){
assert(!$('style_test_3').visible())
});
}},
testParseStylePerformance: function() { with(this) {
benchmark(function(){
"font:12px/15pt Verdana;opacity:0.4;border:4px dotted red".parseStyle();
},100);
}}
}, "testlog");
// ]]>
</script>
</body>
</html>