Merge "Less related changes jank"

This commit is contained in:
Viktar Donich 2017-02-24 18:31:49 +00:00 committed by Gerrit Code Review
commit b3ae6f0d6a
3 changed files with 9 additions and 1 deletions

View File

@ -409,6 +409,7 @@
this._changeNum = value.changeNum; this._changeNum = value.changeNum;
this._patchRange = patchRange; this._patchRange = patchRange;
this.$.relatedChanges.clear();
this._reload().then(function() { this._reload().then(function() {
this._performPostLoadTasks(); this._performPostLoadTasks();

View File

@ -479,6 +479,7 @@ limitations under the License.
var reloadPatchDependentStub = sandbox.stub(element, var reloadPatchDependentStub = sandbox.stub(element,
'_reloadPatchNumDependentResources', '_reloadPatchNumDependentResources',
function() { return Promise.resolve(); }); function() { return Promise.resolve(); });
var relatedClearSpy = sandbox.spy(element.$.relatedChanges, 'clear');
var value = { var value = {
view: 'gr-change-view', view: 'gr-change-view',
@ -486,6 +487,8 @@ limitations under the License.
}; };
element._paramsChanged(value); element._paramsChanged(value);
assert.isTrue(reloadStub.calledOnce); assert.isTrue(reloadStub.calledOnce);
assert.isTrue(relatedClearSpy.calledOnce);
element._initialLoadComplete = true; element._initialLoadComplete = true;
value.basePatchNum = '1'; value.basePatchNum = '1';
@ -493,7 +496,7 @@ limitations under the License.
element._paramsChanged(value); element._paramsChanged(value);
assert.isFalse(reloadStub.calledTwice); assert.isFalse(reloadStub.calledTwice);
assert.isTrue(reloadPatchDependentStub.calledOnce); assert.isTrue(reloadPatchDependentStub.calledOnce);
assert.isTrue(relatedClearSpy.calledOnce);
}); });
test('reload entire page when patchRange doesnt change', function() { test('reload entire page when patchRange doesnt change', function() {

View File

@ -53,6 +53,10 @@
'_conflicts, _cherryPicks, _sameTopic)', '_conflicts, _cherryPicks, _sameTopic)',
], ],
clear: function() {
this._loading = true;
},
reload: function() { reload: function() {
if (!this.change || !this.patchNum) { if (!this.change || !this.patchNum) {
return Promise.resolve(); return Promise.resolve();