Merge "Fix event targeting in menu-editor" into stable-2.15
This commit is contained in:
commit
cba2cf5d5b
@ -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);
|
||||
},
|
||||
|
||||
|
@ -47,9 +47,10 @@ limitations under the License.
|
||||
// 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 @@ limitations under the License.
|
||||
['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, []);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user