diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.html b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.html index dc6404232e..b2c3e18852 100644 --- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.html +++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.html @@ -267,9 +267,9 @@ limitations under the License. [[_computeFileStatus(file.status)]] - + [[_computeFileDisplayName(file.__path)]] diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js index 856071724e..c1f8c6cf2c 100644 --- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js +++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js @@ -662,9 +662,8 @@ return status || 'M'; }, - _computeDiffURL(change, patchRange, path) { - return Gerrit.Nav.getUrlForDiff(change, path, patchRange.patchNum, - patchRange.basePatchNum); + _computeDiffURL(change, patchNum, basePatchNum, path) { + return Gerrit.Nav.getUrlForDiff(change, path, patchNum, basePatchNum); }, _computeFileDisplayName(path) { diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html index 9be19a7b75..70f7e2b54f 100644 --- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html +++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html @@ -988,6 +988,21 @@ limitations under the License. element.flushDebouncer('loading-change'); assert.isFalse(element.classList.contains('loading')); }); + + test('no execute _computeDiffURL before patchNum is knwon', done => { + const urlStub = sandbox.stub(element, '_computeDiffURL'); + element.change = {_number: 123}; + element.patchRange = {patchNum: undefined, basePatchNum: 'PARENT'}; + element._files = [{__path: 'foo/bar.cpp'}]; + flush(() => { + assert.isFalse(urlStub.called); + element.set('patchRange.patchNum', 4); + flush(() => { + assert.isTrue(urlStub.called); + done(); + }); + }); + }); }); suite('gr-file-list inline diff tests', () => {