aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorgnarf <gnarf@gnarf.net>2011-05-10 16:16:34 -0500
committergnarf <gnarf@gnarf.net>2011-05-10 16:16:34 -0500
commit27a7deebf299e1673e8b452476be02e486bba2c6 (patch)
tree79521a78ab770ebd7ee167575b680f14d3ed4089 /tests
parent4dcfeee8d54d81db4d5af8b2fd189b799cd9561e (diff)
parent85ac420a1e4281ee7f361e847d3cad72fa58525e (diff)
downloadjquery-ui-27a7deebf299e1673e8b452476be02e486bba2c6.tar.gz
jquery-ui-27a7deebf299e1673e8b452476be02e486bba2c6.zip
Merge branch 'master' into effects-unit
Conflicts: ui/jquery.effects.pulsate.js
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/autocomplete/autocomplete_events.js16
-rw-r--r--tests/unit/datepicker/datepicker.html1
-rw-r--r--tests/unit/datepicker/datepicker_core.js8
-rw-r--r--tests/unit/datepicker/datepicker_options.js4
-rw-r--r--tests/unit/tabs/spinner.gifbin1387 -> 0 bytes
-rw-r--r--tests/unit/tabs/tabs.html1
-rw-r--r--tests/unit/tabs/tabs_core.js28
-rw-r--r--tests/unit/tabs/tabs_deprecated.html1
-rw-r--r--tests/unit/tabs/tabs_deprecated.js302
-rw-r--r--tests/unit/tabs/tabs_events.js92
-rw-r--r--tests/unit/tabs/tabs_methods.js17
-rw-r--r--tests/unit/tabs/tabs_options.js83
-rw-r--r--tests/unit/tabs/tabs_tickets.js37
-rw-r--r--tests/visual/effects.all.html12
-rw-r--r--tests/visual/effects.all.js20
-rw-r--r--tests/visual/menu/contextmenu.html191
-rw-r--r--tests/visual/menu/menubar.html232
-rw-r--r--tests/visual/menu/menubar.js234
-rw-r--r--tests/visual/menu/popup.html176
-rw-r--r--tests/visual/menu/popup.js124
20 files changed, 447 insertions, 1132 deletions
diff --git a/tests/unit/autocomplete/autocomplete_events.js b/tests/unit/autocomplete/autocomplete_events.js
index 35103d89b..eb009064c 100644
--- a/tests/unit/autocomplete/autocomplete_events.js
+++ b/tests/unit/autocomplete/autocomplete_events.js
@@ -203,4 +203,20 @@ test("cancel select", function() {
}, 50);
});
+test("blur without selection", function() {
+ expect(1);
+ var ac = $("#autocomplete").autocomplete({
+ delay: 0,
+ source: data
+ });
+ stop();
+ ac.val("j").keydown();
+ setTimeout(function() {
+ $( ".ui-menu-item" ).first().simulate("mouseover");
+ ac.simulate("keydown", { keyCode: $.ui.keyCode.TAB });
+ same( ac.val(), "j" );
+ start();
+ }, 50);
+});
+
})(jQuery);
diff --git a/tests/unit/datepicker/datepicker.html b/tests/unit/datepicker/datepicker.html
index 76082e780..fa346c6c9 100644
--- a/tests/unit/datepicker/datepicker.html
+++ b/tests/unit/datepicker/datepicker.html
@@ -12,6 +12,7 @@
<script type="text/javascript" src="../../../ui/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="../../../ui/i18n/jquery.ui.datepicker-fr.js"></script>
<script type="text/javascript" src="../../../ui/i18n/jquery.ui.datepicker-he.js"></script>
+ <script type="text/javascript" src="../../../ui/i18n/jquery.ui.datepicker-zh-CN.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/>
<script type="text/javascript" src="../../../external/qunit.js"></script>
diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js
index 78f78ce38..badb837ed 100644
--- a/tests/unit/datepicker/datepicker_core.js
+++ b/tests/unit/datepicker/datepicker_core.js
@@ -116,8 +116,16 @@ test('baseStructure', function() {
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2] - second month division');
child = dp.children(':eq(2)');
ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2] - row break');
+ ok(dp.is('.ui-datepicker-multi-2'), 'Structure multi [2] - multi-2');
inp.datepicker('hide').datepicker('destroy');
+ // Multi-month 3
+ inp = init('#inp', {numberOfMonths: 3});
+ inp.focus();
+ ok(dp.is('.ui-datepicker-multi-3'), 'Structure multi [3] - multi-3');
+ ok(! dp.is('.ui-datepicker-multi-2'), 'Structure multi [3] - Trac #6704');
+ inp.datepicker('hide').datepicker('destroy');
+
// Multi-month [2, 2]
inp = init('#inp', {numberOfMonths: [2, 2]});
inp.focus();
diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js
index 4f1e9a164..a10d1ea45 100644
--- a/tests/unit/datepicker/datepicker_options.js
+++ b/tests/unit/datepicker/datepicker_options.js
@@ -827,6 +827,10 @@ test('parseDate', function() {
equalsDate($.datepicker.parseDate('\'jour\' d \'de\' MM (\'\'DD\'\'), yy',
'jour 9 de Avril (\'Lundi\'), 2001', settings), new Date(2001, 4 - 1, 9),
'Parse date \'jour\' d \'de\' MM (\'\'DD\'\'), yy with settings');
+
+ var zh = $.datepicker.regional['zh-CN'];
+ equalsDate($.datepicker.parseDate('yy M d', '2011 十一 22', zh),
+ new Date(2011, 11 - 1, 22), 'Parse date yy M d with zh-CN');
});
test('parseDateErrors', function() {
diff --git a/tests/unit/tabs/spinner.gif b/tests/unit/tabs/spinner.gif
deleted file mode 100644
index 822747576..000000000
--- a/tests/unit/tabs/spinner.gif
+++ /dev/null
Binary files differ
diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html
index 565a0b427..34ec28bc4 100644
--- a/tests/unit/tabs/tabs.html
+++ b/tests/unit/tabs/tabs.html
@@ -24,7 +24,6 @@
<script src="tabs_events.js"></script>
<script src="tabs_methods.js"></script>
<script src="tabs_options.js"></script>
- <script src="tabs_tickets.js"></script>
<script>
function tabs_state( tabs ) {
diff --git a/tests/unit/tabs/tabs_core.js b/tests/unit/tabs/tabs_core.js
index c9b16e3a8..98cb617ec 100644
--- a/tests/unit/tabs/tabs_core.js
+++ b/tests/unit/tabs/tabs_core.js
@@ -63,4 +63,32 @@ test( "accessibility", function() {
// TODO: add tests
});
+test( "#3627 - Ajax tab with url containing a fragment identifier fails to load", function() {
+ expect( 1 );
+
+ var element = $( "#tabs2" ).tabs({
+ active: 2,
+ beforeLoad: function( event, ui ) {
+ event.preventDefault();
+ ok( /test.html$/.test( ui.ajaxSettings.url ), "should ignore fragment identifier" );
+ }
+ });
+});
+
+test( "#4033 - IE expands hash to full url and misinterprets tab as ajax", function() {
+ expect( 2 );
+
+ var element = $( "<div><ul><li><a href='#tab'>Tab</a></li></ul><div id='tab'></div></div>" );
+ element.appendTo( "#main" );
+ element.tabs({
+ beforeLoad: function( event, ui ) {
+ event.preventDefault();
+ ok( false, 'should not be an ajax tab');
+ }
+ });
+
+ equals( element.find( ".ui-tabs-nav a" ).attr( "aria-controls" ), "tab", "aria-contorls attribute is correct" );
+ tabs_state( element, 1 );
+});
+
}( jQuery ) );
diff --git a/tests/unit/tabs/tabs_deprecated.html b/tests/unit/tabs/tabs_deprecated.html
index e71fea3d4..89d08f4d0 100644
--- a/tests/unit/tabs/tabs_deprecated.html
+++ b/tests/unit/tabs/tabs_deprecated.html
@@ -22,7 +22,6 @@
<script src="tabs_events.js"></script>
<script src="tabs_methods.js"></script>
<script src="tabs_options.js"></script>
- <script src="tabs_tickets.js"></script>
<script src="tabs_deprecated.js"></script>
<script>
diff --git a/tests/unit/tabs/tabs_deprecated.js b/tests/unit/tabs/tabs_deprecated.js
index 90c43037c..4b50df405 100644
--- a/tests/unit/tabs/tabs_deprecated.js
+++ b/tests/unit/tabs/tabs_deprecated.js
@@ -1,6 +1,6 @@
(function( $ ) {
-module("tabs (deprecated): core");
+module( "tabs (deprecated): core" );
test( "panel ids", function() {
expect( 2 );
@@ -20,91 +20,149 @@ test( "panel ids", function() {
element.tabs( "option", "active", 2 );
});
-module("tabs (deprecated): options");
+module( "tabs (deprecated): options" );
-test('ajaxOptions', function() {
- ok(false, "missing test - untested code is broken code.");
-});
+asyncTest( "ajaxOptions", function() {
+ expect( 1 );
-test('cache', function() {
- ok(false, "missing test - untested code is broken code.");
+ var element = $( "#tabs2" ).tabs({
+ ajaxOptions: {
+ converters: {
+ "text html": function() {
+ return "test";
+ }
+ }
+ }
+ });
+ element.one( "tabsload", function( event, ui ) {
+ equals( ui.panel.html(), "test" );
+ start();
+ });
+ element.tabs( "option", "active", 2 );
});
-test('idPrefix', function() {
- ok(false, "missing test - untested code is broken code.");
-});
+asyncTest( "cache", function() {
+ expect( 5 );
-test('tabTemplate', function() {
- ok(false, "missing test - untested code is broken code.");
+ var element = $( "#tabs2" ).tabs({
+ cache: true
+ });
+ element.one( "tabsshow", function( event, ui ) {
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ });
+ element.one( "tabsload", function( event, ui ) {
+ ok( true, "tabsload" );
+
+ setTimeout(function() {
+ element.tabs( "option", "active", 0 );
+ tabs_state( element, 1, 0, 0, 0, 0 );
+
+ element.one( "tabsshow", function( event, ui ) {
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ });
+ element.one( "tabsload", function( event, ui ) {
+ ok( false, "should be cached" );
+ });
+ element.tabs( "option", "active", 2 );
+ start();
+ }, 1 );
+ });
+ element.tabs( "option", "active", 2 );
+ tabs_state( element, 0, 0, 1, 0, 0 );
});
-test('panelTemplate', function() {
- ok(false, "missing test - untested code is broken code.");
+test( "idPrefix", function() {
+ expect( 1 );
+
+ $( "#tabs2" )
+ .one( "tabsbeforeload", function( event, ui ) {
+ ok( /^testing-\d+$/.test( ui.panel.attr( "id" ) ), "generated id" );
+ event.preventDefault();
+ })
+ .tabs({
+ idPrefix: "testing-",
+ active: 2
+ });
});
-test('cookie', function() {
- expect(6);
+test( "tabTemplate + panelTemplate", function() {
+ // defaults are tested in the add method test
+ expect( 11 );
+
+ var element = $( "#tabs2" ).tabs({
+ tabTemplate: "<li class='customTab'><a href='http://example.com/#{href}'>#{label}</a></li>",
+ panelTemplate: "<div class='customPanel'></div>"
+ });
+ element.one( "tabsadd", function( event, ui ) {
+ var anchor = $( ui.tab );
+ equal( ui.index, 5, "ui.index" );
+ equal( anchor.text(), "New", "ui.tab" );
+ equal( anchor.attr( "href" ), "http://example.com/#new", "tab href" );
+ ok( anchor.parent().hasClass( "customTab" ), "tab custom class" );
+ equal( ui.panel.id, "new", "ui.panel" );
+ ok( $( ui.panel ).hasClass( "customPanel" ), "panel custom class" );
+ });
+ element.tabs( "add", "#new", "New" );
+ var tab = element.find( ".ui-tabs-nav li" ).last(),
+ anchor = tab.find( "a" );
+ equals( tab.text(), "New", "label" );
+ ok( tab.hasClass( "customTab" ), "tab custom class" );
+ equals( anchor.attr( "href" ), "http://example.com/#new", "href" );
+ equals( anchor.attr( "aria-controls" ), "new", "aria-controls" );
+ ok( element.find( "#new" ).hasClass( "customPanel" ), "panel custom class" );
+});
- el = $('#tabs1');
- var cookieName = 'tabs_test', cookieObj = { name: cookieName };
- $.cookie(cookieName, null); // blank state
- var cookie = function() {
- return parseInt($.cookie(cookieName), 10);
- };
+test( "cookie", function() {
+ expect( 6 );
- el.tabs({ cookie: cookieObj });
- equals(cookie(), 0, 'initial cookie value');
+ var element = $( "#tabs1" ),
+ cookieName = "tabs_test",
+ cookieObj = { name: cookieName };
+ $.cookie( cookieName, null );
+ function cookie() {
+ return parseInt( $.cookie( cookieName ), 10 );
+ }
- el.tabs('destroy');
- el.tabs({ active: 1, cookie: cookieObj });
- equals(cookie(), 1, 'initial cookie value, from active property');
+ element.tabs({ cookie: cookieObj });
+ equals( cookie(), 0, "initial cookie value" );
- el.tabs('option', 'active', 2);
- equals(cookie(), 2, 'cookie value updated after activating');
+ element.tabs( "destroy" );
+ element.tabs({ active: 1, cookie: cookieObj });
+ equals( cookie(), 1, "initial cookie value, from active property" );
- el.tabs('destroy');
- $.cookie(cookieName, 1);
- el.tabs({ cookie: cookieObj });
- equals(cookie(), 1, 'initial cookie value, from existing cookie');
+ element.tabs( "option", "active", 2 );
+ equals( cookie(), 2, "cookie value updated after activating" );
- el.tabs('destroy');
- el.tabs({ cookie: cookieObj, collapsible: true });
- el.tabs('option', 'active', false);
- equals(cookie(), -1, 'cookie value for all tabs unselected');
+ element.tabs( "destroy" );
+ $.cookie( cookieName, 1 );
+ element.tabs({ cookie: cookieObj });
+ equals( cookie(), 1, "initial cookie value, from existing cookie" );
- el.tabs('destroy');
- ok($.cookie(cookieName) === null, 'erase cookie after destroy');
+ element.tabs( "destroy" );
+ element.tabs({ cookie: cookieObj, collapsible: true });
+ element.tabs( "option", "active", false );
+ equals( cookie(), -1, "cookie value for all tabs unselected" );
+ element.tabs( "destroy" );
+ ok( $.cookie( cookieName ) === null, "erase cookie after destroy" );
});
+asyncTest( "spinner", function() {
+ expect( 2 );
-test('spinner', function() {
- expect(4);
- stop();
-
- el = $('#tabs2');
-
- el.tabs({
- selected: 2,
- load: function() {
- // spinner: default spinner
- setTimeout(function() {
- equals($('li:eq(2) > a > span', el).length, 1, "should restore tab markup after spinner is removed");
- equals($('li:eq(2) > a > span', el).html(), '3', "should restore tab label after spinner is removed");
- el.tabs('destroy');
- el.tabs({
- selected: 2,
- spinner: '<img src="spinner.gif" alt="">',
- load: function() {
- // spinner: image
- equals($('li:eq(2) > a > span', el).length, 1, "should restore tab markup after spinner is removed");
- equals($('li:eq(2) > a > span', el).html(), '3', "should restore tab label after spinner is removed");
- start();
- }
- });
- }, 1);
- }
+ var element = $( "#tabs2" ).tabs();
+
+ element.one( "tabsbeforeload", function( event, ui ) {
+ equals( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 1, "beforeload" );
+ });
+ element.one( "tabsload", function( event, ui ) {
+ // wait until after the load finishes before checking for the spinner to be removed
+ setTimeout(function() {
+ equals( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 0, "load" );
+ start();
+ }, 1 );
});
+ element.tabs( "option", "active", 2 );
});
test( "selected", function() {
@@ -193,45 +251,85 @@ test( "disable", function() {
element.tabs( "disable", 1 );
});
-test('show', function() {
- expect(5);
- var uiObj, eventObj;
- el = $('#tabs1').tabs({
- show: function(event, ui) {
- uiObj = ui;
- eventObj = event;
- }
+test( "show", function() {
+ expect( 13 );
+
+ var element = $( "#tabs1" ).tabs({
+ active: false,
+ collapsible: true
+ }),
+ tabs = element.find( ".ui-tabs-nav a" ),
+ panels = element.find( ".ui-tabs-panel" );
+
+ // from collapsed
+ element.one( "tabsshow", function( event, ui ) {
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ strictEqual( ui.tab, tabs[ 0 ], "ui.tab" );
+ strictEqual( ui.panel, panels[ 0 ], "ui.panel" );
+ equal( ui.index, 0, "ui.index" );
+ tabs_state( element, 1, 0, 0 );
});
- ok(uiObj !== undefined, 'trigger callback after initialization');
- equals(uiObj.tab, $('a', el)[0], 'contain tab as DOM anchor element');
- equals(uiObj.panel, $('div', el)[0], 'contain panel as DOM div element');
- equals(uiObj.index, 0, 'contain index');
+ element.tabs( "option", "active", 0 );
+ tabs_state( element, 1, 0, 0 );
- el.find( "li:eq(1) a" ).simulate( "click" );
- equals( eventObj.originalEvent.type, "click", "show triggered by click" );
+ // switching tabs
+ element.one( "tabsshow", function( event, ui ) {
+ equals( event.originalEvent.type, "click", "originalEvent" );
+ strictEqual( ui.tab, tabs[ 1 ], "ui.tab" );
+ strictEqual( ui.panel, panels[ 1 ], "ui.panel" );
+ equal( ui.index, 1, "ui.index" );
+ tabs_state( element, 0, 1, 0 );
+ });
+ tabs.eq( 1 ).click();
+ tabs_state( element, 0, 1, 0 );
+ // collapsing
+ element.one( "tabsshow", function( event, ui ) {
+ ok( false, "collapsing" );
+ });
+ element.tabs( "option", "active", false );
+ tabs_state( element, 0, 0, 0 );
});
-test('select', function() {
- expect(7);
+test( "select", function() {
+ expect( 13 );
- var eventObj;
- el = $('#tabs1').tabs({
- select: function(event, ui) {
- ok(true, 'select triggered after initialization');
- equals(this, el[0], "context of callback");
- equals(event.type, 'tabsselect', 'event type in callback');
- equals(ui.tab, el.find('a')[1], 'contain tab as DOM anchor element');
- equals(ui.panel, el.find('div')[1], 'contain panel as DOM div element');
- equals(ui.index, 1, 'contain index');
- evenObj = event;
- }
+ var element = $( "#tabs1" ).tabs({
+ active: false,
+ collapsible: true
+ }),
+ tabs = element.find( ".ui-tabs-nav a" ),
+ panels = element.find( ".ui-tabs-panel" );
+
+ // from collapsed
+ element.one( "tabsselect", function( event, ui ) {
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ strictEqual( ui.tab, tabs[ 0 ], "ui.tab" );
+ strictEqual( ui.panel, panels[ 0 ], "ui.panel" );
+ equal( ui.index, 0, "ui.index" );
+ tabs_state( element, 0, 0, 0 );
+ });
+ element.tabs( "option", "active", 0 );
+ tabs_state( element, 1, 0, 0 );
+
+ // switching tabs
+ element.one( "tabsselect", function( event, ui ) {
+ equals( event.originalEvent.type, "click", "originalEvent" );
+ strictEqual( ui.tab, tabs[ 1 ], "ui.tab" );
+ strictEqual( ui.panel, panels[ 1 ], "ui.panel" );
+ equal( ui.index, 1, "ui.index" );
+ tabs_state( element, 1, 0, 0 );
});
- el.tabs('select', 1);
+ tabs.eq( 1 ).click();
+ tabs_state( element, 0, 1, 0 );
- el.find( "li:eq(1) a" ).simulate( "click" );
- equals( evenObj.originalEvent.type, "click", "select triggered by click" );
+ // collapsing
+ element.one( "tabsselect", function( event, ui ) {
+ ok( false, "collapsing" );
+ });
+ element.tabs( "option", "active", false );
+ tabs_state( element, 0, 0, 0 );
});
module( "tabs (deprecated): methods" );
@@ -405,4 +503,18 @@ test( "url", function() {
element.tabs( "option", "active", 3 );
});
+asyncTest( "abort", function() {
+ expect( 1 );
+
+ var element = $( "#tabs2" ).tabs();
+ element.one( "tabsbeforeload", function( event, ui ) {
+ ui.jqXHR.error(function( jqXHR, status ) {
+ equals( status, "abort", "aborted" );
+ start();
+ });
+ });
+ element.tabs( "option", "active", 2 );
+ element.tabs( "abort" );
+});
+
}( jQuery ) );
diff --git a/tests/unit/tabs/tabs_events.js b/tests/unit/tabs/tabs_events.js
index 28925a2b9..2fabaafca 100644
--- a/tests/unit/tabs/tabs_events.js
+++ b/tests/unit/tabs/tabs_events.js
@@ -138,15 +138,32 @@ test( "activate", function() {
});
test( "beforeLoad", function() {
- expect( 21 );
+ expect( 32 );
var tab, panelId, panel,
- element = $( "#tabs2" ).tabs();
+ element = $( "#tabs2" );
+
+ // init
+ element.one( "tabsbeforeload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 2 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
- // TODO: init
-// element.one( "tabsbeforeload", function( event, ui ) {
-// });
-// element.tabs({ active: 2 });
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ ok( "abort" in ui.jqXHR, "jqXHR" );
+ ok( ui.ajaxSettings.url, "data/test.html", "ajaxSettings.url" );
+ equals( ui.tab.size(), 1, "tab size" );
+ strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+ equals( ui.panel.size(), 1, "panel size" );
+ strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+ equals( ui.panel.html(), "", "panel html" );
+ event.preventDefault();
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ });
+ element.tabs({ active: 2 });
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ equals( panel.html(), "", "panel html after" );
+ element.tabs( "destroy" );
// .option()
element.one( "tabsbeforeload", function( event, ui ) {
@@ -165,6 +182,7 @@ test( "beforeLoad", function() {
event.preventDefault();
tabs_state( element, 1, 0, 0, 0, 0 );
});
+ element.tabs();
element.tabs( "option", "active", 2 );
tabs_state( element, 0, 0, 1, 0, 0 );
equals( panel.html(), "", "panel html after" );
@@ -191,8 +209,66 @@ test( "beforeLoad", function() {
equals( panel.html(), "<p>testing</p>", "panel html after" );
});
-test( "load", function() {
- ok( false, "missing test - untested code is broken code." );
+asyncTest( "load", function() {
+ expect( 21 );
+
+ var tab, panelId, panel,
+ element = $( "#tabs2" );
+
+ // init
+ element.one( "tabsload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 2 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
+
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ equals( ui.tab.size(), 1, "tab size" );
+ strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+ equals( ui.panel.size(), 1, "panel size" );
+ strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+ equals( ui.panel.find( "p" ).length, 1, "panel html" );
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ tabsload1();
+ });
+ element.tabs({ active: 2 });
+
+ function tabsload1() {
+ // .option()
+ element.one( "tabsload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 3 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
+
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ equals( ui.tab.size(), 1, "tab size" );
+ strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+ equals( ui.panel.size(), 1, "panel size" );
+ strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+ equals( ui.panel.find( "p" ).length, 1, "panel html" );
+ tabs_state( element, 0, 0, 0, 1, 0 );
+ tabsload2();
+ });
+ element.tabs( "option", "active", 3 );
+ }
+
+ function tabsload2() {
+ // click, change panel content
+ element.one( "tabsload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 4 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
+
+ equals( event.originalEvent.type, "click", "originalEvent" );
+ equals( ui.tab.size(), 1, "tab size" );
+ strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+ equals( ui.panel.size(), 1, "panel size" );
+ strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+ equals( ui.panel.find( "p" ).length, 1, "panel html" );
+ tabs_state( element, 0, 0, 0, 0, 1 );
+ start();
+ });
+ element.find( ".ui-tabs-nav a" ).eq( 4 ).click();
+ }
});
}( jQuery ) );
diff --git a/tests/unit/tabs/tabs_methods.js b/tests/unit/tabs/tabs_methods.js
index a6e60a4b3..221b0d39d 100644
--- a/tests/unit/tabs/tabs_methods.js
+++ b/tests/unit/tabs/tabs_methods.js
@@ -2,19 +2,10 @@
module( "tabs: methods" );
-test('destroy', function() {
- expect(6);
-
- el = $('#tabs1').tabs({ collapsible: true });
- $('li:eq(2)', el).simulate('mouseover').find('a').focus();
- el.tabs('destroy');
-
- ok( el.is(':not(.ui-tabs, .ui-widget, .ui-widget-content, .ui-corner-all, .ui-tabs-collapsible)'), 'remove classes from container');
- ok( $('ul', el).is(':not(.ui-tabs-nav, .ui-helper-reset, .ui-helper-clearfix, .ui-widget-header, .ui-corner-all)'), 'remove classes from list' );
- ok( $('div:eq(1)', el).is(':not(.ui-tabs-panel, .ui-widget-content, .ui-corner-bottom)'), 'remove classes to panel' );
- ok( $('li:eq(0)', el).is(':not(.ui-tabs-active, .ui-state-active, .ui-corner-top)'), 'remove classes from active li');
- ok( $('li:eq(1)', el).is(':not(.ui-state-default, .ui-corner-top)'), 'remove classes from inactive li');
- ok( $('li:eq(2)', el).is(':not(.ui-state-hover, .ui-state-focus)'), 'remove classes from mouseovered or focused li');
+test( "destroy", function() {
+ domEqual( "#tabs1", function() {
+ $( "#tabs1" ).tabs().tabs( "destroy" );
+ });
});
test( "enable", function() {
diff --git a/tests/unit/tabs/tabs_options.js b/tests/unit/tabs/tabs_options.js
index 691186276..8d61c47ef 100644
--- a/tests/unit/tabs/tabs_options.js
+++ b/tests/unit/tabs/tabs_options.js
@@ -133,28 +133,81 @@ test( "{ collapsible: true }", function() {
tabs_state( element, 0, 0, 0 );
});
-test('disabled', function() {
- expect(4);
+test( "disabled", function() {
+ expect( 10 );
- el = $('#tabs1').tabs();
- same(el.tabs('option', 'disabled'), false, "should not disable any tab by default");
+ // fully enabled by default
+ var element = $( "#tabs1" ).tabs();
+ tabs_disabled( element, false );
+
+ // disable single tab
+ element.tabs( "option", "disabled", [ 1 ] );
+ tabs_disabled( element, [ 1 ] );
- el.tabs('option', 'disabled', [ 1 ]);
- same(el.tabs('option', 'disabled'), [ 1 ], "should set property"); // everything else is being tested in methods module...
+ // disabled active tab
+ element.tabs( "option", "disabled", [ 0, 1 ] );
+ tabs_disabled( element, [ 0, 1 ] );
- el.tabs('option', 'disabled', [ 0, 1 ]);
- same(el.tabs('option', 'disabled'), [ 0, 1 ], "should disable given tabs, even selected one"); // ...
+ // disable all tabs
+ element.tabs( "option", "disabled", [ 0, 1, 2 ] );
+ tabs_disabled( element, true );
- el.tabs('option', 'disabled', [ ]);
- same(el.tabs('option', 'disabled'), false, "should not disable any tab"); // ...
+ // enable all tabs
+ element.tabs( "option", "disabled", [] );
+ tabs_disabled( element, false );
});
-test('event', function() {
- ok(false, "missing test - untested code is broken code.");
+test( "{ event: null }", function() {
+ expect( 5 );
+
+ var element = $( "#tabs1" ).tabs({
+ event: null
+ });
+ tabs_state( element, 1, 0, 0 );
+
+ element.tabs( "option", "active", 1 );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ // ensure default click handler isn't bound
+ element.find( ".ui-tabs-nav a" ).eq( 2 ).click();
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
});
-test('fx', function() {
- ok(false, "missing test - untested code is broken code.");
+test( "{ event: custom }", function() {
+ expect( 11 );
+
+ var element = $( "#tabs1" ).tabs({
+ event: "custom1 custom2"
+ });
+ tabs_state( element, 1, 0, 0 );
+
+ element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom1" );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ // ensure default click handler isn't bound
+ element.find( ".ui-tabs-nav a" ).eq( 2 ).trigger( "click" );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ element.find( ".ui-tabs-nav a" ).eq( 2 ).trigger( "custom2" );
+ equal( element.tabs( "option", "active" ), 2 );
+ tabs_state( element, 0, 0, 1 );
+
+ element.tabs( "option", "event", "custom3" );
+
+ // ensure old event handlers are unbound
+ element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom1" );
+ equal( element.tabs( "option", "active" ), 2 );
+ tabs_state( element, 0, 0, 1 );
+
+ element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom3" );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
});
-})(jQuery);
+// TODO: add animation tests
+
+}( jQuery ) );
diff --git a/tests/unit/tabs/tabs_tickets.js b/tests/unit/tabs/tabs_tickets.js
deleted file mode 100644
index d7a59cb5b..000000000
--- a/tests/unit/tabs/tabs_tickets.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * tabs_tickets.js
- */
-(function($) {
-
-module("tabs: tickets");
-
-test('#3627 - Ajax tab with url containing a fragment identifier fails to load', function() {
- // http://dev.jqueryui.com/ticket/3627
- expect(1);
-
- el = $('#tabs2').tabs({
- active: 2,
- beforeLoad: function( event, ui ) {
- event.preventDefault();
- ok(/test.html$/.test( ui.ajaxSettings.url ), 'should ignore fragment identifier');
- }
- });
-});
-
-test('#4033 - IE expands hash to full url and misinterprets tab as ajax', function() {
- // http://dev.jqueryui.com/ticket/4033
- expect(1);
-
- el = $('<div><ul><li><a href="#tab">Tab</a></li></ul><div id="tab"></div></div>');
- el.appendTo('#main');
- el.tabs({
- beforeLoad: function( event, ui ) {
- event.preventDefault();
- ok( false, 'should not be an ajax tab');
- }
- });
-
- equals($('a', el).attr('aria-controls'), 'tab', 'aria-contorls attribute is correct');
-});
-
-})(jQuery);
diff --git a/tests/visual/effects.all.html b/tests/visual/effects.all.html
index 1fc35f700..fed35de8a 100644
--- a/tests/visual/effects.all.html
+++ b/tests/visual/effects.all.html
@@ -146,6 +146,18 @@
</li>
<li>
+ <div class="effect" id="size">
+ <p>Size Default Show/Hide</p>
+ </div>
+ </li>
+
+ <li>
+ <div class="effect" id="sizeToggle">
+ <p>Size Toggle</p>
+ </div>
+ </li>
+
+ <li>
<div class="effect" id="slideDown">
<p>Slide down</p>
</div>
diff --git a/tests/visual/effects.all.js b/tests/visual/effects.all.js
index 9cf7487c9..a28c41a89 100644
--- a/tests/visual/effects.all.js
+++ b/tests/visual/effects.all.js
@@ -30,10 +30,10 @@ $(function() {
var el = $(this);
el.addClass("current").hide(duration, function() {
setTimeout(function() {
- el.show(duration, function() { el.removeClass("current") });
+ el.show(duration, function() { el.removeClass("current"); });
}, wait);
- })
- })
+ });
+ });
effect("#blindLeft", "blind", { direction: "left" });
effect("#blindUp", "blind", { direction: "up" });
@@ -63,6 +63,16 @@ $(function() {
effect("#puff", "puff", { times: 2 });
effect("#scale", "scale", {});
+ effect("#size", "size", {});
+ $("#sizeToggle").bind("click", function() {
+ var opts = { to: { width: 300, height: 300 }};
+ $(this).addClass('current')
+ .toggle("size", opts, duration)
+ .delay(wait)
+ .toggle("size", opts, duration, function() {
+ $(this).removeClass("current");
+ });
+ });
$("#shake").bind("click", function() { $(this).addClass("current").effect("shake", {}, 100, function() { $(this).removeClass("current"); }); });
@@ -84,13 +94,13 @@ $(function() {
$("#removeClass").click(function() {
$(this).addClass("current").removeClass(function() {
window.console && console.log(arguments);
- return "current"
+ return "current";
}, duration);
});
$("#toggleClass").click(function() {
$(this).toggleClass(function() {
window.console && console.log(arguments);
- return "current"
+ return "current";
}, duration);
});
});
diff --git a/tests/visual/menu/contextmenu.html b/tests/visual/menu/contextmenu.html
deleted file mode 100644
index 63d9877a0..000000000
--- a/tests/visual/menu/contextmenu.html
+++ /dev/null
@@ -1,191 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <title>Menu Visual Test: Default</title>
- <link rel="stylesheet" href="../visual.css" type="text/css" />
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
- <script type="text/javascript" src="../../../jquery-1.5.1.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
- <!--
- <script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
- -->
- <script type="text/javascript">
- $(function() {
- $.fn.themeswitcher && $('<div/>').css({
- position: "absolute",
- right: 10,
- top: 10
- }).appendTo(document.body).themeswitcher();
-
- // TODO close other menus when opening a new one
- $("button").each(function() {
- $(this).next().menu({
- /* top-alignment
- position: function(item) {
- return {
- my: "left top",
- at: "right top",
- of: item.parent()
- }
- },
- */
- select: function(event, ui) {
- $(this).hide().prev().focus();
- $("#log").append("<div>Selected " + ui.item.text() + "</div>");
- }
- }).hide();
-
- // equal height
- //menu.find("ul").height(menu.height());
- }).click(function(event) {
- // required to prevent the click handler below from handling this event
- event.stopPropagation();
- var menu = $("#menu" + this.id).menu("blur").show().position({
- my: "left top",
- at: "right top",
- of: event.pageX > 0 ? event : this
- }).focus();
- $(document).one("click", function() {
- menu.menu("closeAll").menu("widget").hide();
- })
- }).next().keydown(function(event) {
- var menu = $(this).data("menu");
- if (menu.widget().is(":hidden"))
- return;
- event.stopPropagation();
- switch (event.keyCode) {
- case $.ui.keyCode.TAB:
- menu.closeAll();
- menu.widget().hide();
- $(this).prev().focus()
- break;
- case $.ui.keyCode.ESCAPE:
- menu.closeAll();
- menu.widget().hide();
- $(this).prev().focus()
- break;
- default:
-
- }
- });
- });
- </script>
- <style>
- body { font-size:62.5%; }
- .ui-menu { width: 200px; position: absolute; }
- #menu3 { height: 200px; overflow: auto; }
- </style>
-</head>
-<body>
-
-<button id="1">Show context menu 1</button>
-<ul id="menu1">
- <li><a href="#">Amsterdam</a></li>
- <li><a href="#">Anaheim</a></li>
- <li><a href="#">Cologne</a></li>
- <li><a href="#">Frankfurt</a></li>
- <li><a href="#">Magdeburg</a></li>
- <li><a href="#">Munich</a></li>
- <li><a href="#">Utrecht</a></li>
- <li><a href="#">Zurich</a></li>
-</ul>
-
-<button id="2">Show context menu 2</button>
-<ul id="menu2">
- <li>
- <a id="a1" href="#">Amsterdam</a>
- <ul>
- <li><a id="b1" href="#">Aberdeen</a></li>
- <li><a id="b2" href="#">Ada</a></li>
- <li>
- <a href="#">Adamsville</a>
- <ul>
- <li><a href="#">Anaheim</a></li>
- <li>
- <a href="#">Cologne</a>
- <ul>
- <li><a href="#">Mberdeen</a></li>
- <li><a href="#">Mda</a></li>
- <li><a href="#">Mdamsville</a></li>
- <li><a href="#">Mddyston</a></li>
- <li><a href="#">Mmesville</a></li>
- </ul>
- </li>
- <li><a href="#">Frankfurt</a></li>
- </ul>
- </li>
- <li><a href="#">Addyston</a></li>
- <li><a href="#">Amesville</a></li>
- </ul>
- </li>
- <li><a id="a2" href="#">Anaheim</a></li>
- <li><a id="a3" href="#">Cologne</a></li>
- <li><a href="#">Frankfurt</a></li>
- <li>
- <a href="#">Magdeburg</a>
- <ul>
- <li><a href="#">Mberdeen</a></li>
- <li><a href="#">Mda</a></li>
- <li><a href="#">Mdamsville</a></li>
- <li><a href="#">Mddyston</a></li>
- <li><a href="#">Mmesville</a></li>
- </ul>
- </li>
- <li><a href="#">Munich</a></li>
- <li><a href="#">Utrecht</a></li>
- <li><a href="#">Zurich</a></li>
-</ul>
-
-
-<div class="ui-widget" style="margin-top:2em; font-family:Arial">
- Log:
- <div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
-</div>
-
-<button id="3">Show context menu 3</button>
-<ul id="menu3">
- <li><a href="#">Aberdeen</a></li>
- <li><a href="#">Ada</a></li>
- <li><a href="#">Adamsville</a></li>
- <li><a href="#">Addyston</a></li>
- <li><a href="#">Adelphi</a></li>
- <li><a href="#">Adena</a></li>
- <li><a href="#">Adrian</a></li>
- <li><a href="#">Akron</a></li>
- <li><a href="#">Albany</a></li>
- <li><a href="#">Alexandria</a></li>
- <li><a href="#">Alger</a></li>
- <li><a href="#">Alledonia</a></li>
- <li><a href="#">Alliance</a></li>
- <li><a href="#">Alpha</a></li>
- <li><a href="#">Alvada</a></li>
- <li><a href="#">Alvordton</a></li>
- <li><a href="#">Amanda</a></li>
- <li><a href="#">Amelia</a></li>
- <li><a href="#">Amesville</a></li>
- <li><a href="#">Aberdeen</a></li>
- <li><a href="#">Ada</a></li>
- <li><a href="#">Adamsville</a></li>
- <li><a href="#">Addyston</a></li>
- <li><a href="#">Adelphi</a></li>
- <li><a href="#">Adena</a></li>
- <li><a href="#">Adrian</a></li>
- <li><a href="#">Akron</a></li>
- <li><a href="#">Albany</a></li>
- <li><a href="#">Alexandria</a></li>
- <li><a href="#">Alger</a></li>
- <li><a href="#">Alledonia</a></li>
- <li><a href="#">Alliance</a></li>
- <li><a href="#">Alpha</a></li>
- <li><a href="#">Alvada</a></li>
- <li><a href="#">Alvordton</a></li>
- <li><a href="#">Amanda</a></li>
- <li><a href="#">Amelia</a></li>
- <li><a href="#">Amesville</a></li>
-</ul>
-
-</body>
-</html>
diff --git a/tests/visual/menu/menubar.html b/tests/visual/menu/menubar.html
deleted file mode 100644
index d2185e97c..000000000
--- a/tests/visual/menu/menubar.html
+++ /dev/null
@@ -1,232 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Menu Visual Test: Default</title>
- <link rel="stylesheet" href="../visual.css" type="text/css" />
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
- <script type="text/javascript" src="../../../jquery-1.5.1.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.button.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
- <script type="text/javascript" src="menubar.js"></script>
- <!--
- <script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
- -->
- <script type="text/javascript">
- $(function() {
- $.fn.themeswitcher && $('<div/>').css({
- position: "absolute",
- right: 10,
- top: 10
- }).appendTo(document.body).themeswitcher();
-
- $("td:has(.menubar)").clone().appendTo("tbody tr:not(:first)");
-
- $("#bar1, .menubar").menubar({
- select: function(event, ui) {
- $("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
- }
- });
-
- $(".menubar-icons").menubar({
- menuIcon: true,
- buttons: true,
- select: function(event, ui) {
- $("<div/>").text("Selected: " + ui.item.text()).appendTo("#log");
- }
- });
- });
- </script>
- <style type="text/css">
- body { font-size:62.5%; }
- #bar1, #bar2 { margin: 0 0 4em; } /* style for this page only */
- .ui-menu { width: 200px; position: absolute; outline: none; z-index: 9999; }
- .ui-menu .ui-icon { float: right; }
- .ui-menu li.ui-state-disabled {
- font-weight: bold;
- padding: .0em .4em;
- margin: .4em 0 .2em;
- line-height: 1.5;
- }
-
- /* menubar styles */
- .ui-menubar .ui-button { float: left; font-weight: normal; border-top-width: 0 !important; border-bottom-width: 0 !important; margin: 0; outline: none; }
- .ui-menubar .ui-menubar-link { border-right: 1px dashed transparent; border-left: 1px dashed transparent; }
-
- .ui-menubar {
- list-style: none;
- margin: 0;
- padding-left: 0;
- }
-
- .ui-menubar-item {
- float: left;
- }
-
- table {
- border-collapse: collapse;
- }
- th, td {
- padding: 0.5em;
- border: 1px solid black;
- }
- </style>
-</head>
-<body>
-
-<ul id="bar1" class="menubar">
- <li>
- <a href="#">File</a>
- <ul>
- <li><a href="#">Open...</a></li>
- <li class="ui-state-disabled">Open recent...</li>
- <li><a href="#">Save</a></li>
- <li><a href="#">Save as...</a></li>
- <li><a href="#">Close</a></li>
- <li><a href="#">Quit</a></li>
- </ul>
- </li>
- <li>
- <a href="#">Edit</a>
- <ul>
- <li><a href="#">Copy</a></li>
- <li><a href="#">Cut</a></li>
- <li class="ui-state-disabled">Paste</li>
- </ul>
- </li>
- <li>
- <a href="#">View</a>
- <ul>
- <li><a href="#">Fullscreen</a></li>
- <li><a href="#">Fit into view</a></li>
- <li>
- <a href="#">Encoding</a>
- <ul>
- <li><a href="#">Auto-detect</a></li>
- <li><a href="#">UTF-8</a></li>
- <li>
- <a href="#">UTF-16</a>
- <ul>
- <li><a href="#">Option 1</a></li>
- <li><a href="#">Option 2</a></li>
- <li><a href="#">Option 3</a></li>
- <li><a href="#">Option 4</a></li>
- </ul>
- </li>
- </ul>
- </li>
- <li><a href="#">Customize...</a></li>
- </ul>
- </li>
-</ul>
-
-<ul id="bar2" class="menubar-icons">
- <li>
- <a href="#">File</a>
- <ul>
- <li><a href="#">Open...</a></li>
- <li class="ui-state-disabled">Open recent...</li>
- <li><a href="#">Save</a></li>
- <li><a href="#">Save as...</a></li>
- <li><a href="#">Close</a></li>
- <li><a href="#">Quit</a></li>
- </ul>
- </li>
- <li>
- <a href="#">Edit</a>
- <ul>
- <li><a href="#">Copy</a></li>
- <li><a href="#">Cut</a></li>
- <li class="ui-state-disabled">Paste</li>
- </ul>
- </li>
- <li>
- <a href="#">View</a>
- <ul>
- <li><a href="#">Fullscreen</a></li>
- <li><a href="#">Fit into view</a></li>
- <li>
- <a href="#">Encoding</a>
- <ul>
- <li><a href="#">Auto-detect</a></li>
- <li><a href="#">UTF-8</a></li>
- <li>
- <a href="#">UTF-16</a>
- <ul>
- <li><a href="#">Option 1</a></li>
- <li><a href="#">Option 2</a></li>
- <li><a href="#">Option 3</a></li>
- <li><a href="#">Option 4</a></li>
- </ul>
- </li>
- </ul>
- </li>
- <li><a href="#">Customize...</a></li>
- </ul>
- </li>
-</ul>
-
-<table id="movies" class="ui-widget">
- <thead>
- <tr>
- <th data-field="Name" class="ui-widget-header">Name</th>
- <th data-field="ReleaseYear" class="ui-widget-header">Release Year</th>
- <th data-field="AverageRating" class="ui-widget-header">Average Rating</th>
- <th class="ui-widget-header"></th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td class="ui-widget-content">Red Hot Chili Peppers: Funky Monks</td>
- <td class="ui-widget-content">1993</td>
- <td class="ui-widget-content">3.6</td>
- <td class="ui-widget-content">
- <ul class="menubar">
- <li>
- <a href="#">Options</a>
- <ul>
- <li><a href="#">Order...</a></li>
- <li class="ui-state-disabled">Write a Review...</li>
- <li><a href="#">Find Similar Movies...</a></li>
- <li>
- <a href="#">Rate</a>
- <ul>
- <li><a href="#">5 stars</a></li>
- <li><a href="#">4 stars</a></li>
- <li><a href="#">3 stars</a></li>
- <li><a href="#">2 stars</a></li>
- <li><a href="#">1 stars</a></li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </td>
- </tr>
- <tr>
- <td class="ui-widget-content">Rod Stewart: Storyteller 1984-1991</td>
- <td class="ui-widget-content">1991</td>
- <td class="ui-widget-content">3.1</td>
- </tr>
- <tr>
- <td class="ui-widget-content">Stevie Ray Vaughan and Double Trouble: Live at the El Mocambo 1983</td>
- <td class="ui-widget-content">1991</td>
- <td class="ui-widget-content">3.9</td>
- </tr>
- <tr>
- <td class="ui-widget-content">Spike and Mike's Sick &amp; Twisted Festival of Animation</td>
- <td class="ui-widget-content">1997</td>
- <td class="ui-widget-content">2.6</td>
- </tr>
- </tbody>
-</table>
-
-<div class="ui-widget" style="margin-top:2em; font-family:Arial">
- Log:
- <div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
-</div>
-
-</body>
-</html>
diff --git a/tests/visual/menu/menubar.js b/tests/visual/menu/menubar.js
deleted file mode 100644
index cc3258d4a..000000000
--- a/tests/visual/menu/menubar.js
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * jQuery UI menubar
- *
- * backported from Michael Lang's fork: http://www.nexul.com/prototypes/toolbar/demo.html
- */
-(function($) {
-
-// TODO take non-menubar buttons into account
-$.widget("ui.menubar", {
- options: {
- buttons: false,
- menuIcon: false
- },
- _create: function() {
- var self = this;
- var items = this.items = this.element.children("li")
- .addClass("ui-menubar-item")
- .attr("role", "presentation")
- .children("button, a");
- items.slice(1).attr("tabIndex", -1);
- var o = this.options;
-
- this.element.addClass('ui-menubar ui-widget-header ui-helper-clearfix').attr("role", "menubar");
- this._focusable(items);
- this._hoverable(items);
- items.next("ul").each(function(i, elm) {
- $(elm).menu({
- select: function(event, ui) {
- ui.item.parents("ul.ui-menu:last").hide();
- self._trigger( "select", event, ui );
- self._close();
- $(event.target).prev().focus();
- }
- }).hide()
- .attr("aria-hidden", "true")
- .attr("aria-expanded", "false")
- .keydown(function(event) {
- var menu = $(this);
- if (menu.is(":hidden"))
- return;
- switch (event.keyCode) {
- case $.ui.keyCode.LEFT:
- self._left(event);
- event.preventDefault();
- break;
- case $.ui.keyCode.RIGHT:
- self._right(event);
- event.preventDefault();
- break;
- };
- })
- });
- items.each(function() {
- var input = $(this),
- menu = input.next("ul");
-
- input.bind("click focus mouseenter", function(event) {
- // ignore triggered focus event
- if (event.type == "focus" && !event.originalEvent) {
- return;
- }
- event.preventDefault();
- if (event.type == "click" && menu.is(":visible") && self.active && self.active[0] == menu[0]) {
- self._close();
- return;
- }
- if ((self.open && event.type == "mouseenter") || event.type == "click") {
- self._open(event, menu);
- }
- })
- .bind( "keydown", function( event ) {
- switch ( event.keyCode ) {
- case $.ui.keyCode.SPACE:
- case $.ui.keyCode.UP:
- case $.ui.keyCode.DOWN:
- self._open( event, $( this ).next() );
- event.preventDefault();
- break;
- case $.ui.keyCode.LEFT:
- self._prev( event, $( this ) );
- event.preventDefault();
- break;
- case $.ui.keyCode.RIGHT:
- self._next( event, $( this ) );
- event.preventDefault();
- break;
- }
- })
- .addClass("ui-button ui-widget ui-button-text-only ui-menubar-link")
- .attr("role", "menuitem")
- .attr("aria-haspopup", "true")
- .wrapInner("<span class='ui-button-text'></span>");
-
- if (o.menuIcon) {
- input.addClass("ui-state-default").append("<span class='ui-button-icon-secondary ui-icon ui-icon-triangle-1-s'></span>");
- input.removeClass("ui-button-text-only").addClass("ui-button-text-icon-secondary");
- }
-
- if (!o.buttons) {
- input.addClass('ui-menubar-link').removeClass('ui-state-default');
- };
-
- });
- self._bind({
- keydown: function(event) {
- if (event.keyCode == $.ui.keyCode.ESCAPE) {
- if (self.active && self.active.menu("left", event) !== true) {
- var active = self.active;
- self.active.blur();
- self._close( event );
- active.prev().focus();
- }
- }
- },
- focusout : function( event ) {
- self.closeTimer = setTimeout(function() {
- self._close( event );
- }, 100);
- },
- focusin :function( event ) {
- clearTimeout(self.closeTimer);
- }
- });
- },
-
- _destroy : function() {
- var items = this.element.children("li")
- .removeClass("ui-menubar-item")
- .removeAttr("role", "presentation")
- .children("button, a");
-
- this.element.removeClass('ui-menubar ui-widget-header ui-helper-clearfix').removeAttr("role", "menubar").unbind(".menubar");;
- items.unbind("focusin focusout click focus mouseenter keydown");
-
- items
- .removeClass("ui-button ui-widget ui-button-text-only ui-menubar-link ui-state-default")
- .removeAttr("role", "menuitem")
- .removeAttr("aria-haspopup", "true")
- .children("span.ui-button-text").each(function(i, e) {
- var item = $(this);
- item.parent().html(item.html());
- })
- .end()
- .children(".ui-icon").remove();
-
- $(document).unbind(".menubar");
-
- this.element.find(":ui-menu").menu("destroy")
- .show()
- .removeAttr("aria-hidden", "true")
- .removeAttr("aria-expanded", "false")
- .removeAttr("tabindex")
- .unbind("keydown", "blur")
- ;
- },
-
- _close: function() {
- if (!this.active || !this.active.length)
- return;
- this.active.menu("closeAll").hide().attr("aria-hidden", "true").attr("aria-expanded", "false");
- this.active.prev().removeClass("ui-state-active").removeAttr("tabIndex");
- this.active = null;
- this.open = false;
- },
-
- _open: function(event, menu) {
- // on a single-button menubar, ignore reopening the same menu
- if (this.active && this.active[0] == menu[0]) {
- return;
- }
- // almost the same as _close above, but don't remove tabIndex
- if (this.active) {
- this.active.menu("closeAll").hide().attr("aria-hidden", "true").attr("aria-expanded", "false");
- this.active.prev().removeClass("ui-state-active");
- }
- // set tabIndex -1 to have the button skipped on shift-tab when menu is open (it gets focus)
- var button = menu.prev().addClass("ui-state-active").attr("tabIndex", -1);
- this.active = menu.show().position({
- my: "left top",
- at: "left bottom",
- of: button
- })
- .removeAttr("aria-hidden").attr("aria-expanded", "true")
- .menu("focus", event, menu.children("li").first())
- .focus()
- .focusin()
- ;
- this.open = true;
- },
-
- _prev: function( event, button ) {
- button.attr("tabIndex", -1);
- var prev = button.parent().prevAll("li").children( ".ui-button" ).eq( 0 );
- if (prev.length) {
- prev.removeAttr("tabIndex")[0].focus();
- } else {
- var lastItem = this.element.children("li:last").children(".ui-button:last");
- lastItem.removeAttr("tabIndex")[0].focus();
- }
- },
-
- _next: function( event, button ) {
- button.attr("tabIndex", -1);
- var next = button.parent().nextAll("li").children( ".ui-button" ).eq( 0 );
- if (next.length) {
- next.removeAttr("tabIndex")[0].focus();
- } else {
- var firstItem = this.element.children("li:first").children(".ui-button:first");
- firstItem.removeAttr("tabIndex")[0].focus();
- }
- },
-
- _left: function(event) {
- var prev = this.active.parent().prevAll("li:eq(0)").children( ".ui-menu" ).eq( 0 );
- if (prev.length) {
- this._open(event, prev);
- } else {
- var lastItem = this.element.children("li:last").children(".ui-menu:first");
- this._open(event, lastItem);
- }
- },
-
- _right: function(event) {
- var next = this.active.parent().nextAll("li:eq(0)").children( ".ui-menu" ).eq( 0 );
- if (next.length) {
- this._open(event, next);
- } else {
- var firstItem = this.element.children("li:first").children(".ui-menu:first");
- this._open(event, firstItem);
- }
- }
-});
-
-}(jQuery));
diff --git a/tests/visual/menu/popup.html b/tests/visual/menu/popup.html
deleted file mode 100644
index 271002a20..000000000
--- a/tests/visual/menu/popup.html
+++ /dev/null
@@ -1,176 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Visual Test for Popup Utility</title>
- <link rel="stylesheet" href="../visual.css" type="text/css" />
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
- <script type="text/javascript" src="../../../jquery-1.5.1.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.button.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
- <script type="text/javascript" src="popup.js"></script>
- <!--
- <script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
- -->
- <script type="text/javascript">
- $(function() {
- $.fn.themeswitcher && $('<div/>').css({
- position: "absolute",
- right: 10,
- top: 10
- }).appendTo(document.body).themeswitcher();
-
- var selected = {
- select: function( event, ui ) {
- $( "<div/>" ).text( "Selected: " + ui.item.text() ).appendTo( "#log" );
- $(this).hide();
- }
- };
-
- $("#members-popup").popup();
-
- $("#button1").button();
- $("#menu1").menu(selected).popup();
-
- $( "#rerun" )
- .button()
- .click(function() {
- alert( "Running the last action" );
- })
- .next()
- .button({
- text: false,
- icons: {
- primary: "ui-icon-triangle-1-s"
- }
- })
- .parent()
- .buttonset()
- .next()
- .menu(selected)
- .popup({
- trigger: $("#select")
- });
-
- $("td:has(.menubar)").clone().appendTo("tbody tr:not(:first)");
- $("table .menubar > ul").menu(selected).popup().prev().button();
- });
- </script>
- <style type="text/css">
- body { font-size:62.5%; }
-
- .ui-popup { position: absolute; z-index: 5000; }
- .ui-menu { width: 200px; }
-
- table {
- border-collapse: collapse;
- }
- th, td {
- padding: 0.5em;
- border: 1px solid black;
- }
-
- #members-popup {
- width: 200px; height: 150px; border: 1px solid gray; border-radius: 5px;
- box-shadow: 3px 3px 5px -1px rgba(0, 0, 0, 0.5);
- background: lightgray; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#ddd));
- font-size: 120%; text-align: center; line-height: 150px;
- }
- </style>
-</head>
-<body>
-
-<div>
- <a href="#members-popup">Project members</a>
- <div id="members-popup" tabIndex="0">
- some form controls in here
- </div>
-</div>
-
-<button id="button1">Show context menu 1</button>
-<ul id="menu1">
- <li><a href="#">Amsterdam</a></li>
- <li><a href="#">Anaheim</a></li>
- <li><a href="#">Cologne</a></li>
- <li><a href="#">Frankfurt</a></li>
- <li><a href="#">Magdeburg</a></li>
- <li><a href="#">Munich</a></li>
- <li><a href="#">Utrecht</a></li>
- <li><a href="#">Zurich</a></li>
-</ul>
-
-
-<div>
- <div>
- <button id="rerun">Run last action</button>
- <button id="select">Select an action</button>
- </div>
- <ul>
- <li><a href="#">Open...</a></li>
- <li><a href="#">Save</a></li>
- <li><a href="#">Delete</a></li>
- </ul>
-</div>
-
-<table id="movies" class="ui-widget">
- <thead>
- <tr>
- <th data-field="Name" class="ui-widget-header">Name</th>
- <th data-field="ReleaseYear" class="ui-widget-header">Release Year</th>
- <th data-field="AverageRating" class="ui-widget-header">Average Rating</th>
- <th class="ui-widget-header"></th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td class="ui-widget-content">Red Hot Chili Peppers: Funky Monks</td>
- <td class="ui-widget-content">1993</td>
- <td class="ui-widget-content">3.6</td>
- <td class="ui-widget-content">
- <div class="menubar">
- <a href="#">Options</a>
- <ul>
- <li><a href="#">Order...</a></li>
- <li class="ui-state-disabled">Write a Review...</li>
- <li><a href="#">Find Similar Movies...</a></li>
- <li>
- <a href="#">Rate</a>
- <ul>
- <li><a href="#">5 stars</a></li>
- <li><a href="#">4 stars</a></li>
- <li><a href="#">3 stars</a></li>
- <li><a href="#">2 stars</a></li>
- <li><a href="#">1 stars</a></li>
- </ul>
- </li>
- </ul>
- </div>
- </td>
- </tr>
- <tr>
- <td class="ui-widget-content">Rod Stewart: Storyteller 1984-1991</td>
- <td class="ui-widget-content">1991</td>
- <td class="ui-widget-content">3.1</td>
- </tr>
- <tr>
- <td class="ui-widget-content">Stevie Ray Vaughan and Double Trouble: Live at the El Mocambo 1983</td>
- <td class="ui-widget-content">1991</td>
- <td class="ui-widget-content">3.9</td>
- </tr>
- <tr>
- <td class="ui-widget-content">Spike and Mike's Sick &amp; Twisted Festival of Animation</td>
- <td class="ui-widget-content">1997</td>
- <td class="ui-widget-content">2.6</td>
- </tr>
- </tbody>
-</table>
-
-<div class="ui-widget" style="margin-top:2em; font-family:Arial">
- Log:
- <div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
-</div>
-
-</body>
-</html>
diff --git a/tests/visual/menu/popup.js b/tests/visual/menu/popup.js
deleted file mode 100644
index f57cba699..000000000
--- a/tests/visual/menu/popup.js
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * jQuery UI popup utility
- */
-(function($) {
-
-var idIncrement = 0;
-
-$.widget( "ui.popup", {
- options: {
- position: {
- my: "left top",
- at: "left bottom"
- }
- },
- _create: function() {
- if ( !this.options.trigger ) {
- this.options.trigger = this.element.prev();
- }
-
- if ( !this.element.attr( "id" ) ) {
- this.element.attr( "id", "ui-popup-" + idIncrement++ );
- this.generatedId = true;
- }
-
- if ( !this.element.attr( "role" ) ) {
- // TODO alternatives to tooltip are dialog and menu, all three aren't generic popups
- this.element.attr( "role", "tooltip" );
- this.generatedRole = true;
- }
-
- this.options.trigger
- .attr( "aria-haspopup", true )
- .attr( "aria-owns", this.element.attr( "id" ) );
-
- this.element
- .addClass("ui-popup")
- this._close();
-
- this._bind(this.options.trigger, {
- click: function( event ) {
- event.preventDefault();
- var that = this;
- setTimeout(function() {
- that._open( event );
- }, 1);
- }
- });
-
- this._bind(this.element, {
- blur: "_close"
- });
-
- this._bind({
- keyup: function( event ) {
- if (event.keyCode == $.ui.keyCode.ESCAPE && this.element.is( ":visible" )) {
- this._close( event );
- this.options.trigger.focus();
- }
- }
- });
-
- this._bind(document, {
- click: function( event ) {
- if (this.open && !$(event.target).closest(".ui-popup").length) {
- this._close( event );
- }
- }
- })
- },
-
- _destroy: function() {
- this.element
- .show()
- .removeClass( "ui-popup" )
- .removeAttr( "aria-hidden" )
- .removeAttr( "aria-expanded" );
-
- this.options.trigger
- .removeAttr( "aria-haspopup" )
- .removeAttr( "aria-owns" );
-
- if ( this.generatedId ) {
- this.element.removeAttr( "id" );
- }
- if ( this.generatedRole ) {
- this.element.removeAttr( "role" );
- }
- },
-
- _open: function( event ) {
- var position = $.extend( {}, {
- of: this.options.trigger
- }, this.options.position );
-
- this.element
- .show()
- .attr( "aria-hidden", false )
- .attr( "aria-expanded", true )
- .position( position )
- .focus();
-
- // take trigger out of tab order to allow shift-tab to skip trigger
- this.options.trigger.attr("tabindex", -1);
-
- this.open = true;
- this._trigger( "open", event );
- },
-
- _close: function( event ) {
- this.element
- .hide()
- .attr( "aria-hidden", true )
- .attr( "aria-expanded", false );
-
- this.options.trigger.attr("tabindex", 0);
-
- this.open = false;
- this._trigger( "close", event );
- }
-
-
-});
-
-}(jQuery));