jquery.ui library now is in its module directory

This commit is contained in:
Manuel Cillero 2017-08-16 17:57:42 +02:00
parent fd335a57b5
commit 6481cf646a
491 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,126 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Accordion Test Suite</title>
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../ui/ui.core.js"></script>
<script type="text/javascript" src="../ui/ui.accordion.js"></script>
<link type="text/css" href="testsuite.css" rel="stylesheet" />
<script type="text/javascript" src="testsuite.js"></script>
<script type="text/javascript" src="qunit/testrunner.js"></script>
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
<script type="text/javascript" src="accordion.js"></script>
</head>
<body>
<div id="main">
<div id="list1">
<a>There is one obvious advantage:</a>
<div>
<p>
You've seen it coming!<br/>
Buy now and get nothing for free!<br/>
Well, at least no free beer. Perhaps a bear, if you can afford it.
</p>
</div>
<a>Now that you've got...</a>
<div>
<p>
your bear, you have to admit it!<br/>
No, we aren't selling bears.
</p>
<p>
We could talk about renting one.
</p>
</div>
<a>Rent one bear, ...</a>
<div>
<p>
get two for three beer.
</p>
<p>
And now, for something completely different.
</p>
</div>
</div>
<ul id="navigation">
<li>
<a class="head" href="?p=1.1.1">Guitar</a>
<ul>
<li><a href="?p=1.1.1.1">Electric</a></li>
<li><a href="?p=1.1.1.2">Acoustic</a></li>
<li><a href="?p=1.1.1.3">Amps</a></li>
<li><a href="?p=1.1.1.4">Effects</a></li>
<li><a href="?p=1.1.1.5">Accessories</a></li>
</ul>
</li>
<li>
<a class="head" href="?p=1.1.2"><span>Bass</span></a>
<ul>
<li><a href="?p=1.1.2.1">Electric</a></li>
<li><a href="?p=1.1.2.2">Acoustic</a></li>
<li><a href="?p=1.1.2.3">Amps</a></li>
<li><a href="?p=1.1.2.4">Effects</a></li>
<li><a href="?p=1.1.2.5">Accessories</a></li>
<li><a href="?p=1.1.2.5">Accessories</a></li>
<li><a href="?p=1.1.2.5">Accessories</a></li>
</ul>
</li>
<li>
<a class="head" href="?p=1.1.3">Drums</a>
<ul>
<li><a href="?p=1.1.3.2">Acoustic Drums</a></li>
<li><a href="?p=1.1.3.3">Electronic Drums</a></li>
<li><a href="?p=1.1.3.6">Accessories</a></li>
</ul>
</li>
</ul>
<dl id="list2">
<dt class="red">Red</dt>
<dd>
Fancy stuff about red thingies.
</dd>
<dt class="green selected">Green</dt>
<dd>
Green! Green! Green!
</dd>
<dt class="blue">Blue</dt>
<dd>
Cool kids are blue.
</dd>
</dl>
<div id="list3">
<div>
<div class="title">Tennis</div>
<div>
One ball, two players. Lots of fun.
</div>
</div>
<div>
<div class="title">Soccer</div>
<div>
One ball, 22 players. Lots of fun.
</div>
</div>
<div>
<div class="title">Baseball</div>
<div>
Well, one ball, some guys running around, some guys hitting others with a stick.<br/>
Sounds like fun, doesn't it?
</div>
<div>
Well, apart from the running part.
</div>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,150 @@
/*
* accordion unit tests
*/
(function($) {
module("accordion");
jQuery.ui.accordion.defaults.animated = false;
function state(accordion) {
var args = $.makeArray(arguments).slice(1);
$.each(args, function(i, n) {
equals(accordion.find("div").eq(i).is(":visible"), n);
});
}
$.fn.triggerEvent = function(type, target) {
return this.triggerHandler(type, [jQuery.event.fix({ type: type, target: target })]);
}
test("basics", function() {
state($('#list1').accordion(), 1, 0, 0);
});
test("autoheight", function() {
$('#navigation').accordion({ header: '.head', autoHeight: false });
equals( 90, $('#navigation ul:first').height() );
equals( 126, $('#navigation ul:eq(1)').height() );
equals( 54, $('#navigation ul:last').height() );
$('#navigation').accordion("destroy").accordion({ header: '.head', autoHeight: true });
equals( 126, $('#navigation ul:first').height() );
equals( 126, $('#navigation ul:eq(1)').height() );
equals( 126, $('#navigation ul:last').height() );
});
test("activate, numeric", function() {
var ac = $('#list1').accordion({ active: 1 });
state(ac, 0, 1, 0);
ac.accordion("activate", 2);
state(ac, 0, 0, 1);
ac.accordion("activate", 0);
state(ac, 1, 0, 0);
ac.accordion("activate", 1);
state(ac, 0, 1, 0);
ac.accordion("activate", 2);
state(ac, 0, 0, 1);
ac.accordion("activate", -1);
state(ac, 0, 0, 1);
});
test("activate, boolean and numeric, alwaysOpen:false", function() {
var ac = $('#list1').accordion({alwaysOpen: false}).accordion("activate", 2);
state(ac, 0, 0, 1);
ok("x", "----");
ac.accordion("activate", 0);
state(ac, 1, 0, 0);
ok("x", "----");
ac.accordion("activate", -1);
state(ac, 0, 0, 0);
});
test("activate, boolean, alwaysOpen:true", function() {
var ac = $('#list1').accordion().accordion("activate", 2);
state(ac, 0, 0, 1);
ac.accordion("activate", -1);
state(ac, 0, 0, 1);
});
test("activate, string expression", function() {
var ac = $('#list1').accordion({ active: ":last" });
state(ac, 0, 0, 1);
ac.accordion("activate", ":first");
state(ac, 1, 0, 0);
ac.accordion("activate", ":eq(1)");
state(ac, 0, 1, 0);
ac.accordion("activate", ":last");
state(ac, 0, 0, 1);
});
test("activate, jQuery or DOM element", function() {
var ac = $('#list1').accordion({ active: $("#list1 a:last") });
state(ac, 0, 0, 1);
ac.accordion("activate", $("#list1 a:first"));
state(ac, 1, 0, 0);
ac.accordion("activate", $("#list1 a")[1]);
state(ac, 0, 1, 0);
});
function state2(accordion) {
var args = $.makeArray(arguments).slice(1);
$.each(args, function(i, n) {
equals(accordion.find("ul").eq(i).is(":visible"), n);
});
}
test("handle click on header-descendant", function() {
var ac = $('#navigation').accordion({ header: '.head', autoHeight: false })
ac.triggerEvent("click", $('#navigation span:contains(Bass)')[0]);
state2(ac, 0, 1, 0);
});
test("active:false", function() {
$("#list1").accordion({
active: false,
alwaysOpen: false
});
equals( $("#list1 a.selected").size(), 0, "no headers selected" );
});
test("accordionchange event, open closed and close again", function() {
expect(8);
$("#list1").accordion({
active: false,
alwaysOpen: false
})
.one("accordionchange", function(event, ui) {
equals( ui.oldHeader.size(), 0 )
equals( ui.oldContent.size(), 0 )
equals( ui.newHeader.size(), 1 )
equals( ui.newContent.size(), 1 )
})
.accordion("activate", 0)
.one("accordionchange", function(event, ui) {
equals( ui.oldHeader.size(), 1 )
equals( ui.oldContent.size(), 1 )
equals( ui.newHeader.size(), 0 )
equals( ui.newContent.size(), 0 )
})
.accordion("activate", 0);
});
test("accessibility", function () {
expect(9);
var ac = $('#list1').accordion().accordion("activate", 1);
var headers = $(".ui-accordion-header");
equals( headers.eq(1).attr("tabindex"), "0", "active header should have tabindex=0");
equals( headers.eq(0).attr("tabindex"), "-1", "inactive header should have tabindex=-1");
equals( ac.attr("role"), "tablist", "main role");
equals( headers.attr("role"), "tab", "tab roles");
equals( headers.next().attr("role"), "tabpanel", "tabpanel roles");
equals( headers.eq(1).attr("aria-expanded"), "true", "active tab has aria-expanded");
equals( headers.eq(0).attr("aria-expanded"), "false", "inactive tab has aria-expanded");
ac.accordion("activate", 0);
equals( headers.eq(0).attr("aria-expanded"), "true", "newly active tab has aria-expanded");
equals( headers.eq(1).attr("aria-expanded"), "false", "newly inactive tab has aria-expanded");
});
})(jQuery);

View file

@ -0,0 +1,221 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI All Tests</title>
<link rel="stylesheet" href="qunit/testsuite.css" type="text/css" media="screen">
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../ui/ui.core.js"></script>
<script type="text/javascript" src="../ui/ui.accordion.js"></script>
<script type="text/javascript" src="../ui/ui.datepicker.js"></script>
<script type="text/javascript" src="../ui/ui.dialog.js"></script>
<script type="text/javascript" src="../ui/ui.draggable.js"></script>
<script type="text/javascript" src="../ui/ui.droppable.js"></script>
<script type="text/javascript" src="../ui/ui.resizable.js"></script>
<script type="text/javascript" src="../ui/ui.selectable.js"></script>
<script type="text/javascript" src="../ui/ui.slider.js"></script>
<script type="text/javascript" src="../ui/ui.sortable.js"></script>
<script type="text/javascript" src="../ui/ui.tabs.js"></script>
<script type="text/javascript" src="qunit/testrunner.js"></script>
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
<script type="text/javascript" src="plugins/cookie/jquery.cookie.js"></script>
<script type="text/javascript" src="accordion.js"></script>
<script type="text/javascript" src="datepicker.js"></script>
<script type="text/javascript" src="dialog.js"></script>
<script type="text/javascript" src="draggable.js"></script>
<script type="text/javascript" src="resizable.js"></script>
<script type="text/javascript" src="selectable.js"></script>
<script type="text/javascript" src="slider.js"></script>
<script type="text/javascript" src="sortable.js"></script>
<script type="text/javascript" src="tabs.js"></script>
<style type="text/css">
@import "../themes/default/ui.datepicker.css";
.xerror, .error, .ui-tabs-hide {
display: none;
}
</style>
</head>
<body>
<h1>jQuery UI All Tests</h1>
<h2 id="banner"></h2>
<h2 id="userAgent"></h2>
<h4>Run individual testsuites or doubleclick a test below</h4>
<ul>
<li><a href="accordion.html">Accordion</a></li>
<li><a href="datepicker.html">Datepicker</a></li>
<li><a href="dialog.html">Dialog</a></li>
<li><a href="draggable.html">Draggable</a></li>
<li><a href="resizable.html">Resizable</a></li>
<li><a href="selectable.html">Selectable</a></li>
<li><a href="slider.html">Slider</a></li>
<li><a href="sortable.html">Sortable</a></li>
<li><a href="tabs.html">Tabs</a></li>
</ul>
<ol id="tests"></ol>
<div id="main" style="position:absolute;top:-2000000px;">
<p><input type="text" id="dp1"/><input type="text" id="rem"/></p>
<div id="draggable1" style="background: green; width: 200px; height: 100px;">Relative</div>
<div id="draggable2" style="background: green; width: 200px; height: 100px; position: absolute; top: 10px; left: 10px;"><span>Absolute</span></div>
<div id="slider1"></div>
<div id="slider3" style="position: relative; margin: 40px; width: 217px; height: 28px;">
<div class="ui-slider-handle" style="position: absolute; height: 21px; left: 0px; bottom: 0px; width: 17px;"></div>
</div>
<div id="list1">
<a>There is one obvious advantage:</a>
<div>
<p>
You've seen it coming!<br/>
Buy now and get nothing for free!<br/>
Well, at least no free beer. Perhaps a bear, if you can afford it.
</p>
</div>
<a>Now that you've got...</a>
<div>
<p>
your bear, you have to admit it!<br/>
No, we aren't selling bears.
</p>
<p>
We could talk about renting one.
</p>
</div>
<a>Rent one bear, ...</a>
<div>
<p>
get two for three beer.
</p>
<p>
And now, for something completely different.
</p>
</div>
</div>
<ul id="navigation">
<li>
<a class="head" href="?p=1.1.1">Guitar</a>
<ul>
<li><a href="?p=1.1.1.1">Electric</a></li>
<li><a href="?p=1.1.1.2">Acoustic</a></li>
<li><a href="?p=1.1.1.3">Amps</a></li>
<li><a href="?p=1.1.1.4">Effects</a></li>
<li><a href="?p=1.1.1.5">Accessories</a></li>
</ul>
</li>
<li>
<a class="head" href="?p=1.1.2"><span>Bass</span></a>
<ul>
<li><a href="?p=1.1.2.1">Electric</a></li>
<li><a href="?p=1.1.2.2">Acoustic</a></li>
<li><a href="?p=1.1.2.3">Amps</a></li>
<li><a href="?p=1.1.2.4">Effects</a></li>
<li><a href="?p=1.1.2.5">Accessories</a></li>
<li><a href="?p=1.1.2.5">Accessories</a></li>
<li><a href="?p=1.1.2.5">Accessories</a></li>
</ul>
</li>
<li>
<a class="head" href="?p=1.1.3">Drums</a>
<ul>
<li><a href="?p=1.1.3.2">Acoustic Drums</a></li>
<li><a href="?p=1.1.3.3">Electronic Drums</a></li>
<li><a href="?p=1.1.3.6">Accessories</a></li>
</ul>
</li>
</ul>
<dl id="list2">
<dt class="red">Red</dt>
<dd>
Fancy stuff about red thingies.
</dd>
<dt class="green selected">Green</dt>
<dd>
Green! Green! Green!
</dd>
<dt class="blue">Blue</dt>
<dd>
Cool kids are blue.
</dd>
</dl>
<div id="list3">
<div>
<div class="title">Tennis</div>
<div>
One ball, two players. Lots of fun.
</div>
</div>
<div>
<div class="title">Soccer</div>
<div>
One ball, 22 players. Lots of fun.
</div>
</div>
<div>
<div class="title">Baseball</div>
<div>
Well, one ball, some guys running around, some guys hitting others with a stick.<br/>
Sounds like fun, doesn't it?
</div>
<div>
Well, apart from the running part.
</div>
</div>
</div>
<div id="resizable1" style="background: green; width: 100px; height: 100px;">I'm a resizable.</div>
<img src="images/test.jpg" id="resizable2" style="width: 100px; height: 100px;"/>
<ul id="selectable1">
<li>Item 1</li>
<li>Item 2</li>
<li class="special">Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</ul>
<ul id="sortable">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</ul>
<p><input type="text" id="inp"/><input type="text" id="alt"/><div id="inl"></div></p>
<input type="text" id="spin" />
<div id="tabs1">
<ul>
<li><a href="#fragment-1">1</a></li>
<li><a href="#fragment-2">2</a></li>
<li><a href="#fragment-3">3</a></li>
</ul>
<div id="fragment-1"></div>
<div id="fragment-2"></div>
<div id="fragment-3"></div>
</div>
<div id="tabs2">
<ul>
<li><a href="#colon:test">1</a></li>
<li><a href="#inline-style">2</a></li>
</ul>
<div id="colon:test"></div>
<div style="height: 300px;" id="inline-style"></div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,81 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI All Tests</title>
<link rel="stylesheet" href="qunit/testsuite.css" type="text/css" media="screen">
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../ui/ui.core.js"></script>
<script type="text/javascript">
var components = ["accordion","datepicker","dialog","draggable","resizable","selectable","slider","sortable","tabs"];
$(function() {
var $list = $("#individual_list"),
$main = $("#main");
$.each(components, function(i, val){
$list.append('<li><a href="' + val + '.html">' + val + '</a></li>');
$('<div class="component_panel" id="' + val + '">').appendTo($main);
$('#' + val).load(val + '.html #main *');
});
loadScripts();
function loadScripts() {
if ( $("div.component_panel").length == components.length ) {
$.each(components, function(i, val){
$('head').append('<script type="text/javascript" src="' + val + '.js"></scr'+'ipt>');
});
} else {
setTimeout(loadScripts, 10);
}
}
});
</script>
<script type="text/javascript" src="../ui/ui.accordion.js"></script>
<script type="text/javascript" src="../ui/ui.datepicker.js"></script>
<script type="text/javascript" src="../ui/ui.dialog.js"></script>
<script type="text/javascript" src="../ui/ui.draggable.js"></script>
<script type="text/javascript" src="../ui/ui.droppable.js"></script>
<script type="text/javascript" src="../ui/ui.resizable.js"></script>
<script type="text/javascript" src="../ui/ui.selectable.js"></script>
<script type="text/javascript" src="../ui/ui.slider.js"></script>
<script type="text/javascript" src="../ui/ui.sortable.js"></script>
<script type="text/javascript" src="../ui/ui.tabs.js"></script>
<script type="text/javascript" src="qunit/testrunner.js"></script>
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
<script type="text/javascript" src="plugins/cookie/jquery.cookie.js"></script>
<style type="text/css">
@import "../themes/default/ui.datepicker.css";
.xerror, .error, .ui-tabs-hide {
display: none;
}
</style>
</head>
<body>
<h1>jQuery UI All Tests</h1>
<h2 id="banner"></h2>
<h2 id="userAgent"></h2>
<h4>Run individual testsuites or doubleclick a test below</h4>
<ul id="individual_list">
</ul>
<ol id="tests"></ol>
<div id="main" style="position:absolute; top:-2000000px;">
</div>
</body>
</html>

View file

@ -0,0 +1,63 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Core Test Suite</title>
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../ui/ui.core.js"></script>
<link type="text/css" href="testsuite.css" rel="stylesheet" />
<script type="text/javascript" src="testsuite.js"></script>
<script type="text/javascript" src="qunit/testrunner.js"></script>
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
<script type="text/javascript" src="core.js"></script>
</head>
<body>
<div id="main">
<div id="wrap1">
<input id="input1-1" />
<input type="text" id="input1-2" />
<input type="checkbox" id="input1-3" />
<input type="radio" id="input1-4" />
<input type="button" id="input1-5" />
<input type="hidden" id="input1-6" />
<select id="input1-7"></select>
<textarea id="input1-8"></textarea>
<a href="#" id="anchor1-1">anchor</a>
<a id="anchor1-2">anchor</a>
</div>
<div id="wrap2">
<input id="input2-1" disabled="disabled" />
<input type="text" id="input2-2" disabled="disabled" />
<input type="checkbox" id="input2-3" disabled="disabled" />
<input type="radio" id="input2-4" disabled="disabled" />
<input type="button" id="input2-5" disabled="disabled" />
<input type="hidden" id="input2-6" disabled="disabled" />
<select id="input2-7" disabled="disabled"></select>
<textarea id="input2-8" disabled="disabled"></textarea>
</div>
<div id="wrap3">
<div id="wrap3-1" style="display: none;">
<input id="input3-1" />
<a href="#" id="anchor3-1">anchor</a>
</div>
<div id="wrap3-2" style="visibility: hidden;">
<input id="input3-2" />
<a href="#" id="anchor3-2">anchor</a>
</div>
<input id="input3-3" style="display: none;">
<input id="input3-4" style="visibility: hidden;">
</div>
<div id="wrap4">
<input id="input4-1" tabindex="0" />
<input id="input4-2" tabindex="10" />
<input id="input4-3" tabindex="-1" />
<input id="input4-4" tabindex="-50" />
</div>
<div id="aria"></div>
</div>
</body>
</html>

View file

@ -0,0 +1,78 @@
/*
* core unit tests
*/
(function($) {
module("selectors");
test("tabbable - enabled elements", function() {
expect(10);
ok( $('#input1-1').is(':tabbable'), 'input, no type');
ok( $('#input1-2').is(':tabbable'), 'input, type text');
ok( $('#input1-3').is(':tabbable'), 'input, type checkbox');
ok( $('#input1-4').is(':tabbable'), 'input, type radio');
ok( $('#input1-5').is(':tabbable'), 'input, type button');
ok(!$('#input1-6').is(':tabbable'), 'input, type hidden');
ok( $('#input1-7').is(':tabbable'), 'select');
ok( $('#input1-8').is(':tabbable'), 'textarea');
ok( $('#anchor1-1').is(':tabbable'), 'anchor with href');
ok(!$('#anchor1-2').is(':tabbable'), 'anchor without href');
});
test("tabbable - disabled elements", function() {
expect(8);
ok(!$('#input2-1').is(':tabbable'), 'input, no type');
ok(!$('#input2-2').is(':tabbable'), 'input, type text');
ok(!$('#input2-3').is(':tabbable'), 'input, type checkbox');
ok(!$('#input2-4').is(':tabbable'), 'input, type radio');
ok(!$('#input2-5').is(':tabbable'), 'input, type button');
ok(!$('#input2-6').is(':tabbable'), 'input, type hidden');
ok(!$('#input2-7').is(':tabbable'), 'select');
ok(!$('#input2-8').is(':tabbable'), 'textarea');
});
test("tabbable - hidden styles", function() {
expect(6);
ok(!$('#input3-1').is(':tabbable'), 'input, hidden wrapper - display: none');
ok(!$('#anchor3-1').is(':tabbable'), 'anchor, hidden wrapper - display: none');
ok(!$('#input3-2').is(':tabbable'), 'input, hidden wrapper - visibility: hidden');
ok(!$('#anchor3-2').is(':tabbable'), 'anchor, hidden wrapper - visibility: hidden');
ok(!$('#input3-3').is(':tabbable'), 'input, display: none');
ok(!$('#input3-4').is(':tabbable'), 'input, visibility: hidden');
});
test("tabbable - tabindex", function() {
expect(4);
ok( $('#input4-1').is(':tabbable'), 'input, tabindex 0');
ok( $('#input4-2').is(':tabbable'), 'input, tabindex 10');
ok(!$('#input4-3').is(':tabbable'), 'input, tabindex -1');
ok(!$('#input4-4').is(':tabbable'), 'input, tabindex -50');
});
module('jQuery extensions');
test("attr - aria", function() {
expect(6);
var el = $('#aria');
ok(!el.attr('role'), 'role is empty via attr');
equals(el.attr('role', 'tablist').attr('role'), 'tablist', 'role is tablist');
equals(el.attr('aria-expanded'), undefined, 'aria expanded is undefined');
el.attr('aria-expanded', true);
equals(el.attr('aria-expanded'), 'true', 'aria expanded is true');
el.removeAttr('aria-expanded');
equals(el.attr('aria-expanded'), undefined, 'aria expanded is undefined after removing');
el.attr('aria-expanded', false);
equals(el.attr('aria-expanded'), 'false', 'aria expanded is false');
});
})(jQuery);

View file

@ -0,0 +1,30 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Datepicker Test Suite</title>
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../ui/ui.core.js"></script>
<script type="text/javascript" src="../ui/ui.datepicker.js"></script>
<script type="text/javascript" src="../ui/i18n/ui.datepicker-fr.js"></script>
<script type="text/javascript" src="../ui/i18n/ui.datepicker-he.js"></script>
<link type="text/css" href="testsuite.css" rel="stylesheet" />
<script type="text/javascript" src="testsuite.js"></script>
<script type="text/javascript" src="qunit/testrunner.js"></script>
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
<style type="text/css">
@import "../themes/default/ui.datepicker.css";
</style>
<script type="text/javascript" src="datepicker.js"></script>
</head>
<body>
<div id="main">
<p><input type="text" id="inp"/><input type="text" id="alt"/><div id="inl"></div></p>
</div>
</body>
</html>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,26 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Dialog Test Suite</title>
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../ui/ui.core.js"></script>
<script type="text/javascript" src="../ui/ui.dialog.js"></script>
<script type="text/javascript" src="../ui/ui.draggable.js"></script>
<script type="text/javascript" src="../ui/ui.resizable.js"></script>
<link type="text/css" href="testsuite.css" rel="stylesheet" />
<script type="text/javascript" src="testsuite.js"></script>
<script type="text/javascript" src="qunit/testrunner.js"></script>
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
<script type="text/javascript" src="dialog.js"></script>
</head>
<body>
<div id="main">
<div id="dialog1">Dialog Content</div>
</div>
</body>
</html>

View file

@ -0,0 +1,746 @@
/*
* dialog unit tests
*/
(function($) {
//
// Dialog Test Helper Functions
//
var defaults = {
autoOpen: true,
autoResize: true,
buttons: {},
closeOnEscape: true,
closeText: 'close',
disabled: false,
dialogClass: undefined,
draggable: true,
height: 200,
maxHeight: undefined,
maxWidth: undefined,
minHeight: 100,
minWidth: 150,
modal: false,
overlay: {},
position: 'center',
resizable: true,
stack: true,
title: '',
width: 300
};
var el,
offsetBefore, offsetAfter,
heightBefore, heightAfter,
widthBefore, widthAfter,
dragged;
function dlg() {
return el.data("dialog").element.parents(".ui-dialog:first");
}
function isOpen(why) {
ok(dlg().is(":visible"), why);
}
function isNotOpen(why) {
ok(!dlg().is(":visible"), why);
}
function drag(handle, dx, dy) {
var d = dlg();
offsetBefore = d.offset();
heightBefore = d.height();
widthBefore = d.width();
//this mouseover is to work around a limitation in resizable
//TODO: fix resizable so handle doesn't require mouseover in order to be used
$(handle, d).simulate("mouseover");
$(handle, d).simulate("drag", {
dx: dx || 0,
dy: dy || 0
});
dragged = { dx: dx, dy: dy };
offsetAfter = d.offset();
heightAfter = d.height();
widthAfter = d.width();
}
function moved(dx, dy, msg) {
msg = msg ? msg + "." : "";
var actual = { left: offsetAfter.left, top: offsetAfter.top };
var expected = { left: offsetBefore.left + dx, top: offsetBefore.top + dy };
same(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
}
function shouldmove(why) {
var handle = $(".ui-dialog-titlebar", dlg());
drag(handle, 50, 50);
moved(50, 50, why);
}
function shouldnotmove(why) {
var handle = $(".ui-dialog-titlebar", dlg());
drag(handle, 50, 50);
moved(0, 0, why);
}
function resized(dw, dh, msg) {
msg = msg ? msg + "." : "";
var actual = { width: widthAfter, height: heightAfter };
var expected = { width: widthBefore + dw, height: heightBefore + dh };
same(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
}
function shouldresize(why) {
var handle = $(".ui-resizable-se", dlg());
drag(handle, 50, 50);
resized(50, 50, why);
}
function shouldnotresize(why) {
var handle = $(".ui-resizable-se", dlg());
drag(handle, 50, 50);
resized(0, 0, why);
}
function broder(el, side){
return parseInt(el.css('border-' + side + '-width'), 10);
}
function margin(el, side) {
return parseInt(el.css('margin-' + side), 10);
}
// Dialog Tests
module("dialog");
test("init", function() {
expect(6);
$("<div></div>").appendTo('body').dialog().remove();
ok(true, '.dialog() called on element');
$([]).dialog().remove();
ok(true, '.dialog() called on empty collection');
$('<div></div>').dialog().remove();
ok(true, '.dialog() called on disconnected DOMElement');
$('<div></div>').dialog().dialog("foo").remove();
ok(true, 'arbitrary method called after init');
el = $('<div></div>').dialog();
var foo = el.data("foo.dialog");
el.remove();
ok(true, 'arbitrary option getter after init');
$('<div></div>').dialog().data("foo.dialog", "bar").remove();
ok(true, 'arbitrary option setter after init');
});
test("destroy", function() {
expect(6);
$("<div></div>").appendTo('body').dialog().dialog("destroy").remove();
ok(true, '.dialog("destroy") called on element');
$([]).dialog().dialog("destroy").remove();
ok(true, '.dialog("destroy") called on empty collection');
$('<div></div>').dialog().dialog("destroy").remove();
ok(true, '.dialog("destroy") called on disconnected DOMElement');
$('<div></div>').dialog().dialog("destroy").dialog("foo").remove();
ok(true, 'arbitrary method called after destroy');
el = $('<div></div>').dialog();
var foo = el.dialog("destroy").data("foo.dialog");
el.remove();
ok(true, 'arbitrary option getter after destroy');
$('<div></div>').dialog().dialog("destroy").data("foo.dialog", "bar").remove();
ok(true, 'arbitrary option setter after destroy');
});
/*
//This one takes a while to run
test("element types", function() {
var typeNames = ('p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form'
+ ',table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr'
+ ',acronym,code,samp,kbd,var,img,object,hr'
+ ',input,button,label,select,iframe').split(',');
$.each(typeNames, function(i) {
var typeName = typeNames[i];
el = $(document.createElement(typeName)).appendTo('body');
(typeName == 'table' && el.append("<tr><td>content</td></tr>"));
el.dialog();
ok(true, '$("&lt;' + typeName + '/&gt").dialog()');
el.dialog("destroy");
el.remove();
});
});
*/
test("defaults", function() {
el = $('<div></div>').dialog();
$.each(defaults, function(key, val) {
var actual = el.data(key + ".dialog"), expected = val;
same(actual, expected, key);
});
el.remove();
});
test("title id", function() {
expect(3);
var titleId;
// reset the uuid so we know what values to expect
$.ui.dialog.uuid = 0;
el = $('<div></div>').dialog();
titleId = dlg().find('.ui-dialog-title').attr('id');
equals(titleId, 'ui-dialog-title-1', 'auto-numbered title id');
el.remove();
el = $('<div></div>').dialog();
titleId = dlg().find('.ui-dialog-title').attr('id');
equals(titleId, 'ui-dialog-title-2', 'auto-numbered title id');
el.remove();
el = $('<div id="foo"/>').dialog();
titleId = dlg().find('.ui-dialog-title').attr('id');
equals(titleId, 'ui-dialog-title-foo', 'carried over title id');
el.remove();
});
test("ARIA", function() {
expect(4);
el = $('<div></div>').dialog();
equals(dlg().attr('role'), 'dialog', 'dialog role');
var labelledBy = dlg().attr('aria-labelledby');
ok(labelledBy.length > 0, 'has aria-labelledby attribute');
equals(dlg().find('.ui-dialog-title').attr('id'), labelledBy,
'proper aria-labelledby attribute');
equals(dlg().find('.ui-dialog-titlebar-close').attr('role'), 'button',
'close link role');
el.remove();
});
module("dialog: Options");
test("autoOpen", function() {
expect(2);
el = $('<div></div>').dialog({ autoOpen: false });
isNotOpen('.dialog({ autoOpen: false })');
el.remove();
el = $('<div></div>').dialog({ autoOpen: true });
isOpen('.dialog({ autoOpen: true })');
el.remove();
});
test("autoResize", function() {
expect(2);
var actual,
before,
expected,
handle;
el = $('<div>content<br>content<br>content<br>content<br>content</div>').dialog({ autoResize: false });
expected = { height: el.height() };
handle = $(".ui-resizable-se", dlg());
drag(handle, 50, 50);
actual = { height: el.height() };
same(actual, expected, '.dialog({ autoResize: false })');
el.remove();
el = $('<div>content<br>content<br>content<br>content<br>content</div>').dialog({ autoResize: true });
before = { width: el.width(), height: el.height() };
handle = $(".ui-resizable-se", dlg());
drag(handle, 50, 50);
expected = { width: before.width + 50, height: before.height + 50 };
actual = { width: el.width(), height: el.height() };
same(actual, expected, '.dialog({ autoResize: true })');
el.remove();
});
test("buttons", function() {
expect(17);
var buttons = {
"Ok": function(ev, ui) {
ok(true, "button click fires callback");
equals(this, el[0], "context of callback");
equals(ev.target, btn[0], "event target");
},
"Cancel": function(ev, ui) {
ok(true, "button click fires callback");
equals(this, el[0], "context of callback");
equals(ev.target, btn[1], "event target");
}
};
el = $('<div></div>').dialog({ buttons: buttons });
var btn = $("button", dlg());
equals(btn.length, 2, "number of buttons");
var i = 0;
$.each(buttons, function(key, val) {
equals(btn.eq(i).text(), key, "text of button " + (i+1));
i++;
});
equals(btn.parent().attr('className'), 'ui-dialog-buttonpane', "buttons in container");
btn.trigger("click");
var newButtons = {
"Close": function(ev, ui) {
ok(true, "button click fires callback");
equals(this, el[0], "context of callback");
equals(ev.target, btn[0], "event target");
}
};
equals(el.data("buttons.dialog"), buttons, '.data("buttons.dialog") getter');
el.data("buttons.dialog", newButtons);
equals(el.data("buttons.dialog"), newButtons, '.data("buttons.dialog", ...) setter');
btn = $("button", dlg());
equals(btn.length, 1, "number of buttons after setter");
btn.trigger('click');
i = 0;
$.each(newButtons, function(key, val) {
equals(btn.eq(i).text(), key, "text of button " + (i+1));
i += 1;
});
el.remove();
});
test("closeOnEscape", function() {
ok(false, 'missing test');
});
test("closeText", function() {
expect(3);
el = $('<div></div>').dialog();
equals(dlg().find('.ui-dialog-titlebar-close span').text(), 'close',
'default close text');
el.remove();
el = $('<div></div>').dialog({ closeText: "foo" });
equals(dlg().find('.ui-dialog-titlebar-close span').text(), 'foo',
'closeText on init');
el.remove();
el = $('<div></div>').dialog().dialog('option', 'closeText', 'bar');
equals(dlg().find('.ui-dialog-titlebar-close span').text(), 'bar',
'closeText via option method');
el.remove();
});
test("dialogClass", function() {
expect(4);
el = $('<div></div>').dialog();
equals(dlg().is(".foo"), false, 'dialogClass not specified. foo class added');
el.remove();
el = $('<div></div>').dialog({ dialogClass: "foo" });
equals(dlg().is(".foo"), true, 'dialogClass in init. foo class added');
el.remove();
el = $('<div></div>').dialog({ dialogClass: "foo bar" });
equals(dlg().is(".foo"), true, 'dialogClass in init, two classes. foo class added');
equals(dlg().is(".bar"), true, 'dialogClass in init, two classes. bar class added');
el.remove();
});
test("draggable", function() {
expect(4);
el = $('<div></div>').dialog({ draggable: false });
shouldnotmove();
el.data('draggable.dialog', true);
shouldmove();
el.remove();
el = $('<div></div>').dialog({ draggable: true });
shouldmove();
el.data('draggable.dialog', false);
shouldnotmove();
el.remove();
});
test("height", function() {
expect(3);
el = $('<div></div>').dialog();
equals(dlg().height(), defaults.height, "default height");
el.remove();
el = $('<div></div>').dialog({ height: 437 });
equals(dlg().height(), 437, "explicit height");
el.remove();
el = $('<div></div>').dialog();
el.data('height.dialog', 438);
equals(dlg().height(), 438, "explicit height set after init");
el.remove();
});
test("maxHeight", function() {
expect(3);
el = $('<div></div>').dialog({ maxHeight: 400 });
drag('.ui-resizable-s', 1000, 1000);
equals(heightAfter, 400, "maxHeight");
el.remove();
el = $('<div></div>').dialog({ maxHeight: 400 });
drag('.ui-resizable-n', -1000, -1000);
equals(heightAfter, 400, "maxHeight");
el.remove();
el = $('<div></div>').dialog({ maxHeight: 400 }).data('maxHeight.dialog', 600);
drag('.ui-resizable-n', -1000, -1000);
equals(heightAfter, 600, "maxHeight");
el.remove();
});
test("maxWidth", function() {
expect(3);
el = $('<div></div>').dialog({ maxWidth: 400 });
drag('.ui-resizable-e', 1000, 1000);
equals(widthAfter, 400, "maxWidth");
el.remove();
el = $('<div></div>').dialog({ maxWidth: 400 });
drag('.ui-resizable-w', -1000, -1000);
equals(widthAfter, 400, "maxWidth");
el.remove();
el = $('<div></div>').dialog({ maxWidth: 400 }).data('maxWidth.dialog', 600);
drag('.ui-resizable-w', -1000, -1000);
equals(widthAfter, 600, "maxWidth");
el.remove();
});
test("minHeight", function() {
expect(3);
el = $('<div></div>').dialog({ minHeight: 10 });
drag('.ui-resizable-s', -1000, -1000);
equals(heightAfter, 10, "minHeight");
el.remove();
el = $('<div></div>').dialog({ minHeight: 10 });
drag('.ui-resizable-n', 1000, 1000);
equals(heightAfter, 10, "minHeight");
el.remove();
el = $('<div></div>').dialog({ minHeight: 10 }).data('minHeight.dialog', 30);
drag('.ui-resizable-n', 1000, 1000);
equals(heightAfter, 30, "minHeight");
el.remove();
});
test("minWidth", function() {
expect(3);
el = $('<div></div>').dialog({ minWidth: 10 });
drag('.ui-resizable-e', -1000, -1000);
equals(widthAfter, 10, "minWidth");
el.remove();
el = $('<div></div>').dialog({ minWidth: 10 });
drag('.ui-resizable-w', 1000, 1000);
equals(widthAfter, 10, "minWidth");
el.remove();
el = $('<div></div>').dialog({ minWidth: 30 }).data('minWidth.dialog', 30);
drag('.ui-resizable-w', 1000, 1000);
equals(widthAfter, 30, "minWidth");
el.remove();
});
test("modal", function() {
ok(false, "missing test");
});
test("overlay", function() {
ok(false, "missing test");
});
test("position", function() {
ok(false, "missing test");
});
test("resizable", function() {
expect(4);
el = $('<div></div>').dialog();
shouldresize("[default]");
el.data('resizable.dialog', false);
shouldnotresize('disabled after init');
el.remove();
el = $('<div></div>').dialog({ resizable: false });
shouldnotresize("disabled in init options");
el.data('resizable.dialog', true);
shouldresize('enabled after init');
el.remove();
});
test("stack", function() {
ok(false, "missing test");
});
test("title", function() {
expect(5);
function titleText() {
return dlg().find(".ui-dialog-title").html();
}
el = $('<div></div>').dialog();
equals(titleText(), "&nbsp;", "[default]");
el.remove();
el = $('<div title="foo"/>').dialog();
equals(titleText(), "foo", "title in element attribute");
el.remove();
el = $('<div></div>').dialog({ title: 'foo' });
equals(titleText(), "foo", "title in init options");
el.remove();
el = $('<div title="foo"/>').dialog({ title: 'bar' });
equals(titleText(), "bar", "title in init options should override title in element attribute");
el.remove();
el = $('<div></div>').dialog().data('title.dialog', 'foo');
equals(titleText(), 'foo', 'title after init');
el.remove();
});
test("width", function() {
expect(3);
el = $('<div></div>').dialog();
equals(dlg().width(), defaults.width, "default width");
el.remove();
el = $('<div></div>').dialog({width: 437 });
equals(dlg().width(), 437, "explicit width");
el.data('width.dialog', 438);
equals(dlg().width(), 438, 'explicit width after init');
el.remove();
});
module("dialog: Methods");
test("isOpen", function() {
expect(4);
el = $('<div></div>').dialog();
equals(el.dialog('isOpen'), true, "dialog is open after init");
el.dialog('close');
equals(el.dialog('isOpen'), false, "dialog is closed");
el.remove();
el = $('<div></div>').dialog({autoOpen: false});
equals(el.dialog('isOpen'), false, "dialog is closed after init");
el.dialog('open');
equals(el.dialog('isOpen'), true, "dialog is open");
el.remove();
});
module("dialog: Callbacks");
test("open", function() {
expect(6);
el = $("<div></div>");
el.dialog({
open: function(ev, ui) {
ok(true, 'autoOpen: true fires open callback');
equals(this, el[0], "context of callback");
}
});
el.remove();
el = $("<div></div>");
el.dialog({
autoOpen: false,
open: function(ev, ui) {
ok(true, '.dialog("open") fires open callback');
equals(this, el[0], "context of callback");
}
});
el.dialog("open");
el.remove();
el = $('<div></div>').dialog({
autoOpen: false
});
el.bind('dialogopen', function(ev, ui) {
ok(true, 'dialog("open") fires open event');
equals(this, el[0], 'context of event');
});
el.dialog('open');
el.remove();
});
test("dragStart", function() {
expect(2);
el = $("<div></div>");
el.dialog({
dragStart: function(ev, ui) {
ok(true, 'dragging fires dragStart callback');
equals(this, el[0], "context of callback");
}
});
var handle = $(".ui-dialog-titlebar", dlg());
drag(handle, 50, 50);
el.remove();
});
test("drag", function() {
var fired = false;
el = $("<div></div>");
el.dialog({
drag: function(ev, ui) {
fired = true;
equals(this, el[0], "context of callback");
}
});
var handle = $(".ui-dialog-titlebar", dlg());
drag(handle, 50, 50);
ok(fired, "drag fired");
el.remove();
});
test("dragStop", function() {
expect(2);
el = $("<div></div>");
el.dialog({
dragStop: function(ev, ui) {
ok(true, 'dragging fires dragStop callback');
equals(this, el[0], "context of callback");
}
});
var handle = $(".ui-dialog-titlebar", dlg());
drag(handle, 50, 50);
el.remove();
});
test("resizeStart", function() {
expect(2);
el = $("<div></div>");
el.dialog({
resizeStart: function(ev, ui) {
ok(true, 'resizing fires resizeStart callback');
equals(this, el[0], "context of callback");
}
});
var handle = $(".ui-resizable-se", dlg());
drag(handle, 50, 50);
el.remove();
});
test("resize", function() {
var fired = false;
el = $("<div></div>");
el.dialog({
resize: function(ev, ui) {
fired = true;
equals(this, el[0], "context of callback");
}
});
var handle = $(".ui-resizable-se", dlg());
drag(handle, 50, 50);
ok(fired, "resize fired");
el.remove();
});
test("resizeStop", function() {
expect(2);
el = $("<div></div>");
el.dialog({
resizeStop: function(ev, ui) {
ok(true, 'resizing fires resizeStop callback');
equals(this, el[0], "context of callback");
}
});
var handle = $(".ui-resizable-se", dlg());
drag(handle, 50, 50);
el.remove();
});
test("close", function() {
expect(4);
el = $('<div></div>').dialog({
close: function(ev, ui) {
ok(true, '.dialog("close") fires close callback');
equals(this, el[0], "context of callback");
}
});
el.dialog("close");
el.remove();
el = $('<div></div>').dialog().bind('dialogclose', function(ev, ui) {
ok(true, '.dialog("close") firse dialogclose event');
equals(this, el[0], 'context of event');
});
el.dialog('close');
el.remove();
});
test("beforeclose", function() {
expect(6);
el = $('<div></div>').dialog({
beforeclose: function(ev, ui) {
ok(true, '.dialog("close") fires beforeclose callback');
equals(this, el[0], "context of callback");
return false;
}
});
el.dialog('close');
isOpen('beforeclose callback should prevent dialog from closing');
el.remove();
el = $('<div></div>').dialog().bind('dialogbeforeclose', function(ev, ui) {
ok(true, '.dialog("close") triggers dialogbeforeclose event');
equals(this, el[0], "context of event");
return false;
});
el.dialog('close');
isOpen('dialogbeforeclose event should prevent dialog from closing');
el.remove();
});
module("dialog: Tickets");
})(jQuery);

View file

@ -0,0 +1,28 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Draggable Test Suite</title>
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../ui/ui.core.js"></script>
<script type="text/javascript" src="../ui/ui.draggable.js"></script>
<link type="text/css" href="testsuite.css" rel="stylesheet" />
<script type="text/javascript" src="testsuite.js"></script>
<script type="text/javascript" src="qunit/testrunner.js"></script>
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
<script type="text/javascript" src="draggable.js"></script>
</head>
<body>
<div id="main">
<div id="draggable1" style="background: green; width: 200px; height: 100px;">Relative</div>
<div id="draggable2" style="background: green; width: 200px; height: 100px; position: absolute; top: 10px; left: 10px;"><span>Absolute</span></div>
<div style='width: 1px; height: 1000px;'></div>
</div>
<div style="width: 1px; height: 2000px;"></div>
</body>
</html>

View file

@ -0,0 +1,787 @@
/*
* draggable unit tests
*/
(function($) {
//
// Draggable Test Helper Functions
//
var defaults = {
appendTo: "parent",
axis: false,
cancel: ":input",
connectToSortable: false,
containment: false,
cursor: "default",
cursorAt: null,
delay: 0,
disabled: false,
distance: 1,
grid: false,
handle: false,
helper: "original",
iframeFix: false,
opacity: 1.0,
refreshPositions: false,
revert: false,
revertDuration: 500,
scroll: true,
scrollSensitivity: 20,
scrollSpeed: 20,
scope: "default",
snap: false,
snapMode: "both",
snapTolerance: 20,
stack: false,
zIndex: null
};
var el, offsetBefore, offsetAfter, dragged;
var drag = function(handle, dx, dy) {
var element = el.data("draggable").element;
offsetBefore = el.offset();
$(handle).simulate("drag", {
dx: dx || 0,
dy: dy || 0
});
dragged = { dx: dx, dy: dy };
offsetAfter = el.offset();
}
var moved = function (dx, dy, msg) {
msg = msg ? msg + "." : "";
var actual = { left: offsetAfter.left, top: offsetAfter.top };
var expected = { left: offsetBefore.left + dx, top: offsetBefore.top + dy };
same(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
}
function shouldmove(why) {
drag(el, 50, 50);
moved(50, 50, why);
}
function shouldnotmove(why) {
drag(el, 50, 50);
moved(0, 0, why);
}
var border = function(el, side) { return parseInt(el.css('border-' + side + '-width')); }
var margin = function(el, side) { return parseInt(el.css('margin-' + side)); }
// Draggable Tests
module("draggable");
test("init", function() {
expect(6);
$("<div></div>").appendTo('body').draggable().remove();
ok(true, '.draggable() called on element');
$([]).draggable();
ok(true, '.draggable() called on empty collection');
$("<div></div>").draggable();
ok(true, '.draggable() called on disconnected DOMElement');
$("<div></div>").draggable().draggable("foo");
ok(true, 'arbitrary method called after init');
$("<div></div>").draggable().data("foo.draggable");
ok(true, 'arbitrary option getter after init');
$("<div></div>").draggable().data("foo.draggable", "bar");
ok(true, 'arbitrary option setter after init');
});
test("destroy", function() {
expect(6);
$("<div></div>").appendTo('body').draggable().draggable("destroy").remove();
ok(true, '.draggable("destroy") called on element');
$([]).draggable().draggable("destroy");
ok(true, '.draggable("destroy") called on empty collection');
$("<div></div>").draggable().draggable("destroy");
ok(true, '.draggable("destroy") called on disconnected DOMElement');
$("<div></div>").draggable().draggable("destroy").draggable("foo");
ok(true, 'arbitrary method called after destroy');
$("<div></div>").draggable().draggable("destroy").data("foo.draggable");
ok(true, 'arbitrary option getter after destroy');
$("<div></div>").draggable().draggable("destroy").data("foo.draggable", "bar");
ok(true, 'arbitrary option setter after destroy');
});
test("enable", function() {
expect(6);
el = $("#draggable2").draggable({ disabled: true });
shouldnotmove('.draggable({ disabled: true })');
el.draggable("enable");
shouldmove('.draggable("enable")');
equals(el.data("disabled.draggable"), false, "disabled.draggable getter");
el.draggable("destroy");
el.draggable({ disabled: true });
shouldnotmove('.draggable({ disabled: true })');
el.data("disabled.draggable", false);
equals(el.data("disabled.draggable"), false, "disabled.draggable setter");
shouldmove('.data("disabled.draggable", false)');
});
test("disable", function() {
expect(6);
el = $("#draggable2").draggable({ disabled: false });
shouldmove('.draggable({ disabled: false })');
el.draggable("disable");
shouldnotmove('.draggable("disable")');
equals(el.data("disabled.draggable"), true, "disabled.draggable getter");
el.draggable("destroy");
el.draggable({ disabled: false });
shouldmove('.draggable({ disabled: false })');
el.data("disabled.draggable", true);
equals(el.data("disabled.draggable"), true, "disabled.draggable setter");
shouldnotmove('.data("disabled.draggable", true)');
});
test("element types", function() {
var typeNames = ('p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form'
+ ',table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr'
+ ',acronym,code,samp,kbd,var,img,object,hr'
+ ',input,button,label,select,iframe').split(',');
$.each(typeNames, function(i) {
var typeName = typeNames[i];
el = $(document.createElement(typeName)).appendTo('body');
(typeName == 'table' && el.append("<tr><td>content</td></tr>"));
el.draggable({ cancel: '' });
drag(el, 50, 50);
moved(50, 50, "&lt;" + typeName + "&gt;");
el.draggable("destroy");
el.remove();
});
});
test("defaults", function() {
el = $('<div></div>').draggable();
$.each(defaults, function(key, val) {
var actual = el.data(key + ".draggable"), expected = val;
same(actual, expected, key);
});
el.remove();
});
test("No options, relative", function() {
el = $("#draggable1").draggable();
drag(el, 50, 50);
moved(50, 50);
});
test("No options, absolute", function() {
el = $("#draggable2").draggable();
drag(el, 50, 50);
moved(50, 50);
});
module("draggable: Options");
test("{ axis: false }, default", function() {
el = $("#draggable2").draggable({ axis: false });
drag(el, 50, 50);
moved(50, 50);
});
test("{ axis: 'x' }", function() {
el = $("#draggable2").draggable({ axis: "x" });
drag(el, 50, 50);
moved(50, 0);
});
test("{ axis: 'y' }", function() {
el = $("#draggable2").draggable({ axis: "y" });
drag(el, 50, 50);
moved(0, 50);
});
test("{ axis: ? }, unexpected", function() {
var unexpected = {
"true": true,
"{}": {},
"[]": [],
"null": null,
"undefined": undefined,
"function() {}": function() {}
};
$.each(unexpected, function(key, val) {
el = $("#draggable2").draggable({ axis: val });
drag(el, 50, 50);
moved(50, 50, "axis: " + key);
el.draggable("destroy");
})
});
test("{ cancel: 'span' }", function() {
el = $("#draggable2").draggable();
drag("#draggable2 span", 50, 50);
moved(50, 50);
el.draggable("destroy");
el = $("#draggable2").draggable({ cancel: 'span' });
drag("#draggable2 span", 50, 50);
moved(0, 0);
});
test("{ cancel: ? }, unexpected", function() {
var unexpected = {
"true": true,
"false": false,
"{}": {},
"[]": [],
"null": null,
"undefined": undefined,
"function() {return '';}": function() {return '';},
"function() {return true;}": function() {return true;},
"function() {return false;}": function() {return false;}
};
$.each(unexpected, function(key, val) {
el = $("#draggable2").draggable({ cancel: val });
drag(el, 50, 50);
var expected = [50, 50];
moved(expected[0], expected[1], "cancel: " + key);
el.draggable("destroy");
})
});
test("{ containment: 'parent' }, relative", function() {
el = $("#draggable1").draggable({ containment: 'parent' });
var p = el.parent(), po = p.offset();
drag(el, -100, -100);
var expected = {
left: po.left + border(p, 'left') + margin(el, 'left'),
top: po.top + border(p, 'top') + margin(el, 'top')
}
same(offsetAfter, expected, 'compare offset to parent');
});
test("{ containment: 'parent' }, absolute", function() {
el = $("#draggable2").draggable({ containment: 'parent' });
var p = el.parent(), po = p.offset();
drag(el, -100, -100);
var expected = {
left: po.left + border(p, 'left') + margin(el, 'left'),
top: po.top + border(p, 'top') + margin(el, 'top')
}
same(offsetAfter, expected, 'compare offset to parent');
});
test("{ cursor: 'move' }", function() {
function getCursor() { return $("body").css("cursor"); }
expect(2);
var expected = "move", actual, before, after;
el = $("#draggable2").draggable({
cursor: expected,
start: function(event, ui) {
actual = getCursor();
}
});
before = getCursor();
drag("#draggable2", -1, -1);
after = getCursor();
equals(actual, expected, "start callback: cursor '" + expected + "'");
equals(after, before, "after drag: cursor restored");
});
test("{ cursorAt: { left: -5, top: -5 } }", function() {
expect(4);
var dx = -3, dy = -3;
var ox = 5, oy = 5;
var cax = -5, cay = -5;
var actual = null;
$("#draggable2").draggable({
cursorAt: { left: cax, top: cay },
drag: function(event, ui) {
actual = ui.absolutePosition;
}
});
var el = $("#draggable2").data("draggable").element;
var before = el.offset();
var pos = { clientX: before.left + ox, clientY: before.top + oy };
$("#draggable2").simulate("mousedown", pos);
pos = { clientX: pos.clientX + dx, clientY: pos.clientY + dy };
$(document).simulate("mousemove", pos);
$(document).simulate("mousemove", pos);
$("#draggable2").simulate("mouseup", pos);
var expected = {
left: before.left + ox - cax + dx,
top: before.top + oy - cay + dy
};
equals(actual.left, expected.left, "Absolute: -1px left");
equals(actual.top, expected.top, "Absolute: -1px top");
var actual = null;
$("#draggable1").draggable({
cursorAt: { left: cax, top: cay },
drag: function(event, ui) {
actual = ui.absolutePosition;
}
});
var el = $("#draggable2").data("draggable").element;
var before = el.offset();
var pos = { clientX: before.left + ox, clientY: before.top + oy };
$("#draggable2").simulate("mousedown", pos);
pos = { clientX: pos.clientX + dx, clientY: pos.clientY + dy };
$(document).simulate("mousemove", pos);
$(document).simulate("mousemove", pos);
$("#draggable2").simulate("mouseup", pos);
var expected = {
left: before.left + ox - cax + dx,
top: before.top + oy - cay + dy
};
equals(actual.left, expected.left, "Relative: -1px left");
equals(actual.top, expected.top, "Relative: -1px top");
});
test("{ distance: 10 }", function() {
el = $("#draggable2").draggable({ distance: 10 });
drag(el, -9, -9);
moved(0, 0, 'distance not met');
drag(el, -10, -10);
moved(-10, -10, 'distance met');
drag(el, 9, 9);
moved(0, 0, 'distance not met');
});
test("{ grid: [50, 50] }, relative", function() {
el = $("#draggable1").draggable({ grid: [50, 50] });
drag(el, 24, 24);
moved(0, 0);
drag(el, 26, 25);
moved(50, 50);
});
test("{ grid: [50, 50] }, absolute", function() {
el = $("#draggable2").draggable({ grid: [50, 50] });
drag(el, 24, 24);
moved(0, 0);
drag(el, 26, 25);
moved(50, 50);
});
test("{ handle: 'span' }", function() {
el = $("#draggable2").draggable({ handle: 'span' });
drag("#draggable2 span", 50, 50);
moved(50, 50, "drag span");
drag("#draggable2", 50, 50);
moved(0, 0, "drag element");
});
test("{ helper: 'clone' }, relative", function() {
el = $("#draggable1").draggable({ helper: "clone" });
drag(el, 50, 50);
moved(0, 0);
});
test("{ helper: 'clone' }, absolute", function() {
el = $("#draggable2").draggable({ helper: "clone" });
drag(el, 50, 50);
moved(0, 0);
});
test("{ opacity: 0.5 }", function() {
expect(1);
var opacity = null;
el = $("#draggable2").draggable({
opacity: 0.5,
start: function(event, ui) {
opacity = $(this).css("opacity");
}
});
drag("#draggable2", -1, -1);
equals(opacity, 0.5, "start callback: opacity is");
});
test("{ zIndex: 10 }", function() {
expect(1);
var expected = 10, actual;
var zIndex = null;
el = $("#draggable2").draggable({
zIndex: expected,
start: function(event, ui) {
actual = $(this).css("zIndex");
}
});
drag("#draggable2", -1, -1);
equals(actual, expected, "start callback: zIndex is");
});
module("draggable: Callbacks");
test("callbacks occurance count", function() {
expect(3);
var start = 0, stop = 0, dragc = 0;
el = $("#draggable2").draggable({
start: function() { start++; },
drag: function() { dragc++; },
stop: function() { stop++; }
});
drag(el, 10, 10);
equals(start, 1, "start callback should happen exactly once");
equals(dragc, 3, "drag callback should happen exactly once per mousemove");
equals(stop, 1, "stop callback should happen exactly once");
});
module("draggable: Scroll offsets");
function testScroll(position) {
$("#main").css('position', position);
drag(el, 50, 50);
moved(50, 50, position+' parent');
}
function setScroll(what) {
if(what) {
$(document).scrollTop(100); $(document).scrollLeft(100);
} else {
$("#main")[0].scrollTop = 100; $("#main")[0].scrollLeft = 100;
}
}
function restoreScroll(what) {
if(what) {
$(document).scrollTop(0); $(document).scrollLeft(0);
} else {
$("#main")[0].scrollTop = 0; $("#main")[0].scrollLeft = 0;
}
}
test("{ helper: 'original' }, relative, with scroll offset on parent", function() {
el = $("#draggable1").draggable({ helper: "original" });
setScroll();
testScroll('relative');
setScroll();
testScroll('static');
setScroll();
testScroll('absolute');
restoreScroll();
});
test("{ helper: 'original' }, relative, with scroll offset on root", function() {
el = $("#draggable1").draggable({ helper: "original" });
setScroll('root');
testScroll('relative');
setScroll('root');
testScroll('static');
setScroll('root');
testScroll('absolute');
restoreScroll('root');
});
test("{ helper: 'original' }, relative, with scroll offset on root and parent", function() {
el = $("#draggable1").draggable({ helper: "original" });
setScroll();
setScroll('root');
testScroll('relative');
setScroll();
setScroll('root');
testScroll('static');
setScroll();
setScroll('root');
testScroll('absolute');
restoreScroll();
restoreScroll('root');
});
test("{ helper: 'original' }, absolute, with scroll offset on parent", function() {
el = $("#draggable1").css({ position: 'absolute', top: 0, left: 0 }).draggable({ helper: "original" });
setScroll();
testScroll('relative');
setScroll();
testScroll('static');
setScroll();
testScroll('absolute');
restoreScroll();
});
test("{ helper: 'original' }, absolute, with scroll offset on root", function() {
el = $("#draggable1").css({ position: 'absolute', top: 0, left: 0 }).draggable({ helper: "original" });
setScroll('root');
testScroll('relative');
setScroll('root');
testScroll('static');
setScroll('root');
testScroll('absolute');
restoreScroll('root');
});
test("{ helper: 'original' }, absolute, with scroll offset on root and parent", function() {
el = $("#draggable1").css({ position: 'absolute', top: 0, left: 0 }).draggable({ helper: "original" });
setScroll();
setScroll('root');
testScroll('relative');
setScroll();
setScroll('root');
testScroll('static');
setScroll();
setScroll('root');
testScroll('absolute');
restoreScroll();
restoreScroll('root');
});
//Fixed not for IE < 7
if(!($.browser.msie && $.browser.version < 7)) {
test("{ helper: 'original' }, fixed, with scroll offset on parent", function() {
el = $("#draggable1").css({ position: 'fixed', top: 0, left: 0 }).draggable({ helper: "original" });
setScroll();
testScroll('relative');
setScroll();
testScroll('static');
setScroll();
testScroll('absolute');
restoreScroll();
});
test("{ helper: 'original' }, fixed, with scroll offset on root", function() {
el = $("#draggable1").css({ position: 'fixed', top: 0, left: 0 }).draggable({ helper: "original" });
setScroll('root');
testScroll('relative');
setScroll('root');
testScroll('static');
setScroll('root');
testScroll('absolute');
restoreScroll('root');
});
test("{ helper: 'original' }, fixed, with scroll offset on root and parent", function() {
el = $("#draggable1").css({ position: 'fixed', top: 0, left: 0 }).draggable({ helper: "original" });
setScroll();
setScroll('root');
testScroll('relative');
setScroll();
setScroll('root');
testScroll('static');
setScroll();
setScroll('root');
testScroll('absolute');
restoreScroll();
restoreScroll('root');
});
}
test("{ helper: 'clone' }, absolute", function() {
var helperOffset = null;
var origOffset = $("#draggable1").offset();
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
helperOffset = ui.helper.offset();
} });
drag(el, 1, 1);
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
});
test("{ helper: 'clone' }, absolute with scroll offset on parent", function() {
setScroll();
var helperOffset = null;
var origOffset = null;
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
helperOffset = ui.helper.offset();
} });
$("#main").css('position', 'relative');
origOffset = $("#draggable1").offset();
drag(el, 1, 1);
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
$("#main").css('position', 'static');
origOffset = $("#draggable1").offset();
drag(el, 1, 1);
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
$("#main").css('position', 'absolute');
origOffset = $("#draggable1").offset();
drag(el, 1, 1);
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
restoreScroll();
});
test("{ helper: 'clone' }, absolute with scroll offset on root", function() {
setScroll('root');
var helperOffset = null;
var origOffset = null;
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
helperOffset = ui.helper.offset();
} });
$("#main").css('position', 'relative');
origOffset = $("#draggable1").offset();
drag(el, 1, 1);
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
$("#main").css('position', 'static');
origOffset = $("#draggable1").offset();
drag(el, 1, 1);
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
$("#main").css('position', 'absolute');
origOffset = $("#draggable1").offset();
drag(el, 1, 1);
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
restoreScroll('root');
});
test("{ helper: 'clone' }, absolute with scroll offset on root and parent", function() {
setScroll('root');
setScroll();
var helperOffset = null;
var origOffset = null;
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
helperOffset = ui.helper.offset();
} });
$("#main").css('position', 'relative');
origOffset = $("#draggable1").offset()
drag(el, 1, 1);
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
$("#main").css('position', 'static');
origOffset = $("#draggable1").offset()
drag(el, 1, 1);
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
$("#main").css('position', 'absolute');
origOffset = $("#draggable1").offset()
drag(el, 1, 1);
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
restoreScroll('root');
restoreScroll();
});
module("draggable: behaviour");
test("Events should not be executed on the element if drag is initiated", function() {
//TODO: Implement missing test
});
module("draggable: Tickets");
})(jQuery);

View file

@ -0,0 +1,27 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Droppable Test Suite</title>
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../ui/ui.core.js"></script>
<script type="text/javascript" src="../ui/ui.draggable.js"></script>
<script type="text/javascript" src="../ui/ui.droppable.js"></script>
<link type="text/css" href="testsuite.css" rel="stylesheet" />
<script type="text/javascript" src="testsuite.js"></script>
<script type="text/javascript" src="qunit/testrunner.js"></script>
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
<script type="text/javascript" src="droppable.js"></script>
</head>
<body>
<div id="main">
<div id="draggable1" style="width: 25px; height: 25px;">Draggable</div>
<div id="droppable1" style="width: 100px; height: 100px;">Droppable</div>
<div style='width:1000px;height:1000px;'>&nbsp;</div>
</div>
</body>
</html>

View file

@ -0,0 +1,223 @@
/*
* droppable unit tests
*/
(function($) {
//
// Droppable Test Helper Functions
//
var defaults = {
accept: null,
activeClass: null,
cssNamespace: "ui",
disabled: false,
greedy: false,
hoverClass: null,
scope: "default",
tolerance: "intersect"
};
var el, drg;
function shouldBeDroppable() {
ok(false, "missing test - should be droppable");
}
function shouldNotBeDroppable() {
ok(false, "missing test - should not be droppable");
}
// Droppable Tests
module("droppable");
test("init", function() {
expect(6);
$("<div></div>").appendTo('body').droppable().remove();
ok(true, '.droppable() called on element');
$([]).droppable();
ok(true, '.droppable() called on empty collection');
$("<div></div>").droppable();
ok(true, '.droppable() called on disconnected DOMElement');
$("<div></div>").droppable().droppable("foo");
ok(true, 'arbitrary method called after init');
$("<div></div>").droppable().data("foo.droppable");
ok(true, 'arbitrary option getter after init');
$("<div></div>").droppable().data("foo.droppable", "bar");
ok(true, 'arbitrary option setter after init');
});
test("destroy", function() {
expect(6);
$("<div></div>").appendTo('body').droppable().droppable("destroy").remove();
ok(true, '.droppable("destroy") called on element');
$([]).droppable().droppable("destroy");
ok(true, '.droppable("destroy") called on empty collection');
$("<div></div>").droppable().droppable("destroy");
ok(true, '.droppable("destroy") called on disconnected DOMElement');
$("<div></div>").droppable().droppable("destroy").droppable("foo");
ok(true, 'arbitrary method called after destroy');
$("<div></div>").droppable().droppable("destroy").data("foo.droppable");
ok(true, 'arbitrary option getter after destroy');
$("<div></div>").droppable().droppable("destroy").data("foo.droppable", "bar");
ok(true, 'arbitrary option setter after destroy');
});
test("enable", function() {
expect(6);
el = $("#droppable1").droppable({ disabled: true });
shouldNotBeDroppable();
el.droppable("enable");
shouldBeDroppable();
equals(el.data("disabled.droppable"), false, "disabled.droppable getter");
el.droppable("destroy");
el.droppable({ disabled: true });
shouldNotBeDroppable();
el.data("disabled.droppable", false);
equals(el.data("disabled.droppable"), false, "disabled.droppable setter");
shouldBeDroppable();
});
test("disable", function() {
expect(6);
el = $("#droppable1").droppable({ disabled: false });
shouldBeDroppable();
el.droppable("disable");
shouldNotBeDroppable();
equals(el.data("disabled.droppable"), true, "disabled.droppable getter");
el.droppable("destroy");
el.droppable({ disabled: false });
shouldBeDroppable();
el.data("disabled.droppable", true);
equals(el.data("disabled.droppable"), true, "disabled.droppable setter");
shouldNotBeDroppable();
});
test("element types", function() {
var typeNames = ('p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form'
+ ',table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr'
+ ',acronym,code,samp,kbd,var,img,object,hr'
+ ',input,button,label,select,iframe').split(',');
$.each(typeNames, function(i) {
var typeName = typeNames[i];
el = $(document.createElement(typeName)).appendTo('body');
(typeName == 'table' && el.append("<tr><td>content</td></tr>"));
el.droppable();
shouldBeDroppable();
el.droppable("destroy");
el.remove();
});
});
test("defaults", function() {
el = $("<div></div>").droppable();
$.each(defaults, function(key, val) {
var actual = el.data(key + ".droppable"), expected = val;
same(actual, expected, key);
});
el.remove();
});
test("option setting", function() {
// The plugin shouldn't modify an option value set by the user
$.each(defaults, function(key, val) {
el = $("<div></div>").droppable();
el.data(key + ".droppable", val);
var actual = el.data(key + ".droppable"), expected = val;
same(actual, expected, key);
el.remove();
});
});
module("droppable: Options");
test("accept, selector", function() {
ok(false, "missing test");
});
test("accept, fn", function() {
ok(false, "missing test");
});
test("activeClass", function() {
ok(false, "missing test");
});
test("cssNamespace", function() {
//cssNamespace should be appended with '-droppable' and added as className
el = $("<div></div>").droppable({ cssNamespace: "ui" });
equals(el[0].className, "ui-droppable");
el.droppable("destroy");
//no className should be added if cssNamepsace is null
el = $("<div></div>").droppable({ cssNamespace: null });
equals(el[0].className, "");
el.droppable("destroy");
});
test("greedy", function() {
ok(false, "missing test");
});
test("hoverClass", function() {
ok(false, "missing test");
});
test("scope", function() {
ok(false, "missing test");
});
test("tolerance, fit", function() {
ok(false, "missing test");
});
test("tolerance, intersect", function() {
ok(false, "missing test");
});
test("tolerance, pointer", function() {
ok(false, "missing test");
});
test("tolerance, touch", function() {
ok(false, "missing test");
});
module("droppable: Callbacks");
test("activate", function() {
ok(false, "missing test");
});
test("deactivate", function() {
ok(false, "missing test");
});
test("over", function() {
ok(false, "missing test");
});
test("out", function() {
ok(false, "missing test");
});
test("drop", function() {
ok(false, "missing test");
});
module("droppable: Tickets");
})(jQuery);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 834 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 915 B

View file

@ -0,0 +1,97 @@
/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
/**
* Create a cookie with the given name and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
* used when the cookie was set.
*
* @param String name The name of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given name.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String name The name of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options = $.extend({}, options); // clone object since it's unexpected behavior if the expired property were changed
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
// NOTE Needed to parenthesize options.path and options.domain
// in the following expressions, otherwise they evaluate to undefined
// in the packed version for some reason...
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};

View file

@ -0,0 +1,10 @@
/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options=$.extend({},options);options.expires=-1;}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires='; expires='+date.toUTCString();}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}};

View file

@ -0,0 +1,10 @@
/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('q.5=x(k,d,a){4(m d!=\'H\'){a=a||{};4(d===p){d=\'\';a=$.A({},a);a.3=-1}2 g=\'\';4(a.3&&(m a.3==\'u\'||a.3.s)){2 f;4(m a.3==\'u\'){f=F C();f.B(f.z()+(a.3*y*o*o*v))}n{f=a.3}g=\'; 3=\'+f.s()}2 b=a.7?\'; 7=\'+(a.7):\'\';2 e=a.9?\'; 9=\'+(a.9):\'\';2 l=a.t?\'; t\':\'\';6.5=[k,\'=\',L(d),g,b,e,l].K(\'\')}n{2 h=p;4(6.5&&6.5!=\'\'){2 c=6.5.E(\';\');D(2 i=0;i<c.8;i++){2 j=q.G(c[i]);4(j.r(0,k.8+1)==(k+\'=\')){h=I(j.r(k.8+1));J}}}w h}};',48,48,'||var|expires|if|cookie|document|path|length|domain|||||||||||||typeof|else|60|null|jQuery|substring|toUTCString|secure|number|1000|return|function|24|getTime|extend|setTime|Date|for|split|new|trim|undefined|decodeURIComponent|break|join|encodeURIComponent'.split('|'),0,{}))

View file

@ -0,0 +1,780 @@
/*
* QUnit - jQuery unit testrunner
*
* http://docs.jquery.com/QUnit
*
* Copyright (c) 2008 John Resig, Jörn Zaefferer
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* $Id: testrunner.js 6173 2009-02-02 20:09:32Z jeresig $
*/
(function($) {
// Tests for equality any JavaScript type and structure without unexpected results.
// Discussions and reference: http://philrathe.com/articles/equiv
// Test suites: http://philrathe.com/tests/equiv
// Author: Philippe Rathé <prathe@gmail.com>
var equiv = function () {
var innerEquiv; // the real equiv function
var callers = []; // stack to decide between skip/abort functions
// Determine what is o.
function hoozit(o) {
if (typeof o === "string") {
return "string";
} else if (typeof o === "boolean") {
return "boolean";
} else if (typeof o === "number") {
if (isNaN(o)) {
return "nan";
} else {
return "number";
}
} else if (typeof o === "undefined") {
return "undefined";
// consider: typeof null === object
} else if (o === null) {
return "null";
// consider: typeof [] === object
} else if (o instanceof Array) {
return "array";
// consider: typeof new Date() === object
} else if (o instanceof Date) {
return "date";
// consider: /./ instanceof Object;
// /./ instanceof RegExp;
// typeof /./ === "function"; // => false in IE and Opera,
// true in FF and Safari
} else if (o instanceof RegExp) {
return "regexp";
} else if (typeof o === "object") {
return "object";
} else if (o instanceof Function) {
return "function";
}
}
// Call the o related callback with the given arguments.
function bindCallbacks(o, callbacks, args) {
var prop = hoozit(o);
if (prop) {
if (hoozit(callbacks[prop]) === "function") {
return callbacks[prop].apply(callbacks, args);
} else {
return callbacks[prop]; // or undefined
}
}
}
var callbacks = function () {
// for string, boolean, number and null
function useStrictEquality(b, a) {
return a === b;
}
return {
"string": useStrictEquality,
"boolean": useStrictEquality,
"number": useStrictEquality,
"null": useStrictEquality,
"undefined": useStrictEquality,
"nan": function (b) {
return isNaN(b);
},
"date": function (b, a) {
return hoozit(b) === "date" && a.valueOf() === b.valueOf();
},
"regexp": function (b, a) {
return hoozit(b) === "regexp" &&
a.source === b.source && // the regex itself
a.global === b.global && // and its modifers (gmi) ...
a.ignoreCase === b.ignoreCase &&
a.multiline === b.multiline;
},
// - skip when the property is a method of an instance (OOP)
// - abort otherwise,
// initial === would have catch identical references anyway
"function": function () {
var caller = callers[callers.length - 1];
return caller !== Object &&
typeof caller !== "undefined";
},
"array": function (b, a) {
var i;
var len;
// b could be an object literal here
if ( ! (hoozit(b) === "array")) {
return false;
}
len = a.length;
if (len !== b.length) { // safe and faster
return false;
}
for (i = 0; i < len; i++) {
if( ! innerEquiv(a[i], b[i])) {
return false;
}
}
return true;
},
"object": function (b, a) {
var i;
var eq = true; // unless we can proove it
var aProperties = [], bProperties = []; // collection of strings
// comparing constructors is more strict than using instanceof
if ( a.constructor !== b.constructor) {
return false;
}
// stack constructor before traversing properties
callers.push(a.constructor);
for (i in a) { // be strict: don't ensures hasOwnProperty and go deep
aProperties.push(i); // collect a's properties
if ( ! innerEquiv(a[i], b[i])) {
eq = false;
}
}
callers.pop(); // unstack, we are done
for (i in b) {
bProperties.push(i); // collect b's properties
}
// Ensures identical properties name
return eq && innerEquiv(aProperties.sort(), bProperties.sort());
}
};
}();
innerEquiv = function () { // can take multiple arguments
var args = Array.prototype.slice.apply(arguments);
if (args.length < 2) {
return true; // end transition
}
return (function (a, b) {
if (a === b) {
return true; // catch the most you can
} else if (typeof a !== typeof b || a === null || b === null || typeof a === "undefined" || typeof b === "undefined") {
return false; // don't lose time with error prone cases
} else {
return bindCallbacks(a, callbacks, [b, a]);
}
// apply transition with (1..n) arguments
})(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length -1));
};
return innerEquiv;
}(); // equiv
var GETParams = $.map( location.search.slice(1).split('&'), decodeURIComponent ),
ngindex = $.inArray("noglobals", GETParams),
noglobals = ngindex !== -1;
if( noglobals )
GETParams.splice( ngindex, 1 );
var config = {
stats: {
all: 0,
bad: 0
},
queue: [],
// block until document ready
blocking: true,
//restrict modules/tests by get parameters
filters: GETParams,
isLocal: !!(window.location.protocol == 'file:')
};
// public API as global methods
$.extend(window, {
test: test,
module: module,
expect: expect,
ok: ok,
equals: equals,
start: start,
stop: stop,
reset: reset,
isLocal: config.isLocal,
same: function(a, b, message) {
push(equiv(a, b), a, b, message);
},
QUnit: {
equiv: equiv,
ok: ok,
done: function(failures, total){},
log: function(result, message){}
},
// legacy methods below
isSet: isSet,
isObj: isObj,
compare: function() {
throw "compare is deprecated - use same() instead";
},
compare2: function() {
throw "compare2 is deprecated - use same() instead";
},
serialArray: function() {
throw "serialArray is deprecated - use jsDump.parse() instead";
},
q: q,
t: t,
url: url,
triggerEvent: triggerEvent
});
$(window).load(function() {
$('#userAgent').html(navigator.userAgent);
var head = $('<div class="testrunner-toolbar"><label for="filter-pass">Hide passed tests</label></div>').insertAfter("#userAgent");
$('<input type="checkbox" id="filter-pass" />').attr("disabled", true).prependTo(head).click(function() {
$('li.pass')[this.checked ? 'hide' : 'show']();
});
$('<input type="checkbox" id="filter-missing">').attr("disabled", true).appendTo(head).click(function() {
$("li.fail:contains('missing test - untested code is broken code')").parent('ol').parent('li.fail')[this.checked ? 'hide' : 'show']();
});
$("#filter-missing").after('<label for="filter-missing">Hide missing tests (untested code is broken code)</label>');
runTest();
});
function synchronize(callback) {
config.queue.push(callback);
if(!config.blocking) {
process();
}
}
function process() {
while(config.queue.length && !config.blocking) {
config.queue.shift()();
}
}
function stop(timeout) {
config.blocking = true;
if (timeout)
config.timeout = setTimeout(function() {
QUnit.ok( false, "Test timed out" );
start();
}, timeout);
}
function start() {
// A slight delay, to avoid any current callbacks
setTimeout(function() {
if(config.timeout)
clearTimeout(config.timeout);
config.blocking = false;
process();
}, 13);
}
function validTest( name ) {
var i = config.filters.length,
run = false;
if( !i )
return true;
while( i-- ){
var filter = config.filters[i],
not = filter.charAt(0) == '!';
if( not )
filter = filter.slice(1);
if( name.indexOf(filter) != -1 )
return !not;
if( not )
run = true;
}
return run;
}
function runTest() {
config.blocking = false;
var started = +new Date;
config.fixture = document.getElementById('main').innerHTML;
config.ajaxSettings = $.ajaxSettings;
synchronize(function() {
$('<p id="testresult" class="result"/>').html(['Tests completed in ',
+new Date - started, ' milliseconds.<br/>',
'<span class="bad">', config.stats.bad, '</span> tests of <span class="all">', config.stats.all, '</span> failed.']
.join(''))
.appendTo("body");
$("#banner").addClass(config.stats.bad ? "fail" : "pass");
QUnit.done( config.stats.bad, config.stats.all );
});
}
var pollution;
function saveGlobal(){
pollution = [ ];
if( noglobals )
for( var key in window )
pollution.push(key);
}
function checkPollution( name ){
var old = pollution;
saveGlobal();
if( pollution.length > old.length ){
ok( false, "Introduced global variable(s): " + diff(old, pollution).join(", ") );
config.expected++;
}
}
function diff( clean, dirty ){
return $.grep( dirty, function(name){
return $.inArray( name, clean ) == -1;
});
}
function test(name, callback) {
if(config.currentModule)
name = config.currentModule + " module: " + name;
var lifecycle = $.extend({
setup: function() {},
teardown: function() {}
}, config.moduleLifecycle);
if ( !validTest(name) )
return;
synchronize(function() {
config.assertions = [];
config.expected = null;
try {
if( !pollution )
saveGlobal();
lifecycle.setup();
} catch(e) {
QUnit.ok( false, "Setup failed on " + name + ": " + e.message );
}
})
synchronize(function() {
try {
callback();
} catch(e) {
if( typeof console != "undefined" && console.error && console.warn ) {
console.error("Test " + name + " died, exception and test follows");
console.error(e);
console.warn(callback.toString());
}
QUnit.ok( false, "Died on test #" + (config.assertions.length + 1) + ": " + e.message );
// else next test will carry the responsibility
saveGlobal();
}
});
synchronize(function() {
try {
checkPollution();
lifecycle.teardown();
} catch(e) {
QUnit.ok( false, "Teardown failed on " + name + ": " + e.message );
}
})
synchronize(function() {
try {
reset();
} catch(e) {
if( typeof console != "undefined" && console.error && console.warn ) {
console.error("reset() failed, following Test " + name + ", exception and reset fn follows");
console.error(e);
console.warn(reset.toString());
}
}
if(config.expected && config.expected != config.assertions.length) {
QUnit.ok( false, "Expected " + config.expected + " assertions, but " + config.assertions.length + " were run" );
}
var good = 0, bad = 0;
var ol = $("<ol/>").hide();
config.stats.all += config.assertions.length;
for ( var i = 0; i < config.assertions.length; i++ ) {
var assertion = config.assertions[i];
$("<li/>").addClass(assertion.result ? "pass" : "fail").text(assertion.message || "(no message)").appendTo(ol);
assertion.result ? good++ : bad++;
}
config.stats.bad += bad;
var b = $("<strong/>").html(name + " <b style='color:black;'>(<b class='fail'>" + bad + "</b>, <b class='pass'>" + good + "</b>, " + config.assertions.length + ")</b>")
.click(function(){
$(this).next().toggle();
})
.dblclick(function(event) {
var target = $(event.target).filter("strong").clone();
if ( target.length ) {
target.children().remove();
location.href = location.href.match(/^(.+?)(\?.*)?$/)[1] + "?" + encodeURIComponent($.trim(target.text()));
}
});
$("<li/>").addClass(bad ? "fail" : "pass").append(b).append(ol).appendTo("#tests");
if(bad) {
$("#filter-pass").attr("disabled", null);
$("#filter-missing").attr("disabled", null);
}
});
}
// call on start of module test to prepend name to all tests
function module(name, lifecycle) {
config.currentModule = name;
config.moduleLifecycle = lifecycle;
}
/**
* Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
*/
function expect(asserts) {
config.expected = asserts;
}
/**
* Resets the test setup. Useful for tests that modify the DOM.
*/
function reset() {
$("#main").html( config.fixture );
$.event.global = {};
$.ajaxSettings = $.extend({}, config.ajaxSettings);
}
/**
* Asserts true.
* @example ok( $("a").size() > 5, "There must be at least 5 anchors" );
*/
function ok(a, msg) {
QUnit.log(a, msg);
config.assertions.push({
result: !!a,
message: msg
});
}
/**
* Asserts that two arrays are the same
*/
function isSet(a, b, msg) {
function serialArray( a ) {
var r = [];
if ( a && a.length )
for ( var i = 0; i < a.length; i++ ) {
var str = a[i].nodeName;
if ( str ) {
str = str.toLowerCase();
if ( a[i].id )
str += "#" + a[i].id;
} else
str = a[i];
r.push( str );
}
return "[ " + r.join(", ") + " ]";
}
var ret = true;
if ( a && b && a.length != undefined && a.length == b.length ) {
for ( var i = 0; i < a.length; i++ )
if ( a[i] != b[i] )
ret = false;
} else
ret = false;
QUnit.ok( ret, !ret ? (msg + " expected: " + serialArray(b) + " result: " + serialArray(a)) : msg );
}
/**
* Asserts that two objects are equivalent
*/
function isObj(a, b, msg) {
var ret = true;
if ( a && b ) {
for ( var i in a )
if ( a[i] != b[i] )
ret = false;
for ( i in b )
if ( a[i] != b[i] )
ret = false;
} else
ret = false;
QUnit.ok( ret, msg );
}
/**
* Returns an array of elements with the given IDs, eg.
* @example q("main", "foo", "bar")
* @result [<div id="main">, <span id="foo">, <input id="bar">]
*/
function q() {
var r = [];
for ( var i = 0; i < arguments.length; i++ )
r.push( document.getElementById( arguments[i] ) );
return r;
}
/**
* Asserts that a select matches the given IDs
* @example t("Check for something", "//[a]", ["foo", "baar"]);
* @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar'
*/
function t(a,b,c) {
var f = $(b);
var s = "";
for ( var i = 0; i < f.length; i++ )
s += (s && ",") + '"' + f[i].id + '"';
isSet(f, q.apply(q,c), a + " (" + b + ")");
}
/**
* Add random number to url to stop IE from caching
*
* @example url("data/test.html")
* @result "data/test.html?10538358428943"
*
* @example url("data/test.php?foo=bar")
* @result "data/test.php?foo=bar&10538358345554"
*/
function url(value) {
return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random()*100000);
}
/**
* Checks that the first two arguments are equal, with an optional message.
* Prints out both actual and expected values.
*
* Prefered to ok( actual == expected, message )
*
* @example equals( $.format("Received {0} bytes.", 2), "Received 2 bytes." );
*
* @param Object actual
* @param Object expected
* @param String message (optional)
*/
function equals(actual, expected, message) {
push(expected == actual, actual, expected, message);
}
function push(result, actual, expected, message) {
message = message || (result ? "okay" : "failed");
QUnit.ok( result, result ? message + ": " + expected : message + ", expected: " + jsDump.parse(expected) + " result: " + jsDump.parse(actual) );
}
/**
* Trigger an event on an element.
*
* @example triggerEvent( document.body, "click" );
*
* @param DOMElement elem
* @param String type
*/
function triggerEvent( elem, type, event ) {
if ( $.browser.mozilla || $.browser.opera ) {
event = document.createEvent("MouseEvents");
event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,
0, 0, 0, 0, 0, false, false, false, false, 0, null);
elem.dispatchEvent( event );
} else if ( $.browser.msie ) {
elem.fireEvent("on"+type);
}
}
})(jQuery);
/**
* jsDump
* Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)
* Date: 5/15/2008
* @projectDescription Advanced and extensible data dumping for Javascript.
* @version 1.0.0
* @author Ariel Flesler
* @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}
*/
(function(){
function quote( str ){
return '"' + str.toString().replace(/"/g, '\\"') + '"';
};
function literal( o ){
return o + '';
};
function join( pre, arr, post ){
var s = jsDump.separator(),
base = jsDump.indent();
inner = jsDump.indent(1);
if( arr.join )
arr = arr.join( ',' + s + inner );
if( !arr )
return pre + post;
return [ pre, inner + arr, base + post ].join(s);
};
function array( arr ){
var i = arr.length, ret = Array(i);
this.up();
while( i-- )
ret[i] = this.parse( arr[i] );
this.down();
return join( '[', ret, ']' );
};
var reName = /^function (\w+)/;
var jsDump = window.jsDump = {
parse:function( obj, type ){//type is used mostly internally, you can fix a (custom)type in advance
var parser = this.parsers[ type || this.typeOf(obj) ];
type = typeof parser;
return type == 'function' ? parser.call( this, obj ) :
type == 'string' ? parser :
this.parsers.error;
},
typeOf:function( obj ){
var type = typeof obj,
f = 'function';//we'll use it 3 times, save it
return type != 'object' && type != f ? type :
!obj ? 'null' :
obj.exec ? 'regexp' :// some browsers (FF) consider regexps functions
obj.getHours ? 'date' :
obj.scrollBy ? 'window' :
obj.nodeName == '#document' ? 'document' :
obj.nodeName ? 'node' :
obj.item ? 'nodelist' : // Safari reports nodelists as functions
obj.callee ? 'arguments' :
obj.call || obj.constructor != Array && //an array would also fall on this hack
(obj+'').indexOf(f) != -1 ? f : //IE reports functions like alert, as objects
'length' in obj ? 'array' :
type;
},
separator:function(){
return this.multiline ? this.HTML ? '<br />' : '\n' : this.HTML ? '&nbsp;' : ' ';
},
indent:function( extra ){// extra can be a number, shortcut for increasing-calling-decreasing
if( !this.multiline )
return '';
var chr = this.indentChar;
if( this.HTML )
chr = chr.replace(/\t/g,' ').replace(/ /g,'&nbsp;');
return Array( this._depth_ + (extra||0) ).join(chr);
},
up:function( a ){
this._depth_ += a || 1;
},
down:function( a ){
this._depth_ -= a || 1;
},
setParser:function( name, parser ){
this.parsers[name] = parser;
},
// The next 3 are exposed so you can use them
quote:quote,
literal:literal,
join:join,
//
_depth_: 1,
// This is the list of parsers, to modify them, use jsDump.setParser
parsers:{
window: '[Window]',
document: '[Document]',
error:'[ERROR]', //when no parser is found, shouldn't happen
unknown: '[Unknown]',
'null':'null',
undefined:'undefined',
'function':function( fn ){
var ret = 'function',
name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE
if( name )
ret += ' ' + name;
ret += '(';
ret = [ ret, this.parse( fn, 'functionArgs' ), '){'].join('');
return join( ret, this.parse(fn,'functionCode'), '}' );
},
array: array,
nodelist: array,
arguments: array,
object:function( map ){
var ret = [ ];
this.up();
for( var key in map )
ret.push( this.parse(key,'key') + ': ' + this.parse(map[key]) );
this.down();
return join( '{', ret, '}' );
},
node:function( node ){
var open = this.HTML ? '&lt;' : '<',
close = this.HTML ? '&gt;' : '>';
var tag = node.nodeName.toLowerCase(),
ret = open + tag;
for( var a in this.DOMAttrs ){
var val = node[this.DOMAttrs[a]];
if( val )
ret += ' ' + a + '=' + this.parse( val, 'attribute' );
}
return ret + close + open + '/' + tag + close;
},
functionArgs:function( fn ){//function calls it internally, it's the arguments part of the function
var l = fn.length;
if( !l ) return '';
var args = Array(l);
while( l-- )
args[l] = String.fromCharCode(97+l);//97 is 'a'
return ' ' + args.join(', ') + ' ';
},
key:quote, //object calls it internally, the key part of an item in a map
functionCode:'[code]', //function calls it internally, it's the content of the function
attribute:quote, //node calls it internally, it's an html attribute value
string:quote,
date:quote,
regexp:literal, //regex
number:literal,
'boolean':literal
},
DOMAttrs:{//attributes to dump from nodes, name=>realName
id:'id',
name:'name',
'class':'className'
},
HTML:false,//if true, entities are escaped ( <, >, \t, space and \n )
indentChar:' ',//indentation unit
multiline:true //if true, items in a collection, are separated by a \n, else just a space.
};
})();

View file

@ -0,0 +1,120 @@
body, div, h1 { font-family: 'trebuchet ms', verdana, arial; margin: 0; padding: 0 }
body {font-size: 10pt; }
h1 { padding: 15px; font-size: large; background-color: #06b; color: white; }
h1 a { color: white; }
h2 { padding: 10px; background-color: #eee; color: black; margin: 0; font-size: small; font-weight: normal }
.pass { color: green; }
.fail { color: red; }
p.result { margin-left: 1em; }
#banner { height: 2em; border-bottom: 1px solid white; }
h2.pass { background-color: green; }
h2.fail { background-color: red; }
div.testrunner-toolbar { background: #eee; border-top: 1px solid black; padding: 10px; }
ol#tests > li > strong { cursor:pointer; }
div#fx-tests h4 {
background: red;
}
div#fx-tests h4.pass {
background: green;
}
div#fx-tests div.box {
background: red url(data/cow.jpg) no-repeat;
overflow: hidden;
border: 2px solid #000;
}
div#fx-tests div.overflow {
overflow: visible;
}
div.inline {
display: inline;
}
div.autoheight {
height: auto;
}
div.autowidth {
width: auto;
}
div.autoopacity {
opacity: auto;
}
div.largewidth {
width: 100px;
}
div.largeheight {
height: 100px;
}
div.largeopacity {
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100);
}
div.medwidth {
width: 50px;
}
div.medheight {
height: 50px;
}
div.medopacity {
opacity: 0.5;
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50);
}
div.nowidth {
width: 0px;
}
div.noheight {
height: 0px;
}
div.noopacity {
opacity: 0;
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0);
}
div.hidden {
display: none;
}
div#fx-tests div.widewidth {
background-repeat: repeat-x;
}
div#fx-tests div.wideheight {
background-repeat: repeat-y;
}
div#fx-tests div.widewidth.wideheight {
background-repeat: repeat;
}
div#fx-tests div.noback {
background-image: none;
}
div.chain, div.chain div { width: 100px; height: 20px; position: relative; float: left; }
div.chain div { position: absolute; top: 0px; left: 0px; }
div.chain.test { background: red; }
div.chain.test div { background: green; }
div.chain.out { background: green; }
div.chain.out div { background: red; display: none; }
div#show-tests * { display: none; }

View file

@ -0,0 +1,25 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Resizable Test Suite</title>
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../ui/ui.core.js"></script>
<script type="text/javascript" src="../ui/ui.resizable.js"></script>
<link type="text/css" href="testsuite.css" rel="stylesheet" />
<script type="text/javascript" src="testsuite.js"></script>
<script type="text/javascript" src="qunit/testrunner.js"></script>
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
<script type="text/javascript" src="resizable.js"></script>
</head>
<body>
<div id="main">
<div id="resizable1" style="background: green; width: 100px; height: 100px;">I'm a resizable.</div>
<img src="images/test.jpg" id="resizable2" style="width: 100px; height: 100px;"/>
</div>
</body>
</html>

View file

@ -0,0 +1,416 @@
/*
* resizable tests
*/
(function($) {
//
// Resizable Test Helper Functions
//
var defaults = {
animate: false,
animateDuration: 'slow',
animateEasing: 'swing',
alsoResize: false,
aspectRatio: false,
autoHide: false,
cancel: ':input',
containment: false,
delay: 0,
disabled: false,
disableSelection: true,
distance: 1,
ghost: false,
grid: false,
handles: '???',
helper: null,
knobHandles: false,
maxHeight: null,
maxWidth: null,
minHeight: 10,
minWidth: 10,
preserveCursor: true,
preventDefault: true,
proportionallyResize: false,
transparent: false
};
var drag = function(el, dx, dy, complete) {
// speed = sync -> Drag syncrhonously.
// speed = fast|slow -> Drag asyncrhonously - animated.
//this mouseover is to work around a limitation in resizable
//TODO: fix resizable so handle doesn't require mouseover in order to be used
$(el).simulate("mouseover");
return $(el).simulate("drag", {
dx: dx||0, dy: dy||0, speed: 'sync', complete: complete
});
};
// Resizable Tests
module("resizable");
test("init", function() {
expect(6);
$("<div></div>").appendTo('body').resizable().remove();
ok(true, '.resizable() called on element');
$([]).resizable().remove();
ok(true, '.resizable() called on empty collection');
$('<div></div>').resizable().remove();
ok(true, '.resizable() called on disconnected DOMElement');
$('<div></div>').resizable().resizable("foo").remove();
ok(true, 'arbitrary method called after init');
el = $('<div></div>').resizable()
var foo = el.data("foo.resizable");
el.remove();
ok(true, 'arbitrary option getter after init');
$('<div></div>').resizable().data("foo.resizable", "bar").remove();
ok(true, 'arbitrary option setter after init');
});
test("destroy", function() {
expect(6);
$("<div></div>").appendTo('body').resizable().resizable("destroy").remove();
ok(true, '.resizable("destroy") called on element');
$([]).resizable().resizable("destroy").remove();
ok(true, '.resizable("destroy") called on empty collection');
$('<div></div>').resizable().resizable("destroy").remove();
ok(true, '.resizable("destroy") called on disconnected DOMElement');
$('<div></div>').resizable().resizable("destroy").resizable("foo").remove();
ok(true, 'arbitrary method called after destroy');
el = $('<div></div>').resizable();
var foo = el.resizable("destroy").data("foo.resizable");
el.remove();
ok(true, 'arbitrary option getter after destroy');
$('<div></div>').resizable().resizable("destroy").data("foo.resizable", "bar").remove();
ok(true, 'arbitrary option setter after destroy');
});
test("element types", function() {
var typeNames = ('p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form'
+ ',table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr'
+ ',acronym,code,samp,kbd,var,img,object,hr'
+ ',input,button,label,select,iframe').split(',');
$.each(typeNames, function(i) {
var typeName = typeNames[i];
el = $(document.createElement(typeName)).appendTo('body');
(typeName == 'table' && el.append("<tr><td>content</td></tr>"));
el.resizable();
ok(true, '$("&lt;' + typeName + '/&gt").resizable()');
el.resizable("destroy");
el.remove();
});
});
test("defaults", function() {
el = $('<div></div>').resizable();
$.each(defaults, function(key, val) {
var actual = el.data(key + ".resizable"), expected = val;
same(actual, expected, key);
});
el.remove();
});
test("n", function() {
expect(2);
var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ handles: 'all' });
drag(handle, 0, -50);
equals( target.height(), 150, "compare height" );
drag(handle, 0, 50);
equals( target.height(), 100, "compare height" );
});
test("s", function() {
expect(2);
var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ handles: 'all' });
drag(handle, 0, 50);
equals( target.height(), 150, "compare height" );
drag(handle, 0, -50);
equals( target.height(), 100, "compare height" );
});
test("e", function() {
expect(2);
var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ handles: 'all' });
drag(handle, 50);
equals( target.width(), 150, "compare width");
drag(handle, -50);
equals( target.width(), 100, "compare width" );
});
test("w", function() {
expect(2);
var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ handles: 'all' });
drag(handle, -50);
equals( target.width(), 150, "compare width" );
drag(handle, 50);
equals( target.width(), 100, "compare width" );
});
test("ne", function() {
expect(4);
var handle = '.ui-resizable-ne', target = $('#resizable1').css({ overflow: 'hidden' }).resizable({ handles: 'all' });
drag(handle, -50, -50);
equals( target.width(), 50, "compare width" );
equals( target.height(), 150, "compare height" );
drag(handle, 50, 50);
equals( target.width(), 100, "compare width" );
equals( target.height(), 100, "compare height" );
});
test("se", function() {
expect(4);
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all' });
drag(handle, 50, 50);
equals( target.width(), 150, "compare width" );
equals( target.height(), 150, "compare height" );
drag(handle, -50, -50);
equals( target.width(), 100, "compare width" );
equals( target.height(), 100, "compare height" );
});
test("sw", function() {
expect(4);
var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all' });
drag(handle, -50, -50);
equals( target.width(), 150, "compare width" );
equals( target.height(), 50, "compare height" );
drag(handle, 50, 50);
equals( target.width(), 100, "compare width" );
equals( target.height(), 100, "compare height" );
});
test("nw", function() {
expect(4);
var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all' });
drag(handle, -50, -50);
equals( target.width(), 150, "compare width" );
equals( target.height(), 150, "compare height" );
drag(handle, 50, 50);
equals( target.width(), 100, "compare width" );
equals( target.height(), 100, "compare height" );
});
module("resizable: Options");
test("aspectRatio: 'preserve' (e)", function() {
expect(4);
var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
drag(handle, 80);
equals( target.width(), 130, "compare maxWidth");
equals( target.height(), 130, "compare maxHeight");
drag(handle, -130);
equals( target.width(), 70, "compare minWidth");
equals( target.height(), 70, "compare minHeight");
});
test("aspectRatio: 'preserve' (w)", function() {
expect(4);
var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
drag(handle, -80);
equals( target.width(), 130, "compare maxWidth");
equals( target.height(), 130, "compare maxHeight");
drag(handle, 130);
equals( target.width(), 70, "compare minWidth");
equals( target.height(), 70, "compare minHeight");
});
test("aspectRatio: 'preserve' (n)", function() {
expect(4);
var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
drag(handle, 0, -80);
equals( target.width(), 130, "compare maxWidth");
equals( target.height(), 130, "compare maxHeight");
drag(handle, 0, 80);
equals( target.width(), 70, "compare minWidth");
equals( target.height(), 70, "compare minHeight");
});
test("aspectRatio: 'preserve' (s)", function() {
expect(4);
var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
drag(handle, 0, 80);
equals( target.width(), 130, "compare maxWidth");
equals( target.height(), 130, "compare maxHeight");
drag(handle, 0, -80);
equals( target.width(), 70, "compare minWidth");
equals( target.height(), 70, "compare minHeight");
});
test("aspectRatio: 'preserve' (se)", function() {
expect(4);
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
drag(handle, 80, 80);
equals( target.width(), 130, "compare maxWidth");
equals( target.height(), 130, "compare maxHeight");
drag(handle, -80, -80);
equals( target.width(), 70, "compare minWidth");
equals( target.height(), 70, "compare minHeight");
});
test("aspectRatio: 'preserve' (sw)", function() {
expect(4);
var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
drag(handle, -80, 80);
equals( target.width(), 130, "compare maxWidth");
equals( target.height(), 130, "compare maxHeight");
drag(handle, 80, -80);
equals( target.width(), 70, "compare minWidth");
equals( target.height(), 70, "compare minHeight");
});
test("aspectRatio: 'preserve' (ne)", function() {
expect(4);
var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
drag(handle, 80, -80);
equals( target.width(), 130, "compare maxWidth");
equals( target.height(), 130, "compare maxHeight");
drag(handle, -80, 80);
equals( target.width(), 70, "compare minWidth");
equals( target.height(), 70, "compare minHeight");
});
test("grid", function() {
expect(4);
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', grid: [0, 20] });
drag(handle, 3, 9);
equals( target.width(), 103, "compare width");
equals( target.height(), 100, "compare height");
drag(handle, 15, 11);
equals( target.width(), 118, "compare width");
equals( target.height(), 120, "compare height");
});
test("grid (wrapped)", function() {
expect(4);
var handle = '.ui-resizable-se', target = $('#resizable2').resizable({ handles: 'all', grid: [0, 20] });
drag(handle, 3, 9);
equals( target.width(), 103, "compare width");
equals( target.height(), 100, "compare height");
drag(handle, 15, 11);
equals( target.width(), 118, "compare width");
equals( target.height(), 120, "compare height");
});
test("ui-resizable-se { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
expect(4);
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
drag(handle, -50, -50);
equals( target.width(), 60, "compare minWidth" );
equals( target.height(), 60, "compare minHeight" );
drag(handle, 70, 70);
equals( target.width(), 100, "compare maxWidth" );
equals( target.height(), 100, "compare maxHeight" );
});
test("ui-resizable-sw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
expect(4);
var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
drag(handle, 50, -50);
equals( target.width(), 60, "compare minWidth" );
equals( target.height(), 60, "compare minHeight" );
drag(handle, -70, 70);
equals( target.width(), 100, "compare maxWidth" );
equals( target.height(), 100, "compare maxHeight" );
});
test("ui-resizable-ne { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
expect(4);
var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
drag(handle, -50, 50);
equals( target.width(), 60, "compare minWidth" );
equals( target.height(), 60, "compare minHeight" );
drag(handle, 70, -70);
equals( target.width(), 100, "compare maxWidth" );
equals( target.height(), 100, "compare maxHeight" );
});
test("ui-resizable-nw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
expect(4);
var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
drag(handle, 70, 70);
equals( target.width(), 60, "compare minWidth" );
equals( target.height(), 60, "compare minHeight" );
drag(handle, -70, -70);
equals( target.width(), 100, "compare maxWidth" );
equals( target.height(), 100, "compare maxHeight" );
});
})(jQuery);

View file

@ -0,0 +1,30 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Selectable Test Suite</title>
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../ui/ui.core.js"></script>
<script type="text/javascript" src="../ui/ui.selectable.js"></script>
<link type="text/css" href="testsuite.css" rel="stylesheet" />
<script type="text/javascript" src="testsuite.js"></script>
<script type="text/javascript" src="qunit/testrunner.js"></script>
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
<script type="text/javascript" src="selectable.js"></script>
</head>
<body>
<div id="main">
<ul id="selectable1">
<li>Item 1</li>
<li>Item 2</li>
<li class="special">Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</ul>
</div>
</body>
</html>

View file

@ -0,0 +1,196 @@
/*
* selectable unit tests
*/
(function($) {
//
// Selectable Test Helper Functions
//
var defaults = {
autoRefresh: true,
disabled: false,
filter: '*'
};
var el;
var drag = function(dx, dy) {
var off = el.offset(), pos = { clientX: off.left, clientY: off.top };
el.simulate("mousedown", pos);
$(document).simulate("mousemove", pos);
pos.clientX += dx;
pos.clientY += dy;
$(document).simulate("mousemove", pos);
$(document).simulate("mouseup", pos);
}
var border = function(el, side) { return parseInt(el.css('border-' + side + '-width')); }
var margin = function(el, side) { return parseInt(el.css('margin-' + side)); }
// Selectable Tests
module("selectable");
test("init", function() {
expect(6);
$("<div></div>").appendTo('body').selectable().remove();
ok(true, '.selectable() called on element');
$([]).selectable().remove();
ok(true, '.selectable() called on empty collection');
$("<div></div>").selectable().remove();
ok(true, '.selectable() called on disconnected DOMElement');
$("<div></div>").selectable().selectable("foo").remove();
ok(true, 'arbitrary method called after init');
el = $("<div></div>").selectable()
var foo = el.data("foo.selectable");
el.remove();
ok(true, 'arbitrary option getter after init');
$("<div></div>").selectable().data("foo.selectable", "bar").remove();
ok(true, 'arbitrary option setter after init');
});
test("destroy", function() {
expect(6);
$("<div></div>").appendTo('body').selectable().selectable("destroy").remove();
ok(true, '.selectable("destroy") called on element');
$([]).selectable().selectable("destroy").remove();
ok(true, '.selectable("destroy") called on empty collection');
$("<div></div>").selectable().selectable("destroy").remove();
ok(true, '.selectable("destroy") called on disconnected DOMElement');
$("<div></div>").selectable().selectable("destroy").selectable("foo").remove();
ok(true, 'arbitrary method called after destroy');
el = $("<div></div>").selectable();
var foo = el.selectable("destroy").data("foo.selectable");
el.remove();
ok(true, 'arbitrary option getter after destroy');
$("<div></div>").selectable().selectable("destroy").data("foo.selectable", "bar").remove();
ok(true, 'arbitrary option setter after destroy');
});
test("defaults", function() {
el = $('<div></div>').selectable();
$.each(defaults, function(key, val) {
var actual = el.data(key + ".selectable"), expected = val;
same(actual, expected, key);
});
el.remove();
});
module("selectable: Options");
test("autoRefresh", function() {
expect(3);
el = $("#selectable1");
var actual, sel = $("*", el), selected = function() { actual += 1 };
actual = 0;
el = $("#selectable1").selectable({ autoRefresh: false, selected: selected });
sel.hide();
drag(1000, 1000);
equals(actual, sel.length);
el.selectable("destroy");
actual = 0;
sel.show();
el = $("#selectable1").selectable({ autoRefresh: true, selected: selected });
sel.hide();
drag(1000, 1000);
equals(actual, 0);
sel.show();
drag(1000, 1000);
equals(actual, sel.length);
el.selectable("destroy");
sel.show();
});
test("filter", function() {
expect(2);
el = $("#selectable1");
var actual, sel = $("*", el), selected = function() { actual += 1 };
actual = 0;
el = $("#selectable1").selectable({ filter: '.special', selected: selected });
drag(1000, 1000);
ok(sel.length != 1, "this test assumes more than 1 selectee");
equals(actual, 1);
el.selectable("destroy");
});
module("selectable: Methods");
test("disable", function() {
expect(2);
var fired = false;
el = $("#selectable1");
el.selectable({
disabled: false,
start: function() { fired = true; }
});
el.simulate("drag", 20, 20);
equals(fired, true, "start fired");
el.selectable("disable");
fired = false;
el.simulate("drag", 20, 20);
equals(fired, false, "start fired");
el.selectable("destroy");
});
test("enable", function() {
expect(2);
var fired = false;
el = $("#selectable1");
el.selectable({
disabled: true,
start: function() { fired = true; }
});
el.simulate("drag", 20, 20);
equals(fired, false, "start fired");
el.selectable("enable");
el.simulate("drag", 20, 20);
equals(fired, true, "start fired");
el.selectable("destroy");
});
module("selectable: Callbacks");
test("start", function() {
expect(2);
el = $("#selectable1");
el.selectable({
start: function(ev, ui) {
ok(true, "drag fired start callback");
equals(this, el[0], "context of callback");
}
});
el.simulate("drag", 20, 20);
});
test("stop", function() {
expect(2);
el = $("#selectable1");
el.selectable({
start: function(ev, ui) {
ok(true, "drag fired stop callback");
equals(this, el[0], "context of callback");
}
});
el.simulate("drag", 20, 20);
});
module("selectable: Tickets");
})(jQuery);

View file

@ -0,0 +1,152 @@
/*
* jquery.simulate - simulate browser mouse and keyboard events
*
* Copyright (c) 2007 Eduardo Lundgren (eduardolundgren@gmail.com)
* and Richard D. Worth (rdworth@gmail.com)
*
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
*/
;(function($) {
$.fn.extend({
simulate: function(type, options) {
return this.each(function() {
var opt = $.extend({}, $.simulate.defaults, options || {});
new $.simulate(this, type, opt);
});
}
});
$.simulate = function(el, type, options) {
this.target = el;
this.options = options;
if (/^drag$/.test(type)) {
this[type].apply(this, [this.target, options]);
} else {
this.simulateEvent(el, type, options);
}
}
$.extend($.simulate.prototype, {
simulateEvent: function(el, type, options) {
var evt = this.createEvent(type, options);
this.dispatchEvent(el, type, evt, options);
return evt;
},
createEvent: function(type, options) {
if (/^mouse(over|out|down|up|move)|(dbl)?click$/.test(type)) {
return this.mouseEvent(type, options);
} else if (/^key(up|down|press)$/.test(type)) {
return this.keyboardEvent(type, options);
}
},
mouseEvent: function(type, options) {
var evt;
var e = $.extend({
bubbles: true, cancelable: (type != "mousemove"), view: window, detail: 0,
screenX: 0, screenY: 0, clientX: 0, clientY: 0,
ctrlKey: false, altKey: false, shiftKey: false, metaKey: false,
button: 0, relatedTarget: undefined
}, options);
var relatedTarget = $(e.relatedTarget)[0];
if ($.isFunction(document.createEvent)) {
evt = document.createEvent("MouseEvents");
evt.initMouseEvent(type, e.bubbles, e.cancelable, e.view, e.detail,
e.screenX, e.screenY, e.clientX, e.clientY,
e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
e.button, e.relatedTarget || document.body.parentNode);
} else if (document.createEventObject) {
evt = document.createEventObject();
$.extend(evt, e);
evt.button = { 0:1, 1:4, 2:2 }[evt.button] || evt.button;
}
return evt;
},
keyboardEvent: function(type, options) {
var evt;
var e = $.extend({ bubbles: true, cancelable: true, view: window,
ctrlKey: false, altKey: false, shiftKey: false, metaKey: false,
keyCode: 0, charCode: 0
}, options);
if ($.isFunction(document.createEvent)) {
try {
evt = document.createEvent("KeyEvents");
evt.initKeyEvent(type, e.bubbles, e.cancelable, e.view,
e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
e.keyCode, e.charCode);
} catch(err) {
evt = document.createEvent("Events");
evt.initEvent(type, e.bubbles, e.cancelable);
$.extend(evt, { view: e.view,
ctrlKey: e.ctrlKey, altKey: e.altKey, shiftKey: e.shiftKey, metaKey: e.metaKey,
keyCode: e.keyCode, charCode: e.charCode
});
}
} else if (document.createEventObject) {
evt = document.createEventObject();
$.extend(evt, e);
}
if ($.browser.msie || $.browser.opera) {
evt.keyCode = (e.charCode > 0) ? e.charCode : e.keyCode;
evt.charCode = undefined;
}
return evt;
},
dispatchEvent: function(el, type, evt) {
if (el.dispatchEvent) {
el.dispatchEvent(evt);
} else if (el.fireEvent) {
el.fireEvent('on' + type, evt);
}
return evt;
},
drag: function(el) {
var self = this, center = this.findCenter(this.target),
options = this.options, x = Math.floor(center.x), y = Math.floor(center.y),
dx = options.dx || 0, dy = options.dy || 0, target = this.target;
var coord = { clientX: x, clientY: y };
this.simulateEvent(target, "mousedown", coord);
coord = { clientX: x + 1, clientY: y + 1 };
this.simulateEvent(document, "mousemove", coord);
coord = { clientX: x + dx, clientY: y + dy };
this.simulateEvent(document, "mousemove", coord);
this.simulateEvent(document, "mousemove", coord);
this.simulateEvent(target, "mouseup", coord);
},
findCenter: function(el) {
var el = $(this.target), o = el.offset();
return {
x: o.left + el.outerWidth() / 2,
y: o.top + el.outerHeight() / 2
};
}
});
$.extend($.simulate, {
defaults: {
speed: 'sync'
},
VK_TAB: 9,
VK_ENTER: 13,
VK_ESC: 27,
VK_PGUP: 33,
VK_PGDN: 34,
VK_END: 35,
VK_HOME: 36,
VK_LEFT: 37,
VK_UP: 38,
VK_RIGHT: 39,
VK_DOWN: 40
});
})(jQuery);

View file

@ -0,0 +1,27 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Slider Test Suite</title>
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../ui/ui.core.js"></script>
<script type="text/javascript" src="../ui/ui.slider.js"></script>
<link type="text/css" href="testsuite.css" rel="stylesheet" />
<script type="text/javascript" src="testsuite.js"></script>
<script type="text/javascript" src="qunit/testrunner.js"></script>
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
<script type="text/javascript" src="slider.js"></script>
</head>
<body>
<div id="main">
<div id="slider1"></div>
<div id="slider3" style="position: relative; margin: 40px; width: 217px; height: 28px;">
<div class="ui-slider-handle" style="position: absolute; height: 21px; left: 0px; bottom: 0px; width: 17px;"></div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,193 @@
/*
* slider unit tests
*/
(function($) {
//
// Selectable Test Helper Functions
//
var defaults = {
animate: false,
axis: "???",
handle: ".ui-slider-handle",
handles: "???",
disabled: false,
max: 100,
min: 0,
range: false,
startValue: "???",
stepping: "???",
steps: 0
};
var keyCodes = {
leftArrow: 37,
upArrow: 38,
rightArrow: 39,
downArrow: 40
};
$.each(keyCodes, function(key, val) {
$.fn[key] = function() {
return this.simulate("keydown", { keyCode: val });
}
});
function assertChange(stepping, start, result, action) {
return function() {
expect(1);
var slider = $("#slider3").slider({
stepping: stepping,
startValue: start,
min: 0,
max: 1000,
change: function(event, ui) {
equals(ui.value, result, "changed to " + ui.value);
}
});
action.apply(slider);
}
}
// Slider Tests
module("slider");
test("init", function() {
expect(6);
$("<div></div>").appendTo('body').slider().remove();
ok(true, '.slider() called on element');
$([]).slider().remove();
ok(true, '.slider() called on empty collection');
$('<div></div>').slider().remove();
ok(true, '.slider() called on disconnected DOMElement');
$('<div></div>').slider().slider("foo").remove();
ok(true, 'arbitrary method called after init');
el = $('<div></div>').slider();
var foo = el.data("foo.slider");
el.remove();
ok(true, 'arbitrary option getter after init');
$('<div></div>').slider().data("foo.slider", "bar").remove();
ok(true, 'arbitrary option setter after init');
});
test("destroy", function() {
expect(6);
$("<div></div>").appendTo('body').slider().slider("destroy").remove();
ok(true, '.slider("destroy") called on element');
$([]).slider().slider("destroy").remove();
ok(true, '.slider("destroy") called on empty collection');
$('<div></div>').slider().slider("destroy").remove();
ok(true, '.slider("destroy") called on disconnected DOMElement');
$('<div></div>').slider().slider("destroy").slider("foo").remove();
ok(true, 'arbitrary method called after destroy');
el = $('<div></div>').slider();
var foo = el.slider("destroy").data("foo.slider");
el.remove();
ok(true, 'arbitrary option getter after destroy');
$('<div></div>').slider().slider("destroy").data("foo.slider", "bar").remove();
ok(true, 'arbitrary option setter after destroy');
});
test("defaults", function() {
el = $('<div></div>').slider();
$.each(defaults, function(key, val) {
var actual = el.data(key + ".slider"), expected = val;
same(actual, expected, key);
});
el.remove();
});
module("slider: single handle");
test("change one step via keydown", assertChange(1, undefined, 1, function() {
this.find("a").rightArrow();
}))
test("change - 10 steps via keydown", assertChange(10, 20, 10, function() {
this.find("a").leftArrow();
}))
test("change +10 steps via keydown", assertChange(10, 20, 30, function() {
this.find("a").rightArrow();
}))
test("moveTo, absolute value", assertChange(1, 1, 10, function() {
this.slider("moveTo", 10);
}))
test("moveTo, absolute value as string", assertChange(1, 1, 10, function() {
this.slider("moveTo", "10");
}))
test("moveTo, absolute value, below min", assertChange(1, 1, 0, function() {
this.slider("moveTo", -10);
}))
test("moveTo, relative positive value", assertChange(1, 1, 11, function() {
this.slider("moveTo", "+=10");
}))
test("moveTo, relative positive value, above max", assertChange(1, 10, 1000, function() {
this.slider("moveTo", "+=2000");
}))
test("moveTo, relative negative value", assertChange(1, 20, 10, function() {
this.slider("moveTo", "-=10");
}))
test("options update min/max", function() {
expect(2);
var slider = $("#slider3").slider({
stepping: 1,
startValue: 1
});
slider.slider("moveTo", "-=10");
equals(slider.slider("value"), 0);
slider.data("min.slider", -10);
slider.slider("moveTo", "-=20");
equals(slider.slider("value"), -10);
})
module("slider: setup and teardown");
test("destroy and recreate", function() {
expect(3)
var slider = $("#slider3").slider();
slider.slider("moveTo", "+=20");
equals(slider.slider("value"), 20);
slider.slider("destroy");
slider.slider("moveTo", "+=30");
ok(true, "nothing happens after slider is destroyed");
slider.slider().slider("moveTo", "30");
equals(Math.round(slider.slider("value")), 30);
})
test("handle creation", function() {
var slider = $("#slider1");
equals(slider.children().size(), 0);
slider.slider({
handles: [
{ start: 0 },
{ start: 10 }
]
});
equals(slider.children().size(), 2);
var instance = $.data(slider[0], "slider")
equals(instance.handle.length, 2);
ok(instance.handle.jquery, "handle must be a jquery object")
})
})(jQuery);

View file

@ -0,0 +1,30 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Sortable Test Suite</title>
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../ui/ui.core.js"></script>
<script type="text/javascript" src="../ui/ui.sortable.js"></script>
<link type="text/css" href="testsuite.css" rel="stylesheet" />
<script type="text/javascript" src="testsuite.js"></script>
<script type="text/javascript" src="qunit/testrunner.js"></script>
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
<script type="text/javascript" src="sortable.js"></script>
</head>
<body>
<div id="main">
<ul id="sortable">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</ul>
</div>
</body>
</html>

View file

@ -0,0 +1,148 @@
/*
* sortable unit tests
*/
(function($) {
//
// Sortable Test Helper Functions
//
var defaults = {
appendTo: "parent",
cancel: ":input",
delay: 0,
disabled: false,
distance: 1,
dropOnEmpty: true,
helper: "original",
items: "> *",
scroll: true,
scrollSensitivity: 20,
scrollSpeed: 20,
tolerance: "guess",
zIndex: 1000
};
var el, offsetBefore, offsetAfter, dragged;
var drag = function(handle, dx, dy) {
offsetBefore = $(handle).offset();
$(handle).simulate("drag", {
dx: dx || 0,
dy: dy || 0
});
dragged = { dx: dx, dy: dy };
offsetAfter = $(handle).offset();
}
var sort = function(handle, dx, dy, index, msg) {
drag(handle, dx, dy);
equals($(handle).parent().children().index(handle), index, msg);
}
var border = function(el, side) { return parseInt(el.css('border-' + side + '-width')); }
var margin = function(el, side) { return parseInt(el.css('margin-' + side)); }
// Sortable Tests
module("sortable");
test("init", function() {
expect(6);
$("<div></div>").appendTo('body').sortable().remove();
ok(true, '.sortable() called on element');
$([]).sortable();
ok(true, '.sortable() called on empty collection');
$("<div></div>").sortable();
ok(true, '.sortable() called on disconnected DOMElement');
$("<div></div>").sortable().sortable("foo");
ok(true, 'arbitrary method called after init');
$("<div></div>").sortable().data("foo.sortable");
ok(true, 'arbitrary option getter after init');
$("<div></div>").sortable().data("foo.sortable", "bar");
ok(true, 'arbitrary option setter after init');
});
test("destroy", function() {
expect(6);
$("<div></div>").appendTo('body').sortable().sortable("destroy").remove();
ok(true, '.sortable("destroy") called on element');
$([]).sortable().sortable("destroy");
ok(true, '.sortable("destroy") called on empty collection');
$("<div></div>").sortable().sortable("destroy");
ok(true, '.sortable("destroy") called on disconnected DOMElement');
$("<div></div>").sortable().sortable("destroy").sortable("foo");
ok(true, 'arbitrary method called after destroy');
$("<div></div>").sortable().sortable("destroy").data("foo.sortable");
ok(true, 'arbitrary option getter after destroy');
$("<div></div>").sortable().sortable("destroy").data("foo.sortable", "bar");
ok(true, 'arbitrary option setter after destroy');
});
test("enable", function() {
expect(4);
el = $("#sortable").sortable({ disabled: true });
sort($("li", el)[0], 0, 40, 0, '.sortable({ disabled: true })');
el.sortable("enable");
equals(el.data("disabled.sortable"), false, "disabled.sortable getter");
el.sortable("destroy");
el.sortable({ disabled: true });
el.data("disabled.sortable", false);
equals(el.data("disabled.sortable"), false, "disabled.sortable setter");
sort($("li", el)[0], 0, 40, 2, '.data("disabled.sortable", false)');
});
test("disable", function() {
expect(5);
el = $("#sortable").sortable({ disabled: false });
sort($("li", el)[0], 0, 40, 2, '.sortable({ disabled: false })');
el.sortable("disable");
sort($("li", el)[0], 0, 40, 0, 'disabled.sortable getter');
el.sortable("destroy");
el.sortable({ disabled: false });
sort($("li", el)[0], 0, 40, 2, '.sortable({ disabled: false })');
el.data("disabled.sortable", true);
equals(el.data("disabled.sortable"), true, "disabled.sortable setter");
sort($("li", el)[0], 0, 40, 0, '.data("disabled.sortable", true)');
});
test("defaults", function() {
el = $('<div></div>').sortable();
$.each(defaults, function(key, val) {
var actual = el.data(key + ".sortable"), expected = val;
same(actual, expected, key);
});
el.remove();
});
test("#3019: Stop fires too early", function() {
var helper = null;
el = $("#sortable").sortable({ stop: function(event, ui) {
helper = ui.helper;
}});
sort($("li", el)[0], 0, 40, 2, 'Dragging the sortable');
equals(helper, null, "helper should be false");
});
})(jQuery);

View file

@ -0,0 +1,45 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Tabs Test Suite</title>
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../ui/ui.core.js"></script>
<script type="text/javascript" src="../ui/ui.tabs.js"></script>
<link type="text/css" href="testsuite.css" rel="stylesheet" />
<script type="text/javascript" src="testsuite.js"></script>
<script type="text/javascript" src="qunit/testrunner.js"></script>
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
<script type="text/javascript" src="plugins/cookie/jquery.cookie.js"></script>
<script type="text/javascript" src="tabs.js"></script>
</head>
<body>
<div id="main">
<div id="tabs1">
<ul>
<li><a href="#fragment-1">1</a></li>
<li><a href="#fragment-2">2</a></li>
<li><a href="#fragment-3">3</a></li>
</ul>
<div id="fragment-1"></div>
<div id="fragment-2"></div>
<div id="fragment-3"></div>
</div>
<div id="tabs2">
<ul>
<li><a href="#colon:test">1</a></li>
<li><a href="#inline-style">2</a></li>
</ul>
<div id="colon:test"></div>
<div style="height: 300px;" id="inline-style"></div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,224 @@
/*
* tabs unit tests
*/
(function($) {
//
// Tabs Test Helper Functions
//
var defaults = {
ajaxOptions: null,
cache: false,
cookie: null,
deselectable: false,
deselectableClass: 'ui-tabs-deselectable',
disabled: [],
disabledClass: 'ui-tabs-disabled',
event: 'click',
fx: null,
hideClass: 'ui-tabs-hide',
idPrefix: 'ui-tabs-',
loadingClass: 'ui-tabs-loading',
navClass: 'ui-tabs-nav',
panelClass: 'ui-tabs-panel',
panelTemplate: '<div></div>',
selectedClass: 'ui-tabs-selected',
spinner: 'Loading&#8230;',
tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>'
};
var el;
// need to wait a bit for the pseudo animation...
function defer(defered, ms) {
var queue = defer.queue || (defer.queue = []);
if (!queue.length) stop();
queue.push(defered);
setTimeout(function() {
queue.shift()();
if (!queue.length) start();
}, ms || 100);
}
module('tabs');
test('init', function() {
expect(4);
var el = $('#tabs1 > ul').tabs();
ok(true, '.tabs() called on element');
el.tabs('destroy').tabs({ selected: 1 });
equals( el.data('selected.tabs'), 1, 'selected.tabs set' );
equals( $('li', el).index( $('li.ui-tabs-selected', el) ), 1, 'second tab active');
equals( $('div', '#tabs1').index( $('div.ui-tabs-hide', '#tabs1') ), 0, 'first panel should be hidden' );
});
test('destroy', function() {
expect(0);
});
test("defaults", function() {
el = $('#tabs1').tabs();
$.each(defaults, function(key, val) {
var actual = el.data(key + ".tabs"), expected = val;
same(actual, expected, key);
});
el.tabs("destroy");
});
test('add', function() {
expect(0);
});
test('remove', function() {
expect(0);
});
test('enable', function() {
expect(0);
});
test('disable', function() {
expect(0);
});
test('select', function() {
expect(0);
});
test('load', function() {
expect(0);
});
test('url', function() {
expect(0);
});
module('tabs: Options');
test('select: null', function() {
expect(3);
var el = $('#tabs1 > ul');
el.tabs({ selected: null });
equals( el.data('selected.tabs'), null, 'option set' );
equals( $('li.ui-tabs-selected', el).length, 0, 'all tabs should be deselected' );
equals( $('div.ui-tabs-hide', '#tabs1').length, 3, 'all panels should be hidden' );
// TODO select == null with cookie
// TODO select == null with select method
});
test('deselectable: true', function() {
expect(7);
var el = $('#tabs1 > ul');
el.tabs({ deselectable: true });
equals( el.data('deselectable.tabs'), true, 'option set' );
equals( $('li.ui-tabs-deselectable', el).length, 1, 'class "ui-tabs-deselectable" attached once');
equals( $('li', el).index( $('li.ui-tabs-deselectable', el) ), 0, 'class "ui-tabs-deselectable" attached to first tab');
el.tabs('select', 1);
equals( $('li.ui-tabs-deselectable', el).length, 1, 'class "ui-tabs-deselectable" attached once');
equals( $('li', el).index( $('li.ui-tabs-deselectable', el) ), 1, 'class "ui-tabs-deselectable" attached to second tab');
el.tabs('select', 1);
equals( $('li.ui-tabs-deselectable', el).length, 0, 'class "ui-tabs-deselectable" not attached');
defer(function() {
equals( $('div.ui-tabs-hide', '#tabs1').length, 3, 'all panels should be hidden' );
});
});
test('cookie', function() {
expect(5);
var el = $('#tabs1 > ul');
var cookieName = 'ui-tabs-' + $.data(el[0]);
$.cookie(cookieName, null); // blank state
var cookie = function() {
return parseInt($.cookie(cookieName), 10);
};
el.tabs({ cookie: {} });
equals(cookie(), 0, 'initial cookie value, no cookie given');
el.tabs('destroy');
el.tabs({ selected: 1, cookie: {} });
equals(cookie(), 1, 'initial cookie value, given selected');
el.tabs('select', 2);
equals(cookie(), 2, 'cookie value after tabs select');
el.tabs('destroy');
$.cookie(cookieName, 1);
el.tabs({ cookie: {} });
equals(cookie(), 1, 'initial cookie value, from existing cookie');
el.tabs('destroy');
ok($.cookie(cookieName) === null, 'erase cookie after destroy');
});
module('tabs: Tickets');
test('id containing colon, #????', function() {
expect(4);
var el = $('#tabs2 > ul').tabs();
ok( $('div.ui-tabs-panel:eq(0)', '#tabs2').is(':visible'), 'first panel should be visible' );
ok( $('div.ui-tabs-panel:eq(1)', '#tabs2').is(':hidden'), 'second panel should be hidden' );
el.tabs('select', 1).tabs('select', 0);
defer(function() {
ok( $('div.ui-tabs-panel:eq(0)', '#tabs2').is(':visible'), 'first panel should be visible' );
ok( $('div.ui-tabs-panel:eq(1)', '#tabs2').is(':hidden'), 'second panel should be hidden' );
});
});
test('panel containing inline style, #????', function() {
expect(3);
var inlineStyle = function(property) {
return $('#inline-style')[0].style[property];
};
var expected = inlineStyle('height');
var el = $('#tabs2 > ul').tabs();
equals(inlineStyle('height'), expected, 'init should not remove inline style');
el.tabs('select', 1);
defer(function() {
equals(inlineStyle('height'), expected, 'show tab should not remove inline style');
el.tabs('select', 0);
defer(function() {
equals(inlineStyle('height'), expected, 'hide tab should not remove inline style');
});
});
});
// test('', function() {
// expect(0);
//
// });
})(jQuery);

View file

@ -0,0 +1,4 @@
@import url("qunit/testsuite.css");
html { border: 0; }
.xerror, .error, .ui-tabs-hide { display: none }
#main { position: absolute; top: -10000px; left: -10000px; }

View file

@ -0,0 +1,10 @@
$(function() {
$('body').prepend(
'<h1 id="header">' + document.title + '</h1>' +
'<h2 id="banner"></h2>' +
'<h2 id="userAgent"></h2>' +
'<ol id="tests"></ol>'
);
});

View file

@ -0,0 +1,33 @@
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Test Suite</title>
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../ui/ui.core.js"></script>
<script type="text/javascript" src="../ui/ui.accordion.js"></script>
<script type="text/javascript" src="../ui/ui.datepicker.js"></script>
<script type="text/javascript" src="../ui/ui.dialog.js"></script>
<script type="text/javascript" src="../ui/ui.draggable.js"></script>
<script type="text/javascript" src="../ui/ui.droppable.js"></script>
<script type="text/javascript" src="../ui/ui.resizable.js"></script>
<script type="text/javascript" src="../ui/ui.selectable.js"></script>
<script type="text/javascript" src="../ui/ui.slider.js"></script>
<script type="text/javascript" src="../ui/ui.sortable.js"></script>
<script type="text/javascript" src="../ui/ui.tabs.js"></script>
<link type="text/css" href="testsuite.css" rel="stylesheet" />
<script type="text/javascript" src="testsuite.js"></script>
<script type="text/javascript" src="qunit/testrunner.js"></script>
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
<script type="text/javascript" src="ui.js"></script>
</head>
<body>
<div id="main">
</div>
</body>
</html>

View file

@ -0,0 +1,35 @@
/*
* common UI unit tests
*/
(function($) {
var plugins = [
"accordion",
"datepicker",
"dialog",
"draggable",
"droppable",
"resizable",
"selectable",
"slider",
"sortable",
"tabs"
];
module("version");
test("core", function() {
equals($.ui.version, "@VERSION", "$.ui.version");
});
$(plugins).each(function() {
var pluginName = this;
test(pluginName, function() {
if ($.ui[pluginName])
equals($.ui[pluginName].version, "@VERSION", "$.ui." + pluginName + ".version");
else
ok(false, "$.ui." + pluginName + " undefined.");
});
});
})(jQuery);

View file

@ -0,0 +1,80 @@
body { margin: 0; padding: 20px; background: #191919; }
ul.plugins { margin: 0; padding: 0; }
ul.plugins li { margin: 0 12px 12px 0;
list-style-type: none; width: 210px; height: 220px; float: left;
color: white; border: 1px solid gray; text-align: center; font-weight: bold; }
#accordion, #draggable,
#resizable, #selectable, #sortable, #tabs {
margin: 10px;
width: 190px; height: 180px;
text-align: center;
background: #FEA620; color: white; font-weight: bold;
}
#selectable div {
width: 45px; height: 45px; float: left; margin: 6px;
border: 1px solid white;
}
#selectable .ui-selecting {
background: gray;
}
#selectable .ui-selected {
background: black;
}
#sortable div {
width: 45px; height: 45px; float: left; margin: 6px;
border: 1px solid white;
}
#sortable .ui-sortable-helper {
background: black;
}
.draggable { margin: 10px; width: 32px; height: 30px; float: left; background: #FEA620; }
#droppable { margin: 10px; width: 190px; height: 130px; float: left; border: 1px solid #FEA620; overflow: hidden; }
#droppable .draggable { margin: 7px; }
.ui-dialog { background-color: #FEA620; }
.ui-dialog .ui-dialog-titlebar { background: black; padding: 0px; height: 28px; _height: 29px; }
.ui-dialog.ui-draggable .ui-dialog-titlebar { cursor: move; }
.ui-dialog .ui-dialog-titlebar-close {
width: 16px; height: 16px; position: absolute; top: 6px; right: 7px;
cursor: default; color: white;
}
.ui-dialog .ui-dialog-titlebar-close-hover { color: #FEA620; }
.ui-dialog .ui-dialog-title {
margin-left: 5px; color: white; font-weight: bold;
position: relative; top: 7px; left: 4px;
}
.ui-dialog .ui-dialog-content {
margin: 1.2em;
}
.ui-dialog .ui-dialog-buttonpane {
position: absolute;
bottom: 8px;
right: 12px;
width: 100%;
text-align: right;
}
.ui-dialog .ui-dialog-buttonpane button {
margin: 6px;
}
/* Dialog handle styles */
.ui-dialog .ui-resizable-n { cursor: n-resize; height: 6px; width: 100%; top: 0px; left: 0px; background: gray !important; border: none !important; }
.ui-dialog .ui-resizable-s { cursor: s-resize; height: 8px; width: 100%; bottom: 0px; left: 0px; background: gray !important; border: none !important; }
.ui-dialog .ui-resizable-e { cursor: e-resize; width: 7px; right: 0px; top: 0px; height: 100%; background: gray !important; border: none !important; }
.ui-dialog .ui-resizable-w { cursor: w-resize; width: 7px; left: 0px; top: 0px; height: 100%; background: gray !important; border: none !important; }
.ui-dialog .ui-resizable-se { cursor: se-resize; width: 9px; height: 9px; right: 0px; bottom: 0px; background: gray !important; border: none !important; }
.ui-dialog .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: 0px; bottom: 0px; background: gray !important; border: none !important; }
.ui-dialog .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 29px; left: 0px; top: 0px; background: gray !important; border: none !important; }
.ui-dialog .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 29px; right: 0px; top: 0px; background: gray !important; border: none !important; }
.ui-slider { margin: 10px; background: #FEA620; height: 15px; position: relative; }
.ui-slider-handle { width: 10px; height: 15px; background: white; position: absolute; top: 0px; left: 0px; }

View file

@ -0,0 +1,107 @@
<!doctype html>
<html lang="en">
<head>
<title>Simple All</title>
<link rel="stylesheet" href="all.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../themes/ui.datepicker.css" type="text/css" media="screen">
<script type="text/javascript" src="../../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.accordion.js"></script>
<script type="text/javascript" src="../../ui/ui.datepicker.js"></script>
<script type="text/javascript" src="../../ui/ui.dialog.js"></script>
<script type="text/javascript" src="../../ui/ui.draggable.js"></script>
<script type="text/javascript" src="../../ui/ui.droppable.js"></script>
<script type="text/javascript" src="../../ui/ui.resizable.js"></script>
<script type="text/javascript" src="../../ui/ui.selectable.js"></script>
<script type="text/javascript" src="../../ui/ui.slider.js"></script>
<script type="text/javascript" src="../../ui/ui.sortable.js"></script>
<script type="text/javascript" src="../../ui/ui.tabs.js"></script>
<script type="text/javascript">
$(function() {
$("#datepicker").datepicker();
$("#dialog").click(function() { $("<div/>").dialog(); });
$("#draggable").draggable();
$(".draggable").draggable();
$("#droppable").droppable({
accept: '.draggable',
drop: function(ev, ui) {
ui.draggable.css({ position: 'relative', top: 0, left: 0 }).clone().appendTo(this);
}
});
$("#resizable").resizable();
$("#selectable").selectable();
$("#slider").slider();
$("#sortable").sortable();
});
</script>
</head>
<body>
<ul class="plugins">
<li>
Datepicker
<div style="text-align:left;margin-left:10px;">
<input type="text" id="datepicker">
</div>
</li>
<li>
Dialog
<div id="dialog">
<button>Open</button>
</div>
</li>
<li>
Draggable
<div id="draggable"></div>
</li>
<li>
Droppable
<div class="draggable">D</div>
<div class="draggable">R</div>
<div class="draggable">A</div>
<div class="draggable">G</div>
<div id="droppable">
DROP
<hr>
</div>
</li>
<li>
Resizable
<div id="resizable"></div>
</li>
<li>
Selectable
<div id="selectable">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</div>
</li>
<li>
Slider
<div id="slider"></div>
</li>
<li>
Sortable
<div id="sortable">
<div>C</div>
<div>I</div>
<div>G</div>
<div>F</div>
<div>D</div>
<div>H</div>
<div>A</div>
<div>E</div>
<div>B</div>
</div>
</li>
</ul>
</body>
</html>

View file

@ -0,0 +1,28 @@
<!doctype html>
<html lang="en">
<head>
<title>Simple Datepicker</title>
<link rel="stylesheet" href="all.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../themes/ui.datepicker.css" type="text/css" media="screen">
<script type="text/javascript" src="../../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.datepicker.js"></script>
<script type="text/javascript">
$(function() {
$("#datepicker").datepicker();
});
</script>
</head>
<body>
<ul class="plugins">
<li>
Datepicker
<div style="text-align:left;margin-left:10px;">
<input type="text" id="datepicker">
</div>
</li>
</ul>
</body>
</html>

View file

@ -0,0 +1,31 @@
<!doctype html>
<html lang="en">
<head>
<title>Simple Dialog</title>
<link rel="stylesheet" href="all.css" type="text/css" media="screen">
<script type="text/javascript" src="../../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.dialog.js"></script>
<script type="text/javascript" src="../../ui/ui.draggable.js"></script>
<script type="text/javascript" src="../../ui/ui.resizable.js"></script>
<script type="text/javascript">
$(function() {
$("#dialog").click(function() {
$("<div/>").dialog();
});
});
</script>
</head>
<body>
<ul class="plugins">
<li>
Dialog
<div id="dialog">
<button>Open</button>
</div>
</li>
</ul>
</body>
</html>

View file

@ -0,0 +1,27 @@
<!doctype html>
<html lang="en">
<head>
<title>Simple Draggable</title>
<link rel="stylesheet" href="all.css" type="text/css" media="screen">
<script type="text/javascript" src="../../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.draggable.js"></script>
<script type="text/javascript">
$(function() {
$("#draggable").draggable({ handle: "span" });
});
</script>
</head>
<body>
<ul class="plugins">
<li>
Draggable
<div id="draggable">
<span>Handle</span>
</div>
</li>
</ul>
</body>
</html>

View file

@ -0,0 +1,25 @@
<!doctype html>
<html lang="en">
<head>
<title>Simple Draggable</title>
<link rel="stylesheet" href="all.css" type="text/css" media="screen">
<script type="text/javascript" src="../../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.draggable.js"></script>
<script type="text/javascript">
$(function() {
$("#draggable").draggable();
});
</script>
</head>
<body>
<ul class="plugins">
<li>
Draggable
<div id="draggable"></div>
</li>
</ul>
</body>
</html>

View file

@ -0,0 +1,158 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script src="../../jquery-1.2.6.js" type="text/javascript" charset="utf-8"></script>
<script src="../../ui/ui.core.js" type="text/javascript" charset="utf-8"></script>
<script src="../../ui/ui.draggable.js" type="text/javascript" charset="utf-8"></script>
<script src="../../ui/ui.sortable.js" type="text/javascript" charset="utf-8"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>jQuery UI Draggable Visual Test</title>
</head>
<body>
<style>
.draggable {
width:100px;
height:100px;
background-color:green;
color: #fff;
padding: 5px;
margin: 5px;
border: 5px solid red;
}
.container {
width: 500px;
height: 200px;
border: 5px solid black;
padding: 5px;
margin: 5px;
float: left;
background: #fff;
}
.enlarge {
width: 1000px;
height: 1000px;
}
</style>
<script language="JavaScript">
<!--
$(function(){
$(".draggable").draggable({
//helper: 'clone',
drag: function(e, ui) {
//console.log(ui.helper.offset());
},
scroll:true
//containment:"parent"
});
});
//-->
</script>
<div class='container' style="overflow:scroll;">
<div class='draggable'>(Broken in IE)</div>
<div class='enlarge'></div>
</div>
<div class='container' style="overflow:scroll; position: relative;">
<div class='draggable'></div>
<div class='enlarge'></div>
</div>
<div class='container' style="overflow:scroll;">
<div class='draggable' style='position: absolute;top:0px;left:1000px;'>Absolute</div>
<div class='enlarge'></div>
</div>
<div class='container' style="overflow:scroll; position: relative;">
<div class='draggable' style='position: absolute;'>Absolute</div>
<div class='enlarge'></div>
</div>
<div class='container' style="overflow:scroll;">
<div class='draggable' style='position: fixed;'>Fixed</div>
<div class='enlarge'></div>
</div>
<div class='container' style="overflow:scroll; position: relative;">
<div class='draggable' style='position: fixed;'>Fixed</div>
<div class='enlarge'></div>
</div>
<!-- Relative draggable with two containers -->
<div class='container' style="overflow:scroll; position: relative;">
<div class='container'>
<div class='draggable'>Relative</div>
<div class='enlarge'></div>
</div>
</div>
<div class='container' style="overflow:scroll; position: relative;">
<div class='container' style='position: relative;'>
<div class='draggable'>Relative</div>
<div class='enlarge'></div>
</div>
</div>
<div class='container' style="position: relative;">
<div class='container' style='overflow: scroll;'>
<div class='draggable'>Relative (Broken in IE)</div>
<div class='enlarge'></div>
</div>
</div>
<div class='container' style="position: relative;">
<div class='container' style='position: relative; overflow: scroll;'>
<div class='draggable'>Relative</div>
<div class='enlarge'></div>
</div>
</div>
<!-- Absolute draggable with two containers -->
<div class='container' style="overflow:scroll; position: relative;">
<div class='container'>
<div class='draggable' style='position: absolute;'>Absolute</div>
<div class='enlarge'></div>
</div>
</div>
<div class='container' style="overflow:scroll; position: relative;">
<div class='container' style='position: relative;'>
<div class='draggable' style='position: absolute;'>Absolute</div>
<div class='enlarge'></div>
</div>
</div>
<div class='container' style="position: relative;">
<div class='container' style='overflow: scroll;'>
<div class='draggable' style='position: absolute;top:0px;left:0px;'>Absolute</div>
<div class='enlarge'></div>
</div>
</div>
<div class='container' style="position: relative;">
<div class='container' style='position: relative; overflow: scroll;'>
<div class='draggable' style='position: absolute;'>Absolute</div>
<div class='enlarge'></div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,39 @@
<!doctype html>
<html lang="en">
<head>
<title>Simple Droppable</title>
<link rel="stylesheet" href="all.css" type="text/css" media="screen">
<script type="text/javascript" src="../../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.draggable.js"></script>
<script type="text/javascript" src="../../ui/ui.droppable.js"></script>
<script type="text/javascript">
$(function() {
$(".draggable").draggable();
$("#droppable").droppable({
accept: '.draggable',
drop: function(ev, ui) {
ui.draggable.css({ position: 'relative', top: 0, left: 0 }).clone().appendTo(this);
}
});
});
</script>
</head>
<body>
<ul class="plugins">
<li>
Droppable
<div class="draggable">D</div>
<div class="draggable">R</div>
<div class="draggable">A</div>
<div class="draggable">G</div>
<div id="droppable">
DROP
<hr>
</div>
</li>
</ul>
</body>
</html>

View file

@ -0,0 +1,49 @@
body,html {
margin: 0;
padding: 0;
font-size: 12px;
font-family: Arial;
background: #000;
}
ul.effects {
margin: 0;
padding: 0;
}
ul.effects li {
margin: 0;
padding: 0;
width: 120px;
height: 100px;
float: left;
margin-top: 20px;
margin-left: 20px;
}
div.effect {
width: 120px;
height: 100px;
background: #333;
border: 5px outset #aaa;
float: left;
cursor: pointer;
cursor: hand;
}
div.current {
border: 5px outset #FF0000;
background: #660000;
}
div.effect p {
color: #eee;
margin: 0px;
padding: 10px;
}
.ui-effects-transfer {
border: 1px dotted #fff;
background: #666;
opacity: 0.5;
}

View file

@ -0,0 +1,165 @@
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Effects Test Suite</title>
<link rel="stylesheet" href="effects.all.css" type="text/css" media="screen" title="no title" charset="utf-8" />
<script type="text/javascript" src="../../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../../ui/effects.core.js"></script>
<script type="text/javascript" src="../../ui/effects.blind.js"></script>
<script type="text/javascript" src="../../ui/effects.bounce.js"></script>
<script type="text/javascript" src="../../ui/effects.clip.js"></script>
<script type="text/javascript" src="../../ui/effects.drop.js"></script>
<script type="text/javascript" src="../../ui/effects.explode.js"></script>
<script type="text/javascript" src="../../ui/effects.fold.js"></script>
<script type="text/javascript" src="../../ui/effects.highlight.js"></script>
<script type="text/javascript" src="../../ui/effects.pulsate.js"></script>
<script type="text/javascript" src="../../ui/effects.scale.js"></script>
<script type="text/javascript" src="../../ui/effects.shake.js"></script>
<script type="text/javascript" src="../../ui/effects.slide.js"></script>
<script type="text/javascript" src="../../ui/effects.transfer.js"></script>
<script type="text/javascript" src="effects.all.js"></script>
</head>
<body>
<ul class="effects">
<li>
<div class="effect" id="blindHorizontally">
<p>Blind horizontally</p>
</div>
</li>
<li>
<div class="effect" id="blindVertically">
<p>Blind vertically</p>
</div>
</li>
<li>
<div class="effect" id="bounce3times">
<p>Bounce 3 times</p>
</div>
</li>
<li>
<div class="effect" id="clipHorizontally">
<p>Clip horizontally</p>
</div>
</li>
<li>
<div class="effect" id="clipVertically">
<p>Clip vertically</p>
</div>
</li>
<li>
<div class="effect" id="dropDown">
<p>Drop down</p>
</div>
</li>
<li>
<div class="effect" id="dropUp">
<p>Drop up</p>
</div>
</li>
<li>
<div class="effect" id="dropLeft">
<p>Drop left</p>
</div>
</li>
<li>
<div class="effect" id="dropRight">
<p>Drop right</p>
</div>
</li>
<li>
<div class="effect" id="explode9">
<p>Explode in 9 pieces</p>
</div>
</li>
<li>
<div class="effect" id="explode36">
<p>Explode in 36 pieces</p>
</div>
</li>
<li>
<div class="effect" id="fold">
<p>Fold</p>
</div>
</li>
<li>
<div class="effect" id="highlight">
<p>Highlight</p>
</div>
</li>
<li>
<div class="effect" id="pulsate">
<p>Pulsate 2 times</p>
</div>
</li>
<li>
<div class="effect" id="puff">
<p>Puff</p>
</div>
</li>
<li>
<div class="effect" id="scale">
<p>Scale</p>
</div>
</li>
<li>
<div class="effect" id="shake">
<p>Shake</p>
</div>
</li>
<li>
<div class="effect" id="slideDown">
<p>Slide down</p>
</div>
</li>
<li>
<div class="effect" id="slideUp">
<p>Slide up</p>
</div>
</li>
<li>
<div class="effect" id="slideLeft">
<p>Slide left</p>
</div>
</li>
<li>
<div class="effect" id="slideRight">
<p>Slide right</p>
</div>
</li>
<li>
<div class="effect" id="transfer">
<p>Transfer to first element</p>
</div>
</li>
</ul>
</body>
</html>

View file

@ -0,0 +1,65 @@
$(document).ready(function() {
$("div.effect")
.hover(function() {
$(this).addClass("hover");
}, function() {
$(this).removeClass("hover");
})
;
var effect = function(el, n, o) {
$.extend(o, {
easing: "easeOutQuint"
});
$(el).bind("click", function() {
$(this).addClass("current").hide(n, o, 1000, function() {
var self = this;
window.setTimeout(function() {
$(self).show(n, o, 1000, function() { $(this).removeClass("current"); });
},500);
});
});
};
effect("#blindHorizontally", "blind", { direction: "horizontal" });
effect("#blindVertically", "blind", { direction: "vertical" });
effect("#bounce3times", "bounce", { times: 3 });
effect("#clipHorizontally", "clip", { direction: "horizontal" });
effect("#clipVertically", "clip", { direction: "vertical" });
effect("#dropDown", "drop", { direction: "down" });
effect("#dropUp", "drop", { direction: "up" });
effect("#dropLeft", "drop", { direction: "left" });
effect("#dropRight", "drop", { direction: "right" });
effect("#explode9", "explode", { });
effect("#explode36", "explode", { pieces: 36 });
effect("#fold", "fold", { size: 50 });
effect("#highlight", "highlight", { });
effect("#pulsate", "pulsate", { times: 2 });
effect("#puff", "puff", { times: 2 });
effect("#scale", "scale", { });
$("#shake").bind("click", function() { $(this).addClass("current").effect("shake", {}, 100, function() { $(this).removeClass("current"); }); });
effect("#slideDown", "slide", { direction: "down" });
effect("#slideUp", "slide", { direction: "up" });
effect("#slideLeft", "slide", { direction: "left" });
effect("#slideRight", "slide", { direction: "right" });
$("#transfer").bind("click", function() { $(this).addClass("current").effect("transfer", { to: "div:eq(0)" }, 1000, function() { $(this).removeClass("current"); }); });
});

View file

@ -0,0 +1,26 @@
<!doctype html>
<html lang="en">
<head>
<title>Simple Resizable</title>
<link rel="stylesheet" href="all.css" type="text/css" media="screen">
<script type="text/javascript" src="../../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.resizable.js"></script>
<script type="text/javascript">
$(function() {
$("#resizable").resizable();
});
</script>
</head>
<body>
<ul class="plugins">
<li>
Resizable
<div id="resizable"></div>
</li>
</ul>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!doctype html>
<html lang="en">
<head>
<title>Simple Selectable</title>
<link rel="stylesheet" href="all.css" type="text/css" media="screen">
<script type="text/javascript" src="../../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.selectable.js"></script>
<script type="text/javascript">
$(function() {
$("#selectable").selectable();
});
</script>
</head>
<body>
<ul class="plugins">
<li>
Selectable
<div id="selectable">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
</div>
</li>
</ul>
</body>
</html>

View file

@ -0,0 +1,26 @@
<!doctype html>
<html lang="en">
<head>
<title>Simple Slider</title>
<link rel="stylesheet" href="all.css" type="text/css" media="screen">
<script type="text/javascript" src="../../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.slider.js"></script>
<script type="text/javascript">
$(function() {
$("#slider").slider();
});
</script>
</head>
<body>
<ul class="plugins">
<li>
Slider
<div id="slider"></div>
</li>
</ul>
</body>
</html>

View file

@ -0,0 +1,36 @@
<!doctype html>
<html lang="en">
<head>
<title>Simple Sortable</title>
<link rel="stylesheet" href="all.css" type="text/css" media="screen">
<script type="text/javascript" src="../../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.sortable.js"></script>
<script type="text/javascript">
$(function() {
$("#sortable").sortable();
});
</script>
</head>
<body>
<ul class="plugins">
<li>
Sortable
<div id="sortable">
<div>C</div>
<div>I</div>
<div>G</div>
<div>F</div>
<div>D</div>
<div>H</div>
<div>A</div>
<div>E</div>
<div>B</div>
</div>
</li>
</ul>
</body>
</html>

View file

@ -0,0 +1,756 @@
<!doctype html>
<html lang="en">
<head>
<title>Sortable Visual Test</title>
<script type="text/javascript" src="../../jquery-1.2.6.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.sortable.js"></script>
<script type="text/javascript" src="../../ui/ui.draggable.js"></script>
<script type="text/javascript">
$(document).ready( function() {
$('ul').not(".draggable").sortable({ items: "li" });
$("ul.draggable li").draggable({ helper: "clone", connectToSortable: "ul" });
});
</script>
<style>
ul {
list-style: none;
padding: 0;
border: 1px solid black;
width: 210px;
float: left;
margin-right: 10px;
}
li {
width: 200px;
background: #eee;
margin: 5px;
}
</style>
</head>
<body>
<ul class="draggable">
<li>Draggable</li>
</ul>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
</ul>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
</ul>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
</ul>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
</ul>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
<li>Item 11</li>
<li>Item 12</li>
<li>Item 13</li>
<li>Item 14</li>
<li>Item 15</li>
<li>Item 16</li>
<li>Item 17</li>
<li>Item 18</li>
<li>Item 19</li>
<li>Item 20</li>
</ul>
</body>
</html>