dom/tests/mochitest/ajax/scriptaculous/test/unit/element_test.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
michael@0 2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
michael@0 3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
michael@0 4 <head>
michael@0 5 <title>script.aculo.us Unit test file</title>
michael@0 6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
michael@0 7 <script src="../../lib/prototype.js" type="text/javascript"></script>
michael@0 8 <script src="../../src/scriptaculous.js" type="text/javascript"></script>
michael@0 9 <script src="../../src/unittest.js" type="text/javascript"></script>
michael@0 10 <link rel="stylesheet" href="../test.css" type="text/css" />
michael@0 11 <style type="text/css" media="screen">
michael@0 12 #style_test_1 { color:rgb(0, 0, 255); background-color: rgb(0, 0, 255); }
michael@0 13 blah { color:rgb(0, 255, 0); }
michael@0 14 #op2 { opacity:0.5;filter:alpha(opacity=50)progid:DXImageTransform.Microsoft.Blur(strength=10);}
michael@0 15 </style>
michael@0 16 </head>
michael@0 17 <body>
michael@0 18 <h1>script.aculo.us Unit test file</h1>
michael@0 19 <p>
michael@0 20 Tests for Element extensions in effects.js
michael@0 21 </p>
michael@0 22
michael@0 23 <!-- Log output -->
michael@0 24 <div id="testlog"> </div>
michael@0 25
michael@0 26 <!-- Test elements follow -->
michael@0 27 <div id="test_1" class="a bbbbbbbbbbbb cccccccccc dddd"> </div>
michael@0 28
michael@0 29 <div id="test_2" class="classA-foobar classB-foobar"> </div> <span> </span>
michael@0 30
michael@0 31 <div id="style_test_1" style="display:none;"></div>
michael@0 32 <div id="style_test_2" class="blah" style="font-size:11px;"></div>
michael@0 33
michael@0 34 <div id="style_test_3">blah</div>
michael@0 35
michael@0 36 <div id="test_whitespace"> <span> </span>
michael@0 37
michael@0 38
michael@0 39
michael@0 40 <div><div></div> </div><span> </span>
michael@0 41 </div>
michael@0 42
michael@0 43 <!-- Test Element opacity functions -->
michael@0 44 <img id="op1" alt="op2" src="icon.png" style="opacity:0.5;filter:alpha(opacity=50)" />
michael@0 45 <img id="op2" alt="op2" src="icon.png"/>
michael@0 46 <img id="op3" alt="op3" src="icon.png"/>
michael@0 47 <img id="op4-ie" alt="op3" src="icon.png" style="filter:alpha(opacity=30)" />
michael@0 48
michael@0 49 <!-- Test Element.childrenWithClassName -->
michael@0 50 <div id="Container" class="moo hoo">
michael@0 51 <span id="1" class="firstClass">First class</span>
michael@0 52 <span id="2" class="secondClass">Second class</span>
michael@0 53 <span id="3" class="firstClass secondClass">First and Second class</span>
michael@0 54 <span id="4" class="thirdClass">Third class <span id="5" class="firstClass">Nested First class</span></span>
michael@0 55
michael@0 56 <div id="collect">1<span class="ignore"><span class="someclass">2</span>3</span><ul><li class="ignore">4</li></ul></div>
michael@0 57
michael@0 58 </div>
michael@0 59
michael@0 60 <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>
michael@0 61
michael@0 62 <!-- Tests follow -->
michael@0 63 <script type="text/javascript" language="javascript" charset="utf-8">
michael@0 64 // <![CDATA[
michael@0 65
michael@0 66 new Test.Unit.Runner({
michael@0 67
michael@0 68 testElementCollectTextNodes: function() { with(this) {
michael@0 69 assertEqual('1234', Element.collectTextNodes('collect'));
michael@0 70 assert(benchmark(function(){
michael@0 71 Element.collectTextNodes('collect')
michael@0 72 },50) < 1000);
michael@0 73
michael@0 74 benchmark(function(){
michael@0 75 Element.collectTextNodes('collect')
michael@0 76 },10,'Element.collectTextNodes');
michael@0 77
michael@0 78 assertEqual('1234', Element.collectTextNodesIgnoreClass('collect', 'somethingcompletelydifferent'));
michael@0 79 assertEqual('1', $('collect').collectTextNodesIgnoreClass('ignore'));
michael@0 80 benchmark(function(){
michael@0 81 Element.collectTextNodesIgnoreClass('collect','ignore')
michael@0 82 },10,'Element.collectTextNodesIgnoreClass');
michael@0 83
michael@0 84 assertEqual('134', Element.collectTextNodesIgnoreClass('collect', 'someclass'));
michael@0 85 }},
michael@0 86
michael@0 87 testVisualEffect: function() { with(this) {
michael@0 88 assert($('style_test_3') == $('style_test_3').visualEffect('fade'));
michael@0 89 wait(1500,function(){
michael@0 90 assert(!$('style_test_3').visible())
michael@0 91 });
michael@0 92 }},
michael@0 93
michael@0 94 testParseStylePerformance: function() { with(this) {
michael@0 95 benchmark(function(){
michael@0 96 "font:12px/15pt Verdana;opacity:0.4;border:4px dotted red".parseStyle();
michael@0 97 },100);
michael@0 98 }}
michael@0 99
michael@0 100 }, "testlog");
michael@0 101 // ]]>
michael@0 102 </script>
michael@0 103 </body>
michael@0 104 </html>

mercurial