aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/selectmenu/all.html30
-rw-r--r--tests/unit/selectmenu/selectmenu.html87
-rw-r--r--tests/unit/selectmenu/selectmenu_core.js88
-rw-r--r--tests/unit/selectmenu/selectmenu_defaults.js19
-rw-r--r--tests/unit/selectmenu/selectmenu_events.js108
-rw-r--r--tests/unit/selectmenu/selectmenu_methods.js146
-rw-r--r--tests/unit/selectmenu/selectmenu_options.js37
-rw-r--r--tests/visual/selectmenu/compatibility.html121
-rw-r--r--tests/visual/selectmenu/disabled.html137
-rw-r--r--tests/visual/selectmenu/events.html74
-rw-r--r--tests/visual/selectmenu/methods.html88
-rw-r--r--tests/visual/selectmenu/themeswitcher.html104
12 files changed, 1039 insertions, 0 deletions
diff --git a/tests/unit/selectmenu/all.html b/tests/unit/selectmenu/all.html
new file mode 100644
index 000000000..9bb6835d0
--- /dev/null
+++ b/tests/unit/selectmenu/all.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery UI Selectmenu Test Suite</title>
+
+ <script src="../../../jquery-1.6.2.js"></script>
+
+ <link rel="stylesheet" href="../../../external/qunit.css">
+ <link rel="stylesheet" href="../subsuiteRunner.css">
+ <script src="../../../external/qunit.js"></script>
+ <script src="../subsuiteRunner.js"></script>
+ <script src="../subsuite.js"></script>
+
+ <script>
+ testAllVersions( "selectmenu" );
+ </script>
+</head>
+<body>
+
+<h1 id="qunit-header">jQuery UI Selectmenu Test Suite</h1>
+<h2 id="qunit-banner"></h2>
+<div id="qunit-testrunner-toolbar"></div>
+<h2 id="qunit-userAgent"></h2>
+<ol id="qunit-tests"></ol>
+<div id="qunit-fixture">
+
+</div>
+</body>
+</html>
diff --git a/tests/unit/selectmenu/selectmenu.html b/tests/unit/selectmenu/selectmenu.html
new file mode 100644
index 000000000..c64b364fa
--- /dev/null
+++ b/tests/unit/selectmenu/selectmenu.html
@@ -0,0 +1,87 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery UI Selectmenu Test Suite</title>
+
+ <link rel="stylesheet" href="../../../themes/base/jquery.ui.core.css">
+ <link rel="stylesheet" href="../../../themes/base/jquery.ui.button.css">
+ <link rel="stylesheet" href="../../../themes/base/jquery.ui.menu.css">
+ <link rel="stylesheet" href="../../../themes/base/jquery.ui.selectmenu.css">
+
+ <script src="../../jquery.js"></script>
+ <script src="../../../ui/jquery.ui.core.js"></script>
+ <script src="../../../ui/jquery.ui.widget.js"></script>
+ <script src="../../../ui/jquery.ui.button.js"></script>
+ <script src="../../../ui/jquery.ui.menu.js"></script>
+ <script src="../../../ui/jquery.ui.selectmenu.js"></script>
+
+ <link rel="stylesheet" href="../../../external/qunit.css">
+ <script src="../../../external/qunit.js"></script>
+ <script src="../../jquery.simulate.js"></script>
+ <script src="../testsuite.js"></script>
+
+ <script src="selectmenu_core.js"></script>
+ <script src="selectmenu_defaults.js"></script>
+ <script src="selectmenu_events.js"></script>
+ <script src="selectmenu_methods.js"></script>
+ <script src="selectmenu_options.js"></script>
+
+ <script src="../swarminject.js"></script>
+</head>
+<body>
+
+<h1 id="qunit-header">jQuery UI Selectmenu Test Suite</h1>
+<h2 id="qunit-banner"></h2>
+<div id="qunit-testrunner-toolbar"></div>
+<h2 id="qunit-userAgent"></h2>
+<ol id="qunit-tests"></ol>
+<div id="qunit-fixture">
+
+ <label for="speed">Select a speed:</label>
+ <select name="speed" id="speed">
+ <option value="Slower">Slower</option>
+ <option value="Slow">Slow</option>
+ <option value="Medium" selected="selected">Medium</option>
+ <option value="Fast">Fast</option>
+ <option value="Faster">Faster</option>
+ </select>
+
+ <label for="number">Select a number:</label>
+ <select name="number" id="number">
+ <option value="1">1</option>
+ <option value="2" selected="selected">2</option>
+ <option value="3">3</option>
+ <option value="4">4</option>
+ <option value="5">5</option>
+ <option value="6">6</option>
+ <option value="7">7</option>
+ <option value="8">8</option>
+ <option value="9">9</option>
+ <option value="10">10</option>
+ <option value="11">11</option>
+ <option value="12">12</option>
+ <option value="13">13</option>
+ <option value="14">14</option>
+ <option value="15">15</option>
+ <option value="16">16</option>
+ <option value="17">17</option>
+ <option value="18">18</option>
+ <option value="19">19</option>
+ </select>
+
+ <label for="files">Select a file:</label>
+ <select name="files" id="files">
+ <optgroup label="Scripts">
+ <option value="jquery">jQuery.js</option>
+ <option value="jqueryui">ui.jQuery.js</option>
+ </optgroup>
+ <optgroup label="Other files">
+ <option value="somefile">Some unknown file</option>
+ <option value="someotherfile">Some other file</option>
+ </optgroup>
+ </select>
+
+</div>
+</body>
+</html>
diff --git a/tests/unit/selectmenu/selectmenu_core.js b/tests/unit/selectmenu/selectmenu_core.js
new file mode 100644
index 000000000..d3b2bfa81
--- /dev/null
+++ b/tests/unit/selectmenu/selectmenu_core.js
@@ -0,0 +1,88 @@
+(function( $ ) {
+
+module( "selectmenu: core" );
+
+test("accessibility", function () {
+ var element = $('#speed').selectmenu(),
+ widget = element.selectmenu("widget"),
+ button = widget.filter(".ui-selectmenu-button"),
+ menu = widget.filter(".ui-selectmenu-menu"),
+ link = button.find("a"),
+ selected = element.find("option:selected"),
+ ul = menu.children("ul"),
+ links = ul.find("li.ui-menu-item a");
+
+ expect(13 + links.length * 2);
+
+ equals( link.attr("role"), "combobox", "button link role" );
+ equals( link.attr("aria-haspopup"), "true", "button link aria-haspopup" );
+ equals( link.attr("aria-expanded"), "false", "button link aria-expanded" );
+ equals( link.attr("aria-autocomplete"), "list", "button link aria-autocomplete" );
+ equals( link.attr("aria-activedescendant"), links.eq(element[0].selectedIndex).attr("id"), "button link aria-activedescendant" );
+ equals( link.attr("aria-owns"), ul.attr("id"), "button link aria-owns" );
+ equals( link.attr("tabindex"), 0, "button link tabindex" );
+
+ equals( ul.attr("role"), "listbox", "menu role" );
+ equals( ul.attr("aria-labelledby"), link.attr("id"), "menu aria-labelledby" );
+ equals( ul.attr("aria-hidden"), "true", "menu aria-hidden" );
+ equals( ul.attr("tabindex"), 0, "menu tabindex" );
+ equals( ul.attr("aria-activedescendant"), links.eq(element[0].selectedIndex).attr("id"), "menu aria-activedescendant" );
+ $.each( links, function(index){
+ equals( $(this).attr("role"), "option", "menu link #" + index +" role" );
+ equals( $(this).attr("tabindex"), -1, "menu link #" + index +" tabindex" );
+ });
+ equals( links.eq(element[0].selectedIndex).attr("aria-selected"), "true", "selected menu link aria-selected" );
+});
+
+
+$.each([
+ {
+ type: "default",
+ selector: "#speed"
+ },
+ {
+ type: "optgroups",
+ selector: "#files"
+ }
+], function( i, settings ) {
+ test("state synchronization - " + settings.type, function () {
+ expect(10);
+
+ var element = $(settings.selector).selectmenu(),
+ widget = element.selectmenu("widget"),
+ button = widget.filter(".ui-selectmenu-button"),
+ menu = widget.filter(".ui-selectmenu-menu"),
+ link = button.find("a"),
+ ul = menu.children("ul"),
+ links = ul.find("li.ui-menu-item a"),
+ selected = element.find("option:selected");
+
+ link.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ equals( ul.attr("aria-activedescendant"), links.eq(element[0].selectedIndex).attr("id"), "after keydown menu aria-activedescendant" );
+ equals( link.attr("aria-activedescendant"), links.eq(element[0].selectedIndex).attr("id"), "after keydown button link aria-activedescendant" );
+ equals( links.eq(element[0].selectedIndex).attr("aria-selected"), "true", "after keydown selected menu link aria-selected" );
+ equals( element.find("option:selected").val(), selected.next("option").val() , "after keydown original select state" );
+ equals( button.text(), selected.next("option").text(), "after keydown button text" );
+
+ link.simulate( "click" );
+ menu.find("a").last().simulate( "mouseover" ).trigger( "click" );
+ equals( ul.attr("aria-activedescendant"), links.eq(element[0].selectedIndex).attr("id"), "after click menu aria-activedescendant" );
+ equals( link.attr("aria-activedescendant"), links.eq(element[0].selectedIndex).attr("id"), "after click button link aria-activedescendant" );
+ equals( links.eq(element[0].selectedIndex).attr("aria-selected"), "true", "after click selected menu link aria-selected" );
+ equals( element.find("option:selected").val(), element.find("option").last().val(), "after click original select state" );
+ equals( button.text(), element.find("option").last().text(), "after click button text" );
+ });
+});
+
+
+// test("mass", function () {
+ // for (var i = 0; i < 100; i++) {
+ // var element = $('#speed').selectmenu();
+ // var widget = element.selectmenu("destroy");
+ // expect(0);
+ // }
+// });
+
+
+
+})( jQuery );
diff --git a/tests/unit/selectmenu/selectmenu_defaults.js b/tests/unit/selectmenu/selectmenu_defaults.js
new file mode 100644
index 000000000..9f6a1a964
--- /dev/null
+++ b/tests/unit/selectmenu/selectmenu_defaults.js
@@ -0,0 +1,19 @@
+commonWidgetTests( "selectmenu", {
+ defaults: {
+ appendTo: "body",
+ disabled: false,
+ dropdown: true,
+ position: {
+ my: "left top",
+ at: "left bottom",
+ collision: "none"
+ },
+ // callbacks,
+ create: null,
+ open: null,
+ focus: null,
+ select: null,
+ close: null,
+ change: null
+ }
+});
diff --git a/tests/unit/selectmenu/selectmenu_events.js b/tests/unit/selectmenu/selectmenu_events.js
new file mode 100644
index 000000000..92dc6f01a
--- /dev/null
+++ b/tests/unit/selectmenu/selectmenu_events.js
@@ -0,0 +1,108 @@
+(function ($) {
+
+module("selectmenu: events", {
+ setup: function () {
+ this.element = $("#speed");
+ }
+});
+
+test("change", function () {
+ expect(5);
+
+ this.element.selectmenu({
+ change: function (event, ui) {
+ ok(event, "change event fired on change");
+ equals(event.type, "selectmenuchange", "event type set to selectmenuchange");
+ ok(ui, "ui object is passed as second argument to event handler");
+ equals(ui.item.element[0].nodeName, "OPTION", "ui.item.element[0] points to original option element");
+ equals(ui.item.value, value, "ui.item.value property updated correctly");
+ }
+ });
+
+ var widget = this.element.selectmenu("widget"),
+ menu = widget.filter(".ui-selectmenu-menu"),
+ button = widget.filter(".ui-selectmenu-button"),
+ value = this.element.find("option").first().text();
+
+ button.find("a").simulate( "click" );
+ menu.find("a").first().simulate( "mouseover" ).trigger( "click" );
+});
+
+
+test("close", function () {
+ expect(3);
+
+ this.element.selectmenu({
+ close: function (event, ui) {
+ ok(event, "close event fired on close");
+ equals(event.type, "selectmenuclose", "event type set to selectmenuclose");
+ ok(ui, "ui object is passed as second argument to event handler");
+ }
+ });
+
+ this.element.selectmenu("open").selectmenu("close");
+});
+
+
+test("focus", function () {
+ expect(4);
+
+ var counter = 0;
+
+ this.element.selectmenu({
+ focus: function (event, ui) {
+ counter++;
+ if (counter === 1) {
+ ok(event, "focus event fired on mouseover");
+ equals(event.type, "selectmenufocus", "event type set to selectmenufocus");
+ ok(ui, "ui object is passed as second argument to event handler");
+ equals(ui.item.element[0].nodeName, "OPTION", "ui points to original option element");
+ }
+ }
+ });
+
+ var widget = this.element.selectmenu("widget"),
+ button = widget.filter(".ui-selectmenu-button"),
+ menu = widget.filter(".ui-selectmenu-menu");
+
+ button.find("a").simulate( "click" );
+ menu.find(".ui-menu-item").simulate("mouseover");
+});
+
+
+test("open", function () {
+ expect(3);
+
+ this.element.selectmenu({
+ open: function (event, ui) {
+ ok(event, "open event fired on open");
+ equals(event.type, "selectmenuopen", "event type set to selectmenuopen");
+ ok(ui, "ui object is passed as second argument to event handler");
+ }
+ });
+
+ this.element.selectmenu("open");
+});
+
+
+test("select", function () {
+ expect(4);
+
+ this.element.selectmenu({
+ select: function (event, ui) {
+ ok(event, "select event fired on item select");
+ equals(event.type, "selectmenuselect", "event type set to selectmenuselect");
+ ok(ui, "ui object is passed as second argument to event handler");
+ equals(ui.item.element[0].nodeName, "OPTION", "ui points to original option element");
+ }
+ });
+
+ var widget = this.element.selectmenu("widget"),
+ button = widget.filter(".ui-selectmenu-button"),
+ menu = widget.filter(".ui-selectmenu-menu");
+
+ button.find("a").simulate( "click" );
+ menu.find("a").first().simulate( "mouseover" ).trigger("click");
+});
+
+})(jQuery);
diff --git a/tests/unit/selectmenu/selectmenu_methods.js b/tests/unit/selectmenu/selectmenu_methods.js
new file mode 100644
index 000000000..47e76053d
--- /dev/null
+++ b/tests/unit/selectmenu/selectmenu_methods.js
@@ -0,0 +1,146 @@
+(function( $ ) {
+
+module( "selectmenu: methods" );
+
+test( "destroy", function() {
+ expect( 1 );
+ domEqual( "#speed", function() {
+ $( "#speed" ).selectmenu().selectmenu( "destroy" );
+ });
+});
+
+
+test( "open / close", function() {
+ expect( 4 );
+
+ var element = $('#speed').selectmenu(),
+ widget = element.selectmenu("widget"),
+ button = widget.filter(".ui-selectmenu-button"),
+ menu = widget.filter(".ui-selectmenu-menu");
+
+ element.selectmenu("open");
+ ok( menu.is( ":visible" ), "menu visible" );
+ equals( menu.find("ul").attr("aria-hidden"), "false", "menu aria-disabled" );
+
+ element.selectmenu("close");
+ ok( menu.is( ":hidden" ), "menu hidden" );
+ equals( menu.find("ul").attr("aria-hidden"), "true", "menu aria-disabled" );
+});
+
+
+test("enable / disable", function () {
+ expect(14);
+
+ var element = $('#speed').selectmenu(),
+ widget = element.selectmenu("widget"),
+ button = widget.filter(".ui-selectmenu-button"),
+ menu = widget.filter(".ui-selectmenu-menu"),
+ link = button.find("a");
+
+ element.selectmenu("disable")
+ ok( element.selectmenu("option", "disabled"), "disable: widget option" );
+ equals( element.attr("disabled"), "disabled", "disable: native select disabled" );
+ equals( button.attr("aria-disabled"), "true", "disable: button wrapper ARIA" );
+ equals( link.attr("aria-disabled"), "true", "disable: button ARIA" );
+ equals( link.attr("tabindex"), -1, "disable: button tabindex" );
+ equals( menu.attr("aria-disabled"), "true", "disable: menu wrapper ARIA" );
+ equals( menu.children("ul").attr("aria-disabled"), "true", "disable: menu ARIA" );
+
+ element.selectmenu("enable")
+ ok( !element.selectmenu("option", "disabled"), "enable: widget option" );
+ equals( element.attr("disabled"), undefined, "enable: native select disabled" );
+ equals( button.attr("aria-disabled"), "false", "enable: button wrapper ARIA" );
+ equals( link.attr("aria-disabled"), "false", "enable: button ARIA" );
+ equals( link.attr("tabindex"), 0, "enable: button tabindex" );
+ equals( menu.attr("aria-disabled"), "false", "enable: menu wrapper ARIA" );
+ equals( menu.children("ul").attr("aria-disabled"), "false", "enable: menu ARIA" );
+});
+
+
+test("refresh - structure", function () {
+ expect(3);
+
+ var element = $('#speed').selectmenu(),
+ widget = element.selectmenu("widget"),
+ button = widget.filter(".ui-selectmenu-button"),
+ menu = widget.filter(".ui-selectmenu-menu");
+
+ element.find("option").eq(2).remove();
+ element.find("option").eq(3).remove();
+ element.append('<option value="added_option">Added option</option>');
+ element.find("option").first()
+ .attr("value", "changed_value")
+ .text("Changed value");
+ element.selectmenu("refresh");
+
+ equals( element.find("option").length, menu.find("li").not(".ui-selectmenu-optgroup").length, "menu item length" );
+ equals( element.find("option").last().text(), menu.find("li").not(".ui-selectmenu-optgroup").last().text(), "added item" );
+ equals( element.find("option").first().text(), menu.find("li").not(".ui-selectmenu-optgroup").first().text(), "chnaged item" );
+});
+
+
+test("refresh - disabled select", function () {
+ expect(6);
+
+ var element = $('#speed').selectmenu(),
+ widget = element.selectmenu("widget"),
+ button = widget.filter(".ui-selectmenu-button"),
+ menu = widget.filter(".ui-selectmenu-menu");
+
+ element.attr("disabled", "disabled");
+ element.selectmenu("refresh");
+
+ ok( element.selectmenu("option", "disabled"), "widget option" );
+ equals( button.attr("aria-disabled"), "true", "button wrapper ARIA" );
+ equals( button.children("a").attr("aria-disabled"), "true", "button ARIA" );
+ equals( button.children("a").attr("tabindex"), -1, "button tabindex" );
+ equals( menu.attr("aria-disabled"), "true", "menu wrapper ARIA" );
+ equals( menu.children("ul").attr("aria-disabled"), "true", "mene ARIA" );
+});
+
+
+test("refresh - disabled option", function () {
+ expect(2);
+
+ var element = $('#speed').selectmenu(),
+ widget = element.selectmenu("widget"),
+ button = widget.filter(".ui-selectmenu-button"),
+ menu = widget.filter(".ui-selectmenu-menu");
+
+ element.attr("disabled", "disabled");
+ element.find("option").eq(2).attr("disabled", "disabled");
+ element.selectmenu("refresh");
+
+ var disabledItem = menu.find("li").not(".ui-selectmenu-optgroup").eq(2);
+ ok( disabledItem.hasClass("ui-state-disabled"), "class" );
+ ok( disabledItem.children("a").length <= 0, "has no link" );
+});
+
+
+test("refresh - disabled optgroup", function () {
+
+ var element = $('#files').selectmenu(),
+ widget = element.selectmenu("widget"),
+ button = widget.filter(".ui-selectmenu-button"),
+ menu = widget.filter(".ui-selectmenu-menu");
+ originalDisabledOptgroup = element.find("optgroup").first(),
+ originalDisabledOptions = originalDisabledOptgroup.find("option");
+
+ expect(2 + originalDisabledOptions.length * 2);
+
+ originalDisabledOptgroup.attr("disabled", "disabled");
+ element.selectmenu("refresh");
+
+ var item = menu.find("li.ui-selectmenu-optgroup").first();
+ ok( item.hasClass("ui-state-disabled"), "class" );
+
+ equals( menu.find("li").not(".ui-selectmenu-optgroup").filter(".ui-state-disabled").length, originalDisabledOptions.length, "disabled options" );
+ for ( var i = 0; i < originalDisabledOptions.length; i++ ) {
+ item = item.next("li");
+ ok( item.hasClass("ui-state-disabled"), "item #" + i + ": class" );
+ ok( item.children("a").length <= 0, "item #" + i + ": has no link" );
+ }
+});
+
+
+})( jQuery );
diff --git a/tests/unit/selectmenu/selectmenu_options.js b/tests/unit/selectmenu/selectmenu_options.js
new file mode 100644
index 000000000..993086b27
--- /dev/null
+++ b/tests/unit/selectmenu/selectmenu_options.js
@@ -0,0 +1,37 @@
+(function ($) {
+
+module("selectmenu: options", {
+ setup: function () {
+ this.element = $("#speed").selectmenu();
+ }
+});
+
+test("appendTo another element", function () {
+ expect(2);
+
+ ok(this.element.selectmenu("option", "appendTo", "#qunit-fixture"), "appendTo accepts selector");
+ ok($("#qunit-fixture").find(".ui-selectmenu-menu").length, "selectmenu appendedTo other element");
+});
+
+
+test("dropdown: CSS styles", function () {
+ expect(4);
+
+ var widget = this.element.selectmenu("widget"),
+ button = widget.filter(".ui-selectmenu-button"),
+ link = button.find("a"),
+ menu = widget.filter(".ui-selectmenu-menu"),
+ ul = widget.find("ul");
+
+ this.element.selectmenu("open");
+ ok( link.hasClass("ui-corner-top") && !link.hasClass("ui-corner-all"), "button styles dropdown");
+ ok( ul.hasClass("ui-corner-bottom") && !ul.hasClass("ui-corner-all"), "menu styles dropdown");
+
+ this.element.selectmenu("close");
+ this.element.selectmenu("option", "dropdown", false);
+ this.element.selectmenu("open");
+ ok( !link.hasClass("ui-corner-top") && link.hasClass("ui-corner-all"), "button styles pop-up");
+ ok( !ul.hasClass("ui-corner-bottom") && ul.hasClass("ui-corner-all"), "menu styles pop-up");
+});
+
+})(jQuery);
diff --git a/tests/visual/selectmenu/compatibility.html b/tests/visual/selectmenu/compatibility.html
new file mode 100644
index 000000000..a99a629df
--- /dev/null
+++ b/tests/visual/selectmenu/compatibility.html
@@ -0,0 +1,121 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery UI Selectmenu - Compatibility with other widgets</title>
+ <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
+ <script src="../../../jquery-1.7.1.js"></script>
+ <script src="../../../ui/jquery.ui.core.js"></script>
+ <script src="../../../ui/jquery.ui.widget.js"></script>
+ <script src="../../../ui/jquery.ui.position.js"></script>
+ <script src="../../../ui/jquery.ui.tabs.js"></script>
+ <script src="../../../ui/jquery.ui.dialog.js"></script>
+ <script src="../../../ui/jquery.ui.autocomplete.js"></script>
+ <script src="../../../ui/jquery.ui.button.js"></script>
+ <script src="../../../ui/jquery.ui.menu.js"></script>
+ <script src="../../../ui/jquery.ui.selectmenu.js"></script>
+ <link rel="stylesheet" href="../../../demos/demos.css">
+ <script>
+ $(function() {
+ $('select').selectmenu();
+
+ var availableTags = [
+ "ActionScript",
+ "AppleScript",
+ "Asp",
+ "BASIC",
+ "C",
+ "C++",
+ "Clojure",
+ "COBOL",
+ "ColdFusion",
+ "Erlang",
+ "Fortran",
+ "Groovy",
+ "Haskell",
+ "Java",
+ "JavaScript",
+ "Lisp",
+ "Perl",
+ "PHP",
+ "Python",
+ "Ruby",
+ "Scala",
+ "Scheme"
+ ];
+ $( "#tags" ).autocomplete({
+ source: availableTags
+ });
+ $( "#tabs" ).tabs();
+ $( "#dialog" ).dialog();
+ });
+ </script>
+ <style>
+ form { margin: 20px 0 0 0 }
+ fieldset { border: 0; }
+ label { display: block; }
+ select { width: 200px; }
+ #tabs { margin: 50px 0 0 0 }
+ </style>
+</head>
+<body>
+
+<div class="demo">
+
+<div class="ui-widget">
+ <label for="tags">Tags: </label>
+ <input id="tags">
+</div>
+
+<div id="tabs">
+ <ul>
+ <li><a href="#tabs-1">Nunc tincidunt</a></li>
+ <li><a href="#tabs-2">Selectmenu</a></li>
+ <li><a href="#tabs-3">Aenean lacinia</a></li>
+ </ul>
+ <div id="tabs-1">
+ <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
+ </div>
+ <div id="tabs-2">
+ <form action="#">
+ <fieldset>
+ <label for="speed">Select a speed:</label>
+ <select name="speed" id="speed">
+ <option value="Slower">Slower</option>
+ <option value="Slow">Slow</option>
+ <option value="Medium" selected="selected">Medium</option>
+ <option value="Fast">Fast</option>
+ <option value="Faster">Faster</option>
+ </select>
+ </fieldset>
+ </form>
+ </div>
+ <div id="tabs-3">
+ <p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p>
+ <p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
+ </div>
+</div>
+
+<div id="dialog" title="Basic dialog">
+ <p>Some example content</p>
+ <p><a href="#nogo">Test Link</a></p>
+ <form action="#">
+ <fieldset>
+ <label for="speed">Select a speed:</label>
+ <select name="speed" id="speed">
+ <option value="Slower">Slower</option>
+ <option value="Slow">Slow</option>
+ <option value="Medium" selected="selected">Medium</option>
+ <option value="Fast">Fast</option>
+ <option value="Faster">Faster</option>
+ </select>
+ </fieldset>
+ </form>
+</div>
+
+</div><!-- End demo -->
+
+
+
+</body>
+</html>
diff --git a/tests/visual/selectmenu/disabled.html b/tests/visual/selectmenu/disabled.html
new file mode 100644
index 000000000..e2bc436ac
--- /dev/null
+++ b/tests/visual/selectmenu/disabled.html
@@ -0,0 +1,137 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery UI Selectmenu - Disable functionality</title>
+ <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
+ <script src="../../../jquery-1.7.1.js"></script>
+ <script src="../../../ui/jquery.ui.core.js"></script>
+ <script src="../../../ui/jquery.ui.widget.js"></script>
+ <script src="../../../ui/jquery.ui.position.js"></script>
+ <script src="../../../ui/jquery.ui.button.js"></script>
+ <script src="../../../ui/jquery.ui.menu.js"></script>
+ <script src="../../../ui/jquery.ui.selectmenu.js"></script>
+ <link rel="stylesheet" href="../../../demos/demos.css">
+ <script>
+ $(function() {
+ $('select#speed').selectmenu({
+ dropdown: false
+ });
+ var withOverflow = $('select#number').selectmenu({
+ dropdown: false
+ });
+ withOverflow.selectmenu("widget").addClass("overflow");
+ $('select#files').selectmenu();
+ var files2 = $('select#files2').selectmenu();
+
+ $("#disable_select").toggle( function() {
+ files2.selectmenu("disable");
+ }, function() {
+ files2.removeAttr("disabled");
+ files2.selectmenu("refresh");
+ });
+ $("#disable_option").toggle( function() {
+ files2.find("option:eq(0)").attr("disabled", "disabled");
+ files2.selectmenu("refresh");
+ }, function() {
+ files2.find("option:eq(0)").removeAttr("disabled");
+ files2.selectmenu("refresh");
+ });
+ $("#disable_optgroup").toggle( function() {
+ files2.find("optgroup:eq(0)").attr("disabled", "disabled");
+ files2.selectmenu("refresh");
+ }, function() {
+ files2.find("optgroup:eq(0)").removeAttr("disabled");
+ files2.selectmenu("refresh");
+
+ });
+ });
+ </script>
+ <style>
+ form { margin: 100px 0 0 0 }
+ fieldset { border: 0; }
+ label { display: block; }
+ select { width: 200px; }
+ .overflow ul { height: 200px; overflow: auto; }
+ </style>
+</head>
+<body>
+
+<div class="demo">
+
+<form action="#">
+ <fieldset>
+ <label for="speed">Select a speed:</label>
+ <select disabled="disabled" name="speed" id="speed">
+ <option value="Slower">Slower</option>
+ <option value="Slow">Slow</option>
+ <option value="Medium" selected="selected">Medium</option>
+ <option value="Fast">Fast</option>
+ <option value="Faster">Faster</option>
+ </select>
+ <br />
+ <br />
+ <br />
+ <label for="number">Select a number:</label>
+ <select name="number" id="number">
+ <option value="1">1</option>
+ <option value="2" selected="selected">2</option>
+ <option value="3">3</option>
+ <option disabled="disabled" value="4">4</option>
+ <option value="5">5</option>
+ <option value="6">6</option>
+ <option value="7">7</option>
+ <option disabled="disabled" value="8">8</option>
+ <option value="9">9</option>
+ <option value="10">10</option>
+ <option disabled="disabled" value="11">11</option>
+ <option value="12">12</option>
+ <option value="13">13</option>
+ <option disabled="disabled" value="14">14</option>
+ <option disabled="disabled" value="15">15</option>
+ <option value="16">16</option>
+ <option value="17">17</option>
+ <option value="18">18</option>
+ <option value="19">19</option>
+ </select>
+ <br />
+ <br />
+ <br />
+ <label for="files">Select a file:</label>
+ <select name="files" id="files">
+ <optgroup disabled="disabled" label="Scripts">
+ <option value="jquery">jQuery.js</option>
+ <option value="jqueryui">ui.jQuery.js</option>
+ </optgroup>
+ <optgroup label="Other files">
+ <option value="somefile">Some unknown file</option>
+ <option value="someotherfile">Some other file</option>
+ </optgroup>
+ </select>
+ <br />
+ <br />
+ <br />
+ <label for="files2">Select a file:</label>
+ <select name="files2" id="files2">
+ <optgroup label="Scripts">
+ <option value="jquery">jQuery.js</option>
+ <option value="jqueryui">ui.jQuery.js</option>
+ </optgroup>
+ <optgroup label="Other files">
+ <option value="somefile">Some unknown file</option>
+ <option value="someotherfile">Some other file</option>
+ </optgroup>
+ </select>
+ </fieldset>
+</form>
+<br />
+<button id="disable_select">Toggle disable select</button>
+<button id="disable_option">Toggle disable option</button>
+<button id="disable_optgroup">Toggle disable optgroup</button>
+
+</div><!-- End demo -->
+
+
+
+</body>
+</html>
diff --git a/tests/visual/selectmenu/events.html b/tests/visual/selectmenu/events.html
new file mode 100644
index 000000000..7371e1373
--- /dev/null
+++ b/tests/visual/selectmenu/events.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery UI Selectmenu - Events functionality</title>
+ <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
+ <script src="../../../jquery-1.7.1.js"></script>
+ <script src="../../../ui/jquery.ui.core.js"></script>
+ <script src="../../../ui/jquery.ui.widget.js"></script>
+ <script src="../../../ui/jquery.ui.position.js"></script>
+ <script src="../../../ui/jquery.ui.button.js"></script>
+ <script src="../../../ui/jquery.ui.menu.js"></script>
+ <script src="../../../ui/jquery.ui.selectmenu.js"></script>
+ <link rel="stylesheet" href="../../../demos/demos.css">
+ <script>
+ $(function() {
+ var log = $("#log");
+ var index = 0;
+ $('select').selectmenu({
+ open: function(event, ui) {
+ $("<div/>").text( index++ + " Opened").prependTo(log);
+ },
+ close: function(event, ui) {
+ $("<div/>").text( index++ + " Closed").prependTo(log);
+ },
+ focus : function(event, ui) {
+ $("<div/>").text( index++ + " Focused: " + ui.item.label + " #" + ui.item.index ).prependTo(log);
+ },
+ select: function(event, ui) {
+ $("<div/>").text( index++ + " Selected: " + ui.item.label + " #" + ui.item.index ).prependTo(log);
+ },
+ change: function(event, ui) {
+ $("<div/>").text( index++ + " Changed to: " + ui.item.label + " #" + ui.item.index ).prependTo(log);
+ }
+ });
+ });
+ </script>
+ <style>
+ form { margin: 20px 0 0 0 }
+ fieldset { border: 0; }
+ label { display: block; }
+ select { width: 200px; }
+ .overflow ul { height: 200px; overflow: auto; }
+ </style>
+</head>
+<body>
+
+<div class="demo">
+
+
+<div class="ui-widget" style="float: left; margin-top:2em; font-family:Arial">
+ Log:
+ <div id="log" style="height: 400px; width: 270px; overflow: auto;" class="ui-widget-content"></div>
+</div>
+
+<form action="#">
+ <fieldset>
+ <label for="speed">Select a speed:</label>
+ <select name="speed" id="speed">
+ <option value="Slower">Slower</option>
+ <option value="Slow">Slow</option>
+ <option value="Medium" selected="selected">Medium</option>
+ <option value="Fast">Fast</option>
+ <option value="Faster">Faster</option>
+ </select>
+ </fieldset>
+</form>
+
+</div><!-- End demo -->
+
+
+
+</body>
+</html>
diff --git a/tests/visual/selectmenu/methods.html b/tests/visual/selectmenu/methods.html
new file mode 100644
index 000000000..d2654abfa
--- /dev/null
+++ b/tests/visual/selectmenu/methods.html
@@ -0,0 +1,88 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery UI Selectmenu - Methids functionality</title>
+ <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
+ <script src="../../../jquery-1.7.1.js"></script>
+ <script src="../../../ui/jquery.ui.core.js"></script>
+ <script src="../../../ui/jquery.ui.widget.js"></script>
+ <script src="../../../ui/jquery.ui.position.js"></script>
+ <script src="../../../ui/jquery.ui.button.js"></script>
+ <script src="../../../ui/jquery.ui.menu.js"></script>
+ <script src="../../../ui/jquery.ui.selectmenu.js"></script>
+ <link rel="stylesheet" href="../../../demos/demos.css">
+ <script>
+ $(function() {
+ var mySelectmenu = $('select').selectmenu();
+
+ $('select').show();
+
+ $("#destroy").click( function() {
+ mySelectmenu.selectmenu("destroy");
+ });
+
+ $("#refresh_add").click( function() {
+ mySelectmenu.append('<option value="fastsound">Faster than sound</option>');
+ mySelectmenu.selectmenu("refresh");
+ });
+
+ $("#refresh_selected").click( function() {
+ mySelectmenu[0].selectedIndex = 0;
+ mySelectmenu.selectmenu("refresh");
+ });
+
+ $("#refresh").click( function() {
+ mySelectmenu.selectmenu("refresh");
+ return false;
+ });
+
+ $("#open").click( function() {
+ mySelectmenu.selectmenu("open");
+ return false;
+ });
+
+ $("#close").click( function() {
+ mySelectmenu.selectmenu("close");
+ return false;
+ });
+ });
+ </script>
+ <style>
+ form { margin: 20px 0 0 0 }
+ fieldset { border: 0; }
+ label { display: block; }
+ select { width: 200px; }
+ .overflow ul { height: 200px; overflow: auto; }
+ </style>
+</head>
+<body>
+
+<div class="demo">
+
+<form action="#">
+ <fieldset>
+ <label for="speed">Select a speed:</label>
+ <select name="speed" id="speed">
+ <option value="Slower">Slower</option>
+ <option value="Slow">Slow</option>
+ <option value="Medium" selected="selected">Medium</option>
+ <option value="Fast">Fast</option>
+ <option value="Faster">Faster</option>
+ </select>
+ </fieldset>
+</form>
+<br />
+<button id="destroy">Destroy</button>
+<button id="refresh_add">Add item</button>
+<button id="refresh">Refresh</button>
+<button id="refresh_selected">Change to first item</button>
+<button id="open">Open</button>
+<button id="close">Close</button>
+
+</div><!-- End demo -->
+
+
+
+</body>
+</html>
diff --git a/tests/visual/selectmenu/themeswitcher.html b/tests/visual/selectmenu/themeswitcher.html
new file mode 100644
index 000000000..c533fc4ae
--- /dev/null
+++ b/tests/visual/selectmenu/themeswitcher.html
@@ -0,0 +1,104 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery UI Selectmenu - Themeswitcher functionality</title>
+ <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
+ <script src="../../../jquery-1.7.1.js"></script>
+ <script src="../../../ui/jquery.ui.core.js"></script>
+ <script src="../../../ui/jquery.ui.widget.js"></script>
+ <script src="../../../ui/jquery.ui.position.js"></script>
+ <script src="../../../ui/jquery.ui.button.js"></script>
+ <script src="../../../ui/jquery.ui.menu.js"></script>
+ <script src="../../../ui/jquery.ui.selectmenu.js"></script>
+ <link rel="stylesheet" href="../../../demos/demos.css">
+ <script>
+ $(function() {
+ $('select#speed').selectmenu();
+
+ var withOverflow = $('select#number').selectmenu({
+ dropdown: false
+ });
+ withOverflow.selectmenu("widget").addClass("overflow");
+
+ $('select#files').selectmenu();
+ });
+ </script>
+ <style>
+ form { margin: 100px 0 0 0 }
+ fieldset { border: 0; }
+ label { display: block; }
+ select { width: 200px; }
+ .overflow ul { height: 200px; overflow: auto; overflow-y: auto; overflow-x: hidden;}
+ </style>
+</head>
+<body>
+
+<div class="demo">
+
+<form action="#">
+ <fieldset>
+ <label for="speed">Select a speed:</label>
+ <select name="speed" id="speed">
+ <option value="Slower">Slower</option>
+ <option value="Slow">Slow</option>
+ <option value="Medium" selected="selected">Medium</option>
+ <option value="Fast">Fast</option>
+ <option value="Faster">Faster</option>
+ </select>
+ <br />
+ <br />
+ <br />
+ <label for="number">Select a number:</label>
+ <select name="number" id="number">
+ <option value="1">1</option>
+ <option value="2" selected="selected">2</option>
+ <option value="3">3</option>
+ <option value="4">4</option>
+ <option value="5">5</option>
+ <option value="6">6</option>
+ <option value="7">7</option>
+ <option value="8">8</option>
+ <option value="9">9</option>
+ <option value="10">10</option>
+ <option value="11">11</option>
+ <option value="12">12</option>
+ <option value="13">13</option>
+ <option value="14">14</option>
+ <option value="15">15</option>
+ <option value="16">16</option>
+ <option value="17">17</option>
+ <option value="18">18</option>
+ <option value="19">19</option>
+ </select>
+ <br />
+ <br />
+ <br />
+ <label for="files">Select a file:</label>
+ <select name="files" id="files">
+ <optgroup label="Scripts">
+ <option value="jquery">jQuery.js</option>
+ <option value="jqueryui">ui.jQuery.js</option>
+ </optgroup>
+ <optgroup label="Other files">
+ <option value="somefile">Some unknown file</option>
+ <option value="someotherfile">Some other file</option>
+ </optgroup>
+ </select>
+ </fieldset>
+</form>
+
+</div><!-- End demo -->
+
+
+<script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
+<script>
+ $('<div/>').css({
+ position: "absolute",
+ right: 10,
+ top: 10
+ }).appendTo(document.body).themeswitcher();
+</script>
+
+</body>
+</html>