Skip to content

Commit

Permalink
Merge "[FEATURE] sap.ui.unified.MenuItem: HasPopup enumeration consumed"
Browse files Browse the repository at this point in the history
  • Loading branch information
ghristanov authored and Gerrit Code Review committed Oct 8, 2020
2 parents 3c152c4 + 0549fd5 commit 0d95920
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/sap.ui.unified/src/sap/ui/unified/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
*/

// Provides control sap.ui.unified.MenuItem.
sap.ui.define(['sap/ui/core/IconPool', './MenuItemBase', './library'],
function(IconPool, MenuItemBase, library) {
sap.ui.define(['sap/ui/core/IconPool', './MenuItemBase', './library', 'sap/ui/core/library'],
function(IconPool, MenuItemBase, library, coreLibrary) {
"use strict";


Expand Down Expand Up @@ -97,7 +97,7 @@ sap.ui.define(['sap/ui/core/IconPool', './MenuItemBase', './library'],
labelledby: {value: /*oMenu.getId() + "-label " + */this.getId() + "-txt " + this.getId() + "-scuttxt", append: true}
});
if (oSubMenu) {
rm.attr("aria-haspopup", true);
rm.attr("aria-haspopup", coreLibrary.aria.HasPopup.Menu.toLowerCase());
rm.attr("aria-owns", oSubMenu.getId());
}
}
Expand Down
15 changes: 15 additions & 0 deletions src/sap.ui.unified/test/sap/ui/unified/qunit/MenuItem.qunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ sap.ui.define([
oLabel.destroy();
});

QUnit.test("aria-haspopup", function (assert) {
var oMenuItem = new MenuItem({ text: "Plain" }),
oMenuItemWithSubmenu = new MenuItem({ text: "With submenu", submenu: new Menu() }),
oMenu = new Menu({ items: [oMenuItem, oMenuItemWithSubmenu] });

oMenu.placeAt("qunit-fixture");
sap.ui.getCore().applyChanges();

oMenu.open();
assert.notOk(oMenuItem.$().attr("aria-haspopup"), "Menu items don't have aria-haspopup when there's no submenu");
assert.strictEqual(oMenuItemWithSubmenu.$().attr("aria-haspopup"), "menu", "Submenu presence is indicated in aria-haspopup");

oMenu.destroy();
});

QUnit.module("Events", {
beforeEach: function() {
this.oMenuItem = new MenuItem({
Expand Down

0 comments on commit 0d95920

Please sign in to comment.