Merge "Fix event targeting in menu-editor"
diff --git a/polygerrit-ui/app/elements/settings/gr-menu-editor/gr-menu-editor.js b/polygerrit-ui/app/elements/settings/gr-menu-editor/gr-menu-editor.js
index 543c86d..26a2470 100644
--- a/polygerrit-ui/app/elements/settings/gr-menu-editor/gr-menu-editor.js
+++ b/polygerrit-ui/app/elements/settings/gr-menu-editor/gr-menu-editor.js
@@ -24,7 +24,7 @@
},
_handleMoveUpButton(e) {
- const index = e.target.dataIndex;
+ const index = Polymer.dom(e).localTarget.dataIndex;
if (index === 0) { return; }
const row = this.menuItems[index];
const prev = this.menuItems[index - 1];
@@ -32,7 +32,7 @@
},
_handleMoveDownButton(e) {
- const index = e.target.dataIndex;
+ const index = Polymer.dom(e).localTarget.dataIndex;
if (index === this.menuItems.length - 1) { return; }
const row = this.menuItems[index];
const next = this.menuItems[index + 1];
@@ -40,7 +40,7 @@
},
_handleDeleteButton(e) {
- const index = e.target.dataIndex;
+ const index = Polymer.dom(e).localTarget.dataIndex;
this.splice('menuItems', index, 1);
},
diff --git a/polygerrit-ui/app/elements/settings/gr-menu-editor/gr-menu-editor_test.html b/polygerrit-ui/app/elements/settings/gr-menu-editor/gr-menu-editor_test.html
index f16ba6c..c70ae88 100644
--- a/polygerrit-ui/app/elements/settings/gr-menu-editor/gr-menu-editor_test.html
+++ b/polygerrit-ui/app/elements/settings/gr-menu-editor/gr-menu-editor_test.html
@@ -47,9 +47,10 @@
// Click the up/down button (according to direction) for the index'th row.
// The index of the first row is 0, corresponding to the array.
function move(element, index, direction) {
- const selector =
- 'tr:nth-child(' + (index + 1) + ') .move' + direction + 'Button';
- const button = element.$$('tbody').querySelector(selector);
+ const selector = 'tr:nth-child(' + (index + 1) + ') .move' +
+ direction + 'Button';
+ const button =
+ element.$$('tbody').querySelector(selector).$$('paper-button');
MockInteractions.tap(button);
}
@@ -141,15 +142,15 @@
['first name', 'second name', 'third name']);
// Tap the delete button for the middle item.
- MockInteractions.tap(
- element.$$('tbody').querySelector('tr:nth-child(2) .remove-button'));
+ MockInteractions.tap(element.$$('tbody')
+ .querySelector('tr:nth-child(2) .remove-button').$$('paper-button'));
assertMenuNamesEqual(element, ['first name', 'third name']);
// Delete remaining items.
for (let i = 0; i < 2; i++) {
- MockInteractions.tap(
- element.$$('tbody').querySelector('tr:first-child .remove-button'));
+ MockInteractions.tap(element.$$('tbody')
+ .querySelector('tr:first-child .remove-button').$$('paper-button'));
}
assertMenuNamesEqual(element, []);