Merge "Use requestUpdate to trigger an update" into stable-3.6
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);
+ });
});
diff --git a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.ts b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.ts
index f429c22..c8c06c9 100644
--- a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.ts
+++ b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.ts
@@ -90,12 +90,6 @@
#claNewAgreementsLabel {
font-weight: var(--font-weight-bold);
}
- #claNewAgreement {
- display: none;
- }
- #claNewAgreement.show {
- display: block;
- }
.contributorAgreementButton {
font-weight: var(--font-weight-bold);
}
@@ -166,7 +160,7 @@
Please review the agreement.</a
>
</div>
- ${this.renderAgreementsTextBox()} ${this.computeHideAgreementTextbox()}
+ ${this.renderAgreementsTextBox()}
</div>
`;
}
@@ -223,14 +217,12 @@
// private but used in test
getAgreementsUrl(configUrl: string) {
if (!configUrl) return '';
- let url;
+
if (configUrl.startsWith('http:') || configUrl.startsWith('https:')) {
- url = configUrl;
- } else {
- url = getBaseUrl() + '/' + configUrl;
+ return configUrl;
}
- return url;
+ return `${getBaseUrl()}/${configUrl}`;
}
private readonly handleShowAgreement = (e: Event) => {