Merge "Fix exception when deleting a change"

This commit is contained in:
Wyatt Allen 2017-01-30 17:51:36 +00:00 committed by Gerrit Code Review
commit 37fe386fdf
2 changed files with 27 additions and 0 deletions

View File

@ -562,6 +562,9 @@
},
_setLoadingOnButtonWithKey: function(key) {
// Return a NoOp for menu keys. @see Issue 5366
if (MENU_ACTION_KEYS.indexOf(key) !== -1) { return function() {}; }
var buttonEl = this.$$('[data-action-key="' + key + '"]');
buttonEl.setAttribute('loading', true);
buttonEl.disabled = true;

View File

@ -382,6 +382,30 @@ limitations under the License.
});
});
test('_setLoadingOnButtonWithKey top-level', function() {
var key = 'rebase';
var cleanup = element._setLoadingOnButtonWithKey(key);
var button = element.$$('[data-action-key="' + key + '"]');
assert.isTrue(button.hasAttribute('loading'));
assert.isTrue(button.disabled);
assert.isOk(cleanup);
assert.isFunction(cleanup);
cleanup();
assert.isFalse(button.hasAttribute('loading'));
assert.isFalse(button.disabled);
});
test('_setLoadingOnButtonWithKey overflow menu', function() {
// TODO(wyatta): Should not throw error when setting loading on an
// overflow action. @see Issue 5366
var key = 'cherrypick';
var cleanup = element._setLoadingOnButtonWithKey(key);
assert.isFunction(cleanup);
});
suite('revert change', function() {
var alertStub;
var fireActionStub;