Fix change-star in change view
Regression caused by 08ab3aa2
-- the change-star element no longer makes
API calls, instead relying on the parent component.
Bug: Issue 9511
Change-Id: I26faee7ab9158687ec939c48592f3a263cffc93e
This commit is contained in:
parent
e27a404a3e
commit
bbd286781c
@ -362,7 +362,9 @@ limitations under the License.
|
||||
<div class="headerTitle">
|
||||
<gr-change-star
|
||||
id="changeStar"
|
||||
change="{{_change}}" hidden$="[[!_loggedIn]]"></gr-change-star>
|
||||
change="{{_change}}"
|
||||
on-toggle-star="_handleToggleStar"
|
||||
hidden$="[[!_loggedIn]]"></gr-change-star>
|
||||
<div class="changeStatuses">
|
||||
<template is="dom-repeat" items="[[_changeStatuses]]" as="status">
|
||||
<gr-change-status
|
||||
|
@ -1623,5 +1623,10 @@
|
||||
_resetReplyOverlayFocusStops() {
|
||||
this.$.replyOverlay.setFocusStops(this.$.replyDialog.getFocusStops());
|
||||
},
|
||||
|
||||
_handleToggleStar(e) {
|
||||
this.$.restAPI.saveChangeStarred(e.detail.change._number,
|
||||
e.detail.starred);
|
||||
},
|
||||
});
|
||||
})();
|
||||
|
@ -1735,5 +1735,18 @@ limitations under the License.
|
||||
assert.isTrue(setStub.calledOnce);
|
||||
assert.isTrue(setStub.calledWith(101, 'test-project'));
|
||||
});
|
||||
|
||||
test('_handleToggleStar called when star is tapped', () => {
|
||||
element._change = {
|
||||
owner: {_account_id: 1},
|
||||
starred: false,
|
||||
};
|
||||
element._loggedIn = true;
|
||||
const stub = sandbox.stub(element, '_handleToggleStar');
|
||||
flushAsynchronousOperations();
|
||||
|
||||
MockInteractions.tap(element.$.changeStar.$$('button'));
|
||||
assert.isTrue(stub.called);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user