[Menu] Listen to element directly

Add listener to menu element directly instead of
using ng-click to aid in testing (and for consistency
with related listeners.) WTD-1506.
This commit is contained in:
Victor Woeltjen
2015-08-07 14:39:59 -07:00
parent 87aa0cfce2
commit 2d5ec97dc3
2 changed files with 27 additions and 7 deletions

View File

@ -31,7 +31,6 @@ define(
var MENU_TEMPLATE = "<mct-representation key=\"'context-menu'\" " +
"mct-object=\"domainObject\" " +
"ng-click=\"dismiss()\" " +
"ng-class=\"menuClass\" " +
"ng-style=\"menuStyle\">" +
"</mct-representation>",
@ -87,7 +86,6 @@ define(
"go-up": goUp,
"context-menu-holder": true
};
scope.dismiss = dismiss;
// Create the context menu
menu = $compile(MENU_TEMPLATE)(scope);
@ -103,6 +101,7 @@ define(
// Dismiss the menu when body is clicked elsewhere
// ('mousedown' because 'click' breaks left-click context menus)
body.on('mousedown', dismiss);
menu.on('click', dismiss);
// Don't launch browser's context menu
actionContext.event.preventDefault();