Changeset 6387
- Timestamp:
- 03/11/07 23:26:54 (1 year ago)
- Files:
-
- spinoffs/scriptaculous/CHANGELOG (modified) (1 diff)
- spinoffs/scriptaculous/lib/prototype.js (modified) (7 diffs)
- spinoffs/scriptaculous/MIT-LICENSE (modified) (1 diff)
- spinoffs/scriptaculous/Rakefile (modified) (2 diffs)
- spinoffs/scriptaculous/src/builder.js (modified) (1 diff)
- spinoffs/scriptaculous/src/controls.js (modified) (1 diff)
- spinoffs/scriptaculous/src/dragdrop.js (modified) (6 diffs)
- spinoffs/scriptaculous/src/effects.js (modified) (1 diff)
- spinoffs/scriptaculous/src/scriptaculous.js (modified) (2 diffs)
- spinoffs/scriptaculous/src/slider.js (modified) (1 diff)
- spinoffs/scriptaculous/src/unittest.js (modified) (1 diff)
- spinoffs/scriptaculous/test/functional/index.html (modified) (3 diffs)
- spinoffs/scriptaculous/test/test.css (modified) (1 diff)
- spinoffs/scriptaculous/test/unit/ajax_autocompleter_test.html (modified) (1 diff)
- spinoffs/scriptaculous/test/unit/ajax_inplaceeditor_test.html (modified) (1 diff)
- spinoffs/scriptaculous/test/unit/builder_test.html (modified) (8 diffs)
- spinoffs/scriptaculous/test/unit/effects_test.html (modified) (6 diffs)
- spinoffs/scriptaculous/test/unit/element_test.html (modified) (1 diff)
- spinoffs/scriptaculous/test/unit/index.html (modified) (3 diffs)
- spinoffs/scriptaculous/test/unit/loading_test.html (modified) (1 diff)
- spinoffs/scriptaculous/test/unit/position_clone_test.html (modified) (1 diff)
- spinoffs/scriptaculous/test/unit/slider_test.html (modified) (1 diff)
- spinoffs/scriptaculous/test/unit/string_test.html (modified) (1 diff)
- spinoffs/scriptaculous/test/unit/transform_test.html (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
spinoffs/scriptaculous/CHANGELOG
r6370 r6387 1 *SVN* 2 3 * Update to Prototype 1.5.1_rc0 4 See http://dev.rubyonrails.org/browser/spinoffs/prototype/trunk/CHANGELOG?rev=6369 for more information 1 *V1.7.1 beta 1* (March 12, 2007) 2 3 * Update to Prototype 1.5.1 r6386 4 - Fixes SlideUp/SlideDown on IE 5 - Fixes an opacity problem with IE 6 - Performance optimizations 7 - See http://dev.rubyonrails.org/browser/spinoffs/prototype/trunk/CHANGELOG?rev=6381 for more information 8 9 * Make builder unit tests work on IE 5 10 6 11 * Fix id assignment for sounds on Firefox/Windows, fixes #7709 [Robert Wallis] spinoffs/scriptaculous/lib/prototype.js
r6370 r6387 1 /* Prototype JavaScript framework, version 1.5.1_rc 01 /* Prototype JavaScript framework, version 1.5.1_rc1 2 2 * (c) 2005-2007 Sam Stephenson 3 3 * … … 8 8 9 9 var Prototype = { 10 Version: '1.5.1_rc 0',10 Version: '1.5.1_rc1', 11 11 12 12 Browser: { … … 629 629 } 630 630 631 if (Prototype.Browser.WebKit) { 632 $A = Array.from = function(iterable) { 633 if (!iterable) return []; 634 if (!(typeof iterable == 'function' && iterable == '[object NodeList]') && 635 iterable.toArray) { 636 return iterable.toArray(); 637 } else { 638 var results = []; 639 for (var i = 0, length = iterable.length; i < length; i++) 640 results.push(iterable[i]); 641 return results; 642 } 643 } 644 } 645 631 646 Object.extend(Array.prototype, Enumerable); 632 647 … … 1274 1289 } 1275 1290 1276 element._extended = true;1291 element._extended = Prototype.emptyFunction; 1277 1292 return element; 1278 1293 }; … … 1360 1375 1361 1376 descendants: function(element) { 1362 return $A($(element).getElementsByTagName('*')) ;1377 return $A($(element).getElementsByTagName('*')).each(Element.extend); 1363 1378 }, 1364 1379 … … 1425 1440 element = $(element); 1426 1441 if (Prototype.Browser.IE) { 1442 if (!element.attributes) return null; 1427 1443 var t = Element._attributeTranslations; 1428 1444 if (t.values[name]) return t.values[name](element, name); … … 2226 2242 unique: function(nodes) { 2227 2243 if (nodes.length == 0) return nodes; 2228 var results = [nodes[0]], n; 2229 nodes[0]._counted = true; 2230 for (var i = 0, l = nodes.length; i < l; i++) { 2231 n = nodes[i]; 2232 if (!n._counted) { 2244 var results = [], n; 2245 for (var i = 0, l = nodes.length; i < l; i++) 2246 if (!(n = nodes[i])._counted) { 2233 2247 n._counted = true; 2234 2248 results.push(Element.extend(n)); 2235 2249 } 2236 }2237 2250 return Selector.handlers.unmark(results); 2238 2251 }, spinoffs/scriptaculous/MIT-LICENSE
r5468 r6387 1 Copyright (c) 2005 , 2006Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)1 Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 2 2 3 3 Permission is hereby granted, free of charge, to any person obtaining spinoffs/scriptaculous/Rakefile
r6295 r6387 6 6 PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : '' 7 7 PKG_TIMESTAMP = Time.new.to_s 8 PKG_VERSION = '1.7. 0' + PKG_BUILD8 PKG_VERSION = '1.7.1_beta1' + PKG_BUILD 9 9 PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}" 10 10 PKG_DESTINATION = ENV["PKG_DESTINATION"] || "dist" … … 27 27 'test/**/*.html', 28 28 'test/**/*.css', 29 'test/**/*.png' 29 'test/**/*.png', 30 'test/**/*.mp3' 30 31 ] 31 32 spinoffs/scriptaculous/src/builder.js
r6135 r6387 1 // Copyright (c) 2005 , 2006Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)1 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 2 2 // 3 3 // script.aculo.us is freely distributable under the terms of an MIT-style license. spinoffs/scriptaculous/src/controls.js
r6261 r6387 1 // Copyright (c) 2005 , 2006Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)2 // (c) 2005 , 2006Ivan Krstic (http://blogs.law.harvard.edu/ivan)3 // (c) 2005 , 2006Jon Tirsen (http://www.tirsen.com)1 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 2 // (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan) 3 // (c) 2005-2007 Jon Tirsen (http://www.tirsen.com) 4 4 // Contributors: 5 5 // Richard Livsey spinoffs/scriptaculous/src/dragdrop.js
r6258 r6387 1 // Copyright (c) 2005 , 2006Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)2 // (c) 2005 , 2006Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)1 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 2 // (c) 2005-2007 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz) 3 3 // 4 4 // script.aculo.us is freely distributable under the terms of an MIT-style license. … … 246 246 zindex: 1000, 247 247 revert: false, 248 quiet: false, 248 249 scroll: false, 249 250 scrollSensitivity: 20, … … 354 355 updateDrag: function(event, pointer) { 355 356 if(!this.dragging) this.startDrag(event); 356 Position.prepare(); 357 Droppables.show(pointer, this.element); 357 358 if(!this.options.quiet){ 359 Position.prepare(); 360 Droppables.show(pointer, this.element); 361 } 362 358 363 Draggables.notify('onDrag', this, event); 359 364 … … 390 395 finishDrag: function(event, success) { 391 396 this.dragging = false; 397 398 if(this.options.quiet){ 399 Position.prepare(); 400 var pointer = [Event.pointerX(event), Event.pointerY(event)]; 401 Droppables.show(pointer, this.element); 402 } 392 403 393 404 if(this.options.ghosting) { … … 621 632 hoverclass: null, 622 633 ghosting: false, 634 quiet: false, 623 635 scroll: false, 624 636 scrollSensitivity: 20, … … 635 647 var options_for_draggable = { 636 648 revert: true, 649 quiet: options.quiet, 637 650 scroll: options.scroll, 638 651 scrollSpeed: options.scrollSpeed, spinoffs/scriptaculous/src/effects.js
r6284 r6387 1 // Copyright (c) 2005 , 2006Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)1 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 2 2 // Contributors: 3 3 // Justin Palmer (http://encytemedia.com/) spinoffs/scriptaculous/src/scriptaculous.js
r6370 r6387 1 // Copyright (c) 2005 , 2006Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)1 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 2 2 // 3 3 // Permission is hereby granted, free of charge, to any person obtaining … … 23 23 24 24 var Scriptaculous = { 25 Version: '1.7. 0',25 Version: '1.7.1_beta1', 26 26 require: function(libraryName) { 27 27 // inserting via DOM fails in Safari 2.0, so brute force approach spinoffs/scriptaculous/src/slider.js
r6191 r6387 1 // Copyright (c) 2005 , 2006Marty Haught, Thomas Fuchs1 // Copyright (c) 2005-2007 Marty Haught, Thomas Fuchs 2 2 // 3 3 // script.aculo.us is freely distributable under the terms of an MIT-style license. spinoffs/scriptaculous/src/unittest.js
r5528 r6387 1 // Copyright (c) 2005 , 2006Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)2 // (c) 2005 , 2006Jon Tirsen (http://www.tirsen.com)3 // (c) 2005 , 2006Michael Schuerig (http://www.schuerig.de/michael/)1 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 2 // (c) 2005-2007 Jon Tirsen (http://www.tirsen.com) 3 // (c) 2005-2007 Michael Schuerig (http://www.schuerig.de/michael/) 4 4 // 5 5 // script.aculo.us is freely distributable under the terms of an MIT-style license. spinoffs/scriptaculous/test/functional/index.html
r6295 r6387 10 10 <link rel="stylesheet" href="../test.css" type="text/css" /> 11 11 </head> 12 <body >12 <body class="navigation"> 13 13 14 <h1>script.aculo.us Functional Tests</h1>14 <h1>script.aculo.us<br/>Functional Tests</h1> 15 15 16 16 <p id="version"></p> … … 24 24 <p><a href="http://wiki.script.aculo.us/scriptaculous/show/UnitTesting" target="test">Documentation</a></p> 25 25 26 <ul> 27 <li><a href="position_clone_test.html" target="test">position_clone_test</a></li> 28 </ul> 29 <ul> 30 <li><a href="ajax_autocompleter_test.html" target="test">ajax_autocompleter_test</a></li> 31 <li><a href="ajax_autocompleter2_test.html" target="test">ajax_autocompleter2_test</a></li> 32 </ul> 33 <ul> 34 <li><a href="ajax_inplaceeditor_test.html" target="test">ajax_inplaceeditor_test</a></li> 35 <li><a href="ajax_inplacecollectioneditor_test.html" target="test">ajax_inplacecollectioneditor_test</a></li> 36 </ul> 37 <ul> 38 <li><a href="dragdrop_test.html" target="test">dragdrop_test</a></li> 39 <li><a href="dragdrop2_test.html" target="test">dragdrop2_test</a></li> 40 <li><a href="dragdrop3_test.html" target="test">dragdrop3_test</a></li> 41 <li><a href="dragdrop4_test.html" target="test">dragdrop4_test</a></li> 42 <li><a href="dragdrop5_test.html" target="test">dragdrop5_test</a></li> 43 <li><a href="dragdrop6_test.html" target="test">dragdrop6_test: snap option</a></li> 44 <li><a href="dragdrop7_test.html" target="test">dragdrop7_test</a></li> 45 <li><a href="dragdrop8_test.html" target="test">dragdrop8_test</a></li> 46 <li><a href="dragdrop9_test.html" target="test">Revert: failure</a></li> 47 <li><a href="dragdrop_delay_test.html" target="test">dragdrop delay test</a></li> 48 </ul> 49 <ul> 50 <li><a href="sortable_test.html" target="test">sortable_test</a></li> 51 <li><a href="sortable2_test.html" target="test">sortable2_test</a></li> 52 <li><a href="sortable3_test.html" target="test">sortable3_test</a></li> 53 <li><a href="sortable4_test.html" target="test">sortable4_test</a></li> 54 <li><a href="sortable5_test.html" target="test">sortable5_test</a></li> 55 <li><a href="sortable6_test.html" target="test">sortable5_test</a></li> 56 </ul> 57 <ul> 58 <li><a href="sortable_tree_test.html" target="test">Sortable trees</a></li> 59 </ul> 60 <ul> 61 <li><a href="slider_test.html" target="test">slider_test</a></li> 62 </ul> 26 <h2>Effects</h2> 63 27 <ul> 64 28 <li><b><a href="effects_random_demo.html" target="test">Random effects test</a></b></li> … … 79 43 <li><a href="effects_float_appear_test.html" target="test">Test for Safari .Appear w/ floats</a></li> 80 44 <li><a href="effects_highlight_bg_image.html" target="test">Effect.Highlight keepBackgroundImage option</a></li> 81 </ul>82 <ul>83 45 <li><a href="texteffects_test.html" target="test">texteffects_test.html</a></li> 84 46 </ul> 47 48 <h2>Controls</h2> 49 <ul> 50 <li><a href="ajax_autocompleter_test.html" target="test">ajax_autocompleter_test</a></li> 51 <li><a href="ajax_autocompleter2_test.html" target="test">ajax_autocompleter2_test</a></li> 52 <li><a href="ajax_inplaceeditor_test.html" target="test">ajax_inplaceeditor_test</a></li> 53 <li><a href="ajax_inplacecollectioneditor_test.html" target="test">ajax_inplacecollectioneditor_test</a></li> 54 <li><a href="slider_test.html" target="test">slider_test</a></li> 55 </ul> 56 57 <h2>Drag & Drop</h2> 58 <ul> 59 <li><a href="dragdrop_test.html" target="test">dragdrop_test</a></li> 60 <li><a href="dragdrop2_test.html" target="test">dragdrop2_test</a></li> 61 <li><a href="dragdrop3_test.html" target="test">dragdrop3_test</a></li> 62 <li><a href="dragdrop4_test.html" target="test">dragdrop4_test</a></li> 63 <li><a href="dragdrop5_test.html" target="test">dragdrop5_test</a></li> 64 <li><a href="dragdrop6_test.html" target="test">dragdrop6_test: snap option</a></li> 65 <li><a href="dragdrop7_test.html" target="test">dragdrop7_test</a></li> 66 <li><a href="dragdrop8_test.html" target="test">dragdrop8_test</a></li> 67 <li><a href="dragdrop9_test.html" target="test">Revert: failure</a></li> 68 <li><a href="dragdrop_delay_test.html" target="test">dragdrop delay test</a></li> 69 <li><a href="sortable_test.html" target="test">sortable_test</a></li> 70 <li><a href="sortable2_test.html" target="test">sortable2_test</a></li> 71 <li><a href="sortable3_test.html" target="test">sortable3_test</a></li> 72 <li><a href="sortable4_test.html" target="test">sortable4_test</a></li> 73 <li><a href="sortable5_test.html" target="test">sortable5_test</a></li> 74 <li><a href="sortable6_test.html" target="test">sortable5_test</a></li> 75 <li><a href="sortable_tree_test.html" target="test">Sortable trees</a></li> 76 </ul> 77 78 <h2>Sound (experimental)</h2> 85 79 <ul> 86 80 <li><a href="sound_test.html" target="test">sound_test.html</a></li> 87 81 </ul> 88 82 83 <h2>Miscellaneous</h2> 84 <ul> 85 <li><a href="position_clone_test.html" target="test">position_clone_test</a></li> 86 </ul> 87 89 88 </body> 90 89 </html> spinoffs/scriptaculous/test/test.css
r5296 r6387 5 5 body { 6 6 font-size:0.8em; 7 } 8 9 .navigation { 10 background: #9DC569; 11 color: #fff; 12 } 13 14 .navigation h1 { 15 font-size: 20px; 16 } 17 18 .navigation h2 { 19 font-size: 16px; 20 font-weight: normal; 21 margin: 0; 22 border: 1px solid #e8a400; 23 border-bottom: 0; 24 background: #ffc; 25 color: #E8A400; 26 padding: 8px; 27 padding-bottom: 0; 28 } 29 30 .navigation ul { 31 margin-top: 0; 32 border: 1px solid #E8A400; 33 border-top: none; 34 background: #ffc; 35 padding: 8px; 36 margin-left: 0; 37 } 38 39 .navigation ul li { 40 font-size: 12px; 41 list-style-type: none; 42 margin-top: 1px; 43 margin-bottom: 1px; 44 } 45 46 .navigation a { 47 color: #ffc; 48 } 49 50 .navigation ul li a { 51 color: #000; 7 52 } 8 53 spinoffs/scriptaculous/test/unit/ajax_autocompleter_test.html
r4799 r6387 16 16 <h1>script.aculo.us Unit test file</h1> 17 17 <p> 18 Tests for the Ajax.Autocompleter.18 Tests for Ajax.Autocompleter in controls.js. 19 19 </p> 20 20 spinoffs/scriptaculous/test/unit/ajax_inplaceeditor_test.html
r2491 r6387 13 13 <h1>script.aculo.us Unit test file</h1> 14 14 <p> 15 Tests for the Ajax.InPlaceEditor.15 Tests for Ajax.InPlaceEditor in controls.js 16 16 </p> 17 17 spinoffs/scriptaculous/test/unit/builder_test.html
r6135 r6387 11 11 </head> 12 12 <body> 13 <h1>script.aculo.us Builder unit test file</h1>13 <h1>script.aculo.us Unit test file</h1> 14 14 <p> 15 Tests for Builder.15 Tests for builder.js 16 16 </p> 17 17 … … 24 24 <script type="text/javascript" language="javascript" charset="utf-8"> 25 25 // <![CDATA[ 26 27 // Serializes a node and it's contents to plain old HTML 28 // IMPORTANT: style attributes can't be correctly serialized cross-browser wise, 29 // so the contents of style attributes must match what IE thinks is correct 30 function serializeNode(node){ 31 if(node.nodeType == 3) return node.nodeValue; 32 node = $(node); 33 var tag = node.tagName.toLowerCase(); 34 return '<' + ([tag].concat($A(node.attributes).map(function(attr){ 35 // Filter out stuff that we don't need 36 if(attr.nodeName == '_extended' || attr.nodeName == '_counted' || 37 typeof attr.nodeValue == 'function' ||!Element.hasAttribute(node, attr.nodeName)) return; 38 // remove trailing ; in style attributes on Firefox 39 var value = node.readAttribute(attr.nodeName); 40 if(attr.nodeName == 'style' && value.endsWith(';')) 41 value = value.substr(0, value.length-1); 42 return attr.nodeName + '="' + value + '"' 43 }).compact().sort())).join(' ') + '>' + $A(node.childNodes).map(serializeNode).join('') + 44 '</' + tag + '>'; 45 } 26 46 27 47 new Test.Unit.Runner({ … … 81 101 82 102 var element = Builder.node('div', Builder.node('span')); 83 console.log(element);84 103 assertEqual(1, element.childNodes.length); 85 104 assertEqual('SPAN', element.childNodes[0].tagName); … … 173 192 testBuilderComplexExample: function() { with(this) { 174 193 var element = Builder.node('div',{id:'ghosttrain'},[ 175 Builder.node('div',{style:'font- size: 11px; font-weight: bold;'},[194 Builder.node('div',{style:'font-weight: bold; font-size: 11px'},[ 176 195 Builder.node('h1','Ghost Train'), 177 196 "testtext", 2, 3, 4, … … 186 205 187 206 // browsers aren't sure about upper and lower case on elements 188 assertEqual('<div id="ghosttrain"><div style="font-size: 11px; font-weight: bold;"><h1>ghost train</h1>testtext234<ul><li onclick="alert(\'test\')">click me</li></ul></div></div>', $('result').innerHTML.toLowerCase()); 207 assertEqual( 208 '<div id="ghosttrain"><div style="font-weight: bold; font-size: 11px">' + 209 '<h1>Ghost Train</h1>testtext234<ul><li onclick="alert(\'test\')">click me</li></ul></div></div>', 210 serializeNode($('result').childNodes[0])); 189 211 }}, 190 212 … … 199 221 200 222 var element = DIV({id:'ghosttrain'},[ 201 DIV({style:'font- size: 11px; font-weight: bold;'},[223 DIV({style:'font-weight: bold; font-size: 11px'},[ 202 224 H1('Ghost Train'), 203 225 "testtext", 2, 3, 4, … … 210 232 211 233 $('result').appendChild(element); 212 assertEqual('<div id="ghosttrain"><div style="font-size: 11px; font-weight: bold;"><h1>ghost train</h1>testtext234<ul><li onclick="alert(\'test\')">click me</li></ul></div></div>', $('result').innerHTML.toLowerCase()); 234 235 assertEqual( 236 '<div id="ghosttrain"><div style="font-weight: bold; font-size: 11px">' + 237 '<h1>Ghost Train</h1>testtext234<ul><li onclick="alert(\'test\')">click me</li></ul></div></div>', 238 serializeNode($('result').childNodes[0])); 213 239 }}, 214 240 … … 217 243 function(html){ 218 244 var node = Builder.build(html); 219 assertEqual('SPAN', node.tagName.toUpperCase()); 220 assertEqual('this is <b>neat!</b>', 221 node.innerHTML.toLowerCase()); 245 assertEqual('<span>this is <b>neat!</b></span>', serializeNode(node)); 222 246 }); 223 247 }} spinoffs/scriptaculous/test/unit/effects_test.html
r6236 r6387 9 9 <script src="../../src/unittest.js" type="text/javascript"></script> 10 10 <link rel="stylesheet" href="../test.css" type="text/css" /> 11 <style type="text/css" media="screen"> 12 #rotfl { 13 color: red; 14 font-family: serif; 15 font-style: italic; 16 font-size: 40px; 17 background: #fed; 18 padding: 1em; 19 width: 400px; 20 } 21 .final { 22 color: #fff; 23 font-style: italic; 24 font-size: 20px; 25 background: #000; 26 opacity: 0.5; 27 } 28 </style> 11 29 </head> 12 30 <body> 13 31 <h1>script.aculo.us Unit test file</h1> 14 32 <p> 15 Tests the effects33 Tests for effects.js 16 34 </p> 17 35 … … 21 39 <!-- Log output --> 22 40 <div id="testlog"> </div> 41 42 <div class="morphing blub" style="font-size:25px;color:#f00">Well</div> 43 <div class="morphing">You know</div> 44 <div id="blah" style="border:1px solid black;width:100px">Whoo-hoo!</div> 45 46 <div id="error_message">ERROR MESSAGE</div> 47 <div id="error_message_2">SECOND ERROR MESSAGE</div> 48 <div id="error_message_3" style="border:1px solid red; width:100px; color: #f00">THIRD ERROR MESSAGE</div> 49 50 <ul class="error-list" id="error_test_ul"> 51 <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit,</li> 52 <li>sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li> 53 <li>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris</li> 54 <li>nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in</li> 55 <li>reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</li> 56 </ul> 57 58 <div id="rotfl">ROTFL</div> 23 59 24 60 <!-- Tests follow --> … … 33 69 'SlideUp','SlideDown','Pulsate','Squish','Fold','Grow','Shrink']; 34 70 35 var COMBINED_RJS_EFFECTS = $w(''+ 36 'fade appear blind_up blind_down puff switch_off drop_out shake '+ 37 'slide_up slide_down pulsate squish fold grow shrink' 38 ); 71 var COMBINED_RJS_EFFECTS = $w('fade appear blind_up blind_down puff switch_off '+ 72 'drop_out shake slide_up slide_down pulsate squish fold grow shrink'); 39 73 40 74 var tmp, tmp2; … … 132 166 testInspect: function() { with(this) { 133 167 var e1 = new Effect.Opacity('sandbox',{from:1.0,to:0.5,duration:0.5}); 168 info( e1.inspect() ); 134 169 assertEqual(0, e1.inspect().indexOf('#<Effect:')); 135 170 assert(e1.inspect().indexOf('idle')>0); … … 275 310 $('sandbox').appendChild( 276 311 Builder.node('div',{id:'test_element'}, 277 [Builder.node('span','test')])); //some effects require a child element312 Builder.node('span','test'))); //some effects require a child element 278 313 279 314 // should work with new Effect.Blah syntax … … 338 373 e.render(0.5); 339 374 },1000, 'With afterUpdate event'); 375 }}, 376 377 testElementMorph: function() { with(this) { 378 $('error_test_ul').morph('font-size:40px', {duration: 0.5}).setStyle({marginRight:'17px'}); 379 $('error_message_2').morph({ 380 fontSize: '20px', 381 color: '#f00', 382 backgroundColor: '#ffffff' 383 }, 384 { 385 duration:0.5 386 }); 387 $('error_message_3').morph('final', {duration:0.5}); 388 wait(1000,function(){ 389 assertEqual('17px', $('error_test_ul').getStyle('margin-right')); 390 assertEqual('40px', $('error_test_ul').getStyle('font-size')); 391 assertEqual('#ffffff', $('error_message_2').getStyle('background-color').parseColor()); 392 assertEqual('20px', $('error_message_2').getStyle('font-size')); 393 assertEqual('italic', $('error_message_3').getStyle('font-style')); 394 assertEqual('20px', $('error_message_3').getStyle('font-size')); 395 assertEqual(.5, $('error_message_3').getStyle('opacity')); 396 assertEqual('', $('error_message_3').style.fontSize); 397 }); 398 }}, 399 400 testElementMorphChaining: function() { with(this) { 401 $('error_message').morph('font-size:17px').morph('opacity:0',{delay:3}); 402 wait(4100,function(){ // 3000ms delay + 1000ms default duration 403 assertEqual(0, $('error_message').getOpacity()); 404 }); 405 }}, 406 407 testTransformBySelector: function() { with(this) { 408 new Effect.Transform([ 409 { 'ul.error-list li': 'font-size:20px;text-indent:40pt' } 410 ],{ duration: 0.5 }).play(); 411 412 wait(700,function(){ 413 var idx = 0; 414 $A($('error_test_ul').cleanWhitespace().childNodes).each(function(node){ 415 assertEqual('20px', $(node).getStyle('font-size')); 416 assertEqual('40pt', $(node).getStyle('text-indent')); 417 idx++; 418 }); 419 assertEqual(5, idx); 420 }); 421 }}, 422 423 testTransformUsesCSSClassPresets: function() { with(this) { 424 assertEqual('40px', $('rotfl').getStyle('font-size')); 425 426 // Render the effect at half-way through, font-size should be 427 // exactly half-way between original and target 428 new Effect.Transform([ 429 { 'rotfl': 'font-size:20px;text-indent:40pt;background-color:#888' } 430 ],{ sync:true }).play().render(0.5); 431 432 wait(1100,function(){ 433 // shoould be 30px = 40px + (20px-40px)/2 434 assertEqual('30px', $('rotfl').getStyle('font-size')); 435 }); 436 }}, 437 438 testTransformMultiple: function() { with(this) { 439 var transformation = new Effect.Transform([ 440 { 'div.morphing': 'font-size:20px;padding-left:40em;opacity:0.5' }, 441 { 'blah' : 442 'width:480px;border-width:10px;border-right-width:20px;' + 443 'margin:20px;margin-bottom:-20px;font-size:30px;' + 444 'background:#954' } 445 ],{ duration: 0.5 }); 446 447 var generatedEffect = transformation.play(); 448 449 assertEqual(3, generatedEffect.effects.length); 450 451 wait(700, function(){ 452 // have a look at the generated color transforms for the 3rd found element 453 // which is the "blah" div 454 assertEqual('blah', generatedEffect.effects[2].element.id); 455 assertEnumEqual([255,255,255], 456 generatedEffect.effects[2].transforms.detect( function(transform){ 457 return (transform.style == 'backgroundColor') 458 }).originalValue); 459 assertEnumEqual([153,85,68], 460 generatedEffect.effects[2].transforms.detect( function(transform){ 461 return (transform.style == 'backgroundColor') 462 }).targetValue); 463 464 assertEqual('20px', $$('div.morphing').first().getStyle('font-size')); 465 assertEqual('20px', $$('div.morphing').last().getStyle('font-size')); 466 assertEqual('30px', $('blah').getStyle('font-size')); 467 468 // border-width/border-right-width should be set independently 469 assertEqual('10px', $('blah').getStyle('border-top-width')); 470 assertEqual('10px', $('blah').getStyle('border-bottom-width')); 471 assertEqual('10px', $('blah').getStyle('border-left-width')); 472 assertEqual('20px', $('blah').getStyle('border-right-width')); 473 474 // colors should assume transition from 475 // #ffffff (white) if original was transparent 476 // we now should have arrived at the given color 477 assertEqual('#995544', $('blah').getStyle('background-color').parseColor()); 478 479 // play again = should have same values 480 transformation.play(); 481 wait(700, function(){ 482 assertEqual('20px', $$('div.morphing').first().getStyle('font-size')); 483 assertEqual('20px', $$('div.morphing').last().getStyle('font-size')); 484 assertEqual('30px', $('blah').getStyle('font-size')); 485 486 $('blah').setStyle({'font-size':'100px'}); 487 assertEqual('100px', $('blah').getStyle('font-size')); 488 transformation.play(); 489 wait(700, function(){ 490 assertEqual('30px', $('blah').getStyle('font-size')); 491 492 new Effect.Transform([ 493 { 'blah': 'color: #80d980; background: #208020' } 494 ],{ duration: 1.1 }).play(); 495 wait(1500, function(){ 496 assertEqual('#80d980', $('blah').getStyle('color').parseColor()); 497 assertEqual('#208020', $('blah').getStyle('background-color').parseColor()); 498 }); 499 }); 500 }); 501 }); 340 502 }} 341 503 spinoffs/scriptaculous/test/unit/element_test.html
r6284 r6387 18 18 <h1>script.aculo.us Unit test file</h1> 19 19 <p> 20 Test element extensions20 Tests for Element extensions in effects.js 21 21 </p> 22 22 spinoffs/scriptaculous/test/unit/index.html
r5528 r6387 10 10 <link rel="stylesheet" href="../test.css" type="text/css" /> 11 11 </head> 12 <body >12 <body class="navigation"> 13 13 14 <h1>script.aculo.us Unit Tests</h1>14 <h1>script.aculo.us<br/>Unit Tests</h1> 15 15 16 16 <p id="version"></p> … … 24 24 <p><a href="http://wiki.script.aculo.us/scriptaculous/show/UnitTesting" target="test">Documentation</a></p> 25 25 26 <p>27 Please note that some of these unit tests require Firefox <= 1.0.4 (due to a Firefox bug,28 1.0.5 and later won't work [until fixed]).29 </p>30 31 26 <h2>scriptaculous.js</h2> 32 27 <ul> 33 28 <li><a href="loading_test.html" target="test">Dynamic loading test</a></li> 29 </ul> 30 31 <h2>effects.js</h2> 32 <ul> 33 <li><a href="effects_test.html" target="test">Effects test</a></li> 34 <li><a href="string_test.html" target="test">String test</a></li> 35 <li><a href="element_test.html" target="test">Element extensions test</a></li> 36 <li><a href="position_clone_test.html" target="test">Position.clone test</a></li> 37 </ul> 38 39 <h2>dragdrop.js</h2> 40 <ul> 41 <li><a href="dragdrop_test.html" target="test">Drag & Drop test</a></li> 42 <li><a href="sortable_test.html" target="test">Sortable test</a></li> 43 </ul> 44 45 <h2>builder.js</h2> 46 <ul> 47 <li><a href="builder_test.html" target="test">Builder test</a></li> 34 48 </ul> 35 49 … … 45 59 </ul> 46 60 47 <h2>util.js</h2>48 <ul>49 <li><a href="builder_test.html" target="test">Builder test</a></li>50 <li><a href="string_test.html" target="test">String test</a></li>51 <li><a href="element_test.html" target="test">Element extensions test</a></li>52 <li><a href="position_clone_test.html" target="test">Position.clone test</a></li>53 </ul>54 55 <h2>dragdrop.js</h2>56 <ul>57 <li><a href="dragdrop_test.html" target="test">Drag & Drop test</a></li>58 <li><a href="sortable_test.html" target="test">Sortable test</a></li>59 </ul>60 61 <h2>effects.js</h2>62 <ul>63 <li><a href="effects_test.html" target="test">Effects test</a></li>64 <li><a href="transform_test.html" target="test">Transform test</a></li>65 </ul>66 61 67 62 <h2>unittest.js</h2> spinoffs/scriptaculous/test/unit/loading_test.html
r3312 r6387 13 13 <h1>script.aculo.us Unit test file</h1> 14 14 <p> 15 Test dynamic loading 15 Test dynamic loading in scriptaculous.js 16 16 </p> 17 17 spinoffs/scriptaculous/test/unit/position_clone_test.html
r2069 r6387 13 13 <h1>script.aculo.us Unit test file</h1> 14 14 <p> 15 Tests for String.prototype extensions15 Tests for Postion.clone (to be moved to Prototype) 16 16 </p> 17 17 spinoffs/scriptaculous/test/unit/slider_test.html
r6191 r6387 13 13 <h1>script.aculo.us Unit test file</h1> 14 14 <p> 15 Test ofslider.js15 Tests for slider.js 16 16 </p> 17 17 spinoffs/scriptaculous/test/unit/string_test.html
r5742 r6387 13 13 <h1>script.aculo.us Unit test file</h1> 14 14 <p> 15 Tests for String.prototype extensions 15 Tests for String.prototype extensions in effects.js 16 16 </p> 17 17