Merge changes Ib2ed69b8,I8e8f9597,Ia6c44f0a into stable-3.6
* changes:
gr-cla-view: remove old css that broke displaying claNewAgreement
gr-cla-view: simplify getAgreementsUrl
gr-cla-view: Remove computeHideAgreementTextbox from html
diff --git a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.ts b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.ts
index 39fc048..1656f5f 100644
--- a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.ts
+++ b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.ts
@@ -453,13 +453,13 @@
const patchSetValue = convertToPatchSetNum(e.detail.value)!;
const latestPatchNum = computeLatestPatchNum(this.availablePatches);
if (target === this.patchNumDropdown) {
- if (detail.patchNum === e.detail.value) return;
+ if (detail.patchNum === patchSetValue) return;
this.reporting.reportInteraction('right-patchset-changed', {
previous: detail.patchNum,
- current: e.detail.value,
+ current: patchSetValue,
latest: latestPatchNum,
commentCount: this.changeComments?.computeCommentThreadCount({
- patchNum: e.detail.value as PatchSetNum,
+ patchNum: patchSetValue,
}),
});
detail.patchNum = patchSetValue;
@@ -467,7 +467,7 @@
if (detail.basePatchNum === patchSetValue) return;
this.reporting.reportInteraction('left-patchset-changed', {
previous: detail.basePatchNum,
- current: e.detail.value,
+ current: patchSetValue,
commentCount: this.changeComments?.computeCommentThreadCount({
patchNum: patchSetValue,
}),
diff --git a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.ts b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.ts
index dc501c8..c4e710d 100644
--- a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.ts
+++ b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select_test.ts
@@ -23,7 +23,7 @@
import '../../../test/mocks/comment-api';
import {RevisionInfo as RevisionInfoClass} from '../../shared/revision-info/revision-info';
import {ChangeComments} from '../gr-comment-api/gr-comment-api';
-import {stubRestApi} from '../../../test/test-utils';
+import {stubReporting, stubRestApi} from '../../../test/test-utils';
import {
BasePatchSetNum,
EditPatchSetNum,
@@ -45,6 +45,7 @@
GrDropdownList,
} from '../../shared/gr-dropdown-list/gr-dropdown-list';
import {queryAndAssert} from '../../../test/test-utils';
+import {fire} from '../../../utils/event-util';
const basicFixture = fixtureFromElement('gr-patch-range-select');
@@ -418,4 +419,30 @@
patchNum: 'edit',
});
});
+
+ test('handlePatchChange', async () => {
+ element.availablePatches = [
+ {num: 'edit', sha: '1'} as PatchSet,
+ {num: 3, sha: '2'} as PatchSet,
+ {num: 2, sha: '3'} as PatchSet,
+ {num: 1, sha: '4'} as PatchSet,
+ ];
+ element.revisions = [
+ createRevision(2),
+ createRevision(3),
+ createRevision(1),
+ createRevision(4),
+ ];
+ element.revisionInfo = getInfo(element.revisions);
+ element.patchNum = 1 as PatchSetNum;
+ element.basePatchNum = 'PARENT' as BasePatchSetNum;
+ await element.updateComplete;
+
+ const stub = stubReporting('reportInteraction');
+ fire(element.patchNumDropdown!, 'value-change', {value: '1'});
+ assert.isFalse(stub.called);
+
+ fire(element.patchNumDropdown!, 'value-change', {value: '2'});
+ assert.isTrue(stub.called);
+ });
});