Merge remote branch 'origin/master'
@ -11,7 +11,7 @@
|
||||
.toggler { width: 500px; height: 200px; position: relative;}
|
||||
#button { padding: .5em 1em; text-decoration: none; }
|
||||
#effect { width: 240px; padding: 1em; font-size: 1.2em; border: 1px solid #000; background: #eee; color: #333; }
|
||||
#effect.newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
|
||||
.newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
@ -54,6 +54,12 @@
|
||||
minLength: 0
|
||||
})
|
||||
.addClass("ui-widget ui-widget-content ui-corner-left");
|
||||
input.data("autocomplete")._renderItem = function( ul, item) {
|
||||
return $( "<li></li>" )
|
||||
.data( "item.autocomplete", item )
|
||||
.append( "<a>" + item.label + "</a>" )
|
||||
.appendTo( ul );
|
||||
};
|
||||
$("<button> </button>")
|
||||
.attr("tabIndex", -1)
|
||||
.attr("title", "Show All Items")
|
||||
@ -96,19 +102,28 @@
|
||||
<label>Your preferred programming language: </label>
|
||||
<select id="combobox">
|
||||
<option value="">Select one...</option>
|
||||
<option value="a">asp</option>
|
||||
<option value="c">c</option>
|
||||
<option value="cpp">c++</option>
|
||||
<option value="cf">coldfusion</option>
|
||||
<option value="g">groovy</option>
|
||||
<option value="h">haskell</option>
|
||||
<option value="j">java</option>
|
||||
<option value="js">javascript</option>
|
||||
<option value="p1">perl</option>
|
||||
<option value="p2">php</option>
|
||||
<option value="p3">python</option>
|
||||
<option value="r">ruby</option>
|
||||
<option value="s">scala</option>
|
||||
<option value="ActionScript">ActionScript</option>
|
||||
<option value="AppleScript">AppleScript</option>
|
||||
<option value="Asp">Asp</option>
|
||||
<option value="BASIC">BASIC</option>
|
||||
<option value="C">C</option>
|
||||
<option value="C++">C++</option>
|
||||
<option value="Clojure">Clojure</option>
|
||||
<option value="COBOL">COBOL</option>
|
||||
<option value="ColdFusion">ColdFusion</option>
|
||||
<option value="Erlang">Erlang</option>
|
||||
<option value="Fortran">Fortran</option>
|
||||
<option value="Groovy">Groovy</option>
|
||||
<option value="Haskell">Haskell</option>
|
||||
<option value="Java">Java</option>
|
||||
<option value="JavaScript">JavaScript</option>
|
||||
<option value="Lisp">Lisp</option>
|
||||
<option value="Perl">Perl</option>
|
||||
<option value="PHP">PHP</option>
|
||||
<option value="Python">Python</option>
|
||||
<option value="Ruby">Ruby</option>
|
||||
<option value="Scala">Scala</option>
|
||||
<option value="Scheme">Scheme</option>
|
||||
</select>
|
||||
</div>
|
||||
<button id="toggle">Show underlying select</button>
|
||||
|
@ -60,7 +60,7 @@
|
||||
$('#project').val(ui.item.label);
|
||||
$('#project-id').val(ui.item.value);
|
||||
$('#project-description').html(ui.item.desc);
|
||||
$('#project-icon').attr('src', '../images/' + ui.item.icon);
|
||||
$('#project-icon').attr('src', 'images/' + ui.item.icon);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -78,7 +78,7 @@
|
||||
|
||||
<div class="demo">
|
||||
<div id="project-label">Select a project (type "j" for a start):</div>
|
||||
<img id="project-icon" src="../images/transparent_1x1.png" class="ui-state-default"/>
|
||||
<img id="project-icon" src="images/transparent_1x1.png" class="ui-state-default"/>
|
||||
<input id="project"/>
|
||||
<input type="hidden" id="project-id"/>
|
||||
<p id="project-description"></p>
|
||||
|
@ -12,7 +12,7 @@
|
||||
<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"];
|
||||
var availableTags = ["ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme"];
|
||||
$("#tags").autocomplete({
|
||||
source: availableTags
|
||||
});
|
||||
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 137 B After Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@ -13,10 +13,12 @@
|
||||
<li><a href="remote.html">Remote datasource</a></li>
|
||||
<li><a href="remote-with-cache.html">Remote with caching</a></li>
|
||||
<li><a href="remote-jsonp.html">Remote JSONP datasource</a></li>
|
||||
<li><a href="maxheight.html">Scrollable results</a></li>
|
||||
<li><a href="combobox.html">Combobox</a></li>
|
||||
<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="folding.html">Accent folding</a></li>
|
||||
<li><a href="multiple.html">Multiple values</a></li>
|
||||
<li><a href="multiple-remote.html">Multiple, remote</a></li>
|
||||
</ul>
|
||||
|
52
demos/autocomplete/maxheight.html
Normal file
@ -0,0 +1,52 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>jQuery UI Autocomplete Scrollable Results 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" />
|
||||
<style type="text/css">
|
||||
.ui-autocomplete {
|
||||
max-height: 100px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
/* IE 6 doesn't support max-height
|
||||
* we use height instead, but this forces the menu to always be this tall
|
||||
*/
|
||||
* html .ui-autocomplete {
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var availableTags = ["ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme"];
|
||||
$("#tags").autocomplete({
|
||||
source: availableTags
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="demo">
|
||||
|
||||
<div class="ui-widget">
|
||||
<label for="tags">Tags: </label>
|
||||
<input id="tags" />
|
||||
</div>
|
||||
|
||||
</div><!-- End demo -->
|
||||
|
||||
<div class="demo-description">
|
||||
<p>
|
||||
When displaying a long list of options, you can simply set the max-height for the autocomplete menu to prevent the menu from growing too large. Try typing "a" or "s" above to get a long list of results that you can scroll through.
|
||||
</p>
|
||||
</div><!-- End demo-description -->
|
||||
|
||||
</body>
|
||||
</html>
|
@ -10,6 +10,9 @@
|
||||
<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" />
|
||||
<style type="text/css">
|
||||
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
function split(val) {
|
||||
|
@ -12,7 +12,7 @@
|
||||
<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"];
|
||||
var availableTags = ["ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme"];
|
||||
function split(val) {
|
||||
return val.split(/,\s*/);
|
||||
}
|
||||
|
@ -10,6 +10,9 @@
|
||||
<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" />
|
||||
<style type="text/css">
|
||||
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
function log(message) {
|
||||
|
@ -10,6 +10,9 @@
|
||||
<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" />
|
||||
<style type="text/css">
|
||||
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var cache = {};
|
||||
|
@ -10,6 +10,9 @@
|
||||
<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" />
|
||||
<style type="text/css">
|
||||
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
function log(message) {
|
||||
|
@ -3,8 +3,8 @@
|
||||
$q = strtolower($_GET["term"]);
|
||||
if (!$q) return;
|
||||
$items = array(
|
||||
"Great <em>Bittern</em>"=>"Botaurus stellaris",
|
||||
"Little <em>Grebe</em>"=>"Tachybaptus ruficollis",
|
||||
"Great Bittern"=>"Botaurus stellaris",
|
||||
"Little Grebe"=>"Tachybaptus ruficollis",
|
||||
"Black-necked Grebe"=>"Podiceps nigricollis",
|
||||
"Little Bittern"=>"Ixobrychus minutus",
|
||||
"Black-crowned Night Heron"=>"Nycticorax nycticorax",
|
||||
|
@ -10,6 +10,9 @@
|
||||
<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" />
|
||||
<style type="text/css">
|
||||
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
function log(message) {
|
||||
|
@ -11,7 +11,7 @@
|
||||
.toggler { width: 500px; height: 200px; position: relative;}
|
||||
#button { padding: .5em 1em; text-decoration: none; }
|
||||
#effect {position: relative; width: 240px; padding: 1em; letter-spacing: 0; font-size: 1.2em; border: 1px solid #000; background: #eee; color: #333; }
|
||||
#effect.newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
|
||||
.newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
@ -11,8 +11,8 @@
|
||||
.toggler { width: 500px; height: 200px; position: relative;}
|
||||
#button { padding: .5em 1em; text-decoration: none; }
|
||||
#effect {position: relative; }
|
||||
#effect.newClass { width: 240px; padding: 1em; letter-spacing: 0; font-size: 1.2em; }
|
||||
#effect.anotherNewClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
|
||||
.newClass { width: 240px; padding: 1em; letter-spacing: 0; font-size: 1.2em; margin: 0; }
|
||||
.anotherNewClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
@ -11,7 +11,7 @@
|
||||
.toggler { width: 500px; height: 200px; position: relative;}
|
||||
#button { padding: .5em 1em; text-decoration: none; }
|
||||
#effect {position: relative; width: 240px; padding: 1em; letter-spacing: 0; font-size: 1.2em; border: 1px solid #000; background: #eee; color: #333; }
|
||||
#effect.newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
|
||||
.newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
@ -6,7 +6,12 @@ var autocomplete_defaults = {
|
||||
delay: 300,
|
||||
disabled: false,
|
||||
minLength: 1,
|
||||
source: undefined
|
||||
position: {
|
||||
my: "left top",
|
||||
at: "left bottom",
|
||||
collision: "none"
|
||||
},
|
||||
source: null
|
||||
};
|
||||
|
||||
commonWidgetTests('autocomplete', { defaults: autocomplete_defaults });
|
||||
|
@ -242,8 +242,8 @@ test("modal", function() {
|
||||
|
||||
test("position, default center on window", function() {
|
||||
var el = $('<div></div>').dialog();
|
||||
var offset = el.parent().offset();
|
||||
// use .position() instead to avoid replicating center-logic?
|
||||
var dialog = el.dialog('widget');
|
||||
var offset = dialog.offset();
|
||||
same(offset.left, Math.floor($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft());
|
||||
same(offset.top, Math.floor($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop());
|
||||
el.remove();
|
||||
@ -251,16 +251,16 @@ test("position, default center on window", function() {
|
||||
|
||||
test("position, top on window", function() {
|
||||
var el = $('<div></div>').dialog({ position: "top" });
|
||||
var dialog = el.closest('.ui-dialog');
|
||||
var dialog = el.dialog('widget');
|
||||
var offset = dialog.offset();
|
||||
same(offset.left, Math.floor($(window).width() / 2 - dialog.outerWidth() / 2));
|
||||
same(offset.left, Math.floor($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft());
|
||||
same(offset.top, $(window).scrollTop());
|
||||
el.remove();
|
||||
});
|
||||
|
||||
test("position, left on window", function() {
|
||||
var el = $('<div></div>').dialog({ position: "left" });
|
||||
var dialog = el.closest('.ui-dialog');
|
||||
var dialog = el.dialog('widget');
|
||||
var offset = dialog.offset();
|
||||
same(offset.left, 0);
|
||||
same(offset.top, Math.floor($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop());
|
||||
@ -269,27 +269,27 @@ test("position, left on window", function() {
|
||||
|
||||
test("position, right bottom on window", function() {
|
||||
var el = $('<div></div>').dialog({ position: "right bottom" });
|
||||
var dialog = el.closest('.ui-dialog');
|
||||
var dialog = el.dialog('widget');
|
||||
var offset = dialog.offset();
|
||||
same(offset.left, $(window).width() - dialog.outerWidth());
|
||||
same(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft());
|
||||
same(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop());
|
||||
el.remove();
|
||||
});
|
||||
|
||||
test("position, right bottom on window w/array", function() {
|
||||
var el = $('<div></div>').dialog({ position: ["right", "bottom"] });
|
||||
var dialog = el.closest('.ui-dialog');
|
||||
var dialog = el.dialog('widget');
|
||||
var offset = dialog.offset();
|
||||
same(offset.left, $(window).width() - dialog.outerWidth());
|
||||
same(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft());
|
||||
same(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop());
|
||||
el.remove();
|
||||
});
|
||||
|
||||
test("position, offset from top left w/array", function() {
|
||||
var el = $('<div></div>').dialog({ position: [10, 10] });
|
||||
var dialog = el.closest('.ui-dialog');
|
||||
var dialog = el.dialog('widget');
|
||||
var offset = dialog.offset();
|
||||
same(offset.left, 10);
|
||||
same(offset.left, 10 + $(window).scrollLeft());
|
||||
same(offset.top, 10 + $(window).scrollTop());
|
||||
el.remove();
|
||||
});
|
||||
@ -302,10 +302,10 @@ test("position, right bottom at right bottom via ui.position args", function() {
|
||||
}
|
||||
});
|
||||
|
||||
var dialog = el.closest('.ui-dialog');
|
||||
var dialog = el.dialog('widget');
|
||||
var offset = dialog.offset();
|
||||
|
||||
same(offset.left, $(window).width() - dialog.outerWidth());
|
||||
same(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft());
|
||||
same(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop());
|
||||
el.remove();
|
||||
});
|
||||
@ -317,22 +317,21 @@ test("position, at another element", function() {
|
||||
left: 600,
|
||||
height: 10,
|
||||
width: 10
|
||||
});
|
||||
}).appendTo('body');
|
||||
|
||||
var el = $('<div></div>').dialog({
|
||||
position: {
|
||||
my: "left top",
|
||||
at: "top left",
|
||||
at: "left top",
|
||||
of: parent
|
||||
}
|
||||
});
|
||||
|
||||
var dialog = el.closest('.ui-dialog');
|
||||
var dialog = el.dialog('widget');
|
||||
var offset = dialog.offset();
|
||||
var parentOffset = parent.offset();
|
||||
|
||||
same(offset.left, parentOffset.left);
|
||||
same(offset.top, parentOffset.top);
|
||||
same(offset.left, 600);
|
||||
same(offset.top, 400);
|
||||
|
||||
el.dialog('option', 'position', {
|
||||
my: "left top",
|
||||
@ -340,18 +339,15 @@ test("position, at another element", function() {
|
||||
of: parent
|
||||
});
|
||||
|
||||
same(offset.left, parentOffset.left + parent.outerWidth());
|
||||
same(offset.top, parentOffset.top + parent.outerHeight());
|
||||
var offset = dialog.offset();
|
||||
|
||||
same(offset.left, 610);
|
||||
same(offset.top, 410);
|
||||
|
||||
el.remove();
|
||||
parent.remove();
|
||||
});
|
||||
|
||||
|
||||
test("position, others", function() {
|
||||
ok(false, 'missing test - untested code is broken code');
|
||||
});
|
||||
|
||||
test("resizable", function() {
|
||||
expect(4);
|
||||
|
||||
|
@ -202,6 +202,10 @@ test("{ containment: Selector }", function() {
|
||||
ok(false, 'missing test - untested code is broken code');
|
||||
});
|
||||
|
||||
test("{ containment: [x1, y1, x2, y2] }", function() {
|
||||
ok(false, 'missing test - untested code is broken code');
|
||||
});
|
||||
|
||||
test("{ cursor: 'auto' }, default", function() {
|
||||
equals(draggable_defaults.cursor, 'auto');
|
||||
|
||||
|
@ -15,7 +15,8 @@
|
||||
<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>
|
||||
<script type="text/javascript" src="tabs_events.js"></script>
|
||||
|
@ -97,7 +97,7 @@ test('remove', function() {
|
||||
});
|
||||
|
||||
test('select', function() {
|
||||
expect(9);
|
||||
expect(6);
|
||||
|
||||
el = $('#tabs1').tabs();
|
||||
|
||||
@ -114,21 +114,12 @@ test('select', function() {
|
||||
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)');
|
||||
el.tabs('select', null);
|
||||
equals(el.tabs('option', 'selected'), -1, 'should not select tab passing in null a second time (deprecated)');
|
||||
|
||||
el.tabs('destroy');
|
||||
el.tabs();
|
||||
el.tabs('select', 0);
|
||||
equals(el.tabs('option', 'selected'), 0, 'should not collapse tab if collapsible is not set to true');
|
||||
el.tabs('select', -1);
|
||||
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');
|
||||
|
@ -13,7 +13,8 @@
|
||||
<script type="text/javascript" src="../../jquery.simulate.js"></script>
|
||||
<script type="text/javascript" src="../testsuite.js"></script>
|
||||
|
||||
<script type="text/javascript" src="widget.js"></script>
|
||||
<script type="text/javascript" src="widget_core.js"></script>
|
||||
<script type="text/javascript" src="widget_tickets.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
46
tests/unit/widget/widget_tickets.js
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* widget unit tests
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
module('widget: tickets');
|
||||
|
||||
test('#5830 - Widget: Using inheritance overwrites the base classes options', function() {
|
||||
$.widget( "ui.testWidgetBase", {
|
||||
options: {
|
||||
obj: {
|
||||
key1: "foo",
|
||||
key2: "bar"
|
||||
},
|
||||
arr: [ "testing" ]
|
||||
}
|
||||
});
|
||||
|
||||
$.widget( "ui.testWidgetExtension", $.ui.testWidgetBase, {
|
||||
options: {
|
||||
obj: {
|
||||
key1: "baz"
|
||||
},
|
||||
arr: [ "alpha", "beta" ]
|
||||
}
|
||||
});
|
||||
|
||||
same( $.ui.testWidgetBase.prototype.options.obj, {
|
||||
key1: "foo",
|
||||
key2: "bar"
|
||||
}, "base class option object not overridden");
|
||||
same( $.ui.testWidgetBase.prototype.options.arr, [ "testing" ],
|
||||
"base class option array not overridden");
|
||||
|
||||
same( $.ui.testWidgetExtension.prototype.options.obj, {
|
||||
key1: "baz",
|
||||
key2: "bar"
|
||||
}, "extension class option object extends base");
|
||||
same( $.ui.testWidgetExtension.prototype.options.arr, [ "alpha", "beta" ],
|
||||
"extension class option array overwrites base");
|
||||
|
||||
delete $.ui.testWidgetBase;
|
||||
delete $.ui.testWidgetExtension;
|
||||
});
|
||||
|
||||
})(jQuery);
|
@ -16,7 +16,10 @@
|
||||
<script type="text/javascript" src="../../../ui/jquery.ui.button.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var start = +new Date();
|
||||
$("button").button();
|
||||
var end = +new Date();
|
||||
$("<p></p>").text( "Time to initialize: " + (end - start) + "ms" ).prependTo("body");
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
@ -250,7 +250,7 @@
|
||||
<a href="#">Go back</a>
|
||||
</div>
|
||||
|
||||
<div class="ui-widget" style="margin-top:2em; font-family:Arial">
|
||||
<div class="ui-widget" style="clear: left; margin-top:2em; font-family:Arial">
|
||||
Log:
|
||||
<div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
|
||||
</div>
|
||||
|
@ -109,7 +109,7 @@
|
||||
<li><a href="#">Amesville</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="ui-widget" style="margin-top:2em; font-family:Arial">
|
||||
<div class="ui-widget" style="clear: left; margin-top:2em; font-family:Arial">
|
||||
Log:
|
||||
<div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
|
||||
</div>
|
||||
|
2
themes/base/jquery.ui.autocomplete.css
vendored
@ -8,7 +8,6 @@
|
||||
* http://docs.jquery.com/UI/Autocomplete#theming
|
||||
*/
|
||||
.ui-autocomplete { position: absolute; cursor: default; }
|
||||
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
|
||||
|
||||
/* workarounds */
|
||||
* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
|
||||
@ -27,6 +26,7 @@
|
||||
padding: 2px;
|
||||
margin: 0;
|
||||
display:block;
|
||||
float: left;
|
||||
}
|
||||
.ui-menu .ui-menu {
|
||||
margin-top: -3px;
|
||||
|
2
themes/base/jquery.ui.dialog.css
vendored
@ -15,6 +15,6 @@
|
||||
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
|
||||
.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
|
||||
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
|
||||
.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; }
|
||||
.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; }
|
||||
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
|
||||
.ui-draggable .ui-dialog-titlebar { cursor: move; }
|
||||
|
6
ui/i18n/jquery.ui.datepicker-pt-BR.js
vendored
@ -10,9 +10,9 @@ jQuery(function($){
|
||||
'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
|
||||
monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun',
|
||||
'Jul','Ago','Set','Out','Nov','Dez'],
|
||||
dayNames: ['Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sabado'],
|
||||
dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
|
||||
dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'],
|
||||
dayNames: ['Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sábado'],
|
||||
dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'],
|
||||
dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'],
|
||||
weekHeader: 'Sm',
|
||||
dateFormat: 'dd/mm/yy',
|
||||
firstDay: 0,
|
||||
|
4
ui/jquery.ui.accordion.js
vendored
@ -79,7 +79,9 @@ $.widget("ui.accordion", {
|
||||
}
|
||||
}
|
||||
|
||||
this.active = this._findActive(this.active || o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");
|
||||
this.active = this._findActive(this.active || o.active)
|
||||
.addClass("ui-state-default ui-state-active")
|
||||
.toggleClass("ui-corner-all ui-corner-top");
|
||||
this.active.next().addClass('ui-accordion-content-active');
|
||||
|
||||
//Append icon elements
|
||||
|
43
ui/jquery.ui.autocomplete.js
vendored
@ -16,8 +16,14 @@
|
||||
|
||||
$.widget( "ui.autocomplete", {
|
||||
options: {
|
||||
delay: 300,
|
||||
minLength: 1,
|
||||
delay: 300
|
||||
position: {
|
||||
my: "left top",
|
||||
at: "left bottom",
|
||||
collision: "none"
|
||||
},
|
||||
source: null
|
||||
},
|
||||
_create: function() {
|
||||
var self = this,
|
||||
@ -126,9 +132,12 @@ $.widget( "ui.autocomplete", {
|
||||
}
|
||||
},
|
||||
selected: function( event, ui ) {
|
||||
var item = ui.item.data( "item.autocomplete" );
|
||||
var item = ui.item.data( "item.autocomplete" ),
|
||||
setValue = false;
|
||||
if ( false !== self._trigger( "select", event, { item: item } ) ) {
|
||||
self.element.val( item.value );
|
||||
// #5639 - if we set the value before setting focus
|
||||
// the cursor will move to the beginning of the field in IE
|
||||
setValue = true;
|
||||
}
|
||||
self.close( event );
|
||||
// only trigger when focus was lost (click on menu)
|
||||
@ -138,6 +147,9 @@ $.widget( "ui.autocomplete", {
|
||||
self.previous = previous;
|
||||
}
|
||||
self.selectedItem = item;
|
||||
if ( setValue ) {
|
||||
self.element.val( item.value );
|
||||
}
|
||||
},
|
||||
blur: function( event, ui ) {
|
||||
if ( self.menu.element.is(":visible") ) {
|
||||
@ -269,16 +281,17 @@ $.widget( "ui.autocomplete", {
|
||||
// TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
|
||||
this.menu.deactivate();
|
||||
this.menu.refresh();
|
||||
this.menu.element.show().position({
|
||||
my: "left top",
|
||||
at: "left bottom",
|
||||
of: this.element,
|
||||
collision: "none"
|
||||
});
|
||||
this.menu.element.show().position( $.extend({
|
||||
of: this.element
|
||||
}, this.options.position ));
|
||||
|
||||
menuWidth = ul.width( "" ).width();
|
||||
textWidth = this.element.width();
|
||||
ul.width( Math.max( menuWidth, textWidth ) );
|
||||
menuWidth = ul.width( "" ).outerWidth();
|
||||
textWidth = this.element.outerWidth();
|
||||
ul.width( Math.max( menuWidth, textWidth )
|
||||
- ( parseFloat( ul.css("paddingLeft") ) || 0 )
|
||||
- ( parseFloat( ul.css("paddingRight") ) || 0 )
|
||||
- ( parseFloat( ul.css("borderLeftWidth") ) || 0 )
|
||||
- ( parseFloat( ul.css("borderRightWidth") ) || 0 ) );
|
||||
},
|
||||
|
||||
_renderMenu: function( ul, items ) {
|
||||
@ -291,7 +304,7 @@ $.widget( "ui.autocomplete", {
|
||||
_renderItem: function( ul, item) {
|
||||
return $( "<li></li>" )
|
||||
.data( "item.autocomplete", item )
|
||||
.append( "<a>" + item.label + "</a>" )
|
||||
.append( $( "<a></a>" ).text( item.label ) )
|
||||
.appendTo( ul );
|
||||
},
|
||||
|
||||
@ -426,11 +439,11 @@ $.widget("ui.menu", {
|
||||
},
|
||||
|
||||
first: function() {
|
||||
return this.active && !this.active.prev().length;
|
||||
return this.active && !this.active.prevAll(".ui-menu-item").length;
|
||||
},
|
||||
|
||||
last: function() {
|
||||
return this.active && !this.active.next().length;
|
||||
return this.active && !this.active.nextAll(".ui-menu-item").length;
|
||||
},
|
||||
|
||||
move: function(direction, edge, event) {
|
||||
|
2
ui/jquery.ui.button.js
vendored
@ -196,7 +196,7 @@ $.widget( "ui.button", {
|
||||
// we don't search against the document in case the element
|
||||
// is disconnected from the DOM
|
||||
this.buttonElement = this.element.parents().last()
|
||||
.find( "[for=" + this.element.attr("id") + "]" );
|
||||
.find( "label[for=" + this.element.attr("id") + "]" );
|
||||
this.element.addClass( "ui-helper-hidden-accessible" );
|
||||
|
||||
var checked = this.element.is( ":checked" );
|
||||
|
28
ui/jquery.ui.dialog.js
vendored
@ -59,6 +59,7 @@ $.widget("ui.dialog", {
|
||||
width: 300,
|
||||
zIndex: 1000
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
this.originalTitle = this.element.attr('title');
|
||||
// #5742 - .attr() might return a DOMElement
|
||||
@ -177,6 +178,7 @@ $.widget("ui.dialog", {
|
||||
uiDialog.bgiframe();
|
||||
}
|
||||
},
|
||||
|
||||
_init: function() {
|
||||
if ( this.options.autoOpen ) {
|
||||
this.open();
|
||||
@ -203,7 +205,7 @@ $.widget("ui.dialog", {
|
||||
|
||||
return self;
|
||||
},
|
||||
|
||||
|
||||
widget: function() {
|
||||
return this.uiDialog;
|
||||
},
|
||||
@ -258,12 +260,12 @@ $.widget("ui.dialog", {
|
||||
var self = this,
|
||||
options = self.options,
|
||||
saveScroll;
|
||||
|
||||
|
||||
if ((options.modal && !force) ||
|
||||
(!options.stack && !options.modal)) {
|
||||
return self._trigger('focus', event);
|
||||
}
|
||||
|
||||
|
||||
if (options.zIndex > $.ui.dialog.maxZ) {
|
||||
$.ui.dialog.maxZ = options.zIndex;
|
||||
}
|
||||
@ -305,11 +307,11 @@ $.widget("ui.dialog", {
|
||||
if (event.keyCode !== $.ui.keyCode.TAB) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var tabbables = $(':tabbable', this),
|
||||
first = tabbables.filter(':first'),
|
||||
last = tabbables.filter(':last');
|
||||
|
||||
|
||||
if (event.target === last[0] && !event.shiftKey) {
|
||||
first.focus(1);
|
||||
return false;
|
||||
@ -322,12 +324,9 @@ $.widget("ui.dialog", {
|
||||
|
||||
// set focus to the first tabbable element in the content area or the first button
|
||||
// if there are no tabbable elements, set focus on the dialog itself
|
||||
$([])
|
||||
.add(uiDialog.find('.ui-dialog-content :tabbable:first'))
|
||||
.add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first'))
|
||||
.add(uiDialog)
|
||||
.filter(':first')
|
||||
.focus();
|
||||
$(self.element.find(':tabbable').get().concat(
|
||||
uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
|
||||
uiDialog.get()))).eq(0).focus();
|
||||
|
||||
self._trigger('open');
|
||||
self._isOpen = true;
|
||||
@ -461,7 +460,6 @@ $.widget("ui.dialog", {
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
_position: function(position) {
|
||||
var myAt = [],
|
||||
offset = [0, 0],
|
||||
@ -484,14 +482,14 @@ $.widget("ui.dialog", {
|
||||
myAt[i] = offsetPosition;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
position = {
|
||||
my: myAt.join(" "),
|
||||
at: myAt.join(" "),
|
||||
offset: offset.join(" ")
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
position = $.extend({}, $.ui.dialog.prototype.options.position, position);
|
||||
} else {
|
||||
position = $.ui.dialog.prototype.options.position;
|
||||
@ -516,7 +514,7 @@ $.widget("ui.dialog", {
|
||||
uiDialog = self.uiDialog,
|
||||
isResizable = uiDialog.is(':data(resizable)'),
|
||||
resize = false;
|
||||
|
||||
|
||||
switch (key) {
|
||||
//handling of deprecated beforeclose (vs beforeClose) option
|
||||
//Ticket #4669 http://dev.jqueryui.com/ticket/4669
|
||||
|
4
ui/jquery.ui.sortable.js
vendored
@ -409,6 +409,10 @@ $.widget("ui.sortable", $.ui.mouse, {
|
||||
if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
|
||||
});
|
||||
|
||||
if(!str.length && o.key) {
|
||||
str.push(o.key + '=');
|
||||
}
|
||||
|
||||
return str.join('&');
|
||||
|
||||
},
|
||||
|
30
ui/jquery.ui.tabs.js
vendored
@ -413,6 +413,16 @@ $.widget("ui.tabs", {
|
||||
|
||||
},
|
||||
|
||||
_getIndex: function(index) {
|
||||
// meta-function to give users option to provide a href string instead of a numerical index.
|
||||
// also sanitizes numerical indexes to valid values.
|
||||
if (typeof index == 'string') {
|
||||
index = this.anchors.index(this.anchors.filter('[href$=' + index + ']'));
|
||||
}
|
||||
|
||||
return index;
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
var o = this.options;
|
||||
|
||||
@ -512,6 +522,7 @@ $.widget("ui.tabs", {
|
||||
},
|
||||
|
||||
remove: function(index) {
|
||||
index = this._getIndex(index);
|
||||
var o = this.options, $li = this.lis.eq(index).remove(),
|
||||
$panel = this.panels.eq(index).remove();
|
||||
|
||||
@ -532,6 +543,7 @@ $.widget("ui.tabs", {
|
||||
},
|
||||
|
||||
enable: function(index) {
|
||||
index = this._getIndex(index);
|
||||
var o = this.options;
|
||||
if ($.inArray(index, o.disabled) == -1) {
|
||||
return;
|
||||
@ -546,6 +558,7 @@ $.widget("ui.tabs", {
|
||||
},
|
||||
|
||||
disable: function(index) {
|
||||
index = this._getIndex(index);
|
||||
var self = this, o = this.options;
|
||||
if (index != o.selected) { // cannot disable already selected tab
|
||||
this.lis.eq(index).addClass('ui-state-disabled');
|
||||
@ -561,21 +574,20 @@ $.widget("ui.tabs", {
|
||||
},
|
||||
|
||||
select: function(index) {
|
||||
if (typeof index == 'string') {
|
||||
index = this.anchors.index(this.anchors.filter('[href$=' + index + ']'));
|
||||
index = this._getIndex(index);
|
||||
if (index == -1) {
|
||||
if (this.options.collapsible && this.options.selected != -1) {
|
||||
index = this.options.selected;
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
else if (index === null) { // usage of null is deprecated, TODO remove in next release
|
||||
index = -1;
|
||||
}
|
||||
if (index == -1 && this.options.collapsible) {
|
||||
index = this.options.selected;
|
||||
}
|
||||
|
||||
this.anchors.eq(index).trigger(this.options.event + '.tabs');
|
||||
return this;
|
||||
},
|
||||
|
||||
load: function(index) {
|
||||
index = this._getIndex(index);
|
||||
var self = this, o = this.options, a = this.anchors.eq(index)[0], url = $.data(a, 'load.tabs');
|
||||
|
||||
this.abort();
|
||||
|
2
ui/jquery.ui.widget.js
vendored
@ -57,7 +57,7 @@ $.widget = function( name, base, prototype ) {
|
||||
// basePrototype[ key ] = $.extend( {}, val );
|
||||
// }
|
||||
// });
|
||||
basePrototype.options = $.extend( {}, basePrototype.options );
|
||||
basePrototype.options = $.extend( true, {}, basePrototype.options );
|
||||
$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
|
||||
namespace: namespace,
|
||||
widgetName: name,
|
||||
|