diff options
author | jzaefferer <joern.zaefferer@gmail.com> | 2010-04-21 20:06:56 +0200 |
---|---|---|
committer | jzaefferer <joern.zaefferer@gmail.com> | 2010-04-21 20:06:56 +0200 |
commit | cfa185d962a153aa50c1ec991f37a24d222abce2 (patch) | |
tree | 5f747e161a57dbbd2776a4eae68df7d305ecbf03 | |
parent | 19b76a14a85c000996e22a6377ff86dc931bbc1e (diff) | |
parent | 469d0c52e93fe9e421877eec90489cc06d63e5e5 (diff) | |
download | jquery-ui-cfa185d962a153aa50c1ec991f37a24d222abce2.tar.gz jquery-ui-cfa185d962a153aa50c1ec991f37a24d222abce2.zip |
Merge commit '1.8.1' into tooltip
33 files changed, 646 insertions, 119 deletions
diff --git a/demos/autocomplete/custom-data.html b/demos/autocomplete/custom-data.html index 57598fa8c..139b41d99 100644 --- a/demos/autocomplete/custom-data.html +++ b/demos/autocomplete/custom-data.html @@ -64,7 +64,13 @@ return false; } - }); + }) + .data( "autocomplete" )._renderItem = function( ul, item ) { + return $( "<li></li>" ) + .data( "item.autocomplete", item ) + .append( "<a>" + item.label + "<br>" + item.desc + "</a>" ) + .appendTo( ul ); + }; }); </script> </head> diff --git a/demos/autocomplete/folding.html b/demos/autocomplete/folding.html new file mode 100644 index 000000000..d5bc71e9d --- /dev/null +++ b/demos/autocomplete/folding.html @@ -0,0 +1,64 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8" /> + <title>jQuery UI Autocomplete Accent Folding Demo</title> + <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" /> + <script type="text/javascript" src="../../jquery-1.4.2.js"></script> + <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script> + <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script> + <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script> + <script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script> + <link type="text/css" href="../demos.css" rel="stylesheet" /> + <script type="text/javascript"> + $(function() { + var names = [ "Jörn Zaefferer", "Scott González", "John Resig" ]; + + var accentMap = { + 'á':'a', + 'ö':'o' + }; + var normalize = function( term ) { + var ret = ''; + for ( var i = 0; i < term.length; i++ ) { + ret += accentMap[ term.charAt(i) ] || term.charAt(i); + } + return ret; + }; + + $( "#developer" ).autocomplete({ + source: function( request, response ) { + var matcher = new RegExp( $.ui.autocomplete.escapeRegex( request.term ), "i" ); + response( $.grep( names, function( value ) { + value = value.label || value.value || value; + return matcher.test( value ) || matcher.test( normalize( value ) ); + }) ); + } + }); + }); + </script> +</head> +<body> + +<div class="demo"> + +<div class="ui-widget"> + <form> + <label for="developer">Developer: </label> + <input id="developer" /> + </form> +</div> + +</div><!-- End demo --> + +<div class="demo-description"> +<p> +The autocomplete field uses a custom source option which will match results that have accented characters even when the text field doesn't contain accented characters. However if the you type in accented characters in the text field it is smart enough not to show results that aren't accented. +</p> +<p> +Try typing "Jo" to see "John" and "Jörn", then type "Jö" to see only "Jörn". +</p> +</div><!-- End demo-description --> + +</body> +</html> diff --git a/demos/autocomplete/index.html b/demos/autocomplete/index.html index 42f13dc4b..ba96d994e 100644 --- a/demos/autocomplete/index.html +++ b/demos/autocomplete/index.html @@ -17,6 +17,8 @@ <li><a href="custom-data.html">Custom data and display</a></li> <li><a href="xml.html">XML data parsed once</a></li> <li><a href="categories.html">Categories</a></li> + <li><a href="multiple.html">Multiple values</a></li> + <li><a href="multiple-remote.html">Multiple, remote</a></li> </ul> </div> </body> diff --git a/demos/autocomplete/multiple-remote.html b/demos/autocomplete/multiple-remote.html new file mode 100644 index 000000000..5e0f4b50b --- /dev/null +++ b/demos/autocomplete/multiple-remote.html @@ -0,0 +1,75 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8" /> + <title>jQuery UI Autocomplete multiple demo</title> + <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" /> + <script type="text/javascript" src="../../jquery-1.4.2.js"></script> + <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script> + <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script> + <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script> + <script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script> + <link type="text/css" href="../demos.css" rel="stylesheet" /> + <script type="text/javascript"> + $(function() { + function split(val) { + return val.split(/,\s*/); + } + function extractLast(term) { + return split(term).pop(); + } + + $("#birds").autocomplete({ + source: function(request, response) { + $.getJSON("search.php", { + term: extractLast(request.term) + }, response); + }, + search: function() { + // custom minLength + var term = extractLast(this.value); + if (term.length < 2) { + return false; + } + }, + focus: function() { + // prevent value inserted on focus + return false; + }, + select: function(event, ui) { + var terms = split( this.value ); + // remove the current input + terms.pop(); + // add the selected item + terms.push( ui.item.value ); + // add placeholder to get the comma-and-space at the end + terms.push(""); + this.value = terms.join(", "); + return false; + } + }); + }); + </script> +</head> +<body> + +<div class="demo"> + +<div class="ui-widget"> + <label for="birds">Birds: </label> + <input id="birds" size="50" /> +</div> + +</div><!-- End demo --> + +<div class="demo-description"> +<p> +Usage: Enter at least two characters to get bird name suggestions. Select a value to continue adding more names. +</p> +<p> +This is an example showing how to use the source-option along with some events to enable autocompleting multiple values into a single field. +</p> +</div><!-- End demo-description --> + +</body> +</html> diff --git a/demos/autocomplete/multiple.html b/demos/autocomplete/multiple.html new file mode 100644 index 000000000..908cfe6ce --- /dev/null +++ b/demos/autocomplete/multiple.html @@ -0,0 +1,69 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8" /> + <title>jQuery UI Autocomplete multiple demo</title> + <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" /> + <script type="text/javascript" src="../../jquery-1.4.2.js"></script> + <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script> + <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script> + <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script> + <script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script> + <link type="text/css" href="../demos.css" rel="stylesheet" /> + <script type="text/javascript"> + $(function() { + var availableTags = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl"]; + function split(val) { + return val.split(/,\s*/); + } + function extractLast(term) { + return split(term).pop(); + } + + $("#tags").autocomplete({ + minLength: 0, + source: function(request, response) { + // delegate back to autocomplete, but extract the last term + response($.ui.autocomplete.filter(availableTags, extractLast(request.term))); + }, + focus: function() { + // prevent value inserted on focus + return false; + }, + select: function(event, ui) { + var terms = split( this.value ); + // remove the current input + terms.pop(); + // add the selected item + terms.push( ui.item.value ); + // add placeholder to get the comma-and-space at the end + terms.push(""); + this.value = terms.join(", "); + return false; + } + }); + }); + </script> +</head> +<body> + +<div class="demo"> + +<div class="ui-widget"> + <label for="tags">Tag programming languages: </label> + <input id="tags" size="50" /> +</div> + +</div><!-- End demo --> + +<div class="demo-description"> +<p> +Usage: Type something, eg. "j" to see suggestions for tagging with programming languages. Select a value, then continue typing to add more. +</p> +<p> +This is an example showing how to use the source-option along with some events to enable autocompleting multiple values into a single field. +</p> +</div><!-- End demo-description --> + +</body> +</html> diff --git a/demos/autocomplete/remote-with-cache.html b/demos/autocomplete/remote-with-cache.html index 3688365d4..a00c741e4 100644 --- a/demos/autocomplete/remote-with-cache.html +++ b/demos/autocomplete/remote-with-cache.html @@ -22,12 +22,11 @@ source: function(request, response) { if (cache.term == request.term && cache.content) { response(cache.content); + return; } if (new RegExp(cache.term).test(request.term) && cache.content && cache.content.length < 13) { - var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i"); - response($.grep(cache.content, function(value) { - return matcher.test(value.value) - })); + response($.ui.autocomplete.filter(cache.content, request.term)); + return; } $.ajax({ url: "search.php", diff --git a/demos/draggable/visual-feedback.html b/demos/draggable/visual-feedback.html index bb54de4fe..4644472f0 100644 --- a/demos/draggable/visual-feedback.html +++ b/demos/draggable/visual-feedback.html @@ -27,7 +27,7 @@ return $('<div class="ui-widget-header">I\'m a custom helper</div>'); } }); - $("#set div").draggable({ stack: { group: '#set div', min: 1 } }); + $("#set div").draggable({ stack: '#set div' }); }); </script> </head> diff --git a/demos/effect/index.html b/demos/effect/index.html index b914c96c5..cecceb6cd 100644 --- a/demos/effect/index.html +++ b/demos/effect/index.html @@ -11,7 +11,7 @@ <h4>Examples</h4> <ul> <li class="demo-config-on"><a href="default.html">Effect showcase</a></li> - <li class="demo-config-on"><a href="easing.html">Easing showcase</a></li> + <li><a href="easing.html">Easing showcase</a></li> <!-- WIP <li class="demo-config-on"><a href="scale.html">Scale effect</a></li> <li class="demo-config-on"><a href="size.html">Size effect</a></li> diff --git a/tests/static/menu/all-menus-icons.html b/tests/static/menu/all-menus-icons.html new file mode 100644 index 000000000..b23ab0072 --- /dev/null +++ b/tests/static/menu/all-menus-icons.html @@ -0,0 +1,172 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8" /> + <title>Menu Static Test : Default</title> + <link rel="stylesheet" href="../static.css" type="text/css" /> + <link rel="stylesheet" href="../../../themes/base/jquery.ui.base.css" type="text/css" /> + <link rel="stylesheet" href="../../../themes/base/jquery.ui.theme.css" type="text/css" title="ui-theme" /> + <script type="text/javascript" src="../../../jquery-1.4.2.js"></script> + <script type="text/javascript" src="../static.js"></script> + + <script src="http://jqueryui.com/themeroller/themeswitchertool/" type="text/javascript"></script> + <script> + $(document).ready(function(){ + $('#switcher').themeswitcher(); + }); + </script> + + + + <style type="text/css"> +/* styles for this page only */ +.ui-menu { width: 200px; } +#flyout .ui-menu { position: relative; } +#flyout .ui-menu.ui-menu-icons { position: absolute; } + +.ui-menu.ui-menu-icons { position: relative; } +.ui-menu.ui-menu-icons .ui-menu-item a { position: relative; padding-left: 2em; } + +/* left-aligned icon */ +.ui-menu .ui-icon { position: absolute; top: .2em; left: .2em; } + +/* right-aligned icon */ +.ui-menu .ui-icon.ui-menu-icon { position: static; float: right; } + </style> + +</head> +<body> + +<div id="switcher" style="position: absolute; top: 20px; right: 20px;"></div> + + +<!-- NOTES: + +* Added "ui-menu-icons" class to set a left indent value for all menu items in a single menu + +--> + + +<h2>Default</h2> + +<ul role="menu" aria-activedescendant="ui-active-menuitem" class="ui-menu ui-menu-icons ui-widget ui-widget-content ui-corner-bottom"> + <li class="ui-menu-item" role="menuitem"><a href="#" tabindex="-1" class="ui-corner-all"><span class="ui-icon ui-icon-print"></span>Aberdeen</a></li> + <li class="ui-menu-item" role="menuitem" id="ui-active-menuitem"><a href="#" tabindex="-1" class="ui-state-hover ui-corner-all">Ada</a></li> + <li class="ui-menu-item" role="menuitem"><a href="#" tabindex="-1" class="ui-corner-all">Adamsville</a></li> + <li class="ui-menu-item" role="menuitem"><a href="#" tabindex="-1" class="ui-corner-all"><span class="ui-icon ui-icon-scissors"></span>Addyston really long menu option to show wrap</a></li> + <li class="ui-menu-item" role="menuitem"><a href="#" tabindex="-1" class="ui-corner-all"><span class="ui-icon ui-icon-wrench"></span>Adelphi</a></li> + <li class="ui-menu-item" role="menuitem"><a href="#" tabindex="-1" class="ui-corner-all"><span class="ui-icon ui-icon-star"></span>Adena</a></li> + <li class="ui-menu-item" role="menuitem"><a href="#" tabindex="-1" class="ui-corner-all">Adrian</a></li> + <li class="ui-menu-item" role="menuitem"><a href="#" tabindex="-1" class="ui-corner-all">Akron</a></li> + <li class="ui-menu-item" role="menuitem"><a href="#" tabindex="-1" class="ui-corner-all">Albany</a></li> +</ul> + +<br /><br /> + +<div id="drilldown"> + +<h2>Drilldown</h2> + +<ul role="listbox" aria-activedescendant="ui-active-menuitem" class="ui-menu ui-menu-icons ui-widget ui-widget-content ui-corner-all"> + <li role="menuitem" class="ui-menu-item"> + <a href="#" tabindex="-1" class="ui-state-hover ui-corner-all"><span class="ui-icon ui-icon-print"></span><span class="ui-icon ui-menu-icon ui-icon-carat-1-e"></span>Amsterdam</a> + <ul aria-activedescendant="ui-active-menuitem" role="listbox" class="ui-menu ui-widget ui-widget-content ui-corner-all" style="display: none;"> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Aberdeen</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Ada</a></li> + <li role="menuitem" class="ui-menu-item"> + <a tabindex="-1" class="ui-corner-all" href="#"><span class="ui-icon ui-menu-icon ui-icon-carat-1-e"></span>Adamsville</a> + <ul aria-activedescendant="ui-active-menuitem" role="listbox" class="ui-menu ui-widget ui-widget-content ui-corner-all" style="display: none;"> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Anaheim</a></li> + <li role="menuitem" class="ui-menu-item"> + <a tabindex="-1" class="ui-corner-all" href="#"><span class="ui-icon ui-menu-icon ui-icon-carat-1-e"></span>Cologne</a> + <ul aria-activedescendant="ui-active-menuitem" role="listbox" class="ui-menu ui-widget ui-widget-content ui-corner-all" style="display: none;"> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mberdeen</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mda</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mdamsville</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mddyston</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mmesville</a></li> + </ul> + </li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Frankfurt</a></li> + </ul> + </li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Addyston</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Amesville</a></li> + </ul> + </li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#"><span class="ui-icon ui-icon-star"></span>Anaheim</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#"><span class="ui-icon ui-icon-heart"></span>Cologne</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#"><span class="ui-icon ui-icon-key"></span>Frankfurt</a></li> + <li role="menuitem" class="ui-menu-item"> + <a tabindex="-1" class="ui-corner-all" href="#"><span class="ui-icon ui-menu-icon ui-icon-carat-1-e"></span>Magdeburg</a> + <ul aria-activedescendant="ui-active-menuitem" role="listbox" class="ui-menu ui-widget ui-widget-content ui-corner-all" style="display: none;"> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mberdeen</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mda</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mdamsville</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mddyston</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mmesville</a></li> + </ul> + </li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Munich</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Utrecht</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Zurich</a></li> +</ul> + +</div> + +<br /><br /> + +<div id="flyout"> + +<h2>Flyout / nested</h2> + +<ul aria-activedescendant="ui-active-menuitem" role="listbox" class="ui-menu ui-menu-icons ui-widget ui-widget-content ui-corner-all" id="menu"> + <li role="menuitem" class="ui-menu-item"> + <a tabindex="-1" class="ui-corner-all" href="#"><span class="ui-icon ui-icon-scissors"></span>Amsterdam</a> + <ul style="display: block; top: 88.5px; left: 205px;" aria-activedescendant="ui-active-menuitem" role="listbox" class="ui-menu ui-menu-icons ui-widget ui-widget-content ui-corner-all"> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Aberdeen</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Ada</a></li> + <li role="menuitem" class="ui-menu-item"> + <a tabindex="-1" class="ui-state-active ui-corner-all" href="#"><span class="ui-icon ui-icon-print"></span><span class="ui-icon ui-menu-icon ui-icon-carat-1-e"></span>Adamsville</a> + <ul style="display: block; top: 73px; left: -11px; z-index: 9999;" aria-activedescendant="ui-active-menuitem" role="listbox" class="ui-menu ui-menu-icons ui-widget ui-widget-content ui-corner-all"> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Anaheim</a></li> + <li role="menuitem" class="ui-menu-item"> + <a tabindex="-1" class="ui-corner-all" href="#">Cologne</a> + <ul style="display: none;" aria-activedescendant="ui-active-menuitem" role="listbox" class="ui-menu ui-menu-icons ui-widget ui-widget-content ui-corner-all"> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mberdeen</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mda</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mdamsville</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mddyston</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mmesville</a></li> + </ul> + </li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-state-hover ui-corner-all" href="#">Frankfurt</a></li> + </ul> + </li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Addyston</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Amesville</a></li> + </ul> + </li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Anaheim</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#"><span class="ui-icon ui-icon-pencil"></span>Cologne</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#"><span class="ui-icon ui-icon-clock"></span>Frankfurt</a></li> + <li role="menuitem" class="ui-menu-item"> + <a tabindex="-1" class="ui-state-active ui-corner-all" href="#"><span class="ui-icon ui-icon-print"></span><span class="ui-icon ui-menu-icon ui-icon-carat-1-e"></span>Magdeburg</a> + <ul style="display: none;" aria-activedescendant="ui-active-menuitem" role="listbox" class="ui-menu ui-menu-icons ui-widget ui-widget-content ui-corner-all"> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mberdeen</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mda</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mdamsville</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mddyston</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Mmesville</a></li> + </ul> + </li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#"><span class="ui-icon ui-icon-lightbulb"></span>Munich</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#"><span class="ui-icon ui-icon-clipboard"></span>Utrecht</a></li> + <li role="menuitem" class="ui-menu-item"><a tabindex="-1" class="ui-corner-all" href="#">Zurich</a></li> +</ul> + +</div> + + +</body> +</html> diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html index 3badebda9..c53db8c75 100644 --- a/tests/unit/accordion/accordion.html +++ b/tests/unit/accordion/accordion.html @@ -29,6 +29,15 @@ }); same(args, result) } + function equalHeights(accordion, min, max) { + var sizes = []; + accordion.find(".ui-accordion-content").each(function() { + sizes.push($(this).outerHeight()); + }); + ok( sizes[0] >= min && sizes[0] <= max, "must be within " + min + " and " + max + ", was " + sizes[0] ); + same(sizes[0], sizes[1]); + same(sizes[0], sizes[2]); + } </script> <script type="text/javascript" src="accordion_core.js"></script> <script type="text/javascript" src="accordion_defaults.js"></script> @@ -55,7 +64,7 @@ <div> <div id="list1" class="foo"> <a class="bar">There is one obvious advantage:</a> - <div style="font-style: normal; " class="foo"> + <div class="foo"> <p> You've seen it coming! <br/> @@ -65,7 +74,7 @@ </p> </div> <a class="bar">Now that you've got...</a> - <div style="font-style: normal; " class="foo"> + <div class="foo"> <p> your bear, you have to admit it! <br/> @@ -76,7 +85,7 @@ </p> </div> <a class="bar">Rent one bear, ...</a> - <div style="font-style: normal; " class="foo"> + <div class="foo"> <p> get two for three beer. </p> diff --git a/tests/unit/accordion/accordion_methods.js b/tests/unit/accordion/accordion_methods.js index 894d1f30c..73faff27c 100644 --- a/tests/unit/accordion/accordion_methods.js +++ b/tests/unit/accordion/accordion_methods.js @@ -31,8 +31,12 @@ test("init", function() { }); test("destroy", function() { - var beforeHtml = $("#list1").parent().html(); + var beforeHtml = $("#list1").find("div").css("font-style", "normal").end().parent().html(); var afterHtml = $("#list1").accordion().accordion("destroy").parent().html(); + // Opera 9 outputs role="" instead of removing the attribute like everyone else + if ($.browser.opera) { + afterHtml = afterHtml.replace(/ role=""/g, ""); + } equal( afterHtml, beforeHtml ); }); @@ -114,31 +118,14 @@ test("activate, jQuery or DOM element", function() { }); test("resize", function() { - var expected = $('#list1').parent().height(300).end().accordion({ + var expected = $('#navigation').parent().height(300).end().accordion({ fillSpace: true }); - - var sizes = []; - expected.find(".ui-accordion-content").each(function() { - sizes.push($(this).outerHeight()); - }); - - var actual = expected.accordion('resize'); - equals(actual, expected, 'resize is chainable'); - - var sizes2 = []; - expected.find(".ui-accordion-content").each(function() { - sizes2.push($(this).outerHeight()); - }); - same(sizes, [246, 246, 246]); + equalHeights(expected, 246, 258); expected.parent().height(500); expected.accordion("resize"); - var sizes2 = []; - expected.find(".ui-accordion-content").each(function() { - sizes2.push($(this).outerHeight()); - }); - same(sizes2, [446, 446, 446]); + equalHeights(expected, 446, 458); }); })(jQuery); diff --git a/tests/unit/accordion/accordion_options.js b/tests/unit/accordion/accordion_options.js index e46795993..499fec383 100644 --- a/tests/unit/accordion/accordion_options.js +++ b/tests/unit/accordion/accordion_options.js @@ -66,17 +66,18 @@ test("{ active: Number }", function() { }); test("{ autoHeight: true }, default", function() { - $('#navigation').accordion({ autoHeight: true }); - equals( $('#navigation > li:eq(0) > ul').height(), 126 ); - equals( $('#navigation > li:eq(1) > ul').height(), 126 ); - equals( $('#navigation > li:eq(2) > ul').height(), 126 ); + equalHeights($('#navigation').accordion({ autoHeight: true }), 95, 130); }); test("{ autoHeight: false }", function() { - $('#navigation').accordion({ autoHeight: false }); - equals( $('#navigation > li:eq(0) > ul').height(), 90 ); - equals( $('#navigation > li:eq(1) > ul').height(), 126 ); - equals( $('#navigation > li:eq(2) > ul').height(), 54 ); + var accordion = $('#navigation').accordion({ autoHeight: false }); + var sizes = []; + accordion.find(".ui-accordion-content").each(function() { + sizes.push($(this).height()); + }); + ok( sizes[0] >= 70 && sizes[0] <= 90, "was " + sizes[0] ); + ok( sizes[1] >= 98 && sizes[1] <= 126, "was " + sizes[1] ); + ok( sizes[2] >= 42 && sizes[2] <= 54, "was " + sizes[2] ); }); test("{ collapsible: false }, default", function() { @@ -95,20 +96,10 @@ test("{ collapsible: true }", function() { state(ac, 0, 0, 0); }); -test("{ fillSpace: false }, default", function() { - $("#navigationWrapper").height(500); - $('#navigation').accordion({ fillSpace: false }); - equals( $('#navigation > li:eq(0) > ul').height(), 126 ); - equals( $('#navigation > li:eq(1) > ul').height(), 126 ); - equals( $('#navigation > li:eq(2) > ul').height(), 126 ); -}); - +// fillSpace: false == autoHeight: true, covered above test("{ fillSpace: true }", function() { $("#navigationWrapper").height(500); - $('#navigation').accordion({ fillSpace: true }); - equals( $('#navigation > li:eq(0) > ul').height(), 446 ); - equals( $('#navigation > li:eq(1) > ul').height(), 446 ); - equals( $('#navigation > li:eq(2) > ul').height(), 446 ); + equalHeights($('#navigation').accordion({ fillSpace: true }), 446, 458); }); test("{ header: '> li > :first-child,> :not(li):even' }, default", function() { diff --git a/tests/unit/autocomplete/autocomplete_events.js b/tests/unit/autocomplete/autocomplete_events.js index 28a72145e..a8924e192 100644 --- a/tests/unit/autocomplete/autocomplete_events.js +++ b/tests/unit/autocomplete/autocomplete_events.js @@ -47,7 +47,7 @@ test("all events", function() { same( $(".ui-menu:visible").length, 1 ); ac.simulate("keydown", { keyCode: $.ui.keyCode.DOWN }); ac.simulate("keydown", { keyCode: $.ui.keyCode.ENTER }); - ac.blur(); + $.browser.msie ? ac.simulate("blur") : ac.blur(); }, 50); }); @@ -63,7 +63,8 @@ test("change without selection", function() { start(); } }); - ac.focus().val("ja").blur(); + ac.triggerHandler("focus"); + ac.val("ja").triggerHandler("blur"); }); test("cancel search", function() { diff --git a/tests/unit/autocomplete/autocomplete_methods.js b/tests/unit/autocomplete/autocomplete_methods.js index 76a600fe6..05a7d6e14 100644 --- a/tests/unit/autocomplete/autocomplete_methods.js +++ b/tests/unit/autocomplete/autocomplete_methods.js @@ -13,6 +13,10 @@ module("autocomplete: methods", { test("destroy", function() { var beforeHtml = $("#autocomplete").parent().html(); var afterHtml = $("#autocomplete").autocomplete().autocomplete("destroy").parent().html(); + // Opera 9 outputs role="" instead of removing the attribute like everyone else + if ($.browser.opera) { + afterHtml = afterHtml.replace(/ role=""/g, ""); + } equal( afterHtml, beforeHtml, "before/after html should be the same" ); }) diff --git a/tests/unit/button/button_methods.js b/tests/unit/button/button_methods.js index 43c02d8cc..a83a73ba4 100644 --- a/tests/unit/button/button_methods.js +++ b/tests/unit/button/button_methods.js @@ -9,6 +9,10 @@ module("button: methods"); test("destroy", function() { var beforeHtml = $("#button").parent().html(); var afterHtml = $("#button").button().button("destroy").parent().html(); + // Opera 9 outputs role="" instead of removing the attribute like everyone else + if ($.browser.opera) { + afterHtml = afterHtml.replace(/ role=""/g, ""); + } equal( afterHtml, beforeHtml ); }); diff --git a/tests/unit/core/core.html b/tests/unit/core/core.html index 843344ca7..468c962e5 100644 --- a/tests/unit/core/core.html +++ b/tests/unit/core/core.html @@ -11,11 +11,22 @@ <link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/> <script type="text/javascript" src="../../../external/qunit.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> - <script type="text/javascript" src="../testsuite.js"></script> <script type="text/javascript" src="core.js"></script> <script type="text/javascript" src="selector.js"></script> + <script type="text/javascript"> + // disable this stale testsuite for testswarm only + var url = window.location.search; + url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) ); + if ( url && url.indexOf("http") == 0 ) { + // reset config to kill previous tests; make sure testsuite.js is loaded afterwards to init the testswarm script + QUnit.init(); + test("core", function() { ok(true, "disabled core testsuite"); }); + } + </script> + <script type="text/javascript" src="../testsuite.js"></script> + <style type="text/css"> .zindex {z-index: 100} .absolute {position: absolute} diff --git a/tests/unit/datepicker/datepicker.html b/tests/unit/datepicker/datepicker.html index e64bc74c0..9354e7b99 100644 --- a/tests/unit/datepicker/datepicker.html +++ b/tests/unit/datepicker/datepicker.html @@ -16,7 +16,6 @@ <link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/> <script type="text/javascript" src="../../../external/qunit.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> - <script type="text/javascript" src="../testsuite.js"></script> <script type="text/javascript" src="datepicker_core.js"></script> <script type="text/javascript" src="datepicker_defaults.js"></script> @@ -24,6 +23,18 @@ <script type="text/javascript" src="datepicker_methods.js"></script> <script type="text/javascript" src="datepicker_options.js"></script> <script type="text/javascript" src="datepicker_tickets.js"></script> + + <script type="text/javascript"> + // disable this stale testsuite for testswarm only + var url = window.location.search; + url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) ); + if ( url && url.indexOf("http") == 0 ) { + // reset config to kill previous tests; make sure testsuite.js is loaded afterwards to init the testswarm script + QUnit.init(); + test("datepicker", function() { ok(true, "disabled datepicker testsuite"); }); + } + </script> + <script type="text/javascript" src="../testsuite.js"></script> </head> <body> diff --git a/tests/unit/dialog/dialog.html b/tests/unit/dialog/dialog.html index 03ce280e3..97a5d44cd 100644 --- a/tests/unit/dialog/dialog.html +++ b/tests/unit/dialog/dialog.html @@ -19,7 +19,6 @@ <link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/> <script type="text/javascript" src="../../../external/qunit.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> - <script type="text/javascript" src="../testsuite.js"></script> <script type="text/javascript" src="dialog_core.js"></script> <script type="text/javascript" src="dialog_defaults.js"></script> @@ -27,6 +26,18 @@ <script type="text/javascript" src="dialog_methods.js"></script> <script type="text/javascript" src="dialog_options.js"></script> <script type="text/javascript" src="dialog_tickets.js"></script> + + <script type="text/javascript"> + // disable this stale testsuite for testswarm only + var url = window.location.search; + url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) ); + if ( url && url.indexOf("http") == 0 ) { + // reset config to kill previous tests; make sure testsuite.js is loaded afterwards to init the testswarm script + QUnit.init(); + test("dialog", function() { ok(true, "disabled dialog testsuite"); }); + } + </script> + <script type="text/javascript" src="../testsuite.js"></script> </head> <body> diff --git a/tests/unit/draggable/draggable.html b/tests/unit/draggable/draggable.html index 050d37704..2be472a50 100644 --- a/tests/unit/draggable/draggable.html +++ b/tests/unit/draggable/draggable.html @@ -13,17 +13,25 @@ <link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/> <script type="text/javascript" src="../../../external/qunit.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> - <script type="text/javascript" src="../testsuite.js"></script> - <!-- <script type="text/javascript" src="draggable_core.js"></script> <script type="text/javascript" src="draggable_defaults.js"></script> <script type="text/javascript" src="draggable_events.js"></script> <script type="text/javascript" src="draggable_methods.js"></script> <script type="text/javascript" src="draggable_options.js"></script> <script type="text/javascript" src="draggable_tickets.js"></script> - --> - <script type="text/javascript">test("draggable", function() { ok(true, "disabled draggable testsuite"); });</script> + + <script type="text/javascript"> + // disable this stale testsuite for testswarm only + var url = window.location.search; + url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) ); + if ( url && url.indexOf("http") == 0 ) { + // reset config to kill previous tests; make sure testsuite.js is loaded afterwards to init the testswarm script + QUnit.init(); + test("draggable", function() { ok(true, "disabled draggable testsuite"); }); + } + </script> + <script type="text/javascript" src="../testsuite.js"></script> </head> <body> diff --git a/tests/unit/droppable/droppable.html b/tests/unit/droppable/droppable.html index bc9a9d416..c15992bcd 100644 --- a/tests/unit/droppable/droppable.html +++ b/tests/unit/droppable/droppable.html @@ -14,17 +14,25 @@ <link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/> <script type="text/javascript" src="../../../external/qunit.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> - <script type="text/javascript" src="../testsuite.js"></script> - <!-- <script type="text/javascript" src="droppable_core.js"></script> <script type="text/javascript" src="droppable_defaults.js"></script> <script type="text/javascript" src="droppable_events.js"></script> <script type="text/javascript" src="droppable_methods.js"></script> <script type="text/javascript" src="droppable_options.js"></script> <script type="text/javascript" src="droppable_tickets.js"></script> - --> - <script type="text/javascript">test("droppable", function() { ok(true, "disabled droppable testsuite"); });</script> + + <script type="text/javascript"> + // disable this stale testsuite for testswarm only + var url = window.location.search; + url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) ); + if ( url && url.indexOf("http") == 0 ) { + // reset config to kill previous tests; make sure testsuite.js is loaded afterwards to init the testswarm script + QUnit.init(); + test("droppable", function() { ok(true, "disabled droppable testsuite"); }); + } + </script> + <script type="text/javascript" src="../testsuite.js"></script> </head> <body> diff --git a/tests/unit/position/position_core.js b/tests/unit/position/position_core.js index 57e02da0a..3976e43ab 100644 --- a/tests/unit/position/position_core.js +++ b/tests/unit/position/position_core.js @@ -2,6 +2,8 @@ * position_core.js */ (function($) { + +module("position"); test('my, at, of', function() { $('#elx').position({ diff --git a/tests/unit/progressbar/progressbar_core.js b/tests/unit/progressbar/progressbar_core.js index 2d95ae2f6..e59579634 100644 --- a/tests/unit/progressbar/progressbar_core.js +++ b/tests/unit/progressbar/progressbar_core.js @@ -21,8 +21,8 @@ test("accessibility", function() { el.progressbar("disable"); equals(el.attr("aria-disabled"), "true", "aria-disabled on"); el.progressbar("enable"); - // FAIL: for some reason IE6 returns a boolean false instead of the string - equals(el.attr("aria-disabled"), "false", "aria-disabled off"); + // FAIL: for some reason IE6 and 7 return a boolean false instead of the string + equals(el.attr("aria-disabled"), $.browser.msie && $.browser.version == 6 || $.browser.version == 7 ? false : "false", "aria-disabled off"); }); })(jQuery); diff --git a/tests/unit/resizable/resizable.html b/tests/unit/resizable/resizable.html index 08c4c8798..0f4f91aae 100644 --- a/tests/unit/resizable/resizable.html +++ b/tests/unit/resizable/resizable.html @@ -15,17 +15,25 @@ <link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/> <script type="text/javascript" src="../../../external/qunit.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> - <script type="text/javascript" src="../testsuite.js"></script> - <!-- <script type="text/javascript" src="resizable_core.js"></script> <script type="text/javascript" src="resizable_defaults.js"></script> <script type="text/javascript" src="resizable_events.js"></script> <script type="text/javascript" src="resizable_methods.js"></script> <script type="text/javascript" src="resizable_options.js"></script> <script type="text/javascript" src="resizable_tickets.js"></script> - --> - <script type="text/javascript">test("resizable", function() { ok(true, "disabled resizable testsuite"); });</script> + + <script type="text/javascript"> + // disable this stale testsuite for testswarm only + var url = window.location.search; + url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) ); + if ( url && url.indexOf("http") == 0 ) { + // reset config to kill previous tests; make sure testsuite.js is loaded afterwards to init the testswarm script + QUnit.init(); + test("resizable", function() { ok(true, "disabled resizable testsuite"); }); + } + </script> + <script type="text/javascript" src="../testsuite.js"></script> </head> <body> diff --git a/tests/unit/selectable/selectable.html b/tests/unit/selectable/selectable.html index e71d20e22..278d4dde3 100644 --- a/tests/unit/selectable/selectable.html +++ b/tests/unit/selectable/selectable.html @@ -13,17 +13,25 @@ <link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/> <script type="text/javascript" src="../../../external/qunit.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> - <script type="text/javascript" src="../testsuite.js"></script> - <!-- <script type="text/javascript" src="selectable_core.js"></script> <script type="text/javascript" src="selectable_defaults.js"></script> <script type="text/javascript" src="selectable_events.js"></script> <script type="text/javascript" src="selectable_methods.js"></script> <script type="text/javascript" src="selectable_options.js"></script> <script type="text/javascript" src="selectable_tickets.js"></script> - --> - <script type="text/javascript">test("selectable", function() { ok(true, "disabled selectable testsuite"); });</script> + + <script type="text/javascript"> + // disable this stale testsuite for testswarm only + var url = window.location.search; + url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) ); + if ( url && url.indexOf("http") == 0 ) { + // reset config to kill previous tests; make sure testsuite.js is loaded afterwards to init the testswarm script + QUnit.init(); + test("selectable", function() { ok(true, "disabled selectable testsuite"); }); + } + </script> + <script type="text/javascript" src="../testsuite.js"></script> </head> <body> diff --git a/tests/unit/sortable/sortable.html b/tests/unit/sortable/sortable.html index f956d6df0..ad5cdca6d 100644 --- a/tests/unit/sortable/sortable.html +++ b/tests/unit/sortable/sortable.html @@ -13,17 +13,25 @@ <link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/> <script type="text/javascript" src="../../../external/qunit.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> - <script type="text/javascript" src="../testsuite.js"></script> - <!-- <script type="text/javascript" src="sortable_core.js"></script> <script type="text/javascript" src="sortable_defaults.js"></script> <script type="text/javascript" src="sortable_events.js"></script> <script type="text/javascript" src="sortable_methods.js"></script> <script type="text/javascript" src="sortable_options.js"></script> <script type="text/javascript" src="sortable_tickets.js"></script> - --> - <script type="text/javascript">test("sortable", function() { ok(true, "disabled sortable testsuite"); });</script> + + <script type="text/javascript"> + // disable this stale testsuite for testswarm only + var url = window.location.search; + url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) ); + if ( url && url.indexOf("http") == 0 ) { + // reset config to kill previous tests; make sure testsuite.js is loaded afterwards to init the testswarm script + QUnit.init(); + test("sortable", function() { ok(true, "disabled sortable testsuite"); }); + } + </script> + <script type="text/javascript" src="../testsuite.js"></script> </head> <body> diff --git a/tests/unit/sortable/sortable_methods.js b/tests/unit/sortable/sortable_methods.js index adccc8c87..c4b5cdc08 100644 --- a/tests/unit/sortable/sortable_methods.js +++ b/tests/unit/sortable/sortable_methods.js @@ -84,7 +84,7 @@ test("enable", function() { }); test("disable", function() { - expect(6); + expect(7); el = $("#sortable").sortable({ disabled: false }); sort($("li", el)[0], 0, 40, 2, '.sortable({ disabled: false })'); @@ -97,6 +97,7 @@ test("disable", function() { sort($("li", el)[0], 0, 40, 2, '.sortable({ disabled: false })'); el.sortable("option", "disabled", true); equals(el.sortable("option", "disabled"), true, "disabled option setter"); + ok(el.sortable("widget").is(":not(.ui-state-disabled)"), "sortable element does not get ui-state-disabled since it's an interaction"); sort($("li", el)[0], 0, 40, 0, '.sortable("option", "disabled", true)'); var expected = $('<div></div>').sortable(), diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html index 1e050af97..269f47ed5 100644 --- a/tests/unit/tabs/tabs.html +++ b/tests/unit/tabs/tabs.html @@ -15,7 +15,6 @@ <link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/> <script type="text/javascript" src="../../../external/qunit.js"></script> <script type="text/javascript" src="../../jquery.simulate.js"></script> - <script type="text/javascript" src="../testsuite.js"></script> <script type="text/javascript" src="tabs_core.js"></script> <script type="text/javascript" src="tabs_defaults.js"></script> @@ -23,6 +22,18 @@ <script type="text/javascript" src="tabs_methods.js"></script> <script type="text/javascript" src="tabs_options.js"></script> <script type="text/javascript" src="tabs_tickets.js"></script> + + <script type="text/javascript"> + // disable this stale testsuite for testswarm only + var url = window.location.search; + url = decodeURIComponent( url.slice( url.indexOf("swarmURL=") + 9 ) ); + if ( url && url.indexOf("http") == 0 ) { + // reset config to kill previous tests; make sure testsuite.js is loaded afterwards to init the testswarm script + QUnit.init(); + test("tabs", function() { ok(true, "disabled tabs testsuite"); }); + } + </script> + <script type="text/javascript" src="../testsuite.js"></script> </head> <body> diff --git a/tests/unit/tabs/tabs_events.js b/tests/unit/tabs/tabs_events.js index 2c0eaac18..d0bc5fee2 100644 --- a/tests/unit/tabs/tabs_events.js +++ b/tests/unit/tabs/tabs_events.js @@ -22,15 +22,17 @@ test('show', function() { uiObj = ui; } }); - ok(uiObj !== undefined, 'should fire show after init'); - equals(uiObj.tab, $('#tabs1 a')[0], 'should have tab as DOM anchor element'); - equals(uiObj.panel, $('#tabs1 div')[0], 'should have panel as DOM div element'); - equals(uiObj.index, 0, 'should have index'); - + ok(uiObj !== undefined, 'trigger callback after initialization'); + equals(uiObj.tab, $('a', el)[0], 'contain tab as DOM anchor element'); + equals(uiObj.panel, $('div', el)[0], 'contain panel as DOM div element'); + equals(uiObj.index, 0, 'contain index'); + }); test('add', function() { + // TODO move to methods, not at all event related... + var el = $('<div id="tabs"><ul></ul></div>').tabs(); equals(el.tabs('option', 'selected'), -1, 'Initially empty, no selected tab'); @@ -47,11 +49,36 @@ test('remove', function() { }); test('enable', function() { - ok(false, "missing test - untested code is broken code."); + expect(4); + + var uiObj; + el = $('#tabs1').tabs({ + disabled: [ 0, 1 ], + enable: function (event, ui) { + uiObj = ui; + } + }); + el.tabs('enable', 1); + ok(uiObj !== undefined, 'trigger callback'); + equals(uiObj.tab, $('a', el)[1], 'contain tab as DOM anchor element'); + equals(uiObj.panel, $('div', el)[1], 'contain panel as DOM div element'); + equals(uiObj.index, 1, 'contain index'); }); test('disable', function() { - ok(false, "missing test - untested code is broken code."); + expect(4); + + var uiObj; + el = $('#tabs1').tabs({ + disable: function (event, ui) { + uiObj = ui; + } + }); + el.tabs('disable', 1); + ok(uiObj !== undefined, 'trigger callback'); + equals(uiObj.tab, $('a', el)[1], 'contain tab as DOM anchor element'); + equals(uiObj.panel, $('div', el)[1], 'contain panel as DOM div element'); + equals(uiObj.index, 1, 'contain index'); }); })(jQuery); diff --git a/tests/unit/tabs/tabs_methods.js b/tests/unit/tabs/tabs_methods.js index b1b5462a6..3eb627830 100644 --- a/tests/unit/tabs/tabs_methods.js +++ b/tests/unit/tabs/tabs_methods.js @@ -9,7 +9,7 @@ test('init', function() { expect(9); el = $('#tabs1').tabs(); - + ok(true, '.tabs() called on element'); ok( el.is('.ui-tabs.ui-widget.ui-widget-content.ui-corner-all'), 'attach classes to container'); ok( $('ul', el).is('.ui-tabs-nav.ui-helper-reset.ui-helper-clearfix.ui-widget-header.ui-corner-all'), 'attach classes to list' ); @@ -23,32 +23,48 @@ test('init', function() { test('destroy', function() { expect(6); - + el = $('#tabs1').tabs({ collapsible: true }); $('li:eq(2)', el).simulate('mouseover').find('a').focus(); el.tabs('destroy'); - + ok( el.is(':not(.ui-tabs, .ui-widget, .ui-widget-content, .ui-corner-all, .ui-tabs-collapsible)'), 'remove classes from container'); ok( $('ul', el).is(':not(.ui-tabs-nav, .ui-helper-reset, .ui-helper-clearfix, .ui-widget-header, .ui-corner-all)'), 'remove classes from list' ); ok( $('div:eq(1)', el).is(':not(.ui-tabs-panel, .ui-widget-content, .ui-corner-bottom, .ui-tabs-hide)'), 'remove classes to panel' ); - ok( $('li:eq(0)', el).is(':not(.ui-tabs-selected, .ui-state-active, .ui-corner-top)'), 'remove classes from active li'); + ok( $('li:eq(0)', el).is(':not(.ui-tabs-selected, .ui-state-active, .ui-corner-top)'), 'remove classes from active li'); ok( $('li:eq(1)', el).is(':not(.ui-state-default, .ui-corner-top)'), 'remove classes from inactive li'); ok( $('li:eq(2)', el).is(':not(.ui-state-hover, .ui-state-focus)'), 'remove classes from mouseovered or focused li'); }); test('enable', function() { - ok(false, "missing test - untested code is broken code."); + expect(2); + + el = $('#tabs1').tabs({ disabled: [ 0, 1 ] }); + el.tabs("enable", 1); + ok( $('li:eq(1)', el).is(':not(.ui-state-disabled)'), 'remove class from li'); + same(el.tabs('option', 'disabled'), [ ], 'update property'); }); test('disable', function() { - ok(false, "missing test - untested code is broken code."); + expect(4); + + // normal + el = $('#tabs1').tabs(); + el.tabs('disable', 1); + ok( $('li:eq(1)', el).is('.ui-state-disabled'), 'add class to li'); + same(el.tabs('option', 'disabled'), [ 1 ], 'update disabled property'); + + // attempt to disable selected has no effect + el.tabs('disable', 0); + ok( $('li:eq(0)', el).is(':not(.ui-state-disabled)'), 'not add class to li'); + same(el.tabs('option', 'disabled'), [ 1 ], 'not update property'); }); test('add', function() { expect(4); - + el = $('#tabs1').tabs(); - el.tabs('add', "#new", 'New'); + el.tabs('add', '#new', 'New'); var added = $('li:last', el).simulate('mouseover'); ok(added.is('.ui-state-hover'), 'should add mouseover handler to added tab'); @@ -56,9 +72,9 @@ test('add', function() { var other = $('li:first', el).simulate('mouseover'); ok(other.is('.ui-state-hover'), 'should not remove mouseover handler from existing tab'); other.simulate('mouseout'); - + equals($('a', added).attr('href'), '#new', 'should not expand href to full url of current page'); - + ok(false, "missing test - untested code is broken code."); }); @@ -66,25 +82,25 @@ test('remove', function() { expect(4); el = $('#tabs1').tabs(); - + el.tabs('remove', 0); equals(el.tabs('length'), 2, 'remove tab'); equals($('li a[href$="fragment-1"]', el).length, 0, 'remove associated list item'); equals($('#fragment-1').length, 0, 'remove associated panel'); - + // TODO delete tab -> focus tab to right // TODO delete last tab -> focus tab to left - + el.tabs('select', 1); el.tabs('remove', 1); - equals(el.tabs('option', 'selected'), 0, 'update selected property'); + equals(el.tabs('option', 'selected'), 0, 'update selected property'); }); test('select', function() { expect(9); - + el = $('#tabs1').tabs(); - + el.tabs('select', 1); equals(el.tabs('option', 'selected'), 1, 'should select tab'); @@ -97,11 +113,11 @@ test('select', function() { el.tabs({ collapsible: true }); el.tabs('select', -1); equals(el.tabs('option', 'selected'), -1, 'should collapse tab passing in -1'); - + el.tabs('destroy'); el.tabs({ collapsible: true }); el.tabs('select', null); - equals(el.tabs('option', 'selected'), -1, 'should collapse tab passing in null (deprecated)'); + equals(el.tabs('option', 'selected'), -1, 'should collapse tab passing in null (deprecated)'); el.tabs('select', null); equals(el.tabs('option', 'selected'), -1, 'should not select tab passing in null a second time (deprecated)'); @@ -113,7 +129,7 @@ test('select', function() { equals(el.tabs('option', 'selected'), 0, 'should not collapse tab if collapsible is not set to true'); el.tabs('select', null); equals(el.tabs('option', 'selected'), 0, 'should not collapse tab if collapsible is not set to true'); - + el.tabs('select', '#fragment-2'); equals(el.tabs('option', 'selected'), 1, 'should select tab by id'); }); @@ -128,7 +144,7 @@ test('url', function() { test('length', function() { expect(1); - + el = $('#tabs1').tabs(); equals(el.tabs('length'), $('ul a', el).length, ' should return length'); }); diff --git a/ui/i18n/jquery.ui.datepicker-fr-CH.js b/ui/i18n/jquery.ui.datepicker-fr-CH.js index dafef16ff..38212d548 100644 --- a/ui/i18n/jquery.ui.datepicker-fr-CH.js +++ b/ui/i18n/jquery.ui.datepicker-fr-CH.js @@ -1,15 +1,15 @@ -/* Swiss-French initialisation for the jQuery UI date picker plugin. */ +/* Swiss-French initialisation for the jQuery UI date picker plugin. */ /* Written Martin Voelkle (martin.voelkle@e-tc.ch). */ jQuery(function($){ $.datepicker.regional['fr-CH'] = { closeText: 'Fermer', - prevText: '<Préc', + prevText: '<Préc', nextText: 'Suiv>', currentText: 'Courant', - monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin', - 'Juillet','Août','Septembre','Octobre','Novembre','Décembre'], - monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun', - 'Jul','Aoû','Sep','Oct','Nov','Déc'], + monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin', + 'Juillet','Août','Septembre','Octobre','Novembre','Décembre'], + monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun', + 'Jul','Aoû','Sep','Oct','Nov','Déc'], dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'], dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'], diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 14a19e4b2..070045d16 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -166,11 +166,7 @@ $.widget( "ui.autocomplete", { if ( $.isArray(this.options.source) ) { array = this.options.source; this.source = function( request, response ) { - // escape regex characters - var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" ); - response( $.grep( array, function(value) { - return matcher.test( value.label || value.value || value ); - }) ); + response( $.ui.autocomplete.filter(array, request.term) ); }; } else if ( typeof this.options.source === "string" ) { url = this.options.source; @@ -308,6 +304,12 @@ $.widget( "ui.autocomplete", { $.extend( $.ui.autocomplete, { escapeRegex: function( value ) { return value.replace( /([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1" ); + }, + filter: function(array, term) { + var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" ); + return $.grep( array, function(value) { + return matcher.test( value.label || value.value || value ); + }); } }); diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index 28be062f6..0fa3a1253 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -73,6 +73,18 @@ $.widget("ui.sortable", $.ui.mouse, { return this; }, + _setOption: function(key, value){ + if ( key === "disabled" ) { + this.options[ key ] = value; + + this.widget() + [ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" ); + } else { + // Don't call widget base _setOption for disable as it adds ui-state-disabled class + $.Widget.prototype._setOption.apply(self, arguments); + } + }, + _mouseCapture: function(event, overrideHandle) { if (this.reverting) { diff --git a/version.txt b/version.txt index 21441b706..b9268dae2 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.9pre
\ No newline at end of file +1.8.1
\ No newline at end of file |