From 02afd8a32edb13ea7fc2266ac80092ea15c0930c Mon Sep 17 00:00:00 2001 From: Alvin Li Date: Wed, 9 Oct 2013 15:52:53 +0800 Subject: * treat 'apps/utils' as regular django app; which used to store general tools for used in other apps * moved 'templatetags' from 'apps/indicator' to 'apps/utils' * '.gitignore' to ignore 'fixtures_bak' * moved js plugins from 'apps/indicator/static/plugins' to 'staticfiles/plugins' apps/recommend: * updated 'recommend.models'; o commented 'recommend.models.ResearchCombination' (not used) * implemented views 'add_edit_blog_info' and 'ajax_add_edit_configs'; * added pages 'templates/recommend/add_edit_blog_info.html', 'add_edit_blog_info_error.html'; o related css and javascripts files * added 'tools.py'; * added 'utils/tools.py' for placing generic functions; * deleted 'initial_data.json' (mv 'fixtures' to 'fixtures_bak'); * small fixes to 'indicator.models', 'sciblog.models' and 'sfaccount.views' * fixed automatically show 'proper_nouns' annotation in blog: recovered the line 'import signals' in 'sciblog.models' * added 'is_ok()' method for 'recommend.models.ResearchConfig'; --- .../plugins/jquery-ui/tests/unit/menu/all.html | 30 - .../plugins/jquery-ui/tests/unit/menu/menu.html | 269 --------- .../jquery-ui/tests/unit/menu/menu_common.js | 20 - .../plugins/jquery-ui/tests/unit/menu/menu_core.js | 30 - .../jquery-ui/tests/unit/menu/menu_events.js | 601 --------------------- .../jquery-ui/tests/unit/menu/menu_methods.js | 104 ---- .../jquery-ui/tests/unit/menu/menu_options.js | 115 ---- .../jquery-ui/tests/unit/menu/menu_test_helpers.js | 31 -- 8 files changed, 1200 deletions(-) delete mode 100644 97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/all.html delete mode 100644 97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu.html delete mode 100644 97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_common.js delete mode 100644 97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_core.js delete mode 100644 97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_events.js delete mode 100644 97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_methods.js delete mode 100644 97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_options.js delete mode 100644 97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_test_helpers.js (limited to '97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu') diff --git a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/all.html b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/all.html deleted file mode 100644 index b34fa5e..0000000 --- a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/all.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - jQuery UI Menu Test Suite - - - - - - - - - - - - - -

jQuery UI Menu Test Suite

-

-
-

-
    -
    - -
    - - diff --git a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu.html b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu.html deleted file mode 100644 index ed37623..0000000 --- a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu.html +++ /dev/null @@ -1,269 +0,0 @@ - - - - - jQuery UI Menu Test Suite - - - - - - - - - - - - - - - - - - - - -
    jQuery UI Menu Test Suite
    -
    - - - - - - - - - - - - - -
    - - diff --git a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_common.js b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_common.js deleted file mode 100644 index 4a89a94..0000000 --- a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_common.js +++ /dev/null @@ -1,20 +0,0 @@ -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/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_core.js b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_core.js deleted file mode 100644 index 5ee28c1..0000000 --- a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_core.js +++ /dev/null @@ -1,30 +0,0 @@ -(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/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_events.js b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_events.js deleted file mode 100644 index 3c94a5a..0000000 --- a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_events.js +++ /dev/null @@ -1,601 +0,0 @@ -(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() { - $( "", { 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/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_methods.js b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_methods.js deleted file mode 100644 index c51d123..0000000 --- a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_methods.js +++ /dev/null @@ -1,104 +0,0 @@ -(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( "
  1. test item
  2. " ).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( "
  3. ---
  4. " ).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( "
  5. New Item
  6. " ); - 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/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_options.js b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_options.js deleted file mode 100644 index e3977e6..0000000 --- a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_options.js +++ /dev/null @@ -1,115 +0,0 @@ -(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/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_test_helpers.js b/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_test_helpers.js deleted file mode 100644 index b6c09ad..0000000 --- a/97suifangqa/apps/indicator/static/plugins/jquery-ui/tests/unit/menu/menu_test_helpers.js +++ /dev/null @@ -1,31 +0,0 @@ -(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" ); - } -}; - -})(); -- cgit v1.2.2