aboutsummaryrefslogtreecommitdiffstats
path: root/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu
diff options
context:
space:
mode:
Diffstat (limited to '97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu')
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/all.html30
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu.html269
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_common.js20
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_core.js30
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_events.js601
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_methods.js104
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_options.js115
-rw-r--r--97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_test_helpers.js31
8 files changed, 1200 insertions, 0 deletions
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/all.html b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/all.html
new file mode 100644
index 0000000..b34fa5e
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/all.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery UI Menu Test Suite</title>
+
+ <script src="../../../jquery-1.9.1.js"></script>
+
+ <link rel="stylesheet" href="../../../external/qunit.css">
+ <link rel="stylesheet" href="../qunit-composite.css">
+ <script src="../../../external/qunit.js"></script>
+ <script src="../qunit-composite.js"></script>
+ <script src="../subsuite.js"></script>
+
+ <script>
+ testAllVersions( "menu" );
+ </script>
+</head>
+<body>
+
+<h1 id="qunit-header">jQuery UI Menu 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/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu.html b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu.html
new file mode 100644
index 0000000..ed37623
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu.html
@@ -0,0 +1,269 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery UI Menu Test Suite</title>
+
+ <script src="../../jquery.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>
+ TestHelpers.loadResources({
+ css: [ "ui.core", "ui.menu" ],
+ js: [
+ "ui/jquery.ui.core.js",
+ "ui/jquery.ui.widget.js",
+ "ui/jquery.ui.menu.js"
+ ]
+ });
+ </script>
+
+ <script src="menu_test_helpers.js"></script>
+ <script src="menu_common.js"></script>
+ <script src="menu_core.js"></script>
+ <script src="menu_events.js"></script>
+ <script src="menu_methods.js"></script>
+ <script src="menu_options.js"></script>
+
+ <script src="../swarminject.js"></script>
+ <style>
+ .ui-menu {
+ font-size: 15px;
+ }
+ #menu3 {
+ height: 250px;
+ overflow: auto;
+ }
+ #menu4, #menu4 ul {
+ height: 250px;
+ overflow: auto;
+ }
+ </style>
+</head>
+<body>
+
+<div id="qunit">jQuery UI Menu Test Suite</div>
+<div id="qunit-fixture">
+
+<ul class="foo" id="menu1">
+ <li class="foo"><a class="foo" href="#">Aberdeen</a></li>
+ <li class="foo"><a class="foo" href="#">Ada</a></li>
+ <li class="foo"><a class="foo" href="#">Adamsville</a></li>
+ <li class="foo"><a id="testID1" class="foo" href="#">Addyston</a></li>
+ <li class="foo"><a class="foo" href="#">Adelphi</a></li>
+</ul>
+
+<ul id="menu2">
+ <li class="foo"><a class="foo" href="#">Aberdeen</a></li>
+ <li class="foo"><a class="foo" href="#">Ada</a></li>
+ <li class="foo"><a class="foo" href="#">Adamsville</a></li>
+ <li class="foo"><a class="foo" href="#"><span class="ui-icon ui-icon-print"></span>Addyston</a></li>
+ <li>
+ <a href="#">Delphi</a>
+ <ul>
+ <li class="foo"><a class="foo" href="#">Ada</a></li>
+ <li class="foo"><a class="foo" href="#">Saarland</a></li>
+ <li class="foo"><a class="foo" href="#">Salzburg</a></li>
+ </ul>
+ </li>
+ <li class="foo"><a class="foo" href="#">Saarland</a></li>
+ <li>
+ <a href="#">Salzburg</a>
+ <ul>
+ <li>
+ <a href="#">Delphi</a>
+ <ul>
+ <li class="foo"><a class="foo" href="#">Ada</a></li>
+ <li class="foo"><a class="foo" href="#">Saarland</a></li>
+ <li class="foo"><a class="foo" href="#">Salzburg</a></li>
+ </ul>
+ </li>
+ <li>
+ <a href="#">Delphi</a>
+ <ul>
+ <li class="foo"><a class="foo" href="#">Ada</a></li>
+ <li> - </li>
+ <li class="foo"><a class="foo" href="#">Saarland</a></li>
+ <li></li>
+ <li class="foo"><a class="foo" href="#">Salzburg</a></li>
+ <li>&ndash;</li>
+ </ul>
+ </li>
+ <li class="foo"><a class="foo" href="#">Perch</a></li>
+ </ul>
+ </li>
+</ul>
+
+<ul class="foo" id="menu3">
+ <li class="foo"><a class="foo" href="#">Aberdeen</a></li>
+ <li class="foo"><a class="foo" href="#">Ada</a></li>
+ <li class="foo"><a class="foo" href="#">Adamsville</a></li>
+ <li class="foo"><a class="foo" href="#">Addyston</a></li>
+ <li class="foo"><a class="foo" href="#">Adelphi</a></li>
+ <li class="foo"><a class="foo" href="#">Adena</a></li>
+ <li class="foo"><a class="foo" href="#">Adrian</a></li>
+ <li class="foo"><a class="foo" href="#">Akron</a></li>
+ <li class="foo"><a class="foo" href="#">Albany</a></li>
+ <li class="foo"><a class="foo" href="#">Alexandria</a></li>
+ <li class="foo"><a class="foo" href="#">Alger</a></li>
+ <li class="foo"><a class="foo" href="#">Alledonia</a></li>
+ <li class="foo"><a class="foo" href="#">Alliance</a></li>
+ <li class="foo"><a class="foo" href="#">Alpha</a></li>
+ <li class="foo"><a class="foo" href="#">Alvada</a></li>
+ <li class="foo"><a class="foo" href="#">Alvordton</a></li>
+ <li class="foo"><a class="foo" href="#">Amanda</a></li>
+ <li class="foo"><a class="foo" href="#">Amelia</a></li>
+ <li class="foo"><a class="foo" href="#">Amesville</a></li>
+ <li class="foo"><a class="foo" href="#">Aberdeen</a></li>
+ <li class="foo"><a class="foo" href="#">Ada</a></li>
+ <li class="foo"><a class="foo" href="#">Adamsville</a></li>
+ <li class="foo"><a class="foo" href="#">Addyston</a></li>
+ <li class="foo"><a class="foo" href="#">Adelphi</a></li>
+ <li class="foo"><a class="foo" href="#">Adena</a></li>
+ <li class="foo"><a class="foo" href="#">Adrian</a></li>
+ <li class="foo"><a class="foo" href="#">Akron</a></li>
+ <li class="foo"><a class="foo" href="#">Albany</a></li>
+ <li class="foo"><a class="foo" href="#">Alexandria</a></li>
+ <li class="foo"><a class="foo" href="#">Alger</a></li>
+ <li class="foo"><a class="foo" href="#">Alledonia</a></li>
+ <li class="foo"><a class="foo" href="#">Alliance</a></li>
+ <li class="foo"><a class="foo" href="#">Alpha</a></li>
+ <li class="foo"><a class="foo" href="#">Alvada</a></li>
+ <li class="foo"><a class="foo" href="#">Alvordton</a></li>
+ <li class="foo"><a class="foo" href="#">Amanda</a></li>
+ <li class="foo"><a class="foo" href="#">Amelia</a></li>
+ <li class="foo"><a class="foo" href="#">Amesville</a></li>
+</ul>
+
+<ul class="foo" id="menu4">
+ <li class="foo"><a class="foo" href="#">Aberdeen</a></li>
+ <li class="foo">
+ <a class="foo" href="#">Ada</a>
+ <ul class="foo">
+ <li class="foo"><a class="foo" href="#">Aberdeen</a></li>
+ <li class="foo"><a class="foo" href="#">Ada</a></li>
+ <li class="foo"><a class="foo" href="#">Adamsville</a></li>
+ <li class="foo"><a class="foo" href="#">Addyston</a></li>
+ <li class="foo"><a class="foo" href="#">Adelphi</a></li>
+ <li class="foo"><a class="foo" href="#">Adena</a></li>
+ <li class="foo"><a class="foo" href="#">Adrian</a></li>
+ <li class="foo"><a class="foo" href="#">Akron</a></li>
+ <li class="foo"><a class="foo" href="#">Albany</a></li>
+ <li class="foo"><a class="foo" href="#">Alexandria</a></li>
+ <li class="foo"><a class="foo" href="#">Alger</a></li>
+ <li class="foo"><a class="foo" href="#">Alledonia</a></li>
+ <li class="foo"><a class="foo" href="#">Alliance</a></li>
+ <li class="foo"><a class="foo" href="#">Alpha</a></li>
+ <li class="foo"><a class="foo" href="#">Alvada</a></li>
+ <li class="foo"><a class="foo" href="#">Alvordton</a></li>
+ <li class="foo"><a class="foo" href="#">Amanda</a></li>
+ <li class="foo"><a class="foo" href="#">Amelia</a></li>
+ <li class="foo"><a class="foo" href="#">Amesville</a></li>
+ <li class="foo"><a class="foo" href="#">Aberdeen</a></li>
+ <li class="foo"><a class="foo" href="#">Ada</a></li>
+ <li class="foo"><a class="foo" href="#">Adamsville</a></li>
+ <li class="foo"><a class="foo" href="#">Addyston</a></li>
+ <li class="foo"><a class="foo" href="#">Adelphi</a></li>
+ <li class="foo"><a class="foo" href="#">Adena</a></li>
+ <li class="foo"><a class="foo" href="#">Adrian</a></li>
+ <li class="foo"><a class="foo" href="#">Akron</a></li>
+ <li class="foo"><a class="foo" href="#">Albany</a></li>
+ </ul>
+ </li>
+ <li class="foo"><a class="foo" href="#">Adamsville</a></li>
+ <li class="foo"><a class="foo" href="#">Addyston</a></li>
+ <li class="foo"><a class="foo" href="#">Adelphi</a></li>
+ <li class="foo"><a class="foo" href="#">Adena</a></li>
+ <li class="foo"><a class="foo" href="#">Adrian</a></li>
+ <li class="foo"><a class="foo" href="#">Akron</a></li>
+ <li class="foo"><a class="foo" href="#">Albany</a></li>
+ <li class="foo"><a class="foo" href="#">Alexandria</a></li>
+ <li class="foo"><a class="foo" href="#">Alger</a></li>
+ <li class="foo"><a class="foo" href="#">Alledonia</a></li>
+ <li class="foo"><a class="foo" href="#">Alliance</a></li>
+ <li class="foo"><a class="foo" href="#">Alpha</a></li>
+ <li class="foo"><a class="foo" href="#">Alvada</a></li>
+ <li class="foo"><a class="foo" href="#">Alvordton</a></li>
+ <li class="foo"><a class="foo" href="#">Amanda</a></li>
+ <li class="foo"><a class="foo" href="#">Amelia</a></li>
+ <li class="foo"><a class="foo" href="#">Amesville</a></li>
+ <li class="foo"><a class="foo" href="#">Aberdeen</a></li>
+ <li class="foo"><a class="foo" href="#">Ada</a></li>
+ <li class="foo"><a class="foo" href="#">Adamsville</a></li>
+ <li class="foo"><a class="foo" href="#">Addyston</a></li>
+ <li class="foo"><a class="foo" href="#">Adelphi</a></li>
+ <li class="foo"><a class="foo" href="#">Adena</a></li>
+ <li class="foo"><a class="foo" href="#">Adrian</a></li>
+ <li class="foo"><a class="foo" href="#">Akron</a></li>
+ <li class="foo"><a class="foo" href="#">Albany</a></li>
+ <li class="foo"><a class="foo" href="#">Alexandria</a></li>
+ <li class="foo"><a class="foo" href="#">Alger</a></li>
+ <li class="foo"><a class="foo" href="#">Alledonia</a></li>
+ <li class="foo"><a class="foo" href="#">Alliance</a></li>
+ <li class="foo"><a class="foo" href="#">Alpha</a></li>
+ <li class="foo"><a class="foo" href="#">Alvada</a></li>
+ <li class="foo"><a class="foo" href="#">Alvordton</a></li>
+ <li class="foo"><a class="foo" href="#">Amanda</a></li>
+ <li class="foo"><a class="foo" href="#">Amelia</a></li>
+ <li class="foo"><a class="foo" href="#">Amesville</a></li>
+</ul>
+
+<div id="menu5">
+ <blockquote><a href="#">Aberdeen</a></blockquote>
+ <blockquote><a href="#">Ada</a></blockquote>
+ <blockquote><a href="#">Adamsville</a></blockquote>
+ <blockquote><a href="#">Addyston</a></blockquote>
+ <blockquote>
+ <a href="#">Delphi</a>
+ <div>
+ <blockquote><a href="#">Ada</a></blockquote>
+ <blockquote><a href="#">Saarland</a></blockquote>
+ <blockquote><a href="#">Salzburg</a></blockquote>
+ </div>
+ </blockquote>
+ <blockquote><a href="#">Saarland</a></blockquote>
+ <blockquote>
+ <a href="#">Salzburg</a>
+ <div>
+ <blockquote>
+ <a href="#">Delphi</a>
+ <div>
+ <blockquote><a href="#">Ada</a></blockquote>
+ <blockquote><a id="testID2" href="#">Saarland</a></blockquote>
+ <blockquote><a href="#">Salzburg</a></blockquote>
+ </div>
+ </blockquote>
+ <blockquote>
+ <a href="#">Delphi</a>
+ <div>
+ <blockquote><a href="#">Ada</a></blockquote>
+ <blockquote><a href="#">Saarland</a></blockquote>
+ <blockquote><a href="#">Salzburg</a></blockquote>
+ </div>
+ </blockquote>
+ <blockquote><a href="#">Perch</a></blockquote>
+ </div>
+ </blockquote>
+</div>
+
+<ul id="menu6">
+ <li class="foo"><a class="foo" href="#">Aberdeen</a></li>
+ <li class="foo ui-state-disabled"><a class="foo" href="#">Ada</a></li>
+ <li class="foo"><a class="foo" href="#">Adamsville</a></li>
+ <li class="foo"><a class="foo" href="#">Addyston</a></li>
+ <li class="ui-state-disabled">
+ <a id="testID3" href="#">Delphi</a>
+ <ul>
+ <li class="foo"><a class="foo" href="#">Ada</a></li>
+ <li class="foo"><a class="foo" href="#">Saarland</a></li>
+ <li class="foo"><a class="foo" href="#">Salzburg</a></li>
+ </ul>
+ </li>
+ <li class="foo"><a class="foo" href="#">Saarland</a></li>
+</ul>
+
+</div>
+</body>
+</html>
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_common.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_common.js
new file mode 100644
index 0000000..4a89a94
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_common.js
@@ -0,0 +1,20 @@
+TestHelpers.commonWidgetTests( "menu", {
+ defaults: {
+ disabled: false,
+ icons: {
+ submenu: "ui-icon-carat-1-e"
+ },
+ menus: "ul",
+ position: {
+ my: "left top",
+ at: "right top"
+ },
+ role: "menu",
+
+ // callbacks
+ blur: null,
+ create: null,
+ focus: null,
+ select: null
+ }
+});
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_core.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_core.js
new file mode 100644
index 0000000..5ee28c1
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_core.js
@@ -0,0 +1,30 @@
+(function( $ ) {
+
+module( "menu: core" );
+
+test( "markup structure", function() {
+ expect( 6 );
+ var element = $( "#menu1" ).menu();
+ ok( element.hasClass( "ui-menu" ), "main element is .ui-menu" );
+ element.children().each(function( index ) {
+ ok( $( this ).hasClass( "ui-menu-item" ), "child " + index + " is .ui-menu-item" );
+ });
+});
+
+test( "accessibility", function () {
+ expect( 4 );
+ var element = $( "#menu1" ).menu();
+
+ equal( element.attr( "role" ), "menu", "main role" );
+ ok( !element.attr( "aria-activedescendant" ), "aria-activedescendant not set" );
+
+ element.menu( "focus", $.Event(), element.children().eq( -2 ) );
+ equal( element.attr( "aria-activedescendant" ), "testID1", "aria-activedescendant from existing id" );
+
+ element.menu( "focus", $.Event(), element.children().eq( 0 ) );
+ ok( /^ui-id-\d+$/.test( element.attr( "aria-activedescendant" ) ), "aria-activedescendant from generated id" );
+
+ // Item roles are tested in the role option tests
+});
+
+})( jQuery );
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_events.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_events.js
new file mode 100644
index 0000000..3c94a5a
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_events.js
@@ -0,0 +1,601 @@
+(function( $ ) {
+
+var log = TestHelpers.menu.log,
+ logOutput = TestHelpers.menu.logOutput,
+ click = TestHelpers.menu.click;
+
+module( "menu: events", {
+ setup: function() {
+ TestHelpers.menu.clearLog();
+ }
+});
+
+test( "handle click on menu", function() {
+ expect( 1 );
+ var element = $( "#menu1" ).menu({
+ select: function() {
+ log();
+ }
+ });
+ log( "click", true );
+ click( $( "#menu1" ), "1" );
+ log( "afterclick" );
+ click( element, "2" );
+ click( $( "#menu1" ), "3" );
+ click( element, "1" );
+ equal( logOutput(), "click,1,afterclick,2,3,1", "Click order not valid." );
+});
+
+test( "handle click on custom item menu", function() {
+ expect( 1 );
+ var element = $( "#menu5" ).menu({
+ select: function() {
+ log();
+ },
+ menus: "div"
+ });
+ log( "click", true );
+ click( $( "#menu5" ), "1" );
+ log( "afterclick" );
+ click( element, "2" );
+ click( $( "#menu5" ), "3" );
+ click( element, "1" );
+ equal( logOutput(), "click,1,afterclick,2,3,1", "Click order not valid." );
+});
+
+asyncTest( "handle blur", function() {
+ expect( 1 );
+ var blurHandled = false,
+ element = $( "#menu1" ).menu({
+ blur: function( event ) {
+ // Ignore duplicate blur event fired by IE
+ if ( !blurHandled ) {
+ blurHandled = true;
+ equal( event.type, "menublur", "blur event.type is 'menublur'" );
+ }
+ }
+ });
+
+ click( element, "1" );
+ setTimeout(function() {
+ element.blur();
+ setTimeout(function() {
+ start();
+ }, 350 );
+ });
+});
+
+asyncTest( "handle blur via click outside", function() {
+ expect( 1 );
+ var blurHandled = false,
+ element = $( "#menu1" ).menu({
+ blur: function( event ) {
+ // Ignore duplicate blur event fired by IE
+ if ( !blurHandled ) {
+ blurHandled = true;
+ equal( event.type, "menublur", "blur event.type is 'menublur'" );
+ }
+ }
+ });
+
+ click( element, "1" );
+ setTimeout(function() {
+ $( "<a>", { id: "remove"} ).appendTo( "body" ).trigger( "click" );
+ setTimeout(function() {
+ start();
+ }, 350 );
+ });
+});
+
+asyncTest( "handle focus of menu with active item", function() {
+ expect( 1 );
+ var element = $( "#menu1" ).menu({
+ focus: function( event ) {
+ log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
+ }
+ });
+
+ log( "focus", true );
+ element[0].focus();
+ setTimeout(function() {
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element[0].blur();
+ setTimeout(function() {
+ element[0].focus();
+ setTimeout(function() {
+ equal( logOutput(), "focus,0,1,2,2", "current active item remains active" );
+ start();
+ });
+ });
+ });
+});
+
+asyncTest( "handle submenu auto collapse: mouseleave", function() {
+ expect( 4 );
+ var element = $( "#menu2" ).menu(),
+ event = $.Event( "mouseenter" );
+
+ function menumouseleave1() {
+ equal( element.find( "ul[aria-expanded='true']" ).length, 1, "first submenu expanded" );
+ element.menu( "focus", event, element.find( "li:nth-child(7) li:first" ) );
+ setTimeout( menumouseleave2, 350 );
+ }
+ function menumouseleave2() {
+ equal( element.find( "ul[aria-expanded='true']" ).length, 2, "second submenu expanded" );
+ element.find( "ul[aria-expanded='true']:first" ).trigger( "mouseleave" );
+ setTimeout( menumouseleave3, 350 );
+ }
+ function menumouseleave3() {
+ equal( element.find( "ul[aria-expanded='true']" ).length, 1, "second submenu collapsed" );
+ element.trigger( "mouseleave" );
+ setTimeout( menumouseleave4, 350 );
+ }
+ function menumouseleave4() {
+ equal( element.find( "ul[aria-expanded='true']" ).length, 0, "first submenu collapsed" );
+ start();
+ }
+
+ element.find( "li:nth-child(7)" ).trigger( "mouseenter" );
+ setTimeout( menumouseleave1, 350 );
+});
+
+asyncTest( "handle submenu auto collapse: mouseleave", function() {
+ expect( 4 );
+ var element = $( "#menu5" ).menu({ menus: "div" }),
+ event = $.Event( "mouseenter" );
+
+ function menumouseleave1() {
+ equal( element.find( "div[aria-expanded='true']" ).length, 1, "first submenu expanded" );
+ element.menu( "focus", event, element.find( ":nth-child(7)" ).find( "div" ).eq( 0 ).children().eq( 0 ) );
+ setTimeout( menumouseleave2, 350 );
+ }
+ function menumouseleave2() {
+ equal( element.find( "div[aria-expanded='true']" ).length, 2, "second submenu expanded" );
+ element.find( "div[aria-expanded='true']:first" ).trigger( "mouseleave" );
+ setTimeout( menumouseleave3, 350 );
+ }
+ function menumouseleave3() {
+ equal( element.find( "div[aria-expanded='true']" ).length, 1, "second submenu collapsed" );
+ element.trigger( "mouseleave" );
+ setTimeout( menumouseleave4, 350 );
+ }
+ function menumouseleave4() {
+ equal( element.find( "div[aria-expanded='true']" ).length, 0, "first submenu collapsed" );
+ start();
+ }
+
+ element.find( ":nth-child(7)" ).trigger( "mouseenter" );
+ setTimeout( menumouseleave1, 350 );
+});
+
+
+asyncTest( "handle keyboard navigation on menu without scroll and without submenus", function() {
+ expect( 12 );
+ var element = $( "#menu1" ).menu({
+ select: function( event, ui ) {
+ log( $( ui.item[0] ).text() );
+ },
+ focus: function( event ) {
+ log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
+ }
+ });
+
+ log( "keydown", true );
+ element[0].focus();
+ setTimeout(function() {
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ equal( logOutput(), "keydown,0,1,2", "Keydown DOWN" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
+ equal( logOutput(), "keydown,1", "Keydown UP" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
+ equal( logOutput(), "keydown", "Keydown LEFT (no effect)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
+ equal( logOutput(), "keydown", "Keydown RIGHT (no effect)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
+ equal( logOutput(), "keydown,4", "Keydown PAGE_DOWN" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
+ equal( logOutput(), "keydown", "Keydown PAGE_DOWN (no effect)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
+ equal( logOutput(), "keydown,0", "Keydown PAGE_UP" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
+ equal( logOutput(), "keydown", "Keydown PAGE_UP (no effect)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
+ equal( logOutput(), "keydown,4", "Keydown END" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
+ equal( logOutput(), "keydown,0", "Keydown HOME" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
+ equal( logOutput(), "keydown", "Keydown ESCAPE (no effect)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
+ equal( logOutput(), "keydown,Aberdeen", "Keydown ENTER" );
+
+ start();
+ });
+});
+
+asyncTest( "handle keyboard navigation on menu without scroll and with submenus", function() {
+ expect( 16 );
+ var element = $( "#menu2" ).menu({
+ select: function( event, ui ) {
+ log( $( ui.item[0] ).text() );
+ },
+ focus: function( event ) {
+ log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
+ }
+ });
+
+ log( "keydown", true );
+ element.one( "menufocus", function() {
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ equal( logOutput(), "keydown,1,2", "Keydown DOWN" );
+ setTimeout( menukeyboard1, 50 );
+ });
+ element.focus();
+
+ function menukeyboard1() {
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
+ equal( logOutput(), "keydown,1,0", "Keydown UP" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
+ equal( logOutput(), "keydown", "Keydown LEFT (no effect)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
+
+ setTimeout(function() {
+ equal( logOutput(), "keydown,1,2,3,4,0", "Keydown RIGHT (open submenu)" );
+ setTimeout( menukeyboard2, 50 );
+ }, 50 );
+ }
+
+ function menukeyboard2() {
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
+ equal( logOutput(), "keydown,4", "Keydown LEFT (close submenu)" );
+
+ // re-open submenu
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
+ setTimeout( menukeyboard3, 50 );
+ }
+
+ function menukeyboard3() {
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
+ equal( logOutput(), "keydown,2", "Keydown PAGE_DOWN" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
+ equal( logOutput(), "keydown", "Keydown PAGE_DOWN (no effect)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
+ equal( logOutput(), "keydown,0", "Keydown PAGE_UP" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
+ equal( logOutput(), "keydown", "Keydown PAGE_UP (no effect)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
+ equal( logOutput(), "keydown,2", "Keydown END" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
+ equal( logOutput(), "keydown,0", "Keydown HOME" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
+ equal( logOutput(), "keydown,4", "Keydown ESCAPE (close submenu)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.SPACE } );
+ setTimeout( menukeyboard4, 50 );
+ }
+
+ function menukeyboard4() {
+ equal( logOutput(), "keydown,0", "Keydown SPACE (open submenu)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
+ equal( logOutput(), "keydown,4", "Keydown ESCAPE (close submenu)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
+ setTimeout( function() {
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
+ setTimeout( function() {
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ equal( logOutput(), "keydown,5,6,0,1,0,2,4,0", "Keydown skip dividers and items without anchors" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
+ setTimeout( menukeyboard6, 50 );
+ }, 50 );
+ }, 50 );
+ }
+
+ function menukeyboard6() {
+ equal( logOutput(), "keydown,Ada", "Keydown ENTER (open submenu)" );
+ start();
+ }
+});
+
+asyncTest( "handle keyboard navigation on menu with scroll and without submenus", function() {
+ expect( 14 );
+ var element = $( "#menu3" ).menu({
+ select: function( event, ui ) {
+ log( $( ui.item[0] ).text() );
+ },
+ focus: function( event ) {
+ log( $( event.target ).find( ".ui-state-focus" ).parent().index());
+ }
+ });
+
+ log( "keydown", true );
+ element[0].focus();
+ setTimeout(function() {
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ equal( logOutput(), "keydown,0,1,2", "Keydown DOWN" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
+ equal( logOutput(), "keydown,1,0", "Keydown UP" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
+ equal( logOutput(), "keydown", "Keydown LEFT (no effect)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
+ equal( logOutput(), "keydown", "Keydown RIGHT (no effect)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
+ equal( logOutput(), "keydown,10", "Keydown PAGE_DOWN" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
+ equal( logOutput(), "keydown,20", "Keydown PAGE_DOWN" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
+ equal( logOutput(), "keydown,10", "Keydown PAGE_UP" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
+ equal( logOutput(), "keydown,0", "Keydown PAGE_UP" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
+ equal( logOutput(), "keydown", "Keydown PAGE_UP (no effect)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
+ equal( logOutput(), "keydown,37", "Keydown END" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
+ equal( logOutput(), "keydown", "Keydown PAGE_DOWN (no effect)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
+ equal( logOutput(), "keydown,0", "Keydown HOME" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
+ equal( logOutput(), "keydown", "Keydown ESCAPE (no effect)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
+ equal( logOutput(), "keydown,Aberdeen", "Keydown ENTER" );
+
+ start();
+ });
+});
+
+asyncTest( "handle keyboard navigation on menu with scroll and with submenus", function() {
+ expect( 14 );
+ var element = $( "#menu4" ).menu({
+ select: function( event, ui ) {
+ log( $( ui.item[0] ).text() );
+ },
+ focus: function( event ) {
+ log( $( event.target ).find( ".ui-state-focus" ).parent().index());
+ }
+ });
+
+ log( "keydown", true );
+ element.one( "menufocus", function() {
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ equal( logOutput(), "keydown,1,2", "Keydown DOWN" );
+ setTimeout( menukeyboard1, 50 );
+ });
+ element.focus();
+
+ function menukeyboard1() {
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
+ equal( logOutput(), "keydown,1,0", "Keydown UP" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
+ equal( logOutput(), "keydown", "Keydown LEFT (no effect)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
+
+ setTimeout( function() {
+ equal( logOutput(), "keydown,1,0", "Keydown RIGHT (open submenu)" );
+ }, 50 );
+ setTimeout( menukeyboard2, 50 );
+ }
+
+ function menukeyboard2() {
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
+ equal( logOutput(), "keydown,1", "Keydown LEFT (close submenu)" );
+
+ // re-open submenu
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
+ setTimeout( menukeyboard3, 50 );
+ }
+
+ function menukeyboard3() {
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
+ equal( logOutput(), "keydown,10", "Keydown PAGE_DOWN" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
+ equal( logOutput(), "keydown,20", "Keydown PAGE_DOWN" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
+ equal( logOutput(), "keydown,10", "Keydown PAGE_UP" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
+ equal( logOutput(), "keydown,0", "Keydown PAGE_UP" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
+ equal( logOutput(), "keydown,27", "Keydown END" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
+ equal( logOutput(), "keydown,0", "Keydown HOME" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
+ equal( logOutput(), "keydown,1", "Keydown ESCAPE (close submenu)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
+ setTimeout( menukeyboard4, 50 );
+ }
+
+ function menukeyboard4() {
+ equal( logOutput(), "keydown,0", "Keydown ENTER (open submenu)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
+ equal( logOutput(), "keydown,Aberdeen", "Keydown ENTER (select item)" );
+
+ start();
+ }
+});
+
+asyncTest( "handle keyboard navigation and mouse click on menu with disabled items", function() {
+ expect( 6 );
+ var element = $( "#menu6" ).menu({
+ select: function( event, ui ) {
+ log( $( ui.item[0] ).text() );
+ },
+ focus: function( event ) {
+ log( $( event.target ).find( ".ui-state-focus" ).parent().index());
+ }
+ });
+
+ log( "keydown", true );
+ element.one( "menufocus", function() {
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
+ equal( logOutput(), "keydown,1", "Keydown focus but not select disabled item" );
+ setTimeout( menukeyboard1, 50 );
+ });
+ element.focus();
+
+ function menukeyboard1() {
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
+ equal( logOutput(), "keydown,2,3,4", "Keydown focus disabled item with submenu" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
+ equal( logOutput(), "keydown", "Keydown LEFT (no effect)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
+
+ setTimeout( function() {
+ equal( logOutput(), "keydown", "Keydown RIGHT (no effect on disabled sub-menu)" );
+
+ log( "keydown", true );
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
+
+ setTimeout( function() {
+ equal( logOutput(), "keydown", "Keydown ENTER (no effect on disabled sub-menu)" );
+ log( "click", true );
+ click( element, "1" );
+ equal( logOutput(), "click", "Click disabled item (no effect)" );
+ start();
+ }, 50 );
+ }, 50 );
+ }
+});
+
+asyncTest( "handle keyboard navigation with spelling of menu items", function() {
+ expect( 2 );
+ var element = $( "#menu2" ).menu({
+ focus: function( event ) {
+ log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
+ }
+ });
+
+ log( "keydown", true );
+ element.one( "menufocus", function() {
+ element.simulate( "keydown", { keyCode: 65 } );
+ element.simulate( "keydown", { keyCode: 68 } );
+ element.simulate( "keydown", { keyCode: 68 } );
+ equal( logOutput(), "keydown,0,1,3", "Keydown focus Addyston by spelling the first 3 letters" );
+ element.simulate( "keydown", { keyCode: 68 } );
+ equal( logOutput(), "keydown,0,1,3,4", "Keydown focus Delphi by repeating the 'd' again" );
+ start();
+ });
+ element[0].focus();
+});
+
+})( jQuery );
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_methods.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_methods.js
new file mode 100644
index 0000000..c51d123
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_methods.js
@@ -0,0 +1,104 @@
+(function( $ ) {
+
+var log = TestHelpers.menu.log,
+ logOutput = TestHelpers.menu.logOutput,
+ click = TestHelpers.menu.click;
+
+module( "menu: methods", {
+ setup: function() {
+ TestHelpers.menu.clearLog();
+ }
+});
+
+test( "destroy", function() {
+ expect( 4 );
+ domEqual( "#menu1", function() {
+ $( "#menu1" ).menu().menu( "destroy" );
+ });
+ domEqual( "#menu2", function() {
+ $( "#menu2" ).menu().menu( "destroy" );
+ });
+ domEqual( "#menu5", function() {
+ $( "#menu5").menu().menu( "destroy" );
+ });
+ domEqual( "#menu6", function() {
+ $( "#menu6" ).menu().menu( "destroy" );
+ });
+});
+
+test( "enable/disable", function() {
+ expect( 3 );
+ var element = $( "#menu1" ).menu({
+ select: function() {
+ log();
+ }
+ });
+ element.menu( "disable" );
+ ok( element.is( ".ui-state-disabled" ), "Missing ui-state-disabled class" );
+ log( "click", true );
+ click( element, "1" );
+ log( "afterclick" );
+ element.menu( "enable" );
+ ok( element.not( ".ui-state-disabled" ), "Has ui-state-disabled class" );
+ log( "click" );
+ click( element, "1" );
+ log( "afterclick" );
+ equal( logOutput(), "click,afterclick,click,1,afterclick", "Click order not valid." );
+});
+
+test( "refresh", function() {
+ expect( 5 );
+ var element = $( "#menu1" ).menu();
+ equal( element.find( ".ui-menu-item" ).length, 5, "Incorrect number of menu items" );
+ element.append( "<li><a href='#'>test item</a></li>" ).menu( "refresh" );
+ equal( element.find( ".ui-menu-item" ).length, 6, "Incorrect number of menu items" );
+ element.find( ".ui-menu-item:last" ).remove().end().menu( "refresh" );
+ equal( element.find( ".ui-menu-item" ).length, 5, "Incorrect number of menu items" );
+ element.append( "<li>---</li>" ).menu( "refresh" );
+ equal( element.find( ".ui-menu-item" ).length, 5, "Incorrect number of menu items" );
+ element.children( ":last" ).remove().end().menu( "refresh" );
+ equal( element.find( ".ui-menu-item" ).length, 5, "Incorrect number of menu items" );
+});
+
+test( "refresh submenu", function() {
+ expect( 2 );
+ var element = $( "#menu2" ).menu();
+ equal( element.find( "ul:first .ui-menu-item" ).length, 3 );
+ element.find( "ul" ).addBack().append( "<li><a href=\"#\">New Item</a></li>" );
+ element.menu("refresh");
+ equal( element.find( "ul:first .ui-menu-item" ).length, 4 );
+});
+
+test( "widget", function() {
+ expect( 2 );
+ var element = $( "#menu1" ).menu(),
+ widgetElement = element.menu( "widget" );
+ equal( widgetElement.length, 1, "one element" );
+ strictEqual( widgetElement[ 0 ], element[ 0 ], "same element" );
+});
+
+// TODO: test focus method
+
+// TODO: test blur method
+
+// TODO: test collapseAll method
+
+// TODO: test collapse method
+
+// TODO: test expand method
+
+// TODO: test next method
+
+// TODO: test prev method
+
+// TODO: test isFirstItem method
+
+// TODO: test isLastItem method
+
+// TODO: test nextPage method
+
+// TODO: test prevPage method
+
+// TODO: test select method
+
+})( jQuery );
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_options.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_options.js
new file mode 100644
index 0000000..e3977e6
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_options.js
@@ -0,0 +1,115 @@
+(function( $ ) {
+
+var log = TestHelpers.menu.log,
+ logOutput = TestHelpers.menu.logOutput,
+ click = TestHelpers.menu.click;
+
+module( "menu: options", {
+ setup: function() {
+ TestHelpers.menu.clearLog();
+ }
+});
+
+test( "{ disabled: true }", function() {
+ expect( 2 );
+ var element = $( "#menu1" ).menu({
+ disabled: true,
+ select: function() {
+ log();
+ }
+ });
+ ok( element.hasClass( "ui-state-disabled" ), "Missing ui-state-disabled class" );
+ log( "click", true );
+ click( element, "1" );
+ log( "afterclick" );
+ equal( logOutput(), "click,afterclick", "Click order not valid." );
+});
+
+test( "{ disabled: false }", function() {
+ expect( 2 );
+ var element = $( "#menu1" ).menu({
+ disabled: false,
+ select: function() {
+ log();
+ }
+ });
+ ok( !element.hasClass( "ui-state-disabled" ), "Has ui-state-disabled class" );
+ log( "click", true );
+ click( element, "1" );
+ log( "afterclick" );
+ equal( logOutput(), "click,1,afterclick", "Click order not valid." );
+});
+
+test( "{ icons: default }", function() {
+ expect( 2 );
+ var element = $( "#menu2" ).menu();
+ equal( element.find( ".ui-menu-icon" ).attr( "class" ), "ui-menu-icon ui-icon ui-icon-carat-1-e" );
+
+ element.menu("option", "icons.submenu", "ui-icon-triangle-1-e");
+ equal( element.find( ".ui-menu-icon" ).attr( "class" ), "ui-menu-icon ui-icon ui-icon-triangle-1-e" );
+});
+
+test( "{ icons: { submenu: 'custom' } }", function() {
+ expect( 1 );
+ var element = $( "#menu2" ).menu({
+ icons: {
+ submenu: "custom-class"
+ }
+ });
+ equal( element.find( ".ui-menu-icon" ).attr( "class" ), "ui-menu-icon ui-icon custom-class" );
+});
+
+// TODO: test menus option
+
+// TODO: test position option
+
+test( "{ role: 'menu' } ", function() {
+ var element = $( "#menu1" ).menu(),
+ items = element.find( "li" );
+ expect( 2 + 5 * items.length );
+ equal( element.attr( "role" ), "menu" );
+ ok( items.length > 0, "number of menu items" );
+ items.each(function( item ) {
+ ok( $( this ).hasClass( "ui-menu-item" ), "menu item ("+ item + ") class for item" );
+ equal( $( this ).attr( "role" ), "presentation", "menu item ("+ item + ") role" );
+ equal( $( "a", this ).attr( "role" ), "menuitem", "menu item ("+ item + ") role" );
+ ok( $( "a", this ).hasClass( "ui-corner-all" ), "a element class for menu item ("+ item + ")" );
+ equal( $( "a", this ).attr( "tabindex" ), "-1", "a element tabindex for menu item ("+ item + ")" );
+ });
+});
+
+test( "{ role: 'listbox' } ", function() {
+ var element = $( "#menu1" ).menu({
+ role: "listbox"
+ }),
+ items = element.find( "li" );
+ expect( 2 + 5 * items.length );
+ equal( element.attr( "role" ), "listbox" );
+ ok( items.length > 0, "number of menu items" );
+ items.each(function( item ) {
+ ok( $( this ).hasClass( "ui-menu-item" ), "menu item ("+ item + ") class for item" );
+ equal( $( this ).attr( "role" ), "presentation", "menu item ("+ item + ") role" );
+ equal( $( "a", this ).attr( "role" ), "option", "menu item ("+ item + ") role" );
+ ok( $( "a", this ).hasClass( "ui-corner-all" ), "a element class for menu item ("+ item + ")" );
+ equal( $( "a", this ).attr( "tabindex" ), "-1", "a element tabindex for menu item ("+ item + ")" );
+ });
+});
+
+test( "{ role: null }", function() {
+ var element = $( "#menu1" ).menu({
+ role: null
+ }),
+ items = element.find( "li" );
+ expect( 2 + 5 * items.length );
+ strictEqual( element.attr( "role" ), undefined );
+ ok( items.length > 0, "number of menu items" );
+ items.each(function( item ) {
+ ok( $( this ).hasClass( "ui-menu-item" ), "menu item ("+ item + ") class for item" );
+ equal( $( this ).attr( "role" ), "presentation", "menu item ("+ item + ") role" );
+ equal( $( "a", this ).attr( "role" ), undefined, "menu item ("+ item + ") role" );
+ ok( $( "a", this ).hasClass( "ui-corner-all" ), "a element class for menu item ("+ item + ")" );
+ equal( $( "a", this ).attr( "tabindex" ), "-1", "a element tabindex for menu item ("+ item + ")" );
+ });
+});
+
+})( jQuery );
diff --git a/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_test_helpers.js b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_test_helpers.js
new file mode 100644
index 0000000..b6c09ad
--- /dev/null
+++ b/97suifangqa/staticfiles/plugins/jquery-ui/tests/unit/menu/menu_test_helpers.js
@@ -0,0 +1,31 @@
+(function() {
+
+var lastItem,
+ log = [];
+
+TestHelpers.menu = {
+ log: function( message, clear ) {
+ if ( clear ) {
+ log.length = 0;
+ }
+ if ( message === undefined ) {
+ message = lastItem;
+ }
+ log.push( $.trim( message ) );
+ },
+
+ logOutput: function() {
+ return log.join( "," );
+ },
+
+ clearLog: function() {
+ log.length = 0;
+ },
+
+ click: function( menu, item ) {
+ lastItem = item;
+ menu.children( ":eq(" + item + ")" ).find( "a:first" ).trigger( "click" );
+ }
+};
+
+})();