diff --git a/lib/features/popup-menu/PopupMenu.js b/lib/features/popup-menu/PopupMenu.js index 94b33156a..5f1adb811 100644 --- a/lib/features/popup-menu/PopupMenu.js +++ b/lib/features/popup-menu/PopupMenu.js @@ -501,7 +501,7 @@ PopupMenu.prototype.trigger = function(event) { */ PopupMenu.prototype._getEntry = function(entryId) { - var entry = this._current.entries[entryId]; + var entry = this._current.entries[entryId] || this._current.headerEntries[entryId]; if (!entry) { diff --git a/test/spec/features/popup-menu/PopupMenuSpec.js b/test/spec/features/popup-menu/PopupMenuSpec.js index afc069031..dddf060a6 100755 --- a/test/spec/features/popup-menu/PopupMenuSpec.js +++ b/test/spec/features/popup-menu/PopupMenuSpec.js @@ -636,18 +636,33 @@ describe('features/popup-menu', function() { } } ]; + }, + getHeaderEntries: function() { + return [ + { + id: '3', + label: 'Entry 3', + className: 'Entry_3', + action: function(event, entry) { + return 'Entry 3'; + } + } + ]; } }); popupMenu.open({}, 'test-menu', { x: 100, y: 100 }); var entry = queryEntry('2'); + var headerEntry = queryEntry('3'); // when - var trigger = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 })); + var triggerEntry = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 })); + var triggerHeaderEntry = popupMenu.trigger(globalEvent(headerEntry, { x: 0, y: 0 })); // then - expect(trigger).to.eql('Entry 2'); + expect(triggerEntry).to.eql('Entry 2'); + expect(triggerHeaderEntry).to.eql('Entry 3'); })); });