From: jzaefferer Date: Fri, 11 Feb 2011 14:42:44 +0000 (+0100) Subject: Menu: Fix unit tests and set the right menu1-activedescendant attribute X-Git-Tag: 1.9m4~13 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e69839ae6aee20fcb4f8dee7938bceeb8672671d;p=jquery-ui.git Menu: Fix unit tests and set the right menu1-activedescendant attribute --- diff --git a/tests/unit/index.html b/tests/unit/index.html index f45499c2b..a677023dc 100644 --- a/tests/unit/index.html +++ b/tests/unit/index.html @@ -46,8 +46,10 @@
  • Button
  • Datepicker
  • Dialog
  • +
  • Menu
  • Progressbar
  • Slider
  • +
  • Spinner
  • Tabs
  • Tooltip
  • diff --git a/tests/unit/menu/menu_core.js b/tests/unit/menu/menu_core.js index a1cf11b7f..42a661d05 100644 --- a/tests/unit/menu/menu_core.js +++ b/tests/unit/menu/menu_core.js @@ -8,13 +8,19 @@ module("menu: core"); test("accessibility", function () { - expect(3); + expect(5); var ac = $('#menu1').menu(); var item0 = $("li:eq(0) a"); ok( ac.hasClass("ui-menu ui-widget ui-widget-content ui-corner-all"), "menu class"); equals( ac.attr("role"), "listbox", "main role"); - equals( ac.attr("aria-activedescendant"), "ui-active-menuitem", "aria attribute"); + equals( ac.attr("aria-activedescendant"), undefined, "aria attribute not yet active"); + var item = ac.find( "li:first" ).find( "a" ).attr( "id", "xid" ).end(); + ac.menu( "activate", $.Event(), item ); + equals( ac.attr("aria-activedescendant"), "xid", "aria attribute, id from dom"); + var item = ac.find( "li:last" ); + ac.menu( "activate", $.Event(), item ); + equals( ac.attr("aria-activedescendant"), "menu1-activedescendant", "aria attribute, generated id"); }); test("items class and role", function () { diff --git a/tests/unit/menu/menu_defaults.js b/tests/unit/menu/menu_defaults.js index c3f741d2a..331020959 100644 --- a/tests/unit/menu/menu_defaults.js +++ b/tests/unit/menu/menu_defaults.js @@ -3,9 +3,7 @@ */ var menu_defaults = { - disabled: false, - navigationFilter: function() {} - + disabled: false }; commonWidgetTests('menu', { defaults: menu_defaults }); diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 84ea84384..b2e9e6157 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -146,7 +146,7 @@ $.widget("ui.menu", { .end(); // need to remove the attribute before adding it for the screenreader to pick up the change // see http://groups.google.com/group/jquery-a11y/msg/929e0c1e8c5efc8f - this.element.removeAttr("aria-activedescenant").attr("aria-activedescenant", self.itemId); + this.element.removeAttr("aria-activedescendant").attr("aria-activedescendant", self.itemId); this._trigger( "focus", event, { item: item } ); },